https://sourceware.org/bugzilla/show_bug.cgi?id=33633

            Bug ID: 33633
           Summary: ld --build-id does not use symtab/strtab content
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: i at maskray dot me
  Target Milestone: ---

Originally reported at
https://lore.kernel.org/linux-perf-users/CAP-5=fUC88TVwnjTuTgU+s=lqqp0xohntg5hu27csbazrh7...@mail.gmail.com/

$ cat a.s
.text
.global main
.global foo
main:
foo:
       ret
$ cat b.s
.text
.global main
.global bar
main:
bar:
       ret
$ gcc -Wl,--build-id a.s -o a.out
$ gcc -Wl,--build-id b.s -o b.out
$ readelf -n a.out
...
   Build ID: 9dd0371b953db5d72929af5d98552e4ee1043616
...
$ readelf -n b.out
...
   Build ID: 9dd0371b953db5d72929af5d98552e4ee1043616
...


write_build_id calls bfd/elfcode.h:elf_checksum_contents, which hashes the ELF
header, program headers, section headers and contents.
However, .symstr .strtab .shstrtab are special ` sec =
bfd_section_from_elf_index (abfd, count);` returns NULL for the three sections,
causing their contents to be unused in the final build ID.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to