[Bug lto/51859] New: wrapped symbols (wrap linker option) do not link

ncahill_alt at yahoo dot com gcc-bugzilla@gcc.gnu.org
Sat Jan 14 12:29:00 GMT 2012


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: unassigned@gcc.gnu.org
        ReportedBy: ncahill_alt@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.



More information about the Gcc-bugs mailing list