Bug 61487 - LTO breaks on mips with wireless-tools 0.29
Summary: LTO breaks on mips with wireless-tools 0.29
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 4.8.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, link-failure, lto
Depends on:
Blocks:
 
Reported: 2014-06-12 16:18 UTC by Rose Garcia
Modified: 2021-12-24 10:22 UTC (History)
0 users

See Also:
Host:
Target: mips
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rose Garcia 2014-06-12 16:18:34 UTC
http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/wireless_tools.29.tar.gz
(no dependencies, so easy to test)

when built with a gcc 4.8.3 linux crosscompiler plus -flto, i get:

mips-linux-musl-gcc -L/media/3T/x-prefix/mips/lib -isystem /media/3T/x-prefix/mips/include -s -Wl,--gc-sections -Wl,-z,relro,-z,now -flto -static -Wl,-s -D_GNU_SOURCE -D_BSD_SOURCE -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -ftree-dce -s -Os -flto -MMD     -o iwlist iwlist.o libiw.a -lm
lto1: internal compiler error: in read_cgraph_and_symbols, at lto/lto.c:2935

(the crosscompiler is built from the musl-cross project, current tip as of today, using musl 1.1.1; but my guess is that this would happen with other libcs as well)
Comment 1 Rose Garcia 2014-06-12 16:21:33 UTC
i forgot to add that the same works fine with exactly the same toolchain built for armv7l.
Comment 2 Rose Garcia 2014-06-12 16:45:27 UTC
maybe related (fails also only on mips with -flto)
libpcap 1.3.0 (compiled WITH -fPIC)
http://www.tcpdump.org/release/libpcap-1.3.0.tar.gz

mips-linux-musl-gcc -L/media/3T/x-prefix/mips/lib -isystem /media/3T/x-prefix/mips/include -shared -Wl,-soname,libpcap.so.$MAJOR_VER -s -Wl,--gc-sections -Wl,-z,relro,-z,now -flto \
    -o libpcap.so.$VER pcap-linux.o pcap-usb-linux.o pcap-can-linux.o pcap-netfilter-linux.o fad-gifc.o pcap.o inet.o gencode.o optimize.o nametoaddr.o etherent.o savefile.o sf-pcap.o sf-pcap-ng.o pcap-common.o bpf_image.o bpf_dump.o  scanner.o grammar.o bpf_filter.o version.o   -lnl-tiny -lnl 
ranlib libpcap.a
/home/rose/musl-cross-4.8.3/mips-linux-musl/lib/gcc/mips-linux-musl/4.8.3/../../../../mips-linux-musl/bin/ld: /tmp/ccchmGhk.ltrans0.ltrans.o: relocation R_MIPS_HI16 against `__gnu_local_gp' can not be used when making a shared object; recompile with -fPIC
/tmp/ccchmGhk.ltrans0.ltrans.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

from the looks of it it appears of if __gnu_local_gp could be a libgcc symbol.
Comment 3 Richard Biener 2014-06-13 09:43:24 UTC
Maybe you can check if it is fixed with GCC 4.9.0?

What mips target triplet exactly?
Comment 4 Rose Garcia 2014-06-13 10:26:50 UTC
(In reply to Richard Biener from comment #3)
> What mips target triplet exactly?

mips-linux-musl

(using the patches/buildscripts from https://bitbucket.org/GregorR/musl-cross, as musl support has still not been merged into gcc)

but i suspect the bug affects mips-linux-* or even mips-*