ghc api and .o files

Evan Laforge qdunkan at gmail.com
Tue Sep 25 02:39:50 CEST 2012


On Fri, Sep 14, 2012 at 6:22 PM, Brandon Allbery <allbery.b at gmail.com> wrote:
> On Fri, Sep 14, 2012 at 1:31 AM, Evan Laforge <qdunkan at gmail.com> wrote:
>>
>> Relatedly, I've noticed that OS X is forgiving when you don't link in
>> a needed object.  It will let me run code, but if I call a function
>> that's not linked in I get a crash.  However, linux immediately prints
>> "unknown symbol `etc.'".  The OS X behaviour is more convenient
>> because it's easy to avoid calling the missing functions, and
>> difficult to figure out how to cut all the dependencies so they're not
>> needed, but the linux way is certainly safer.  Does anyone know why
>> this difference exists?  Just curious.
>
> Because the system dynamic loader has different defaults.  OS X defaults to
> a lazier lookup than Linux does; Linux is actually somewhat lazy about it,
> just not as lazy as OS X.  Unfortunately I only know how to make them both
> stricter, not lazier.
>
> ("man ld.so" on Linux, "man dyld" on OS X, for the details)

I thought ghc uses its own homegrown loader, not the system one?  I.e.
ghci loads .o files, not .dyld or .so.



More information about the Glasgow-haskell-users mailing list