Re: Wondering how to create linker map ? (268 Views)
Reply
Occasional Contributor
kraft
Posts: 6
Registered: ‎09-01-2004
Message 1 of 11 (268 Views)

Wondering how to create linker map ?

I am on hp-ux itanium the compiler and linker I am using is aCC, tried -m option, but still can get it work. Anything I am overlooked? Thanks!
Please use plain text.
Acclaimed Contributor
A. Clay Stephenson
Posts: 17,825
Registered: ‎07-16-1998
Message 2 of 11 (268 Views)

Re: Wondering how to create linker map ?

You have to tell the compiler to send the -m option to the linker phase of the operation. Something like this:

aCC -Wl,-m myfile.c

This will output a map on stdout.
If it ain't broke, I can fix that.
Please use plain text.
Occasional Contributor
kraft
Posts: 6
Registered: ‎09-01-2004
Message 3 of 11 (268 Views)

Re: Wondering how to create linker map ?

Thanks! This works. One more question, how to display the library ( eg .o, .so) that my program linked with ?
Please use plain text.
Acclaimed Contributor
A. Clay Stephenson
Posts: 17,825
Registered: ‎07-16-1998
Message 4 of 11 (268 Views)

Re: Wondering how to create linker map ?

ldd myprogram. ldd -> list dynamic dependencies. Man ldd for details.
If it ain't broke, I can fix that.
Please use plain text.
Honored Contributor
Peter Nikitka
Posts: 1,575
Registered: ‎02-10-2003
Message 5 of 11 (268 Views)

Re: Wondering how to create linker map ?

Hi,

call
chatr yourlinkedobject

that will tell used runtime libraries (and more).

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Please use plain text.
Occasional Contributor
kraft
Posts: 6
Registered: ‎09-01-2004
Message 6 of 11 (268 Views)

Re: Wondering how to create linker map ?

Thank you every one. Bear with me I am quite new in hp-ux. One more question what's the different between .o and .so. Is .so like dll on windows?
Please use plain text.
Acclaimed Contributor
A. Clay Stephenson
Posts: 17,825
Registered: ‎07-16-1998
Message 7 of 11 (268 Views)

Re: Wondering how to create linker map ?

Well, it would be more accurate to say that .DLL's are like .so's since UNIX had them before there was even a Windows but .so are shared objects. Essentially that means that you have to turn on some compiler options to make the code relocatable. In HP-UX, .so's are more often .sl's but it's the same thing. You need to become familiar with two commands: nm and file. For example, file myfile.so will tell you what kind of file myfile.so is. nm will dump the symbol table of an object file, library, or executable. Man file and nm for details.
If it ain't broke, I can fix that.
Please use plain text.
Occasional Contributor
kraft
Posts: 6
Registered: ‎09-01-2004
Message 8 of 11 (268 Views)

Re: Wondering how to create linker map ?

Again, Thank you for your help
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,973
Registered: ‎03-06-2006
Message 9 of 11 (268 Views)

Re: Wondering how to create linker map?

[ Edited ]

Why would you want to use -m?

You can get this info from elfdump(1):
$ elfdump -S -h a.out

You can use aCC +help or the following for aC++ help:
http://docs.hp.com/en/8759/index.htm

If you want to display the objects/libs you are linked with: -Wl,-t

>Clay: Essentially that means that you have to turn on some compiler options to make the code relocatable. In HP-UX, .so's are more often .sl's

The default on IPF is PIC, so no options are needed. Also on IPF, you should name your shlibs as .so, not the the PA convention of .sl.

>nm will dump the symbol table of an object file, library, or executable.

elfdump -t is the correct tool to work on shlibs and executables, if you are using tricky linker options:
$ elfdump -s -n .dynsym a.out

Please use plain text.
Occasional Contributor
kraft
Posts: 6
Registered: ‎09-01-2004
Message 10 of 11 (268 Views)

Re: Wondering how to create linker map ?

Dennis, these works as well. Thanks!

Rather starting a new thread, I would like ask here, this is regarding stack trace. I know there are a macro we can use U_STACK_TRACE, just wondering if there are any other ways ? I have a program which crashed very strangely. I don't know the signal would be when it crashes. I tried SIGQUIT, but it wasn't. What I would like to do is whenever it crashes, it creates a stack trace. Any suggestions ?
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,973
Registered: ‎03-06-2006
Message 11 of 11 (268 Views)

Re: Wondering how to create linker map?

[ Edited ]

>I don't know the signal would be when it crashes. I tried SIGQUIT, but it wasn't. What I would like to do is whenever it crashes, it creates a stack trace.

You can use a debugger to figure out the signal. Also "file core" should tell you the signal.

You could call U_STACK_TRACE() from your signal handler. You must arm your handler for the signals you expect to catch. The latest version of libunwind will print the signal #.

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation