https://sourceware.org/bugzilla/show_bug.cgi?id=29086
Bug ID: 29086 Summary: -Wl,--wrap=foo with LTO leads to undefined symbol Product: binutils Version: unspecified Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: hjl.tools at gmail dot com Target Milestone: --- [hjl@gnu-cfl-1 xxx]$ cat x.c int foo (void) { return 0; } int main() { return foo (); } [hjl@gnu-cfl-1 xxx]$ cat y.c extern int __real_foo (void); int __wrap_foo (void) { return __real_foo (); } [hjl@gnu-cfl-1 xxx]$ make gcc -g -flto -c -o x.o x.c gcc -Wl,--wrap=foo -g -flto -o x x.o y.o /usr/local/bin/ld: /tmp/ccaI3Pxt.ltrans0.ltrans.o: in function `__wrap_foo': /export/home/hjl/bugs/binutils/xxx/y.c:6: undefined reference to `foo' collect2: error: ld returned 1 exit status make: *** [Makefile:11: x] Error 1 [hjl@gnu-cfl-1 xxx]$ -- You are receiving this mail because: You are on the CC list for the bug.