Fully-static Alpine/i386 build fails due to non-ABS relocations
Currently attempting to build the validate+fully_static
flavour on i386/Alpine 3.12 fails when building the lint-notes
executable (although this is merely a sign that the compiler is broken):
ld.lld: error: Hpc.c:(.debug_info+0x59005): has non-ABS relocation R_386_GOTOFF against symbol '.LC15'
ld.lld: error: Hash.c:(.debug_info+0x225EB): has non-ABS relocation R_386_GOTOFF against symbol 'XXH3_kSecret'
collect2: error: ld returned 1 exit status
ld.lld: error: Hpc.c:(.debug_info+0x59005): has non-ABS relocation R_386_GOTOFF against symbol '.LC15'
ld.lld: error: Hash.c:(.debug_info+0x225EB): has non-ABS relocation R_386_GOTOFF against symbol 'XXH3_kSecret'
collect2: error: ld returned 1 exit status
ghc-9.5.20220714: `gcc' failed in phase `Linker'. (Exit code: 1)
ghc-9.5.20220714: `gcc' failed in phase `Linker'. (Exit code: 1)
Development.Shake.cmd, system command failed
Command line: /home/ghc/ghc/_build/install/bin/ghc -package array -package base -package bytestring -package containers -package directory -package process -package text -o /home/ghc/ghc/_build/test/bin/lint-notes /home/ghc/ghc/linters/lint-notes/Main.hs -ilinters/lint-notes
Exit code: 1
Stderr:
ld.lld: error: Hpc.c:(.debug_info+0x59005): has non-ABS relocation R_386_GOTOFF against symbol '.LC15'
ld.lld: error: Hash.c:(.debug_info+0x225EB): has non-ABS relocation R_386_GOTOFF against symbol 'XXH3_kSecret'
collect2: error: ld returned 1 exit status
ghc-9.5.20220714: `gcc' failed in phase `Linker'. (Exit code: 1)
Build failed.
hadrian/build-cabal --flavour=validate+fully_static -j24 --broken-test= --bignum=gmp --test-verbose=3 test --summary-junit=./junit.xml --test-have-intree-files --test-compiler=/home/ghc/ghc/_build/install/bin/ghc runtest.opts+= failed
In particular, it appears that the C compiler produced some relocations that aren't compatible with static linking. This manifested here in libHSrts
although I suspect all C compilation products are similarly affected.