Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 877475

Summary: strip removes the .rel.text section
Product: Red Hat Developer Toolset Reporter: Dagmar Prokopová <dprokopo>
Component: binutilsAssignee: Patsy Griffin <pfrankli>
Status: CLOSED NOTABUG QA Contact: Martin Cermak <mcermak>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: DTS 1.1 RHEL 6CC: law, mcermak, mfranc, mnewsome, mpolacek, ohudlick
Target Milestone: ---   
Target Release: 1.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-23 11:38:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
reproducer
none
reproducer.debug none

Description Dagmar Prokopová 2012-11-16 16:02:46 UTC
Created attachment 646433 [details]
reproducer

Description of problem:

The behavior of strip from DTS-binutils differs from the classical notDTS strip. It removes the '.rel.text' section which causes the incompatibility for eu-unstrip.

Version-Release number of selected component (if applicable):
devtoolset-1.1-binutils-2.23.51.0.3-3.el6.x86_64
devtoolset-1.1-elfutils-0.154-6.el6.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. strip sunrpc.ko
2. eu-unstrip sunrpc.ko sunrpc.ko.debug

  
Actual results:
eu-unstrip: cannot find matching section for [3] '.rel.text'

Expected results:
file is unstripped successfully



Additional info:

binutils (not DTS):

bash-4.1# strip sunrpc.ko
bash-4.1# readelf -S sunrpc.ko | grep rel.text
  [ 3] .rel.text         REL             00000000 023da4 000000 08      0   2  4
bash-4.1# echo $?
0

devtoolset-1.1-binutils:

bash-4.1# strip sunrpc.ko
bash-4.1# readelf -S sunrpc.ko | grep rel.text
bash-4.1# echo $?
1

devtoolset-1.1-elfutils:

bash-4.1# eu-strip sunrpc.ko
bash-4.1# readelf -S sunrpc.ko | grep rel.text
  [ 3] .rel.text         REL             00000000 018954 0068a8 08     43   2  4
bash-4.1# echo $?
0

Comment 1 Dagmar Prokopová 2012-11-16 16:04:00 UTC
Created attachment 646434 [details]
reproducer.debug

Comment 3 Marek Polacek 2012-11-22 14:52:49 UTC
Striping ET_RELs (.o files) is not common.  Usually you only want to strip executables (remove .symtab, .debug_* sections, .comment).  For *.o, you might want to strip debugging symbols using the -g option, but you really need to have .symtab in the object files.

I'll look at when this change was introduced.

Comment 4 Marek Polacek 2012-11-23 11:37:39 UTC
This is the patch that introduced this change: http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/objcopy.c.diff?cvsroot=src&r1=1.154&r2=1.155
(a patch for SW#13947).

In objcopy.c we now have:

/* Copy relocations in input section ISECTION of IBFD to an output
   section with the same name in OBFDARG.  If stripping then don't
   copy any relocation info.  */

static void
copy_relocations_in_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
{
  bfd *obfd = (bfd *) obfdarg;
  long relsize;
  ...

So, this change looks intentional => NOTABUG.