
#12527: GHC segfault while linking llvm-general while compiling a file using Template Haskell -------------------------------------+------------------------------------- Reporter: HMPerson1 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): I could reproduce this just by running `ghci -package llvm-general`. What's going on here is that the ghci linker is loading an archive that contains two object files, let's call them `A.o` and `B.o`. For whatever reason ghci processes `A.o` before `B.o`. Now `A.o` has an `.init_array` section that contains a function that eventually calls a function defined in `B.o`. The problem is that `resolveObjs_` works like this: for each object file, resolve its relocations and then run its initializers so `B.o` hasn't had its relocations resolved when the initializer of `A.o` runs and tries to call a function defined in `B.o`. Seems like it should instead work like this: for each object file, resolve its relocations for each object file, run its initializers -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12527#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler