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

            Bug ID: 93195
           Summary: -fpatchable-function-entries :
                    __patchable_function_entries should consider comdat
                    groups
           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: ---

% cat a.cc
inline void foo() {}
void bar() { foo(); }
% cat b.cc
inline void foo() {}
void bar1() { foo(); }
% g++ -fpatchable-function-entry=1 -c a.cc b.cc

Linkers don't allow a relocation to a discarded symbol (foo).

% ld.bfd a.o b.o
...
`.text._Z3foov' referenced in section `__patchable_function_entries' of b.o:
defined in discarded section `.text._Z3foov[_Z3foov]' of b.o

% gold a.o b.o
b.o(__patchable_function_entries+0x0): error: relocation refers to local symbol
"" [5], which is defined in a discarded section
  section group signature: "_Z3foov"
  prevailing definition is from a.o

% ld.lld a.o b.o
ld.lld: error: relocation refers to a discarded section: .text._Z3foov
>>> defined in b.o
>>> referenced by b.cc
>>>               b.o:(__patchable_function_entries+0x0)

Reply via email to