Error "relocation R_X86_64_32S against `.rodata'" occured while linking to gcc library
Ian Lance Taylor
iant@google.com
Tue May 17 09:46:00 GMT 2011
陳韋任 <chenwj@iis.sinica.edu.tw> writes:
> I am trying to use a gcc plugin, gcc-vcg-plugin
> (http://code.google.com/p/gcc-vcg-plugin/), but I
> have a problem with building the plugin.
>
> Error messgae belows,
>
> -------------------------------------------------------------------------------
> /usr/bin/ld: /tmp/chenwj/install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib64/libiberty.a(hashtab.o):
> relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
> /tmp/chenwj/install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib64/libiberty.a: could not read symbols: Bad value
> collect2: ld returned 1 exit status
You need to use a version of libiberty compiled with -fPIC. This can
normally be found in the working directory libiberty/pic. Link your
plugin with libiberty/pic/libiberty.a rather than libiberty/libiberty.a.
An alternative is to observe that libiberty is pretty much all linked
into cc1 anyhow, so you don't really need to link your plugin against
it.
Ian
More information about the Gcc-help
mailing list