[Git][ghc/ghc][wip/T22834] 2 commits: nativeGen: Explicitly set flags of text sections on Windows
Ben Gamari (@bgamari)
gitlab at gitlab.haskell.org
Wed Feb 8 17:38:33 UTC 2023
Ben Gamari pushed to branch wip/T22834 at Glasgow Haskell Compiler / GHC
Commits:
ca1577fc by Ben Gamari at 2023-02-08T12:38:27-05:00
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.
- - - - -
855f4c9b by Ben Gamari at 2023-02-08T12:38:27-05:00
nativeGen: Set explicit section types on all platforms
- - - - -
4 changed files:
- .gitlab-ci.yml
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- compiler/GHC/CmmToAsm/Ppr.hs
Changes:
=====================================
.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?"
=====================================
.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
=====================================
.gitlab/jobs.yaml
=====================================
@@ -2173,7 +2173,7 @@
"XZ_OPT": "-9"
}
},
- "release-aarch64-linux-deb10-release+no_split_sections": {
+ "release-aarch64-linux-deb10-release": {
"after_script": [
".gitlab/ci.sh save_cache",
".gitlab/ci.sh clean",
@@ -2183,7 +2183,7 @@
"artifacts": {
"expire_in": "1 year",
"paths": [
- "ghc-aarch64-linux-deb10-release+no_split_sections.tar.xz",
+ "ghc-aarch64-linux-deb10-release.tar.xz",
"junit.xml"
],
"reports": {
@@ -2225,15 +2225,15 @@
],
"variables": {
"BIGNUM_BACKEND": "gmp",
- "BIN_DIST_NAME": "ghc-aarch64-linux-deb10-release+no_split_sections",
- "BUILD_FLAVOUR": "release+no_split_sections",
+ "BIN_DIST_NAME": "ghc-aarch64-linux-deb10-release",
+ "BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "",
"IGNORE_PERF_FAILURES": "all",
- "TEST_ENV": "aarch64-linux-deb10-release+no_split_sections",
+ "TEST_ENV": "aarch64-linux-deb10-release",
"XZ_OPT": "-9"
}
},
- "release-i386-linux-deb9-release+no_split_sections": {
+ "release-i386-linux-deb9-release": {
"after_script": [
".gitlab/ci.sh save_cache",
".gitlab/ci.sh clean",
@@ -2243,7 +2243,7 @@
"artifacts": {
"expire_in": "1 year",
"paths": [
- "ghc-i386-linux-deb9-release+no_split_sections.tar.xz",
+ "ghc-i386-linux-deb9-release.tar.xz",
"junit.xml"
],
"reports": {
@@ -2285,11 +2285,11 @@
],
"variables": {
"BIGNUM_BACKEND": "gmp",
- "BIN_DIST_NAME": "ghc-i386-linux-deb9-release+no_split_sections",
- "BUILD_FLAVOUR": "release+no_split_sections",
+ "BIN_DIST_NAME": "ghc-i386-linux-deb9-release",
+ "BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "",
"IGNORE_PERF_FAILURES": "all",
- "TEST_ENV": "i386-linux-deb9-release+no_split_sections",
+ "TEST_ENV": "i386-linux-deb9-release",
"XZ_OPT": "-9"
}
},
@@ -2423,7 +2423,7 @@
"XZ_OPT": "-9"
}
},
- "release-x86_64-linux-alpine3_12-release+fully_static+no_split_sections": {
+ "release-x86_64-linux-alpine3_12-release+fully_static": {
"after_script": [
".gitlab/ci.sh save_cache",
".gitlab/ci.sh clean",
@@ -2433,7 +2433,7 @@
"artifacts": {
"expire_in": "1 year",
"paths": [
- "ghc-x86_64-linux-alpine3_12-release+fully_static+no_split_sections.tar.xz",
+ "ghc-x86_64-linux-alpine3_12-release+fully_static.tar.xz",
"junit.xml"
],
"reports": {
@@ -2476,18 +2476,18 @@
],
"variables": {
"BIGNUM_BACKEND": "gmp",
- "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-release+fully_static+no_split_sections",
+ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-release+fully_static",
"BROKEN_TESTS": "encoding004 T10458 ghcilink002 linker_unload_native",
- "BUILD_FLAVOUR": "release+fully_static+no_split_sections",
+ "BUILD_FLAVOUR": "release+fully_static",
"CONFIGURE_ARGS": "--disable-ld-override ",
"HADRIAN_ARGS": "--docs=no-sphinx",
"IGNORE_PERF_FAILURES": "all",
"INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
- "TEST_ENV": "x86_64-linux-alpine3_12-release+fully_static+no_split_sections",
+ "TEST_ENV": "x86_64-linux-alpine3_12-release+fully_static",
"XZ_OPT": "-9"
}
},
- "release-x86_64-linux-centos7-release+no_split_sections": {
+ "release-x86_64-linux-centos7-release": {
"after_script": [
".gitlab/ci.sh save_cache",
".gitlab/ci.sh clean",
@@ -2497,7 +2497,7 @@
"artifacts": {
"expire_in": "1 year",
"paths": [
- "ghc-x86_64-linux-centos7-release+no_split_sections.tar.xz",
+ "ghc-x86_64-linux-centos7-release.tar.xz",
"junit.xml"
],
"reports": {
@@ -2539,12 +2539,12 @@
],
"variables": {
"BIGNUM_BACKEND": "gmp",
- "BIN_DIST_NAME": "ghc-x86_64-linux-centos7-release+no_split_sections",
- "BUILD_FLAVOUR": "release+no_split_sections",
+ "BIN_DIST_NAME": "ghc-x86_64-linux-centos7-release",
+ "BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "",
"HADRIAN_ARGS": "--docs=no-sphinx",
"IGNORE_PERF_FAILURES": "all",
- "TEST_ENV": "x86_64-linux-centos7-release+no_split_sections",
+ "TEST_ENV": "x86_64-linux-centos7-release",
"XZ_OPT": "-9"
}
},
@@ -2728,7 +2728,7 @@
"XZ_OPT": "-9"
}
},
- "release-x86_64-linux-deb9-release+no_split_sections": {
+ "release-x86_64-linux-deb9-release": {
"after_script": [
".gitlab/ci.sh save_cache",
".gitlab/ci.sh clean",
@@ -2738,7 +2738,7 @@
"artifacts": {
"expire_in": "1 year",
"paths": [
- "ghc-x86_64-linux-deb9-release+no_split_sections.tar.xz",
+ "ghc-x86_64-linux-deb9-release.tar.xz",
"junit.xml"
],
"reports": {
@@ -2780,11 +2780,11 @@
],
"variables": {
"BIGNUM_BACKEND": "gmp",
- "BIN_DIST_NAME": "ghc-x86_64-linux-deb9-release+no_split_sections",
- "BUILD_FLAVOUR": "release+no_split_sections",
+ "BIN_DIST_NAME": "ghc-x86_64-linux-deb9-release",
+ "BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "",
"IGNORE_PERF_FAILURES": "all",
- "TEST_ENV": "x86_64-linux-deb9-release+no_split_sections",
+ "TEST_ENV": "x86_64-linux-deb9-release",
"XZ_OPT": "-9"
}
},
@@ -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"
}
},
=====================================
compiler/GHC/CmmToAsm/Ppr.hs
=====================================
@@ -245,6 +245,10 @@ pprGNUSectionHeader config t suffix =
OtherSection _ ->
panic "PprBase.pprGNUSectionHeader: unknown section type"
flags = case t of
+ Text
+ | OSMinGW32 <- platformOS platform
+ -> text ",\"xr\""
+ | otherwise -> text ",\"ax\"," <> sectionType platform "progbits"
CString
| OSMinGW32 <- platformOS platform
-> empty
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3d16a52e3ef5be9a67e79f7666f90bc5eb25ef64...855f4c9b3eda9333fb7006692fec1c7d87745c09
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3d16a52e3ef5be9a67e79f7666f90bc5eb25ef64...855f4c9b3eda9333fb7006692fec1c7d87745c09
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230208/fab9cb4d/attachment-0001.html>
More information about the ghc-commits
mailing list