[Bug lto/50367] -flto and -Wl,--as-needed combination removes some needed libraries
doko at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Sep 19 22:04:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50367
Matthias Klose <doko at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |doko at gcc dot gnu.org
--- Comment #1 from Matthias Klose <doko at gcc dot gnu.org> 2011-09-19 21:14:50 UTC ---
$ cat test-flto.c
#include <math.h>
#include <stdio.h>
int main()
{
printf("%le\n", gamma(42));
return 0;
}
$ gcc -Wl,--as-needed -flto test-flto.c -lm
/tmp/ccXjDUDX.ltrans0.ltrans.o: In function `main':
ccXjDUDX.ltrans0.o:(.text+0xd): undefined reference to `gamma'
collect2: ld returned 1 exit status
$ gcc -B/usr/lib/gold-ld/ -Wl,--as-needed -flto -o test-flto test-flto.c -lm
does work
More information about the Gcc-bugs
mailing list