#4013: build fails on OS X: Invalid Mach-O file:Address out of bounds while
relocating object file
-------------------------+--------------------------------------------------
Reporter: igloo | Owner:
Type: bug | Status: new
Priority: highest | Milestone: 6.14.1
Component: Compiler | Version: 6.13
Keywords: | Difficulty:
Os: MacOS X | Testcase:
Architecture: x86 | Failure: Building GHC failed
-------------------------+--------------------------------------------------
Comment(by thorkilnaur):
Inspired by a successful build
(http://darcs.haskell.org/ghcBuilder/builders/tn23/8/8.html)
{{{
"inplace/bin/ghc-stage2" -H32m -O -package-name dph-par-0.4.0 -hide-
all-packages -i -ilibraries/dph/dph-par/../dph-common -ilibraries/dph/dph-
par/dist-install/build -ilibraries/dph/dph-par/dist-install/build/autogen
-Ilibraries/dph/dph-par/dist-install/build -Ilibraries/dph/dph-par/dist-
install/build/autogen -Ilibraries/dph/dph-par/. -optP-include
-optPlibraries/dph/dph-par/dist-install/build/autogen/cabal_macros.h
-package array-0.3.0.0 -package base-4.2.0.0 -package dph-base-0.4.0
-package dph-prim-par-0.4.0 -package ghc-6.13.20100423 -package ghc-
prim-0.2.0.0 -package random-1.0.0.2 -package template-haskell-2.4.0.0
-Odph -funbox-strict-fields -haddock -fcpr-off -fdph-this -package-name
dph-par -XTypeFamilies -XGADTs -XRankNTypes -XBangPatterns -XMagicHash
-XUnboxedTuples -XTypeOperators -O2 -XGenerics -fno-warn-deprecated-flags
-Wwarn -odir libraries/dph/dph-par/dist-install/build -hidir
libraries/dph/dph-par/dist-install/build -stubdir libraries/dph/dph-par
/dist-install/build -hisuf hi -osuf o -hcsuf hc -c libraries/dph/dph-par
/../dph-common/Data/Array/Parallel/Lifted/PArray.hs -o libraries/dph/dph-
par/dist-install/build/Data/Array/Parallel/Lifted/PArray.o
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.3.0.0 ... linking ... done.
Loading package containers-0.3.0.0 ... linking ... done.
Loading package filepath-1.1.0.4 ... linking ... done.
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package old-time-1.0.0.4 ... linking ... done.
Loading package unix-2.4.0.1 ... linking ... done.
Loading package directory-1.0.1.1 ... linking ... done.
Loading package pretty-1.0.1.1 ... linking ... done.
Loading package process-1.0.1.2 ... linking ... done.
Loading package Cabal-1.9.0 ... linking ... done.
Loading package bytestring-0.9.1.5 ... linking ... done.
Loading package binary-0.5.0.2 ... linking ... done.
Loading package bin-package-db-0.0.0.0 ... linking ... done.
Loading package hpc-0.5.0.5 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package ghc-6.13.20100423 ... linking ... done.
Loading package time-1.1.4 ... linking ... done.
Loading package random-1.0.0.2 ... linking ... done.
Loading package dph-base-0.4.0 ... linking ... done.
Loading package dph-prim-interface-0.4.0 ... linking ... done.
Loading package dph-prim-seq-0.4.0 ... linking ... done.
Loading package dph-prim-par-0.4.0 ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
}}}
I tried
{{{
thorkil-naurs-intel-mac-
mini:~/tn/builders/GHCBuilder/tn23/builder/tempbuild/build thorkilnaur$
inplace/bin/ghc-stage2 --interactive -package Cabal-1.9.0
GHCi, version 6.13.20100501: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.3.0.0 ... linking ... done.
Loading package containers-0.3.0.0 ... linking ... done.
Loading package filepath-1.1.0.4 ... linking ... done.
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package old-time-1.0.0.4 ... linking ... done.
Loading package unix-2.4.0.1 ... linking ... done.
Loading package directory-1.0.1.1 ... linking ... done.
Loading package pretty-1.0.1.1 ... linking ... done.
Loading package process-1.0.1.2 ... linking ... done.
ghc-stage2: internal error: Invalid Mach-O file:Address out of bounds
while relocating object file
(GHC version 6.13.20100501 for i386_apple_darwin)
Please report this as a GHC bug:
http://www.haskell.org/ghc/reportabug
Abort trap
thorkil-naurs-intel-mac-
mini:~/tn/builders/GHCBuilder/tn23/builder/tempbuild/build thorkilnaur$
}}}
The error message is issued by {{{rts/Linker.c}}}:
{{{
static unsigned long relocateAddress(
ObjectCode* oc,
int nSections,
struct section* sections,
unsigned long address)
{
int i;
for(i = 0; i < nSections; i++)
{
if(sections[i].addr <= address
&& address < sections[i].addr + sections[i].size)
{
return (unsigned long)oc->image
+ sections[i].offset + address - sections[i].addr;
}
}
barf("Invalid Mach-O file:"
"Address out of bounds while relocating object file");
return 0;
}
}}}
I also found that after unpulling the patch
{{{
Fri Apr 23 14:48:53 CEST 2010 Simon Marlow <[email protected]>
* reinstate eta-expansion during SimplGently, to fix inlining of
sequence_
}}}
the build succeeded. But I am not sure whether this has any real relevance
or is just a shuffling of generated code that causes this weakness in the
Mach-O part of Linker.c to surface.
Best regards
Thorkil
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4013#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs