Tuesday, September 16, 2008

relocation R_X86_64_PC32 Error

////
Editing post with more information, since I quiet some page visits around 350 for this issue.
////

I was stuck with this error for amlost weeks, till we figured out the solution. Here are some Links that would help to analyse the issue.

Error: relocation R_X86_64_PC32 against 'symbol' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: final link failed: Bad value

This could be a nature of ELF visiblity where global symbols don't resolve locally unless it is made hidden.

OR It could be the infamous bug-7221, which is still open.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37473 (see this link on how to fix the issue of no linkage for typedefed un-named class/struct )

//issue
typedef struct
{
int check ();
} A;
//fix

struct A
{
int check();
};


OR look at some useful links below.

http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3
http://gcc.gnu.org/wiki/Visibility
http://bugs.gentoo.org/108872
http://www.nedprod.com/programs/gccvisibility.html

cheers!