Apparently ld --build-id behavior changed recently, so it no longer checksums symbol table sections.
A short testcase:
cat > A.java <<\EOF
public static void main(String args)
sed s/A/B/ A.java > B.java
gcj -C A.java
gcj -C B.java
gcj -shared -fpic -o libAB.so A.class B.class
gcj -o A -fmain=A ./libAB.so -Wl,--build-id
gcj -o B -fmain=B ./libAB.so -Wl,--build-id
objdump -s -j .note.gnu.build-id A B
While with older linkers (e.g. 22.214.171.124.2) the build ids were different between A and B, in CVS head as well as 126.96.36.199.5 the build ids are the same, eventhough the binaries are different (although they have exactly the same code sections, as they call different code they certainly aren't the same).
Actually, it seems upstream binutils probably never handled it right and it seems Fedora had some local patch for it that got dropped as redundant when it actually has never been redundant.
In elf_checksum_contents it checksums contents of sections guarded with
Except, at least in my testing, i_shdr.contents is always NULL so it only checksums section headers, program headers and ELF header.
See <https://bugzilla.redhat.com/show_bug.cgi?id=472152> for the original bug report and <https://bugzilla.redhat.com/show_bug.cgi?id=501582> for a follow-up bug.
> Actually, it seems upstream binutils probably never handled it right and it
> seems Fedora had some local patch for it that got dropped as redundant when it
> actually has never been redundant.
Sorry about that - it was my fault. I looked at the code and thought
that the problem had been fixed by some other changes but I failed to
make sure that this assumption was correct. :-(
Module name: src
Changes by: firstname.lastname@example.org 2011-12-14 11:50:14
bfd : ChangeLog elfcode.h compress.c
* elfcode.h (elf_checksum_contents): Read in the section's
contents if they are not already available.
* compress.c (bfd_get_full_section_contents): Use zmalloc to
allocate the buffers so that excess bytes are guaranteed to be
Sorry about dropping the ball on this one.
I have now checked in the patch to zero the compressed sections when they are loaded and to force the loading of unloaded sections when computing checksums. This should fix build-ids so that they are now consistent.
For anyone rummaging through bugzilla, please note the followup: http://sourceware.org/ml/binutils-cvs/2011-12/msg00074.html
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.