
#7603: Bad magic in static (FFI) object (7.6.1 for x86_64-apple-darwin) -------------------------------+-------------------------------------------- Reporter: morabbin | Owner: Type: bug | Status: closed Priority: normal | Component: Compiler Version: 7.6.1 | Resolution: invalid Keywords: | Os: MacOS X Architecture: x86_64 (amd64) | Failure: Compile-time crash Blockedby: | Blocking: Related: | -------------------------------+-------------------------------------------- Comment(by thoughtpolice): It's certainly possible we could give a more sane error message (for example, it should be easy to see when you have ```0xfeedface``` but wanted ```0xfeedfacf``` on OS X, that you accidentally have a 32bit object instead of a 64bit one.) But not panicing when we see this occur is not possible. GHC must do dynamic linking and invoke that code at runtime when you use template haskell - if the object file is invalid, and the object file must be linked to resolve some symbols how else can we proceed but to abort? If you would like GHC to give a more sane error message in cases like this, feel free to submit a patch. The relevant code here is in ```loadObj``` inside the file ```rts/Linker.c``` in the source tree - it should be easy to add better errors for some cases like this, and it would certainly help elucidate the problem. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7603#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler