Comment 0 for bug 503448

Revision history for this message
Michael Casadevall (mcasadevall) wrote :

Binary package hint: gcc-4.4

Under lucid, GCC can no longer build non-PIC shared libraries, attempting to build a non-PIC library causes:

/usr/bin/ld: .libs/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 error

According to the binutils mailing list (http://old.nabble.com/Detect-ARM-MOVW-MOVT-relocations-in-shared-library-links-td23266269.html) this error is tripped as a safeguard when an object thats compiled for PIC attempts to load from load an absolute symbol address. Its not clear from the list archives if building non-PIC shared libraries is still supported as of ARMv7, or if this is a regression in the toolchain. The issue disappears if -march=armv6 is passed into the CFLAGS.

Reproduction Instructions:
I've attached a copy of the GNU hell test which is used as part of the libtool test suite, and can be used to easily reproduce the problem on a lucid/armel system. Building for ARMv7 mode fails with a relocation error from the linker. Passing -march=armv6 in the CFLAGS allows the build to succeed and the resulting libraries and binaries work as expected:

To build for ARMv7
$ ./configure --with-pic=no && make

To build for ARMv6
$ CFLAGS=-march=armv6 ./configure --with-pic=no