Re: [PATCH] ld: Don't define section symbols for excluded sections
"H.J. Lu" <[email protected]> Thu, 30 Jul 2026 18:54:46 +0800
| Newsgroups | gmane.comp.gnu.binutils |
|---|---|
| Message-ID | <CAMe9rOpFpYkNVxQ82mo+b8ktmwQqV4U-=8Q6x1A7Z3PZg1Z=sw@mail.gmail.com> |
On Thu, Jul 30, 2026 at 6:34=E2=80=AFPM Alan Modra <[email protected]> wrote= : > > On Thu, Jul 30, 2026 at 03:17:45PM +0800, H.J. Lu wrote: > > When the SEC_EXCLUDE bit is set on a section, the contents of the secti= on > > are excluded by the linker for non-relocatable output. Define __start= , > > __stop, .startof. and .sizeof. symbols for relocatable link or if the > > SEC_EXCLUDE bit on the section is cleared. > > Looks good to me. You might like to mention the ELF SHF_EXCLUDE flag > in the description too, since it was that flag being set that > triggered the segfault in bug_4.o from the pr. bug_4.o didn't even > need --gc-sections to fail. I am checking it in with the updated commit message: When the SEC_EXCLUDE bit is set on a section, for example, sections with the SHF_EXCLUDE flag bit set in ELF input, the contents of the section are excluded by the linker for non-relocatable output. Define __start, __stop, .startof. and .sizeof. symbols for relocatable link or if the SEC_EXCLUDE bit on the section is cleared. > > PR ld/34448 > > * ldlang.c (lang_init_start_stop): Call lang_define_start_stop > > for relocatable link or if the SEC_EXCLUDE bit on the section > > is cleared. > > > --=20 H.J.