Operating System - Linux
1748232 Members
3545 Online
108759 Solutions
New Discussion юеВ

Re: Understanding Linker Symbols

 
SOLVED
Go to solution
Fred Vogel
Frequent Advisor

Understanding Linker Symbols

I'm still unfamiliar with several aspects of HP-UX innerworkings. This may seem trivial but it confuses me.

I am building an .so. In the symbol table it says that symbol IteUtilAppend is an UNDEF in the .dynsym table. In the .o file I am picking up it defines the symbol as _Z13IteUtilAppendPvPPcS0_ as a GLOB.

Sometimes I have symbols that look like this and when I pick them up they look like this in the .so and everything works great, other times it get the situation i'm in where i get all the strange symbology in one and not in the other and it won't.

Obviously I'm doing something wrong and my lack of understanding about what all the jibberish is in the second symbol is the reason. I'm hoping someone can explain what this is and how it works so I can have greater success with my dynamic libraries on HP-UX. My system is 11.23 on IA. I am currently doing 32 bit builds but will move on to 64 bit builds later. I'm using aCC/ld to build my loads.

Thanks,
Fred
3 REPLIES 3
Dennis Handly
Acclaimed Contributor
Solution

Re: Understanding Linker Symbols

You may want to use the simplified "nm -px" command and then look at the one letter symbol types.

The above two symbols are completely different.
One is extern "C": IteUtilAppend.
The other is mangled:
$ c++filt _Z13IteUtilAppendPvPPcS0_
IteUtilAppend(void*, char**, char*)

http://docs.hp.com/en/8759/gloss.htm#n
http://docs.hp.com/en/8759/otherlangs.htm#callinghpc

>will move on to 64 bit builds later.

Any reason you will do this? It isn't needed on HP-UX unless you are running out of address space.
Srimalik
Valued Contributor

Re: Understanding Linker Symbols

Hi Fred,

I think you are talking about name mangling, which is done by compilers to support features like overloading

If you want to avoid name mangling for your objects you should make the use of extern "C" keyword.

You can also do a bit googling to have more details about name mangling and extern C.
thanks
abandon all hope, ye who enter here..
Fred Vogel
Frequent Advisor

Re: Understanding Linker Symbols

Thanks guys! That made my lightbulb come one. You have taken some of the mystery out of all this for me.

Fred