Re: [PATCH] ld: Don't define section symbols for excluded sections
Jan Beulich <[email protected]> Fri, 31 Jul 2026 10:31:52 +0200
| Newsgroups | gmane.comp.gnu.binutils |
|---|---|
| Message-ID | <[email protected]> |
On 30.07.2026 09:17, H.J. Lu wrote:
> When the SEC_EXCLUDE bit is set on a section, 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.
Feels like there is "only" missing in the sentences, to properly describe
what the change actually does (introduce an extra constraint rather than
provide those symbols anew).
For changes like this I would also wish that they were done with less
churn, and without needlessly increasing indentation depth:
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
for (s = abfd->sections; s != NULL; s = s->next)
{
const char *ps;
const char *secname = s->name;
if (!bfd_link_relocatable (&link_info)
&& (s->flags & SEC_EXCLUDE) != 0)
continue;
...
Jan