https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115953
Bug ID: 115953 Summary: --wrap does now work with lto Product: gcc Version: 12.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: koule2333 at gmail dot com Target Milestone: --- I am using gcc 12.3.1 and ld 2.41, and this error occurs again. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88643 my case: int foo(); int __wrap_foo() { return 6; } int main() { return foo(); } When I use 'gcc -flto ccc.c -Wl,--wrap=foo' to compile it, I got undefined reference to `__wrap_foo'. Can anyone tell me why?