Ticket #5435 (new bug)

Opened 21 months ago

Last modified 6 months ago

GHCi linker should run constructors for linked libraries

Reported by: pumpkin Owned by:
Priority: normal Milestone: 7.8.1
Component: Compiler Version: 7.2.1
Keywords: Cc: howard_b_golden@…, pho@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By: #3658
Blocking: Related Tickets: #3658

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.

Change History

Changed 21 months ago by simonmar

see also #5386

Note that if you put the constructor in a shared library (.so or .dll) then the constructor will be run when the library is loaded, because GHCi invokes the system linker for these.

Changed 21 months ago by simonmar

  • priority changed from normal to high
  • milestone set to 7.4.1

Changed 20 months ago by igloo

See also #3333.

Changed 20 months ago by hgolden

  • cc howard_b_golden@… added

Changed 20 months ago by PHO

  • cc pho@… added

Changed 16 months ago by igloo

  • milestone changed from 7.4.1 to 7.4.2

Changed 15 months ago by simonpj

  • difficulty set to Unknown
  • milestone changed from 7.4.2 to 7.6.1

There is real work here, to fix our DIY linker to run constructors when we dynamically load static libraries in GHCi. Our ultimate goal is to do dynamic linking by default, so then we wouldn't have any static libraries, and this whole issue would go away.

So we're punting to 7.6.

Simon

Changed 9 months ago by simonmar

  • related set to #3658

Would be fixed by #3658.

Changed 8 months ago by igloo

  • blockedby 3658 added

Changed 8 months ago by igloo

  • milestone changed from 7.6.1 to 7.6.2

Changed 6 months ago by igloo

  • priority changed from high to normal
  • milestone changed from 7.6.2 to 7.8.1

We plan to fix this by switching to dynamic linking

Note: See TracTickets for help on using tickets.