Summary: | LTO on powerpc will not work with static libraries | ||
---|---|---|---|
Product: | binutils | Reporter: | Michael Meissner <meissner> |
Component: | ld | Assignee: | Alan Modra <amodra> |
Status: | RESOLVED FIXED | ||
Severity: | critical | CC: | amodra, bergner, meissner |
Priority: | P2 | ||
Version: | 2.22 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Attachments: | Tar file to show the problem |
Created attachment 5670 [details] Tar file to show the problem I built binutils for powerpc64-linux that was the top of the tree from April 12th, adding the --enable-plugins I then built a GCC compiler that was top of the tree from April 13ths, using that binutils for the target assembler, linker, etc. I added the options: --with-plugin-ld=<path> --enable-plugin and --enable-lto to enable LTO. I then tried a case where I was enabling vectorization of the math functions on power7 with -ffast-math -mcpu=power7 -mveclibabi=mass, and I get undefined errors (the MASS library is only available as static archives). If I extract the objects and put them on the link line manually, it works fine. If I create a shared library with these objects and use that, it also works. However, if I use a static library, I get undefined errors. I built a sample test case to try this out that is the attachment. In this case, when linking test-lto1-static, I get: -igoo-> make clean; make CC=/home/meissner/fsf-install-ppc64/trunk/bin/gcc all rm -f *.[osia] *.so *.so.1 test-lto1-shared test-lto1-static all /home/meissner/fsf-install-ppc64/trunk/bin/gcc -O3 -mcpu=power7 -mveclibabi=mass -ffast-math -flto -fwhole-program -fuse-linker-plugin -c test-lto1-a.c /home/meissner/fsf-install-ppc64/trunk/bin/gcc -O3 -mcpu=power7 -mveclibabi=mass -ffast-math -flto -fwhole-program -fuse-linker-plugin -c test-lto1-b.c /home/meissner/fsf-install-ppc64/trunk/bin/gcc -O3 -mcpu=power7 -mveclibabi=mass -ffast-math -flto -fwhole-program -fuse-linker-plugin -fpic -c test-lto1-c.c rm -f liblto1-shared.so.1 /home/meissner/fsf-install-ppc64/trunk/bin/gcc -shared -o liblto1-shared.so.1 -Wl,-soname,liblto1-shared.so.1 test-lto1-c.o rm -f liblto1-shared.so ln -s liblto1-shared.so.1 liblto1-shared.so /home/meissner/fsf-install-ppc64/trunk/bin/gcc -o test-lto1-shared -O3 -mcpu=power7 -mveclibabi=mass -ffast-math -flto -fwhole-program -fuse-linker-plugin test-lto1-a.o test-lto1-b.o -L . -Wl,-rpath,$(pwd) -llto1-shared -lm rm -f liblto1-static.a ar cq liblto1-static.a test-lto1-c.o ranlib liblto1-static.a /home/meissner/fsf-install-ppc64/trunk/bin/gcc -o test-lto1-static -O3 -mcpu=power7 -mveclibabi=mass -ffast-math -flto -fwhole-program -fuse-linker-plugin test-lto1-a.o test-lto1-b.o -L . -llto1-static -lm /tmp/ccLckNND.ltrans0.ltrans.o:(.text.startup+0xc4): undefined reference to `sind2' collect2: ld returned 1 exit status make: *** [test-lto1-static] Error 1