https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93197

            Bug ID: 93197
           Summary: -fpatchable-function-entries :
                    __patchable_function_entries does not survive under
                    --gc-sections
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: i at maskray dot me
  Target Milestone: ---

__patchable_function_entries is not a GC root, and not referenced by a retained
section. It will thus be garbage collected.

The only solution I can think of requires fixes to both GCC and GNU ld.

* GNU ld: implement interaction between SHF_LINK_ORDER and --gc-sections
https://sourceware.org/bugzilla/show_bug.cgi?id=24526
* GCC: Create one __patchable_function_entry section for each function. For
each function `foo`,
  + If foo needs to be placed in a comdat group, place
__patchable_function_entry in the comdat group
  + Otherwise, set the SHF_LINK_ORDER flag of __patchable_function_entry and
set its sh_link to reference the section containing `foo`

Reply via email to