diff --git a/overlays/bootstrap.nix b/overlays/bootstrap.nix index 1f3b92408d..0f4edeafc2 100644 --- a/overlays/bootstrap.nix +++ b/overlays/bootstrap.nix @@ -189,6 +189,7 @@ in { ++ fromUntil "9.4.5" "9.4.6" ./patches/ghc/ghc-9.4.5-include-order-fix.patch ++ fromUntil "9.6.2" "9.8" ./patches/ghc/ghc-9.4.5-include-order-fix.patch ++ fromUntil "9.6.1" "9.8" ./patches/ghc/MR10116.patch + ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.6.1" "9.8" ./patches/ghc-image-rel-amd64-srel32.patch) ++ final.lib.optionals (final.stdenv.buildPlatform == final.stdenv.targetPlatform) (fromUntil "9.4.1" "9.6" ./patches/ghc/hadrian-build-deriveConstants-genprimopcode-ghc94.patch) ++ final.lib.optionals (final.stdenv.buildPlatform == final.stdenv.targetPlatform) (fromUntil "9.6.1" "9.8" ./patches/ghc/hadrian-build-deriveConstants-genprimopcode.patch) ++ final.lib.optionals (final.stdenv.targetPlatform.isGhcjs) (fromUntil "9.6.1" "9.8" ./patches/ghc/ghc-9.6-Merge-libiserv-with-ghci.patch) diff --git a/overlays/patches/ghc-image-rel-amd64-srel32.patch b/overlays/patches/ghc-image-rel-amd64-srel32.patch new file mode 100644 index 0000000000..753ac690f7 --- /dev/null +++ b/overlays/patches/ghc-image-rel-amd64-srel32.patch @@ -0,0 +1,21 @@ +From 28607c22f968587177c8a0d25f2e7a64b4ae5be8 Mon Sep 17 00:00:00 2001 +From: Moritz Angermann +Date: Wed, 31 May 2023 12:30:39 +0800 +Subject: [PATCH] Update PEi386.c + +--- + rts/linker/PEi386.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c +index b5134235b02..682b4ec7e83 100644 +--- a/rts/linker/PEi386.c ++++ b/rts/linker/PEi386.c +@@ -2038,6 +2038,7 @@ ocResolve_PEi386 ( ObjectCode* oc ) + } + case 2: /* R_X86_64_32 (ELF constant 10) - IMAGE_REL_AMD64_ADDR32 (PE constant 2) */ + case 3: /* IMAGE_REL_AMD64_ADDR32NB (PE constant 3) */ ++ case 14: /* R_X86_64_PC64 (ELF constant 24) - IMAGE_REL_AMD64_SREL32 (PE constant 14) */ + case 17: /* R_X86_64_32S ELF constant, no PE mapping. See note [ELF constant in PE file] */ + { + uint64_t v; diff --git a/overlays/patches/wine-add-dll-directory.patch b/overlays/patches/wine-add-dll-directory.patch new file mode 100644 index 0000000000..6f817be4ec --- /dev/null +++ b/overlays/patches/wine-add-dll-directory.patch @@ -0,0 +1,13 @@ +diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c +index 85eb2976807..36d92b32d1c 100644 +--- a/dlls/ntdll/loader.c ++++ b/dlls/ntdll/loader.c +@@ -4015,7 +4015,7 @@ NTSTATUS WINAPI LdrAddDllDirectory( const UNICODE_STRING *dir, void **cookie ) + struct dll_dir_entry *ptr; + DOS_PATHNAME_TYPE type = RtlDetermineDosPathNameType_U( dir->Buffer ); + +- if (type != ABSOLUTE_PATH && type != ABSOLUTE_DRIVE_PATH) ++ if (type != ABSOLUTE_PATH && type != ABSOLUTE_DRIVE_PATH && type != DEVICE_PATH ) + return STATUS_INVALID_PARAMETER; + + status = RtlDosPathNameToNtPathName_U_WithStatus( dir->Buffer, &nt_name, NULL, NULL ); diff --git a/overlays/wine.nix b/overlays/wine.nix index 3420bec771..27fa9a3f78 100644 --- a/overlays/wine.nix +++ b/overlays/wine.nix @@ -2,21 +2,10 @@ # files from TH code) for GHC built with msvcrt (ghc<9.6). # This will inevitably replace *any* wine version. Thus this might not really be what we ultimately want. # Wine 5.4 does not build on macOS so that is not pinned and TH code will probably break. -final: prev: -prev.lib.optionalAttrs (!prev.stdenv.hostPlatform.isDarwin) { - winePackages = prev.winePackages // { - minimal = prev.winePackages.minimal.overrideAttrs (oldAttrs: { - name = "wine-5.4"; - version = "5.4"; - src = prev.fetchurl { - url = "https://dl.winehq.org/wine/source/5.x/wine-5.4.tar.xz"; - sha256 = "sha256-Sz4rD/pUFfGZVA5gUcKMOXb86R6lv7LPSgmcJXMXBSw="; - }; - patches = []; - # Turning off the tests as there is a problem with the `schedsvc` test. - # With recent nixpkgs both the IDL files generate `_c.c` files with - # `handle_t rpc_handle` and that results in a linker error (duplicate symbols). - configureFlags = oldAttrs.configureFlags or [] ++ ["--disable-tests"]; - }); - }; +final: prev: { + winePackages = prev.winePackages // { + minimal = prev.winePackages.minimal.overrideAttrs (oldAttrs: { + patches = oldAttrs.patches or [] ++ [ ./patches/wine-add-dll-directory.patch ]; + }); + }; } diff --git a/test/th-dlls/default.nix b/test/th-dlls/default.nix index f460da2b0f..0b2649d970 100644 --- a/test/th-dlls/default.nix +++ b/test/th-dlls/default.nix @@ -21,7 +21,8 @@ in recurseIntoAttrs { meta.disabled = stdenv.hostPlatform.isGhcjs || # TH breaks for ghc 9.4.3 cross compile for windows if the library even # just depends on the `text` package (this may be related to the C++ dependency). - (stdenv.hostPlatform.isWindows && __elem compiler-nix-name ["ghc941" "ghc942" "ghc943" "ghc944" "ghc945" "ghc96020230302" "ghc961" "ghc962"]) || + # TODO: update above comment if we get this working. + # (stdenv.hostPlatform.isWindows && __elem compiler-nix-name ["ghc941" "ghc942" "ghc943" "ghc944" "ghc945" "ghc96020230302" "ghc961" "ghc962"]) || # Similar problem on macOS (stdenv.hostPlatform.isDarwin && __elem compiler-nix-name ["ghc941" "ghc942" "ghc943" "ghc944" "ghc945" "ghc96020230302" "ghc961" "ghc962"]) || # On aarch64 this test also breaks form musl builds (including cross compiles on x86_64-linux)