public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Error "relocation R_X86_64_32S against `.rodata'" occured while linking to gcc library
@ 2011-05-16 10:46 陳韋任
  2011-05-17  9:46 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: 陳韋任 @ 2011-05-16 10:46 UTC (permalink / raw)
  To: gcc-help

Hi, all

  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
-------------------------------------------------------------------------------

  And here is my gcc configuration,

-------------------------------------------------------------------------------
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/tmp/chenwj/install/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.6.0/configure --prefix=/tmp/chenwj/install --enable-languages=c,c++ --enable-plugin
Thread model: posix
gcc version 4.6.0 (GCC)
-------------------------------------------------------------------------------

  Any suggestion appreciated. 

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Error "relocation R_X86_64_32S against `.rodata'" occured while linking to gcc library
  2011-05-16 10:46 Error "relocation R_X86_64_32S against `.rodata'" occured while linking to gcc library 陳韋任
@ 2011-05-17  9:46 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2011-05-17  9:46 UTC (permalink / raw)
  To: 陳韋任; +Cc: gcc-help

陳韋任 <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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-17  6:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-16 10:46 Error "relocation R_X86_64_32S against `.rodata'" occured while linking to gcc library 陳韋任
2011-05-17  9:46 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).