[Bug c++/105169] Compiling C++ code with -fpatchable-function-entry=16,14 results in references to discarded sections

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 6 09:29:51 GMT 2022


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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, a bit reduced test-case:

$ cat 1.ii
struct WinsockInterfaceClass {
  virtual int Get_Protocol() { return 0; }
} PacketTransport;

$ cat 2.ii
struct WinsockInterfaceClass {
  WinsockInterfaceClass();
  virtual void Set_Broadcast_Address() {}
  virtual int Get_Protocol() { return 0; }
};
WinsockInterfaceClass::WinsockInterfaceClass() {}

int main()
{
  return 0;
}

$ g++ 1.ii 2.ii -fpatchable-function-entry=1 -O2
`.text._ZN21WinsockInterfaceClass12Get_ProtocolEv' referenced in section
`__patchable_function_entries' of /tmp/cc6P6bkZ.o: defined in discarded section
`.text._ZN21WinsockInterfaceClass12Get_ProtocolEv[_ZN21WinsockInterfaceClass12Get_ProtocolEv]'
of /tmp/cc6P6bkZ.o
collect2: error: ld returned 1 exit status

$ g++ 1.ii 2.ii -fpatchable-function-entry=1 -O2 -fuse-ld=gold
/tmp/ccCrCzcR.o(__patchable_function_entries+0x8): error: relocation refers to
local symbol "" [4], which is defined in a discarded section
  section group signature: "_ZN21WinsockInterfaceClass12Get_ProtocolEv"
  prevailing definition is from /tmp/ccH1NIH4.o
collect2: error: ld returned 1 exit status


More information about the Gcc-bugs mailing list