Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Mingw-w64 runtime failure: 32 bit pseudo relocation #2228

Open
amesgen opened this issue Jul 14, 2024 · 4 comments
Open

Regression: Mingw-w64 runtime failure: 32 bit pseudo relocation #2228

amesgen opened this issue Jul 14, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@amesgen
Copy link
Member

amesgen commented Jul 14, 2024

Describe the bug

Certain programs fail at runtime when compiled via mingwW64 after #2156:

Mingw-w64runtimefailure:
32 bit pseudo relocation at 00000001400017FE out of range, targeting 00000000004
08160, yielding the value FFFFFFFEC040695E.
  • Build system: x86_64-linux
  • GHC version: GHC 9.6.6 (also tested with GHC 9.10.1)
  • Haskell.nix version (or commit) used: 071f213

Steps To Reproduce

The following program is the most minimal example I managed to produce so far:

import GHC.Types.SrcLoc

main :: IO ()
main = putStrLn "yeah"

data Foo = Foo PsLoc

Here, GHC.Types.SrcLoc comes from ghc or ghc-lib-parser. I tried to inline the definition of PsLoc, or put it into a separate minimal package, but that made the bug go away in the cases I tried.

This minimal reproducible example is also availabe here:

https://github.com/amesgen/stuff/tree/haskell.nix-mingwW64-runtime-bug

nix build github:amesgen/stuff/haskell.nix-mingwW64-runtime-bug

Expected behavior

The program should execute fine (especially as the Foo data type above isn't even used), as it did before #2156.

Additional context

The example above is minimized from trying to compile Ormolu with haskell.nix after #2156.

The error message is already mentioned in the haskell.nix codebase, so maybe this rings a bell:

# If we build libffi with high entropy, we keep running into
#
# > Mingw-w64 runtime failure:
# > 32 bit pseudo relocation at 0000000140117CE6 out of range, targeting 00006FFFFFF18160, yielding the value 00006FFEBFE00476.
#
# This however also means, pretty much all of our haskell packages will need to be built with this as well.
libffi = prev.libffi.overrideAttrs (_: {
LDFLAGS = "-Wl,--disable-dynamicbase,--disable-high-entropy-va,--image-base=0x400000";
});

Copy link

stale bot commented Nov 13, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Nov 13, 2024
@amesgen
Copy link
Member Author

amesgen commented Nov 13, 2024

Just confirming that the problem is still there on current master, i.e. fc8633a.

@stale stale bot removed the wontfix label Nov 13, 2024
@HeinrichApfelmus
Copy link

(Random bystander) Does that error occur only when cross-compiling, or is that an issue with GHC 9.6.6 on Windows?

@amesgen
Copy link
Member Author

amesgen commented Dec 17, 2024

It doesn't happen with a native Windows GHC; and even with haskell.nix, the mingwW64 GHC 9.6.6 didn't have that issue before #2156, so it seems to be specific to the details of the cross compilation infra in haskell.nix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants