[haiku-bugs] Re: [Haiku] #6272: support for undefined weak symbols

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Tue, 06 Jul 2010 17:47:33 -0000

#6272: support for undefined weak symbols
----------------------------+-----------------------------------------------
  Reporter:  lucian         |         Owner:  axeld         
      Type:  bug            |        Status:  closed        
  Priority:  normal         |     Milestone:  R1            
 Component:  System/Kernel  |       Version:  R1/Development
Resolution:  fixed          |      Keywords:                
Blocked By:                 |   Has a Patch:  1             
  Platform:  All            |      Blocking:                
----------------------------+-----------------------------------------------

Comment (by bonefish):

 Replying to [comment:3 lucian]:
 > I'm not sure how to read this binutils mailing list discussion:
 http://sourceware.org/ml/binutils/2010-03/msg00173.html
 >
 >   Because undefined weak references do not cause library archive symbols
 to be pulled in to resolve them, IIRC.
 >
 > My interpretation is that the undefined weak symbol should only be
 searched inside the image in which it appears, not in other images.

 This is what the System V ABI specification has to say (chapter 4, Symbol
 Table):

  "When the link editor searches archive libraries [see ‘‘Archive File’’ in
 Chapter 7], it extracts archive members that contain definitions of
 undefined global symbols. The member’s definition may be either a global
 or a weak symbol. The link editor does not extract archive members to
 resolve undefined weak symbols. Unresolved weak symbols have a zero
 value."

 That pretty explicitly only refers to the link editor, i.e. the linker,
 not the dynamic loader, and archive (i.e. static) libraries, which aren't
 of relevance for the loader. I found no other mention of weak undefined
 symbols in the specification. Sun seems to
 [http://docs.sun.com/app/docs/doc/817-1984/6mhm7pl2g?a=view agree] with
 this interpretation.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/6272#comment:4>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: