At least on my Ubuntu 16.04, it builds:

% git clone --recursive g...@gitlab.haskell.org:ghc/ghc.git 
ghc-gold-error-6f7115dfd4
% cd ghc-gold-error-6f7115dfd4
% ./boot && ./configure --prefix=$HOME/opt/ghc-gold-error-6f7115dfd4 
GHC=$HOME/.stack/programs/x86_64-linux/ghc-8.6.3/bin/ghc
% make -j4

# Ctrl-C after a while when it's building stage-1 code

% rm -f utils/hsc2hs/dist/build/tmp/hsc2hs
% make utils/hsc2hs/dist/build/tmp/hsc2hs
===--- building phase 0
make --no-print-directory -f ghc.mk phase=0 phase_0_builds
make[1]: Nothing to be done for 'phase_0_builds'.
===--- building phase 1
make --no-print-directory -f ghc.mk phase=1 phase_1_builds
"/home/niklas/.stack/programs/x86_64-linux/ghc-8.6.3/bin/ghc" -o 
utils/hsc2hs/dist/build/tmp/hsc2hs -hisuf hi -osuf  o -hcsuf hc -static  -H32m 
-O -Wall   -package-db libraries/bootstrapping.conf  -hide-all-packages -i 
-iutils/hsc2hs/. -iutils/hsc2hs/dist/build -Iutils/hsc2hs/dist/build 
-iutils/hsc2hs/dist/build/hsc2hs/autogen 
-Iutils/hsc2hs/dist/build/hsc2hs/autogen     -optP-include 
-optPutils/hsc2hs/dist/build/hsc2hs/autogen/cabal_macros.h -package-id 
base-4.12.0.0 -package-id containers-0.6.0.1 -package-id directory-1.3.3.0 
-package-id filepath-1.4.2.1 -package-id process-1.6.3.0 -Wall -XHaskell2010  
-no-user-package-db -rtsopts        -outputdir utils/hsc2hs/dist/build    
-static  -H32m -O -Wall   -package-db libraries/bootstrapping.conf  
-hide-all-packages -i -iutils/hsc2hs/. -iutils/hsc2hs/dist/build 
-Iutils/hsc2hs/dist/build -iutils/hsc2hs/dist/build/hsc2hs/autogen 
-Iutils/hsc2hs/dist/build/hsc2hs/autogen     -optP-include 
-optPutils/hsc2hs/dist/build/hsc2hs/autogen/cabal_macros.h -package-id 
base-4.12.0.0 -package-id containers-0.6.0.1 -package-id directory-1.3.3.0 
-package-id filepath-1.4.2.1 -package-id process-1.6.3.0 -Wall -XHaskell2010  
-no-user-package-db -rtsopts        utils/hsc2hs/dist/build/Main.o 
utils/hsc2hs/dist/build/C.o utils/hsc2hs/dist/build/Common.o 
utils/hsc2hs/dist/build/CrossCodegen.o utils/hsc2hs/dist/build/DirectCodegen.o 
utils/hsc2hs/dist/build/Flags.o utils/hsc2hs/dist/build/HSCParser.o 
utils/hsc2hs/dist/build/ATTParser.o utils/hsc2hs/dist/build/UtilsCodegen.o 
utils/hsc2hs/dist/build/Compat/ResponseFile.o 
utils/hsc2hs/dist/build/Paths_hsc2hs.o    
/usr/bin/install -c -m 755 utils/hsc2hs/dist/build/tmp/hsc2hs 
inplace/lib/bin/hsc2hs
...
make[1]: 'utils/hsc2hs/dist/build/tmp/hsc2hs' is up to date.
make utils/hsc2hs/dist/build/tmp/hsc2hs  49.26s user 15.66s system 91% cpu 
1:10.58 total

Adding `-fforce-recomp -v -keep-tmp-files` to the above ghc invocation reveals 
a `gcc` invocation; running that one under `strace` shows:

% strace -s 30000 -fy -e execve gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE 
'-fuse-ld=gold' -Wl,--no-as-needed -o utils/hsc2hs/dist/build/tmp/hsc2hs -lm 
-no-pie -Wl,--gc-sections utils/hsc2hs/dist/build/Main.o 
utils/hsc2hs/dist/build/C.o utils/hsc2hs/dist/build/Common.o 
utils/hsc2hs/dist/build/CrossCodegen.o utils/hsc2hs/dist/build/DirectCodegen.o 
utils/hsc2hs/dist/build/Flags.o utils/hsc2hs/dist/build/HSCParser.o 
utils/hsc2hs/dist/build/ATTParser.o utils/hsc2hs/dist/build/UtilsCodegen.o 
utils/hsc2hs/dist/build/Compat/ResponseFile.o 
utils/hsc2hs/dist/build/Paths_hsc2hs.o 
-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/process-1.6.3.0 
-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/directory-1.3.3.0 
-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/unix-2.7.2.2 
-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/bytestring-0.10.8.2 
-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/time-1.8.0.2 
-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/filepath-1.4.2.1 
-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/containers-0.6.0.1 
-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/deepseq-1.4.4.0 
-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/array-0.5.3.0 
-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/base-4.12.0.0 
-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/integer-gmp-1.0.2.0 
-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/ghc-prim-0.5.3 
-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts 
/tmp/ghc2447_0/ghc_2.o /tmp/ghc2447_0/ghc_5.o 
-Wl,-u,base_GHCziTopHandler_runIO_closure 
-Wl,-u,base_GHCziTopHandler_runNonIO_closure 
-Wl,-u,ghczmprim_GHCziTuple_Z0T_closure 
-Wl,-u,ghczmprim_GHCziTypes_True_closure 
-Wl,-u,ghczmprim_GHCziTypes_False_closure 
-Wl,-u,base_GHCziPack_unpackCString_closure 
-Wl,-u,base_GHCziWeak_runFinalizzerBatch_closure 
-Wl,-u,base_GHCziIOziException_stackOverflow_closure 
-Wl,-u,base_GHCziIOziException_heapOverflow_closure 
-Wl,-u,base_GHCziIOziException_allocationLimitExceeded_closure 
-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnMVar_closure 
-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnSTM_closure 
-Wl,-u,base_GHCziIOziException_cannotCompactFunction_closure 
-Wl,-u,base_GHCziIOziException_cannotCompactPinned_closure 
-Wl,-u,base_GHCziIOziException_cannotCompactMutable_closure 
-Wl,-u,base_ControlziExceptionziBase_absentSumFieldError_closure 
-Wl,-u,base_ControlziExceptionziBase_nonTermination_closure 
-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_closure 
-Wl,-u,base_GHCziEventziThread_blockedOnBadFD_closure 
-Wl,-u,base_GHCziConcziSync_runSparks_closure 
-Wl,-u,base_GHCziConcziIO_ensureIOManagerIsRunning_closure 
-Wl,-u,base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure 
-Wl,-u,base_GHCziConcziSignal_runHandlersPtr_closure 
-Wl,-u,base_GHCziTopHandler_flushStdHandles_closure 
-Wl,-u,base_GHCziTopHandler_runMainIO_closure 
-Wl,-u,ghczmprim_GHCziTypes_Czh_con_info 
-Wl,-u,ghczmprim_GHCziTypes_Izh_con_info 
-Wl,-u,ghczmprim_GHCziTypes_Fzh_con_info 
-Wl,-u,ghczmprim_GHCziTypes_Dzh_con_info 
-Wl,-u,ghczmprim_GHCziTypes_Wzh_con_info -Wl,-u,base_GHCziPtr_Ptr_con_info 
-Wl,-u,base_GHCziPtr_FunPtr_con_info -Wl,-u,base_GHCziInt_I8zh_con_info 
-Wl,-u,base_GHCziInt_I16zh_con_info -Wl,-u,base_GHCziInt_I32zh_con_info 
-Wl,-u,base_GHCziInt_I64zh_con_info -Wl,-u,base_GHCziWord_W8zh_con_info 
-Wl,-u,base_GHCziWord_W16zh_con_info -Wl,-u,base_GHCziWord_W32zh_con_info 
-Wl,-u,base_GHCziWord_W64zh_con_info -Wl,-u,base_GHCziStable_StablePtr_con_info 
-Wl,-u,hs_atomic_add8 -Wl,-u,hs_atomic_add16 -Wl,-u,hs_atomic_add32 
-Wl,-u,hs_atomic_add64 -Wl,-u,hs_atomic_sub8 -Wl,-u,hs_atomic_sub16 
-Wl,-u,hs_atomic_sub32 -Wl,-u,hs_atomic_sub64 -Wl,-u,hs_atomic_and8 
-Wl,-u,hs_atomic_and16 -Wl,-u,hs_atomic_and32 -Wl,-u,hs_atomic_and64 
-Wl,-u,hs_atomic_nand8 -Wl,-u,hs_atomic_nand16 -Wl,-u,hs_atomic_nand32 
-Wl,-u,hs_atomic_nand64 -Wl,-u,hs_atomic_or8 -Wl,-u,hs_atomic_or16 
-Wl,-u,hs_atomic_or32 -Wl,-u,hs_atomic_or64 -Wl,-u,hs_atomic_xor8 
-Wl,-u,hs_atomic_xor16 -Wl,-u,hs_atomic_xor32 -Wl,-u,hs_atomic_xor64 
-Wl,-u,hs_cmpxchg8 -Wl,-u,hs_cmpxchg16 -Wl,-u,hs_cmpxchg32 -Wl,-u,hs_cmpxchg64 
-Wl,-u,hs_atomicread8 -Wl,-u,hs_atomicread16 -Wl,-u,hs_atomicread32 
-Wl,-u,hs_atomicread64 -Wl,-u,hs_atomicwrite8 -Wl,-u,hs_atomicwrite16 
-Wl,-u,hs_atomicwrite32 -Wl,-u,hs_atomicwrite64 -lHSprocess-1.6.3.0 
-lHSdirectory-1.3.3.0 -lHSunix-2.7.2.2 -lHSbytestring-0.10.8.2 -lHStime-1.8.0.2 
-lHSfilepath-1.4.2.1 -lHScontainers-0.6.0.1 -lHSdeepseq-1.4.4.0 
-lHSarray-0.5.3.0 -lHSbase-4.12.0.0 -lHSinteger-gmp-1.0.2.0 -lHSghc-prim-0.5.3 
-lHSrts -lCffi -lrt -lutil -ldl -lpthread -lgmp -lm -lrt -ldl -lpthread -v
...
[pid  2998] execve("/usr/bin/ld.gold", ["/usr/bin/ld.gold", "-plugin", 
"/usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so", 
"-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper", 
"-plugin-opt=-fresolution=/tmp/ccix2beF.res", 
"-plugin-opt=-pass-through=-lgcc", "-plugin-opt=-pass-through=-lgcc_s", 
"-plugin-opt=-pass-through=-lc", "-plugin-opt=-pass-through=-lgcc", 
"-plugin-opt=-pass-through=-lgcc_s", "--sysroot=/", "--build-id", 
"--eh-frame-hdr", "-m", "elf_x86_64", "--hash-style=gnu", "--as-needed", 
"-dynamic-linker", "/lib64/ld-linux-x86-64.so.2", "-z", "relro", "-o", 
"utils/hsc2hs/dist/build/tmp/hsc2hs", 
"/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o", 
"/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o", 
"/usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o", 
"-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/process-1.6.3.0", 
"-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/directory-1.3.3.0",
 "-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/unix-2.7.2.2", 
"-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/bytestring-0.10.8.2",
 "-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/time-1.8.0.2", 
"-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/filepath-1.4.2.1", 
"-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/containers-0.6.0.1",
 "-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/deepseq-1.4.4.0", 
"-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/array-0.5.3.0", 
"-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/base-4.12.0.0", 
"-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/integer-gmp-1.0.2.0",
 "-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/ghc-prim-0.5.3", 
"-L/raid/stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts", 
"-L/usr/lib/gcc/x86_64-linux-gnu/5", 
"-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu", 
"-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib", "-L/lib/x86_64-linux-gnu", 
"-L/lib/../lib", "-L/usr/lib/x86_64-linux-gnu", "-L/usr/lib/../lib", 
"-L/usr/lib/gcc/x86_64-linux-gnu/5/../../..", "--no-as-needed", "-lm", 
"--gc-sections", "utils/hsc2hs/dist/build/Main.o", 
"utils/hsc2hs/dist/build/C.o", "utils/hsc2hs/dist/build/Common.o", 
"utils/hsc2hs/dist/build/CrossCodegen.o", 
"utils/hsc2hs/dist/build/DirectCodegen.o", "utils/hsc2hs/dist/build/Flags.o", 
"utils/hsc2hs/dist/build/HSCParser.o", "utils/hsc2hs/dist/build/ATTParser.o", 
"utils/hsc2hs/dist/build/UtilsCodegen.o", 
"utils/hsc2hs/dist/build/Compat/ResponseFile.o", 
"utils/hsc2hs/dist/build/Paths_hsc2hs.o", "/tmp/ghc2447_0/ghc_2.o", 
"/tmp/ghc2447_0/ghc_5.o", "-u", "base_GHCziTopHandler_runIO_closure", "-u", 
"base_GHCziTopHandler_runNonIO_closure", "-u", 
"ghczmprim_GHCziTuple_Z0T_closure", "-u", "ghczmprim_GHCziTypes_True_closure", 
"-u", "ghczmprim_GHCziTypes_False_closure", "-u", 
"base_GHCziPack_unpackCString_closure", "-u", 
"base_GHCziWeak_runFinalizzerBatch_closure", "-u", 
"base_GHCziIOziException_stackOverflow_closure", "-u", 
"base_GHCziIOziException_heapOverflow_closure", "-u", 
"base_GHCziIOziException_allocationLimitExceeded_closure", "-u", 
"base_GHCziIOziException_blockedIndefinitelyOnMVar_closure", "-u", 
"base_GHCziIOziException_blockedIndefinitelyOnSTM_closure", "-u", 
"base_GHCziIOziException_cannotCompactFunction_closure", "-u", 
"base_GHCziIOziException_cannotCompactPinned_closure", "-u", 
"base_GHCziIOziException_cannotCompactMutable_closure", "-u", 
"base_ControlziExceptionziBase_absentSumFieldError_closure", "-u", 
"base_ControlziExceptionziBase_nonTermination_closure", "-u", 
"base_ControlziExceptionziBase_nestedAtomically_closure", "-u", 
"base_GHCziEventziThread_blockedOnBadFD_closure", "-u", 
"base_GHCziConcziSync_runSparks_closure", "-u", 
"base_GHCziConcziIO_ensureIOManagerIsRunning_closure", "-u", 
"base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure", "-u", 
"base_GHCziConcziSignal_runHandlersPtr_closure", "-u", 
"base_GHCziTopHandler_flushStdHandles_closure", "-u", 
"base_GHCziTopHandler_runMainIO_closure", "-u", 
"ghczmprim_GHCziTypes_Czh_con_info", "-u", "ghczmprim_GHCziTypes_Izh_con_info", 
"-u", "ghczmprim_GHCziTypes_Fzh_con_info", "-u", 
"ghczmprim_GHCziTypes_Dzh_con_info", "-u", "ghczmprim_GHCziTypes_Wzh_con_info", 
"-u", "base_GHCziPtr_Ptr_con_info", "-u", "base_GHCziPtr_FunPtr_con_info", 
"-u", "base_GHCziInt_I8zh_con_info", "-u", "base_GHCziInt_I16zh_con_info", 
"-u", "base_GHCziInt_I32zh_con_info", "-u", "base_GHCziInt_I64zh_con_info", 
"-u", "base_GHCziWord_W8zh_con_info", "-u", "base_GHCziWord_W16zh_con_info", 
"-u", "base_GHCziWord_W32zh_con_info", "-u", "base_GHCziWord_W64zh_con_info", 
"-u", "base_GHCziStable_StablePtr_con_info", "-u", "hs_atomic_add8", "-u", 
"hs_atomic_add16", "-u", "hs_atomic_add32", "-u", "hs_atomic_add64", "-u", 
"hs_atomic_sub8", "-u", "hs_atomic_sub16", "-u", "hs_atomic_sub32", "-u", 
"hs_atomic_sub64", "-u", "hs_atomic_and8", "-u", "hs_atomic_and16", "-u", 
"hs_atomic_and32", "-u", "hs_atomic_and64", "-u", "hs_atomic_nand8", "-u", 
"hs_atomic_nand16", "-u", "hs_atomic_nand32", "-u", "hs_atomic_nand64", "-u", 
"hs_atomic_or8", "-u", "hs_atomic_or16", "-u", "hs_atomic_or32", "-u", 
"hs_atomic_or64", "-u", "hs_atomic_xor8", "-u", "hs_atomic_xor16", "-u", 
"hs_atomic_xor32", "-u", "hs_atomic_xor64", "-u", "hs_cmpxchg8", "-u", 
"hs_cmpxchg16", "-u", "hs_cmpxchg32", "-u", "hs_cmpxchg64", "-u", 
"hs_atomicread8", "-u", "hs_atomicread16", "-u", "hs_atomicread32", "-u", 
"hs_atomicread64", "-u", "hs_atomicwrite8", "-u", "hs_atomicwrite16", "-u", 
"hs_atomicwrite32", "-u", "hs_atomicwrite64", "-lHSprocess-1.6.3.0", 
"-lHSdirectory-1.3.3.0", "-lHSunix-2.7.2.2", "-lHSbytestring-0.10.8.2", 
"-lHStime-1.8.0.2", "-lHSfilepath-1.4.2.1", "-lHScontainers-0.6.0.1", 
"-lHSdeepseq-1.4.4.0", "-lHSarray-0.5.3.0", "-lHSbase-4.12.0.0", 
"-lHSinteger-gmp-1.0.2.0", "-lHSghc-prim-0.5.3", "-lHSrts", "-lCffi", "-lrt", 
"-lutil", "-ldl", "-lpthread", "-lgmp", "-lm", "-lrt", "-ldl", "-lpthread", 
"-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "-lc", "-lgcc", 
"--as-needed", "-lgcc_s", "--no-as-needed", 
"/usr/lib/gcc/x86_64-linux-gnu/5/crtend.o", 
"/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o"], [/* 89 
vars */]) = 0
[pid  2998] +++ exited with 0 +++

