[Bug 503448] Re: [arm] building non-PIC libraries fails under ARMv7 mode

Jean-Luc Aufranc jean-luc.aufranc at cnx-translation.com
Tue Oct 11 07:52:06 UTC 2011


I have the same problem compiling berkelium with linaro toolchain (gcc
4.5.2) on Ubuntu natty.

/usr/lib/gcc/arm-linux-gnueabi/4.5.2/../../../../arm-linux-gnueabi/bin/ld: /home/jaufranc/edev/beagleboard/berkelium/build/chromium/src/out/Release/obj.target/ui/gfx/../../gfx/ui/gfx/rect.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/home/jaufranc/edev/beagleboard/berkelium/build/chromium/src/out/Release/obj.target/ui/gfx/libgfx.a: could not read symbols: Bad value

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-4.4 in Ubuntu.
https://bugs.launchpad.net/bugs/503448

Title:
  [arm] building non-PIC libraries fails under ARMv7 mode

Status in Linaro Binutils:
  New
Status in “gcc-4.4” package in Ubuntu:
  Confirmed

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_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 && make

To manage notifications about this bug go to:
https://bugs.launchpad.net/binutils-linaro/+bug/503448/+subscriptions




More information about the foundations-bugs mailing list