gcc shared library symbols, possible to change?

Tomas Varsavsky tomasv@alphalink.com.au
Wed Jun 18 01:23:00 GMT 2003


Hi All,

I have a quirky problem, can anyone help?

The platform is HP-UX 10.20. GCC Version 3.2. Here goes...

We have a an application that was compiled using aCC (the HP ansi-c compiler) 
by a third party. Part of this application is a shared library (libxxxxx.sl) 
that was also compiled with aCC. The library provides functions to several 
different executables within our application.

What I need to do is update some of the functions within this shared library. 
We don't currently have the aCC compiler available on our machine so I'm 
trying to do this using gcc. I have the source code for the library and can 
build the .sl file using -fPIC and -shared.

The problem is that when I compile the shared library with gcc the symbol 
names end up being different to the names generated by aCC. Therefore the old 
executables compiled with aCC have trouble linking to the shared library. For 
example, using command "nm" I can see that the function SubtagCrypt has a 
different symbolic name than the original library:

Original compiled with aCC:
SubtagCrypt__FRCPcRiiT3|      5468|extern|entry  |
SubtagCrypt__FRCPcRiiT3|      5540|extern|code   |$CODE$

New compiled with gcc:
_Z11SubtagCryptRKPcRiii|      5232|extern|entry  |      
_Z11SubtagCryptRKPcRiii|      5352|extern|code   |$CODE$


So the question is: Is there a way to force gcc to use the same symbol 
convention and aCC? Or alternatively, is there a way that I can do some post 
processing on the shared library (say, via some utility) to manipulate the 
symbol names? 

I'm trying to avoid having to buy aCC since the changes I need to make are 
relatively minor.

Thanks for your help.

Regards,

Tomas Varsavsky






More information about the Gcc-help mailing list