diff options
author | Ben Gamari <ben@smart-cactus.org> | 2023-01-25 11:57:57 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2023-02-08 11:57:44 -0500 |
commit | df3edc69fadc7174f0298f0072a951c5932a331a (patch) | |
tree | bb7c1bb122fa515b72adc6cd2216a4bb383de2f7 | |
parent | a9912de75400b7006fc2eb6cb31c9bf5ae6dacd6 (diff) | |
download | haskell-df3edc69fadc7174f0298f0072a951c5932a331a.tar.gz |
nativeGen: Explicitly set flags of text sections on Windows
The binutils documentation (for COFF) claims,
> If no flags are specified, the default flags depend upon the section
> name. If the section name is not recognized, the default will be for the
> section to be loaded and writable.
We previously assumed that this would do the right thing for split
sections (e.g. a section named `.text$foo` would be correctly inferred
to be a text section). However, we have observed that this is not the
case (at least under the clang toolchain used on Windows): when
split-sections is enabled, text sections are treated by the assembler as
data (matching the "default" behavior specified by the documentation).
Avoid this by setting section flags explicitly. This should fix split
sections on Windows.
Fixes #22834.
-rw-r--r-- | .gitlab-ci.yml | 4 | ||||
-rwxr-xr-x | .gitlab/gen_ci.hs | 4 | ||||
-rw-r--r-- | .gitlab/jobs.yaml | 20 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/Ppr.hs | 3 |
4 files changed, 17 insertions, 14 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 98a40cc90e..581c6b5311 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -502,7 +502,7 @@ doc-tarball: optional: true - job: nightly-x86_64-windows-validate optional: true - - job: release-x86_64-windows-release+no_split_sections + - job: release-x86_64-windows-release optional: true tags: @@ -526,7 +526,7 @@ doc-tarball: || mv "ghc-x86_64-linux-deb10-release.tar.xz" "$LINUX_BINDIST" \ || true mv "ghc-x86_64-windows-validate.tar.xz" "$WINDOWS_BINDIST" \ - || mv "ghc-x86_64-windows-release+no_split_sections.tar.xz" "$WINDOWS_BINDIST" \ + || mv "ghc-x86_64-windows-release.tar.xz" "$WINDOWS_BINDIST" \ || true if [ ! -f "$LINUX_BINDIST" ]; then echo "Error: $LINUX_BINDIST does not exist. Did the Debian 9 job fail?" diff --git a/.gitlab/gen_ci.hs b/.gitlab/gen_ci.hs index c5adc90662..5a2f6960b2 100755 --- a/.gitlab/gen_ci.hs +++ b/.gitlab/gen_ci.hs @@ -871,8 +871,8 @@ job_groups = -- This job is only for generating head.hackage docs , hackage_doc_job (disableValidate (standardBuildsWithConfig Amd64 (Linux Fedora33) releaseConfig)) , disableValidate (standardBuildsWithConfig Amd64 (Linux Fedora33) dwarf) - , fastCI (standardBuildsWithConfig Amd64 Windows (splitSectionsBroken vanilla)) - , disableValidate (standardBuildsWithConfig Amd64 Windows (splitSectionsBroken nativeInt)) + , fastCI (standardBuildsWithConfig Amd64 Windows vanilla) + , disableValidate (standardBuildsWithConfig Amd64 Windows nativeInt) , standardBuilds Amd64 Darwin , allowFailureGroup (addValidateRule FreeBSDLabel (validateBuilds Amd64 FreeBSD13 vanilla)) , standardBuilds AArch64 Darwin diff --git a/.gitlab/jobs.yaml b/.gitlab/jobs.yaml index 6db398f22b..4591032a59 100644 --- a/.gitlab/jobs.yaml +++ b/.gitlab/jobs.yaml @@ -3156,7 +3156,7 @@ "XZ_OPT": "-9" } }, - "release-x86_64-windows-int_native-release+no_split_sections": { + "release-x86_64-windows-int_native-release": { "after_script": [ "bash .gitlab/ci.sh save_cache", "bash .gitlab/ci.sh clean" @@ -3165,7 +3165,7 @@ "artifacts": { "expire_in": "1 year", "paths": [ - "ghc-x86_64-windows-int_native-release+no_split_sections.tar.xz", + "ghc-x86_64-windows-int_native-release.tar.xz", "junit.xml" ], "reports": { @@ -3203,8 +3203,8 @@ ], "variables": { "BIGNUM_BACKEND": "native", - "BIN_DIST_NAME": "ghc-x86_64-windows-int_native-release+no_split_sections", - "BUILD_FLAVOUR": "release+no_split_sections", + "BIN_DIST_NAME": "ghc-x86_64-windows-int_native-release", + "BUILD_FLAVOUR": "release", "CABAL_INSTALL_VERSION": "3.8.1.0", "CONFIGURE_ARGS": "", "GHC_VERSION": "9.4.3", @@ -3212,11 +3212,11 @@ "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", - "TEST_ENV": "x86_64-windows-int_native-release+no_split_sections", + "TEST_ENV": "x86_64-windows-int_native-release", "XZ_OPT": "-9" } }, - "release-x86_64-windows-release+no_split_sections": { + "release-x86_64-windows-release": { "after_script": [ "bash .gitlab/ci.sh save_cache", "bash .gitlab/ci.sh clean" @@ -3225,7 +3225,7 @@ "artifacts": { "expire_in": "1 year", "paths": [ - "ghc-x86_64-windows-release+no_split_sections.tar.xz", + "ghc-x86_64-windows-release.tar.xz", "junit.xml" ], "reports": { @@ -3263,8 +3263,8 @@ ], "variables": { "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-windows-release+no_split_sections", - "BUILD_FLAVOUR": "release+no_split_sections", + "BIN_DIST_NAME": "ghc-x86_64-windows-release", + "BUILD_FLAVOUR": "release", "CABAL_INSTALL_VERSION": "3.8.1.0", "CONFIGURE_ARGS": "", "GHC_VERSION": "9.4.3", @@ -3272,7 +3272,7 @@ "IGNORE_PERF_FAILURES": "all", "LANG": "en_US.UTF-8", "MSYSTEM": "CLANG64", - "TEST_ENV": "x86_64-windows-release+no_split_sections", + "TEST_ENV": "x86_64-windows-release", "XZ_OPT": "-9" } }, diff --git a/compiler/GHC/CmmToAsm/Ppr.hs b/compiler/GHC/CmmToAsm/Ppr.hs index 7959db8d69..52c2f8307f 100644 --- a/compiler/GHC/CmmToAsm/Ppr.hs +++ b/compiler/GHC/CmmToAsm/Ppr.hs @@ -245,6 +245,9 @@ pprGNUSectionHeader config t suffix = OtherSection _ -> panic "PprBase.pprGNUSectionHeader: unknown section type" flags = case t of + Text + | OSMinGW32 <- platformOS platform + -> text ",\"xr\"" CString | OSMinGW32 <- platformOS platform -> empty |