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

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

Title: Re: Lib is not relocatable although --with-pic was used. Bug?
Hi all,
I think the problem lays with the openssl lib that I wanted to use.
If I configure using "--with-tls=no" there is no problem for the libldap.so.
It took me a while to find out that openssl is by default not compiled as a shared lib and hence gets included in full (and probably unrelocatable?) in the openldap lib.
The "symbol (unknown)" didn't really provide a clue. :-)

Kind regards,
Kristof Van Damme.

On 2/03/11 13:00, "Kristof Van Damme" <kristof@axio.be> wrote:

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.