Package: gcc-snapshot Version: 20131201-1 Severity: normal
With the most recent Debian gcc snapshot[1] and using the gold linker[2], I'm getting linker "undefined reference" errors when compiling with LTO. This only happens when the object file containing the undefined symbol is stored in an .a archive. If I do the same link, but link with the .o file (instead of the .a file), it succeeds (and without LTO at all, the .a file works too). [1] g++ (Debian 20131201-1) 4.9.0 20131201 (experimental) [trunk revision 205573] [2] GNU gold (GNU Binutils for Debian 2.24) 1.11 The accompanying [as a reportbug attachment] simple test case illustrates this, with some source files and a shell script "barf-build.sh" that compiles them. The shell-script adds /usr/lib/gcc-snapshot subdirs to PATH and LD_LIBRARY_PATH to invoke the gcc-snapshot compiler (so make sure the gcc-snapshot package is installed). So, using "sh -x barf-build.sh": $ sh -x barf-build.sh + LD_LIBRARY_PATH=/usr/lib/gcc-snapshot/lib:/usr/lib/gcc-snapshot/lib + PATH=/usr/lib/gcc-snapshot/bin:/home/miles/bin:/home/miles/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:.:. + export PATH LD_LIBRARY_PATH + g++ -c -flto -O3 barf-main.cc + g++ -c -flto -O3 barf-lib.cc + ar ru barf-lib.a barf-lib.o + echo ====== Link with barf-lib.a fails: ====== Link with barf-lib.a fails: + g++ -fuse-ld=gold -o barf -flto -O3 barf-main.o barf-lib.a /tmp/cculjbrn.ltrans0.ltrans.o:cculjbrn.ltrans0.o:function main: error: undefined reference to 'barf::oink(std::string const&, char const**)' collect2: error: ld returned 1 exit status + echo ====== Link with barf-lib.o succeeds: ====== Link with barf-lib.o succeeds: + g++ -fuse-ld=gold -o barf -flto -O3 barf-main.o barf-lib.o I notice that with this snapshot, .o files no longer contain normal generated code, and only contain the LTO intermediate form in special ELF sections.... Maybe the .a-archive indexing mechanism isn't working properly with this form? Thanks, -miles -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (101, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.11-1-amd64 (SMP w/4 CPU cores) Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Shell: /bin/sh linked to /bin/dash Versions of packages gcc-snapshot depends on: ii binutils 2.24-1 ii libasound2 1.0.27.2-3 ii libatk1.0-0 2.10.0-2 ii libc6 2.17-97 ii libc6-dev 2.17-97 ii libc6-dev-i386 2.17-97 ii libc6-dev-x32 2.17-97 ii libc6-i386 2.17-97 ii libc6-x32 2.17-97 ii libcairo2 1.12.16-2 ii libcloog-isl4 0.18.1-3 ii libecj-java 3.8.2-4 ii libfontconfig1 2.11.0-2 ii libfreetype6 2.5.1-1 ii libgdk-pixbuf2.0-0 2.28.2-1 ii libglib2.0-0 2.36.4-1 ii libgmp10 2:5.1.2+dfsg-3 ii libgtk2.0-0 2.24.22-1 ii libice6 2:1.0.8-2 ii libisl10 0.12.1-2 ii libmpc3 1.0.1-1 ii libmpfr4 3.1.2-1 ii libpango-1.0-0 1.36.0-1 ii libpangocairo-1.0-0 1.36.0-1 ii libpangoft2-1.0-0 1.36.0-1 ii libsm6 2:1.2.1-2 ii libxrandr2 2:1.4.1-1 ii libxrender1 1:0.9.8-1 ii libxtst6 2:1.2.2-1 ii python 2.7.5-5 ii zlib1g 1:1.2.8.dfsg-1 gcc-snapshot recommends no packages. Versions of packages gcc-snapshot suggests: ii binutils [binutils-gold] 2.24-1 -- no debconf information
gcc-lto-barf.tar.gz
Description: application/gzip