[GHC] #5435: GHCi linker should run constructors for linked libraries

GHC ghc-devs at haskell.org
Fri Sep 6 08:48:33 CEST 2013


#5435: GHCi linker should run constructors for linked libraries
-------------------------------------+------------------------------------
        Reporter:  pumpkin           |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:  7.8.1
       Component:  Compiler          |          Version:  7.2.1
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:  3658
        Blocking:                    |  Related Tickets:  #3658
-------------------------------------+------------------------------------

Old description:

> As far as I can tell from my experimentation, any library that contains a
> function with __attribute__((constructor)) on it won't have its
> constructor(s) run when loaded, or its destructors run when unloaded.
> This violates assumptions that some libraries make.

New description:

 As far as I can tell from my experimentation, any library that contains a
 function with `__attribute__((constructor))` on it won't have its
 constructor(s) run when loaded, or its destructors run when unloaded. This
 violates assumptions that some libraries make.

--

Comment (by ezyang):

 Note that GHC itself uses constructor (but not destructor) for profiling
 and foreign exports, so at least the constructor half of this problem is
 important. I'm attaching implementations for ELF and PEi386; Mach-O coming
 when I get a Mac to do testing on.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/5435#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler




More information about the ghc-tickets mailing list