Skip to contentSkip to conversation

elf: Discard input .note.gnu.build-id sections

PATCH New Valery Chernous 1 participant 1 message Dec 10, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 elf: Discard input .note.gnu.build-id sections

From: Valerii Chernous <[email protected]>

Originally issue:
building of glibc 2.32 or 2.34 with option "-Wl,--build-id" produce libc.so.6 with section ".note.gnu.build-id" that have invalid(double, 0x48) section size. It happens because glibc use sublibraries for linking libc.so.6
ld produce this sublibraries with build-id section and on last linking stage loads this sections as input for linking.
ld should create new(valid) ".note.gnu.build-id" into function ldelf_setup_build_id on last linking stage but it skip creating because build-id section already exists.
As result libc.so.6 contain ".note.gnu.build-id" with build-ids from sublibraries and without valid build-id

Howto solved:
1. Discard input .note.gnu.build-id sections.
2. Clear the build ID field before writing.
3. Use bfd_make_section_anyway_with_flags to create the output .note.gnu.build-id section.

Upstream-Status: Backport

Reference to upstream patch:
[https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=1f1d0f8888a6c944e612b416a2a6e11abcf5199f]

---
 .../binutils/binutils-2.37.inc                |   1 +
 ...rd-input-.note.gnu.build-id-sections.patch | 215 ++++++++++++++++++
 2 files changed, 216 insertions(+)
 create mode 100644 meta/recipes-devtools/binutils/binutils/0001-elf-Discard-input-.note.gnu.build-id-sections.patch
meta/recipes-devtools/binutils/binutils-2.37.inc +1 -0
index 8f91c6460d..c565adc4b7 100644
@@ -35,5 +35,6 @@ SRC_URI = "\
      file://0015-sync-with-OE-libtool-changes.patch \
      file://0016-Check-for-clang-before-checking-gcc-version.patch \
      file://0017-bfd-Close-the-file-descriptor-if-there-is-no-archive.patch \
+     file://0001-elf-Discard-input-.note.gnu.build-id-sections.patch \
 "
 S  = "${WORKDIR}/git"
meta/recipes-devtools/binutils/binutils/0001-elf-Discard-input-.note.gnu.build-id-sections.patch new file +215 -0

215 lines not on this page · raw message

Signature · 1 line
2.25.1