[PATCH 2/3] ld: bfd: sframe: KEEP .sframe sections and support gc-sections

Jens Remus jremus@linux.ibm.com
Mon Jan 12 15:46:28 GMT 2026


On 1/12/2026 11:53 AM, 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.
> 
> Additionally, add logic in the linker to gc mark .sframe sections.
> _bfd_elf_gc_mark () now is aware of SFrame sections. It relies on
> elf_section_sframe () to get the SFrame section associated with the text
> section.
> 
> The stub changes in bfd_elf_discard_info skip checking the return
> value of _bfd_elf_parse_sframe because it may have already been
> parsed.  Remove redundant call to _bfd_elf_set_section_sframe.
> 
> ld/
> 	PR ld/32769
> 	* scripttempl/elf.sc: KEEP .sframe sections.

Doesn't this affect any of the tests added with "[PATCH 1/3] sframe: Add
tests for PR ld/32769"?  If not, why isn't an additional test added?

> bfd/
> 	* elf-bfd.h (struct elf_obj_tdata): Add sframe section pointer.
> 	(elf_sframe_section): New macro.
> 	* elflink.c (_bfd_elf_gc_mark): Handle SFrame sections.
> 	(bfd_elf_gc_sections): Likewise.
> 	(bfd_elf_discard_info): Update for handling gc operations.
> 
> Co-authored-by: Indu Bhagat <indu.bhagat@oracle.com>
> Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/



More information about the Binutils mailing list