[arm] building non-PIC libraries fails under ARMv7 mode
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linaro Binutils |
Won't Fix
|
Undecided
|
Unassigned | ||
gcc-4.4 (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
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_
According to the binutils mailing list (http://
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 && make
tags: | added: armv7 |
tags: | added: toolchain |
tags: | added: thumb |
Changed in gcc-linaro: | |
importance: | Undecided → High |
affects: | gcc-linaro → binutils-linaro |
Changed in binutils-linaro: | |
status: | New → Triaged |
importance: | High → Undecided |
It seems that currently the dynamic linker does not support resolving all the relocations which would be required for non-PIC Thumb-2 shared libraries.
Since non-PIC shared libraries are generally pretty inefficient (memory wastage and thrashing in and out of the dynamic linker and kernel as relocations are fixed up CoW, TLB and cache pollution etc., etc.) I think building such a library would usually be considered an error. This is true on all architectures.
Do we have any real-world examples of packages which build non-PIC shared libraries, or an argument for a case where they might be desirable?