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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #2)
> 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; }
> };

Note this is a ODR violation, so better match up both WinsockInterfaceClass
types.

> 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_Pr
> otocolEv]' 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

Reply via email to