https://sourceware.org/bugzilla/show_bug.cgi?id=32789
--- Comment #5 from Sourceware Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Indu Bhagat <[email protected]>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4651bea1193d5180c47945237ab6451f98097c49 commit 4651bea1193d5180c47945237ab6451f98097c49 Author: Indu Bhagat <[email protected]> Date: Fri Dec 19 23:11:45 2025 -0800 bfd: include: sframe: fix PR ld/32789 Currently, when SFrame sections are emitted after linking the input SFrame sections, the SFrame FDEs are sorted on start PC. Doing so for relocatable links has no effect (SFrame FDEs remain in place), because the start PC is unrelocated data. For relocatable links, then, the emitted SFrame FDEs in the output section remain in the same order as that in the respective input BFD. The assembler does not guarantee the emission of SFrame FDEs in the same order as the placement of the associated .text* sections, (SFRAME_F_FDE_SORTED is not set in the ET_REL objs generated by GAS). This means setting SFRAME_F_FDE_SORTED by the linker was wrong when: - doing relocatable link, and - the input bfds contain multiple .text sections, say .text.hot, .text.init, .text.unlikely etc. For relocatable links, skip sorting the SFrame FDEs. Do not set SFRAME_F_FDE_SORTED for relocatable links. This is achieved by adding an explicit argument (bool sort_fde_p) to the sframe_encoder_write API. Move the API from 2.0 to the 2.1 node as this is an ABI-incompatible change. Skip bumping the "current" in libsframe/libtool-version ATM, we will do so closer to release. When writing of SFrame data for PLT entries, indicate sort_fde_p to false: these sections are like the other SFrame sections for any other ET_REL binary. Add a test in ld/testsuite/ld-sframe/sframe.exp, these tests are run for all ABIs supported for SFrame. In this test, for object file generated for pr32789-1a.c: - the emitted SFrame FDEs by GAS are in the order of the .text* in the input assembly (i.e., .text.init, .text, .text.exit) - the emitted .text* sections by GAS are placed in the following order .text, .text.init, .text.exit. - GAS does not set SFRAME_F_FDE_SORTED, as expected. Reviewed-by: Jens Remus <[email protected]> bfd/ PR ld/32789 * elf-sframe.c (_bfd_elf_write_section_sframe): Skip sorting the SFrame FDEs for relocatable links. * elf64-s390.c (_bfd_s390_elf_write_sframe_plt): Additional argument to sframe_encoder_write. * elfxx-x86.c (_bfd_x86_elf_write_sframe_plt): Likewise. libsframe/ * libsframe.ver: Move from 2.0 node to 2.1. * sframe.c (sframe_encoder_write_sframe): Conditionalize based on argument sort_fde_p. (sframe_encoder_write): New argument to indicate whether SFrame FDEs are to be sorted in output. include/ * sframe-api.h (sframe_encoder_write): New argument. ld/testsuite/ PR ld/32789 * ld/testsuite/ld-sframe/sframe.exp: New test. * ld/testsuite/ld-sframe/pr32789-1.rd: New test. * ld/testsuite/ld-sframe/pr32789-1.sd: New test. * ld/testsuite/ld-sframe/pr32789-1a.c: New test. * ld/testsuite/ld-sframe/pr32789-1b.c: New test. * ld/testsuite/ld-x86-64/sframe-reloc-1.d: Remove SFRAME_F_FDE_SORTED. -- You are receiving this mail because: You are on the CC list for the bug.
