Description of problem: Version-Release number of selected component (if applicable): binutils-2.18.50.0.6-6.fc9.x86_64 How reproducible: 100% Steps to Reproduce: 1.echo 'main(){}' > a.c; cp a.c b.c 2.gcc -g -o a a.c; gcc -g -o b b.c 3.eu-readelf -n a b Actual results: build ID bits (shown in hex by eu-readelf) match Expected results: build ID bits should not match Additional info: bfd/elfcode.h:elf_checksum_contents is responsible for feeding the contents about to be written into the checksum calculation to produce the ID. Debugging shows that i_shdr.contents==0 for all the sections. The original intent of that code was to get all the nonempty sections' contents, maybe except for the build-id section itself (either it won't have contents yet and gets skipped, or its contents bytes are all zero and those feed into the sum, either is fine). I don't think this was broken when originally implemented, so something has changed so that the .contents field is not set to the in-memory contents buffer in this case as the code expects. Note this bug does not affect RPM package builds, because rpmbuild's debugedit recomputes build ID bits itself with separate code that doesn't have this bug.
Created attachment 324713 [details] load section contents if necessary
Hi Roland, Please could you try the uploaded patch and let me know if it works for you. Cheers Nick
Works for me.
I have checked in the patch to the rawhide sources.