[Bug ld/32219] ELF orphan placement doesn't work well without .interp
https://sourceware.org/bugzilla/show_bug.cgi?id=32219 Nick Clifton changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #6 from Nick Clifton --- patch applied -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/32219] ELF orphan placement doesn't work well without .interp
https://sourceware.org/bugzilla/show_bug.cgi?id=32219 --- Comment #5 from Sourceware Commits --- The master branch has been updated by Nick Clifton : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7ecf0250f7f0868f3b828ffadd47d0e5f2dbd875 commit 7ecf0250f7f0868f3b828ffadd47d0e5f2dbd875 Author: Nick Clifton Date: Mon Sep 30 14:41:11 2024 +0100 Improve the placement of orphan note sections. PR 32219 -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/32219] ELF orphan placement doesn't work well without .interp
https://sourceware.org/bugzilla/show_bug.cgi?id=32219 --- Comment #4 from H.J. Lu --- (In reply to Nick Clifton from comment #3) > Created attachment 15722 [details] > Proposed patch > > Hi H.J. > > How about this proposed patch instead ? > > It modifies the orphan placement algorithm to test to see if the anchor > section for orphaned NOTES exists before using it: > > +{ > + /* PR 32219: Check that the .interp section > + exists before attaching orphans to it. */ > + if (lang_output_section_find (hold[orphan_interp].name)) > + place = &hold[orphan_interp]; > + /* Next best place: after .rodata. */ > + else if (lang_output_section_find (hold[orphan_rodata].name)) > + place = &hold[orphan_rodata]; > + /* Last attempt: the .text section. */ > + else > + place = &hold[orphan_text]; > +} > > It also tweaks various linker script files for targets that might benefit > and then adds XFAILS to the pr23658-1e test for the remaining unhandled > targets. > > What do you think ? > It looks good to me. Thanks. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/32219] ELF orphan placement doesn't work well without .interp
https://sourceware.org/bugzilla/show_bug.cgi?id=32219 Sam James changed: What|Removed |Added CC||sam at gentoo dot org -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/32219] ELF orphan placement doesn't work well without .interp
https://sourceware.org/bugzilla/show_bug.cgi?id=32219 --- Comment #3 from Nick Clifton --- Created attachment 15722 --> https://sourceware.org/bugzilla/attachment.cgi?id=15722&action=edit Proposed patch Hi H.J. How about this proposed patch instead ? It modifies the orphan placement algorithm to test to see if the anchor section for orphaned NOTES exists before using it: +{ + /* PR 32219: Check that the .interp section +exists before attaching orphans to it. */ + if (lang_output_section_find (hold[orphan_interp].name)) + place = &hold[orphan_interp]; + /* Next best place: after .rodata. */ + else if (lang_output_section_find (hold[orphan_rodata].name)) + place = &hold[orphan_rodata]; + /* Last attempt: the .text section. */ + else + place = &hold[orphan_text]; +} It also tweaks various linker script files for targets that might benefit and then adds XFAILS to the pr23658-1e test for the remaining unhandled targets. What do you think ? Cheers Nick -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/32219] ELF orphan placement doesn't work well without .interp
https://sourceware.org/bugzilla/show_bug.cgi?id=32219 --- Comment #2 from H.J. Lu --- This patch removes .interp and uses .rodata for note sections instead: diff --git a/ld/ldelf.c b/ld/ldelf.c index 09691609fc0..b09ba054ed5 100644 --- a/ld/ldelf.c +++ b/ld/ldelf.c @@ -2121,9 +2121,6 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint) { 0, SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA, 0, 0, 0, 0 }, - { ".interp", - SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA, - 0, 0, 0, 0 }, { ".sdata", SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_SMALL_DATA, 0, 0, 0, 0 }, @@ -2139,7 +2136,6 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint) orphan_data, orphan_bss, orphan_rel, - orphan_interp, orphan_sdata, orphan_nonalloc }; @@ -2328,7 +2324,7 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint) && (elfinput ? sh_type == SHT_NOTE : startswith (secname, ".note"))) -place = &hold[orphan_interp]; +place = &hold[orphan_rodata]; else if ((flags & (SEC_LOAD | SEC_HAS_CONTENTS | SEC_THREAD_LOCAL)) == 0) place = &hold[orphan_bss]; else if ((flags & SEC_SMALL_DATA) != 0) But -z separate-code still doesn't work for many targets. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/32219] ELF orphan placement doesn't work well without .interp
https://sourceware.org/bugzilla/show_bug.cgi?id=32219 Nick Clifton changed: What|Removed |Added CC||nickc at redhat dot com --- Comment #1 from Nick Clifton --- The problem also affects: arc-linux-uclibc avr-elf d10v-elf h8300-linux-gnu ip2k-elf m32r-elf mep-elf microblaze-elf moxie-elf spu-elf v850-elf xtensa-elf -- You are receiving this mail because: You are on the CC list for the bug.