https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105169
Bug ID: 105169 Summary: Compiling C++ code with -fpatchable-function-entry=16,14 results in references to discarded sections Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: giuliano.belinassi at gmail dot com Target Milestone: --- Created attachment 52751 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52751&action=edit Small project to reproduce claimed failure. Compiling the attached project running `make` results in the following messages from ld (GNU ld (GNU Binutils; SUSE Linux Enterprise 15) 2.37.20211103-7.26): `.text._ZN21WinsockInterfaceClass12Get_ProtocolEv' referenced in section `__patchable_function_entries' of wsproto.o: defined in discarded section `.text._ZN21WinsockInterfaceClass12Get_ProtocolEv[_ZN21WinsockInterfaceClass12Get_ProtocolEv]' of wsproto.o The project compiles fine without -fpatchable-function-entry. PS: I could not manage to reduce the testcase into a single file.