#3654: Mach-O GHCi linker lacks support for a range of relocation entries
---------------------------------+------------------------------------------
Reporter: chak | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 6.12 branch
Component: Runtime System | Version: 6.13
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Os: MacOS X
Architecture: Unknown/Multiple |
---------------------------------+------------------------------------------
Comment (by chak):
Replying to [comment:3 mnislaih]:
> Never mind. I just wanted to show my support to ghci 6.12 working on
Snow Leopard, which as I understood after a quick read, motivated this
ticket. But on a second read I see that the new unsupported entry type has
been implemented, and ghci will continue working in snow leopard.
I implemented ''one'' of the missing relocations, which prevented GHCi to
work on Snow Leopard at all (as it was triggered when loading `integer-
gmp`). However, there are more relocations missing. And, to be honest, I
didn't even implement the one that I did add properly. To do it, one
would need to implement coalesced sections, which AFAIK are completely
ignored at the moment. The Mach-O ABI reference has the following to say:
>These are important static-linking variants of the symbol type and
attributes:
> '''Regular sections.''' In a regular section, only one definition of an
external symbol may exist in intermediate object files. The static linker
returns an error if it finds any duplicate external symbol definitions.
> '''Coalesced sections.''' In the final product, the static linker
retains only one instance of each symbol defined in coalesced sections. To
support complex language features (such as C++ vtables and RTTI) the
compiler may create a definition of a particular symbol in every
intermediate object file. The static linker and the dynamic linker would
then reduce the duplicate definitions to the single definition used by the
program.
>'''Coalesced sections with weak definitions''' Weak symbol definitions
may appear only in coalesced sections. When the static linker finds
duplicate definitions for a symbol, it discards any coalesced symbol
definition that has the weak definition attribute set (see nlist). If
there are no non-weak definitions, the first weak definition is used
instead. This feature is designed to support C++ templates; it allows
explicit template instantiations to override implicit ones. The C++
compiler places explicit definitions in a regular section, and it places
implicit definitions in a coalesced section, marked as weak definitions.
Intermediate object files (and thus static archive libraries) built with
weak definitions can be used only with the static linker in Mac OS X v10.2
and later. Final products (applications and shared libraries) should not
contain weak definitions if they are expected to be used on earlier
versions of Mac OS X.
I guess we haven't run into problems with that yet only because few people
load packages binding to C++ code into GHCi (on Mac OS X). Coalesced
sections and the relocations types that are still missing will definitely
not be in 6.12 and as I mentioned above, I believe we should work on using
the system linker, instead of wasting time on replicating its
functionality in subsequent releases.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3654#comment:5>
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