[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#844780: gcc-6-arm-linux-gnueabihf: cross-compiled code fails to link on target with native gcc-6



Package: gcc-6-arm-linux-gnueabihf
Version: 6.1.1-9cross1
Severity: important

Dear Maintainer,

If I cross-compile any code (even a basic hello-world) and then attempt
to link the resulting objects on the target system (stretch, armhf)
using the native gcc-6 toolchain (which is 6.2.0 in testing and has
already been for a while) I get the following failure:

/usr/bin/ld: hello.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
hello.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

Recompiling with -fPIC as suggested does in fact fix the problem, but
this should not be necessary and never has been.  (Compiling without it
but linking with the cross-toolchain also results in a working binary.)

Note that cross-compiling + native linking is for example needed to be
able to use distcc to speed up compilation on small ARM systems by
delegating most of the work to a build server, which is how I ran into
this issue.  This setup is currently completely broken due to this bug.


-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (100, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-2.1-liquorix-amd64 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_NL.UTF-8, LC_CTYPE=en_NL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages gcc-6-arm-linux-gnueabihf depends on:
ii  binutils-arm-linux-gnueabihf    2.27.51.20161108-1
ii  cpp-6-arm-linux-gnueabihf       6.1.1-9cross1
ii  gcc-6-arm-linux-gnueabihf-base  6.1.1-9cross1
ii  libc6                           2.24-5
ii  libcc1-0                        6.2.0-13
ii  libgcc-6-dev-armhf-cross        6.1.1-9cross1
ii  libgcc1                         1:6.2.0-13
ii  libgmp10                        2:6.1.1+dfsg-1
ii  libisl15                        0.17.1-1
ii  libmpc3                         1.0.3-1
ii  libmpfr4                        3.1.5-1
ii  libstdc++6                      6.2.0-13
ii  zlib1g                          1:1.2.8.dfsg-2+b3

Versions of packages gcc-6-arm-linux-gnueabihf recommends:
ii  libc6-dev-armhf-cross  2.24-1cross1

Versions of packages gcc-6-arm-linux-gnueabihf suggests:
ii  gcc-6-doc                     6.1.0-1
pn  gcc-6-locales                 <none>
pn  libasan3-dbg-armhf-cross      <none>
pn  libatomic1-dbg-armhf-cross    <none>
pn  libcilkrts5-dbg-armhf-cross   <none>
pn  libgcc1-dbg-armhf-cross       <none>
pn  libgomp1-dbg-armhf-cross      <none>
pn  libitm1-dbg-armhf-cross       <none>
pn  liblsan0-dbg-armhf-cross      <none>
pn  libmpx2-dbg-armhf-cross       <none>
pn  libquadmath0-dbg-armhf-cross  <none>
pn  libtsan0-dbg-armhf-cross      <none>
pn  libubsan0-dbg-armhf-cross     <none>

-- no debconf information


Reply to: