http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51859
Bug #: 51859 Summary: wrapped symbols (wrap linker option) do not link Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto AssignedTo: unassig...@gcc.gnu.org ReportedBy: ncahill_...@yahoo.com The following command, > gcc -flto -Wl,-wrap,malloc -o a a.c produces the following error, `__wrap_malloc' referenced in section `.text' of /tmp/ccCKjgAw.ltrans0.ltrans.o: defined in discarded section `.text' of /tmp/ccREUpxM.o (symbol from plugin) collect2: ld returned 1 exit status Here is the test case: --- a.c --- void * __wrap_malloc(int bytes) { __real_malloc(bytes); } int main() { int *p = (int *)malloc(4); *p = 2; free(p); return 0; } --- end a.c --- This has the result that xorg-server 1.11.2 does not build with lto enabled. Thank you. Neil.