Unix Technical Forum

How does the linker decide if a symbol should be deferred?

This is a discussion on How does the linker decide if a symbol should be deferred? within the AIX Operating System forums, part of the Unix Operating Systems category; --> Hi all, I encountered a problem with a runtime-linked shared object which was accidently compiled using profiling. The object ...


Go Back   Unix Technical Forum > Unix Operating Systems > AIX Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-05-2008, 04:06 AM
Johannes
 
Posts: n/a
Default How does the linker decide if a symbol should be deferred?

Hi all,

I encountered a problem with a runtime-linked shared object which was
accidently compiled using profiling. The object could not be loaded
because the main module itself was not compiled with the -p option and
so references to __mcount could not be resolved. (The reason for this
mistake was funny: xlc was used with compiler options intended for
gcc, and they included '-mcpu=powerpc'. There is no such xlc option
but there are options -m, -c, -p, and -u. As -u even takes an argument
you get no compiler error. Murhpy at its best.)

I read aix_ll.pdf and Gary R. Hook's tutorials and was able to figure
out the problem, but there are remaining some mysteries for me:

Linking the object with "ld -bexpall -G test.o -o test.so" resulted
to:
# dump -HTv test.so |grep __mcount
[76] 0x00000000 undef IMP DS EXTref .. __mcount

But when linking with "-bnoentry -bexpall -bM:SRE -brtllib -bnortllib
-berok -bnosymbolic -bnoautoexp", which should be equivalent to "-G"
according to the ld man page, __mcount gets deferred:
# dump -HTv test.so |grep __mcount
[76] 0x00000000 undef IMP DS EXTref [noIMid] __mcount

Even more confusing: Using "xlc -bnoentry -bexpall -bM:SRE -brtllib
-bnortllib -berok -bnosymbolic -bnoautoexp test.o -o test.so" results
in no reference to __mcount at all, whereas "xlc -G ..." is equivalent
to "ld -G ...".

Can someone explain this behaviour of the linker to me? How does the
linker decide if a symbol has to be bind at loadtime or should be
deferred?

Johannes
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:27 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com