[Date Prev][Date Next] [Chronological] [Thread] [Top]

Lib is not relocatable although --with-pic was used. Bug?



Title: Lib is not relocatable although --with-pic was used. Bug?
Hi all,
Platform is Sun Solaris x64 10 u8.
Compiler used is Sun Studio 12u1.
Version is openldap-2.4.23-stable-20100719.

Configure was done with CFLAGS='-xO3 -KPIC -m64 -xtarget=generic' and CC="/usr/bin/cc"
$ ./configure --prefix=/opt/app/damp64 --with-pic --with-tls=openssl
Compilation in 64-bit (-m64) of libldap was succesfull and installed in /opt/app/damp64/lib.

If I create a simple main.c file:
int main(){ return 0; }

I compile (also 64-bit) and link this main.c file with libldap as a test.
$ /usr/bin/cc -o conftest -xO4 -m64 -KPIC -xtarget=generic -s -I/opt/app/damp64/include -L/opt/app/damp64/lib -R/opt/app/damp64/lib main.c -lldap

When I try to run this exec linked to the newly build library libldap.so I get the following error:
# ./conftest
ld.so.1: conftest: fatal: relocation error: R_AMD64_32: file /opt/app/damp64/lib/libldap-2.4.so.2: symbol (unknown): value 0xfffffd7fff2542f0 does not fit

This is a relocation error from the linker on the libldap. But I compiled everything with -KPIC (position independent code) and gave the --with-pic option to configure.
This is a serious issue, as I cannot link the library to anything else and thus it is unusable.
Can I file a bug report?

If I have a look in the libldap shared object, I can see .text relocations...
# elfdump -d /opt/app/damp64/lib/libldap-2.4.so.2 | fgrep TEXTREL
      [18]  TEXTREL           0                   
      [27]  FLAGS             0x4                 [ TEXTREL ]

Kind regards,
Kristof Van Damme.