Skip to content

Commit a951839

Browse files
committed
Add BUGLOG
1 parent 36565bc commit a951839

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

BUGLOG

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,32 @@ hence we backport that patch to GHC-8.10 when targeting windows (to prevent mass
3333
other archs).
3434

3535
--------------------------------------------------------------------------------
36+
2024-04-10 x86_64-linux.R2305.ghc902.mingwW64.ghc
37+
38+
make[1]: *** [utils/hsc2hs/ghc.mk:22: utils/hsc2hs/dist-install/build/tmp/hsc2hs.exe] Error 1
39+
utils/runghc/dist-install/build/Main.o:fake:(.text+0x2a): relocation truncated to fit: R_X86_64_32S against `.text'
40+
utils/runghc/dist-install/build/Main.o:fake:(.text+0x46): relocation truncated to fit: IMAGE_REL_AMD64_ADDR32 against `.data'
41+
utils/runghc/dist-install/build/Main.o:fake:(.text+0x8b): relocation truncated to fit: R_X86_64_32S against symbol `stg_bh_upd_frame_info' defined in .text section in /build/ghc-9.0.2/rts/dist/build/libHSrts.a(Updates.o)
42+
utils/runghc/dist-install/build/Main.o:fake:(.text+0x95): relocation truncated to fit: IMAGE_REL_AMD64_ADDR32 against `.rdata'
43+
utils/runghc/dist-install/build/Main.o:fake:(.text+0xe3): relocation truncated to fit: R_X86_64_32S against symbol `stg_bh_upd_frame_info' defined in .text section in /build/ghc-9.0.2/rts/dist/build/libHSrts.a(Updates.o)
44+
utils/runghc/dist-install/build/Main.o:fake:(.text+0xed): relocation truncated to fit: IMAGE_REL_AMD64_ADDR32 against `.rdata'
45+
utils/runghc/dist-install/build/Main.o:fake:(.text+0x13b): relocation truncated to fit: R_X86_64_32S against symbol `stg_bh_upd_frame_info' defined in .text section in /build/ghc-9.0.2/rts/dist/build/libHSrts.a(Updates.o)
46+
utils/runghc/dist-install/build/Main.o:fake:(.text+0x145): relocation truncated to fit: IMAGE_REL_AMD64_ADDR32 against `.rdata'
47+
utils/runghc/dist-install/build/Main.o:fake:(.text+0x193): relocation truncated to fit: R_X86_64_32S against symbol `stg_bh_upd_frame_info' defined in .text section in /build/ghc-9.0.2/rts/dist/build/libHSrts.a(Updates.o)
48+
utils/runghc/dist-install/build/Main.o:fake:(.text+0x19d): relocation truncated to fit: IMAGE_REL_AMD64_ADDR32 against `.rdata'
49+
utils/runghc/dist-install/build/Main.o:fake:(.text+0x1eb): additional relocation overflows omitted from the output
50+
51+
We notice `fake`, which is GHC failing to provide .file identifier in the source.
52+
We also see lots of R_X64_64_32S relocations, which are signed 32bit relocations.
53+
These fall with ASLR and high entropy base images from later binutils.
54+
55+
The underlying issue is that GHC emits _absolute_ label loads (mov $... reg), instead
56+
of %rpi or other relative loads. This then leads to the linker emitting 32bit
57+
absolute relocation. With the final image being potentially loaded into high memory
58+
(e.g. dynamic base, and the base image being set to some high address), the linker
59+
starts falling over itself, because it simply can't resolve those absolute addresses
60+
in the 32bit slots.
61+
62+
This was fixed in GHC upstream in https://gitlab.haskell.org/ghc/ghc/-/merge_requests/7449,
63+
while the patch in haskell.nix is a bit more pedestrian and just sets PIC on windows to
64+
always be on, and then uses the PIC pipeline.

0 commit comments

Comments
 (0)