[Bug binutils/9933] New: `strip --strip-unneeded` incorrectly strips objects of type COM from relocatable ELF objects

View: New views
7 Messages — Rating Filter:   Alert me  

[Bug binutils/9933] New: `strip --strip-unneeded` incorrectly strips objects of type COM from relocatable ELF objects

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

strip seems to have always behaved this way.  versions 2.16 and older stripped
both types of objects, but with 2.17 and newer, "j" is correctly left.  tested
2.1{5,6,7,8,9} and 2.19.51.0.2.

$ cat test.c
int i;
int j = 1;
$ gcc -c test.c
$ readelf -s test.o | grep OBJ
     7: 0000000000000000     4 OBJECT  GLOBAL DEFAULT    2 j
     8: 0000000000000004     4 OBJECT  GLOBAL DEFAULT  COM i
$ strip --strip-unneeded test.o
$ readelf -s test.o | grep OBJ
     7: 0000000000000000     4 OBJECT  GLOBAL DEFAULT    2 j

"i" has wrongly been stripped

--
           Summary: `strip --strip-unneeded` incorrectly strips objects of
                    type COM from relocatable ELF objects
           Product: binutils
           Version: 2.20 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: vapier at gentoo dot org
                CC: bug-binutils at gnu dot org,toolchain at gentoo dot org
GCC target triplet: x86_64-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=9933

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/9933] `strip --strip-unneeded` strips common symbols from relocatable objects

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From hjl dot tools at gmail dot com  2009-03-09 16:54 -------
A patch is posted at

http://sourceware.org/ml/binutils/2009-03/msg00148.html

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl dot tools at gmail dot
                   |                            |com
 GCC target triplet|x86_64-linux-gnu            |
            Summary|`strip --strip-unneeded`    |`strip --strip-unneeded`
                   |incorrectly strips objects  |strips common symbols from
                   |of type COM from relocatable|relocatable objects
                   |ELF objects                 |


http://sourceware.org/bugzilla/show_bug.cgi?id=9933

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/9933] `strip --strip-unneeded` strips common symbols from relocatable objects

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2009-03-10 00:48 -------
Subject: Bug 9933

CVSROOT: /cvs/src
Module name: src
Changes by: hjl@... 2009-03-10 00:48:10

Modified files:
        binutils       : ChangeLog objcopy.c
        binutils/testsuite: ChangeLog
        binutils/testsuite/binutils-all: objcopy.exp
Added files:
        binutils/testsuite/binutils-all: copy-4.d

Log message:
        binutils/
       
        2009-03-09  H.J. Lu  <hongjiu.lu@...>
       
        PR binutils/9933
        * objcopy.c (filter_symbols): Properly handle common symbols
        in relocatable file.
       
        binutils/testsuite/
       
        2009-03-09  H.J. Lu  <hongjiu.lu@...>
       
        PR binutils/9933
        * binutils-all/copy-4.d: New.
       
        * binutils-all/objcopy.exp: Run copy-4.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1437&r2=1.1438
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/objcopy.c.diff?cvsroot=src&r1=1.125&r2=1.126
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/testsuite/ChangeLog.diff?cvsroot=src&r1=1.166&r2=1.167
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/testsuite/binutils-all/copy-4.d.diff?cvsroot=src&r1=NONE&r2=1.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/testsuite/binutils-all/objcopy.exp.diff?cvsroot=src&r1=1.53&r2=1.54



--


http://sourceware.org/bugzilla/show_bug.cgi?id=9933

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/9933] `strip --strip-unneeded` strips common symbols from relocatable objects

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From hjl dot tools at gmail dot com  2009-03-10 00:51 -------
Fixed.

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=9933

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/9933] `strip --strip-unneeded` strips common symbols from relocatable objects

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From vincent dot riviere at freesbee dot fr  2009-10-16 20:58 -------
The new testcase copy-4 fails on target m68k-netbsd (using a.out).
The test seems to be valid, maybe the fix didn't work for a.out objects.

--


http://sourceware.org/bugzilla/show_bug.cgi?id=9933

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/9933] `strip --strip-unneeded` strips common symbols from relocatable objects

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



--
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vincent dot riviere at
                   |                            |freesbee dot fr


http://sourceware.org/bugzilla/show_bug.cgi?id=9933

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/9933] `strip --strip-unneeded` strips common symbols from relocatable objects

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From amodra at bigpond dot net dot au  2009-10-17 07:15 -------
The fix doesn't work on aout because EXEC_P is set for the bfd flags on your
object file, thus "relocatable" in objcopy.c:filter_symbols is not set.  EXEC_P
is set incorrectly at bfd/aoutx.h:633, and it's been that way since rev 1.1 of
the file.

--


http://sourceware.org/bugzilla/show_bug.cgi?id=9933

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils