#3333: GHCi doesn't load weak symbols
--------------------------------------+-------------------------------------
    Reporter:  heatsink               |        Owner:              
        Type:  bug                    |       Status:  new         
    Priority:  normal                 |    Milestone:  6.14.1      
   Component:  GHCi                   |      Version:  6.10.4      
    Keywords:  weak, dynamic loading  |   Difficulty:  Unknown     
          Os:  Linux                  |     Testcase:              
Architecture:  x86                    |      Failure:  None/Unknown
--------------------------------------+-------------------------------------

Comment(by heatsink):

 > It would be easy to add weak symbols to the symbol table, but I'm not
 sure what the correct semantics should be. Perhaps weak symbols should be
 subordinated to global (STB_GLOBAL) and local (STB_LOCAL) symbols. Is this
 sufficient? (I haven't studied the documentation yet.)

 Weak symbols are never unified with local symbols.  Probably it's an error
 to have a weak and a local symbol with the same name in the same file.  I
 don't know what this means in terms of GHC's linker.

 > Question: Is it possible to have the same weak symbol defined in more
 than one module? If so, how does the linker choose?

 Yes.  AFAICT the choice is arbitrary.  GCC's linker's choice depends on
 the order that files are listed on the command line.  It is at least
 necessary to consider SHN_UNDEF when selecting a weak symbol (defined weak
 symbols take precedence over undefined weak symbols).

 The following statement from the ELF document appears to be relevant, but
 I don't know what extracting archive members has to do with symbol
 resolution.

 > The link editor does ''not'' extract archive members to resolve undefined
 weak symbols.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3333#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to