shared library mysteries



Preface:
--------
I ran into a problem testing libgda, which I have since resolved. I had
seen this kind of problem before so I had an good idea what to do. I
still don't understand what causes the problem, and why my empirical
solution works. Maybe someone on the list has some insights.

The Problem:
--------------
./testing/gda_test complains that it could not load 

	libgda-mysql.so

because of R_PPC_REL24 relocation problems. 

        R_PPC_REL24 relocation at [some hex address] for symbol
        `__stpcpy' out of range


Discussion:
-----------
The cursed "R_PPC_REL24" relocation error arises when PIC and non-PIC
code are indiscriminately thrown together into a shared library. 

This is not to say that PIC and non-PIC code cannot be "properly"
combined to form a shared library on a PPC. It's all a matter to using
the right combination of compiler and linker flags.

A quick perusal of libga-mysql.so using "objdump -R" indicates the
problem is elsewhere.


The Solution:
-------------
The function stpcpy() resides in libc. Since YDL-4 is a FC2 clone, the
thread local storage variant is what the loader finds first.

An examination of the symbols in /lib/tls/libs.so.6 shows that nothing
[obvious] is amiss.

Voodoo step #1
---------------
Remove and reinstall glibc just because...

Reboot the system for good measure, remove and rebuild ld.so.cache, and
run the test again:

==> ./testing/gda_test still fails complaining that it could not load
	
libgda-mysql.so

because of R_PPC_REL24 relocation problems. However, this time around it
complains about a *different* symbol being out of range

        __uncompress

This function resides in zlib.

Voodoo step #2
---------------
Remove and reinstall zlib.

Run the test again  ==> all is well

                            ...
        =========================================
        = Testing provider configuration API
        =========================================
         Provider = XML
                location =
        /opt/garnome/lib/libgda/providers/libgda-xml.so
                description = XML provider, based on the libgda XML
        database format
                gda_params = URI (File Name)
         Provider = MySQL
                location =
        /opt/garnome/lib/libgda/providers/libgda-mysql.so
                description = Provider for MySQL databases
                gda_params = DATABASE (Database Name)  HOST (Host Name) 
        PORT (Port)  UNIX_SOCKET (UNIX Socket)  USE_SSL (Use Secure
        Connection)
        
                           ...
        
Thoughts???

-Joseph

-- 
joseph_sacco[at]comcast[dot]net




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]