https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64949
Bug ID: 64949
Summary: jit linking fails when building with in-tree libraries
(mpc etc...)
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: jit
Assignee: dmalcolm at gcc dot gnu.org
Reporter: ktkachov at gcc dot gnu.org
Target: aarch64-none-linux-gnu
Build: aarch64-none-linux-gnu
I tried building gcc with --disable-bootstrap --enable-languages=jit
--enable-host-shared with in-tree dependencies i.e. I did a
./contrib/download_prerequisites in the gcc source tree.
The final link command fails:
g++ -g -O2 -DIN_GCC -fPIC -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H
-static-libstdc++ -static-libgcc -o libgccjit.so.0.0.1 -shared \
attribs.o jit/dummy-frontend.o jit/libgccjit.o jit/jit-logging.o
jit/jit-recording.o jit/jit-playback.o jit/jit-result.o jit/jit-tempdir.o
jit/jit-builtins.o jit/jit-spec.o gcc.o libbackend.a libcommon-target.a
libcommon.a \
../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a
../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a
../libiberty/pic/libiberty.a ../libdecnumber/libdecnumber.a
-L/$BUILD/./isl/.libs -lisl -L/$BUILD/./gmp/.libs -L/$BUILD/./mpfr/.libs
-L/$BUILD/./mpc/src/.libs -lmpc -lmpfr -lgmp -rdynamic -ldl -L../zlib -lz \
\
-Wl,--version-script=/home/kyrtka01/local-checkouts/gcc-trunk/gcc/jit/libgccjit.map
\
-Wl,-soname,libgccjit.so.0
$BUILD/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/4.9.3/../../../../aarch64-unknown-linux-gnu/bin/ld:
/home/kyrtka01/builds/gcc-fsf-build/./mpc/src/.libs/libmpc.a(acos.o)(.text+0x160):
unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol
`stderr@@GLIBC_2.17'
This doesn't happen if I build with normal system-installed libraries.
The root cause seems to be that mpc is being passed --disable-shared in it's
configury after gcc configure has passed it --enable-host-shared.
The config.log for mpc looks dodgy:
$SRC/mpc/configure --srcdir=$SRC/mpc --cache-file=./config.cache
--prefix=$BUILD --disable-bootstrap --enable-host-shared --enable-multiarch
--disable-werror --enable-checking=release --disable-isl
--enable-languages=c,jit,lto --program-transform-name=s,y,y,
--disable-option-checking --build=aarch64-unknown-linux-gnu
--host=aarch64-unknown-linux-gnu --target=aarch64-unknown-linux-gnu
--disable-shared --with-gmp-include=$BUILD/./gmp
--with-gmp-lib=$BUILD/./gmp/.libs --with-mpfr-include=$SRC/mpfr
--with-mpfr-lib=$BUILD/./mpfr/.libs
notice how --disable-shared comes after --enable-host-shared.
I think this can be fixed in the top-level Makefile.in that seems to hardwire
--disable-shared regardless of anything.