As H. J. Lu told me, I'm opening a bug report. I'm using Slackware -current and some time ago decided to upgrade to 2.16.91.0.6 because it ships with 2.15.92.0.2. What happens is that, whenever I compile something with -Wl,-s added in LDFLAGS or another place in the Makefile, so that it strips the binaries/libraries and I don't have to use strip(1), the final sizes are different. With the old version, there's nothing left to strip if I use -Wl,-s. With the new version, if I use strip(1), it strips something, and the final sizes are then the same and md5sum(1) matches. This is with GCC 3.4.6 (also was with 3.4.5) on x86. I have some small binaries from udev 0.87 if someone wants to take a look. I'm very clueless about it and what may be causing it.
Created attachment 919 [details] Small binaries showing the difference I don't know if this is of any help. These are udevstart binaries from udev 087. udevstart.old is compiled with the old binutils and udevstart.new with the new. Both used the same udev sources and Makefile, which had #STRIP = $(CROSS_COMPILE)strip #STRIPCMD = $(STRIP) -s commented and -Wl,-s added to LDFLAGS = -Wl,-warn-common
BTW, I'm not sure about what I should put in Host, Target, and Build. GCC is from Slackware, so is i486-slackware-linux. I compiled binutils for my host, so it picked i686-pc-linux-gnu.
We need a testcase to look into it. An executable doesn't help here.
As I wrote, I'm very clueless about it, so I don't know how to write a testcase. Would that help if I upload my binutils somewhere ? I could also give ssh access to whoever wants to take a look.
Please provide a simple source code with instructions to reproduce the problem you have described.
I can reproduce it with anything, even a single #include <stdio.h> void main(void) { printf("Hello world \n"); } New binutils: $ gcc -o foo -Wl,-s foo.c foo.c: In function `main': foo.c:2: warning: return type of 'main' is not `int' $ ls -l foo -rwxr-xr-x 1 root root 3313 2006-03-16 20:38 foo $ strip foo $ ls -l foo -rwxr-xr-x 1 root root 2896 2006-03-16 20:39 foo Old binutils: $ gcc -o foo -Wl,-s foo.c foo.c: In function `main': foo.c:2: warning: return type of 'main' is not `int' $ ls -l foo -rwxr-xr-x 1 root root 2896 2006-03-16 23:40 foo $ strip foo -rwxr-xr-x 1 root root 2896 2006-03-16 23:40 foo
Paul, it looks like your patch: http://sourceware.org/ml/binutils/2005-05/msg00170.html puts a some random bytes at the end of output. Can you look into it? Thanks.
I also saw this on Linux/x86-64.
The problem is diff -x 'config*' -x CVS -upr ../binutils-last/src/bfd/elfxx-target.h src/bfd/el fxx-target.h --- ../binutils-last/src/bfd/elfxx-target.h 2006-03-16 22:17:02.000000000 -0 800 +++ src/bfd/elfxx-target.h 2006-03-16 22:29:42.000000000 -0800 @@ -416,7 +416,7 @@ #define elf_backend_merge_symbol_attribute NULL #endif #ifndef elf_backend_emit_relocs -#define elf_backend_emit_relocs NULL +#define elf_backend_emit_relocs _bfd_elf_link_output_rel ocs #endif #ifndef elf_backend_count_relocs #define elf_backend_count_relocs NULL Now all targets will call _bfd_elf_link_output_relocs which generates some random bytes at the end.
A patch is posted at http://sourceware.org/ml/binutils/2006-03/msg00239.html
Fixed by http://sourceware.org/ml/binutils/2006-03/msg00251.html
Thanks, I just tested it.