So no error for me.
We'll want to do the same for you and compare.


On 01/04/2019 3:30 PM, Niklas Hambüchen wrote:
> That sounds good. A few more questions:
> 
> What's the exact version of your OS, and of gold?
> 
> After getting to the error, can you run the failing ghc invocation directly, 
> and see if the error remains? The one starting with
> 
>     "/home/omer/ghc_bins/ghc-8.6.4-bin/bin/ghc" -o
> utils/hsc2hs/dist/build/tmp/hsc2hs ...
> 
> If yes, can you add a `-v` to it, so we can see the invocations to the 
> programs it calls?
> 
> Then, it should show a gcc invocation (which eventually calls gold).
> Can you then manually run and add a `-v` to to the gcc invocation as well, so 
> we can see the linker command it runs (see also 
> https://stackoverflow.com/questions/1170809/how-to-get-gcc-linker-command)?
> You may have to run ghc with `-keep-tmp-files` if it invokes the gcc on 
> temporary files.
> 
> Finally, can you run the printed ld.gold invocation manually, and add a `-v` 
> to that, so we get more detail about what gold is doing?
> 
> If you are on Linux (and also in some other cases), you can also run ghc 
> under `strace -fy -e execve` to see all programs started recursively by any 
> subprogram; this may also easily provide the linker invocation.
> 
> Thank you!
> 
> On 01/04/2019 7:35 AM, Ömer Sinan Ağacan wrote:
>> Yeah I can reproduce it reliably. I tried a few `git clean -xfd`s, and tried
>> with no build.mk and with a debug build.mk, it happened with all 
>> configurations,
>> when building the same file (the hsc2hs executable).
>>
>> The repro is simple: clone the GHC repo, build at 6f7115dfd4. If this doesn't
>> reproduce the bug then I don't know what else to try.
>>
>>> so perhaps you also have a corrupt ELF file somewhere
>>
>> How do I check this? Maybe gold.ld produces a corrupt ELF file during the 
>> build,
>> and then tries to read it to link an executable.
> _______________________________________________
> ghc-devs mailing list
> ghc-devs@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
> 
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to