Operating System - HP-UX
1827279 Members
2641 Online
109717 Solutions
New Discussion

Re: ld -b -h symbol -o outfile.sl ...

 
SOLVED
Go to solution
Stephen Badgett
Regular Advisor

ld -b -h symbol -o outfile.sl ...

the nm command ...

if "T" indicates a global definition then what does "t" indicate?

build a sl file:

ld -b -o /home/sbadgett/bin/lib/libsetjcw.sl ~/bin/externsetjcwA.o

I get ...
nm -p /home/sbadgett/bin/lib/libsetjcw.sl
0000004712 t $PIC$0
0000000000 U P_WRITEINT
0000004648 T P_WRITEINT
0000000000 U P_WRITELN
0000004672 T P_WRITELN
0000000000 U P_WRITESTR
0000004624 T P_WRITESTR
0000004568 d S$4$setjcw
0000000000 U output
0000004600 T setjcw
0000004696 T setjcw

build the sl file and hide setjcw

ld -b -h setjcw -o /home/sbadgett/bin/lib/libsetjcw.sl ~/bin/externsetjcwA.o

I get ...

sbadgett:brainiac:S7: /home/sbadgett/pascal/dev>nm -p /home/sbadgett/bin/lib/libsetjcw.sl
0000004560 t $PIC$0
0000000000 U P_WRITEINT
0000004496 T P_WRITEINT
0000000000 U P_WRITELN
0000004520 T P_WRITELN
0000000000 U P_WRITESTR
0000004472 T P_WRITESTR
0000004440 d S$4$setjcw
0000000000 U output
0000004544 t setjcw

Not as is, is now
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: ld -b -h symbol -o outfile.sl ...

If the symbol refers to a local (non-global,non-external function or value) then type letter is lowercased.

For example 'T' means global text or visible externally while 't' means local (to this object file) text. Local symbols are not available for dynamic linking.

If it ain't broke, I can fix that.
Stephen Badgett
Regular Advisor

Re: ld -b -h symbol -o outfile.sl ...

Thank you
Not as is, is now
Mike Stroyan
Honored Contributor

Re: ld -b -h symbol -o outfile.sl ...

The nm command does not tell the entire story about shared library symbols. There is actually a second symbol table that is used for resolving symbols at when linking with a shared library and at runtime. You can use the odump command to see what symbols are exported and imported by programs and shared libraries. The shared library symbol table remains even if the nm symbol table is removed with the strip command.

/usr/ccs/bin/odump -slexportlist /home/sbadgett/bin/lib/libsetjcw.sl

/usr/ccs/bin/odump -slimportlist /home/sbadgett/bin/lib/libsetjcw.sl

Stephen Badgett
Regular Advisor

Re: ld -b -h symbol -o outfile.sl ...

Thank you Mike

That is a going to be a helpful tool for us.

Thank you again
Not as is, is now
Stephen Badgett
Regular Advisor

Re: ld -b -h symbol -o outfile.sl ...

I like the -all used with odump
Not as is, is now