[PATCH v2 1/3] ld: bfd: sframe: KEEP .sframe sections and support gc-sections
Jan Beulich
jbeulich@suse.com
Fri Jan 16 09:34:54 GMT 2026
On 14.01.2026 11:05, claudiu.zissulescu-ianculescu--- via Binutils wrote:
> From: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
>
> Fix PR ld/32769
>
> Currently, specifying --gc-sections causes the linker to discard all
> input .sframe sections. Fix this behaviour by adding KEEP for .sframe
> sections in the default ELF linker script.
Is this correct though? What if all text sections in an object file are
removed by gc? You'll then keep .sframe for no reason? Yes, it looks to
work similarly for .eh_frame, yet that then looks similarly wrong to me.
Of course I may be missing something here.
> @@ -14697,12 +14700,28 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
> false))
> {
> _bfd_elf_parse_eh_frame (sub, info, sec, &cookie);
> + if (sec->sec_info && (sec->flags & SEC_LINKER_CREATED) == 0)
> + elf_eh_frame_section (sub) = sec;
> + fini_reloc_cookie_for_section (&cookie, sec);
> + sec = bfd_get_next_section_by_name (NULL, sec);
> + }
> +
> + /* Now parse each .sframe section. Point each .sframe secto to
> + each bfd. */
> + sec = bfd_get_section_by_name (sub, ".sframe");
> + while (sec
> + && init_reloc_cookie_for_section (&cookie, info, sec, false))
> + {
> + _bfd_elf_parse_sframe (sub, info, sec, &cookie);
> +
> if (sec->sec_info
> && (sec->flags & SEC_LINKER_CREATED) == 0)
> - elf_eh_frame_section (sub) = sec;
> + elf_sframe_section (sub) = sec;
> +
> fini_reloc_cookie_for_section (&cookie, sec);
> sec = bfd_get_next_section_by_name (NULL, sec);
> }
> +
> }
Nit: No need for this new blank line.
Jan
More information about the Binutils
mailing list