[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 10 commits: Explain the auxiliary functions of permutations
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Wed Jan 4 15:32:14 UTC 2023
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
21bedd84 by Facundo DomÃnguez at 2023-01-03T23:27:30-05:00
Explain the auxiliary functions of permutations
- - - - -
32255d05 by Matthew Pickering at 2023-01-04T11:58:42+00:00
compiler: Add -f[no-]split-sections flags
Here we add a `-fsplit-sections` flag which may some day replace
`-split-sections`. This has the advantage of automatically providing a
`-fno-split-sections` flag, which is useful for our packaging because we
enable `-split-sections` by default but want to disable it in certain
configurations.
- - - - -
e640940c by Matthew Pickering at 2023-01-04T11:58:42+00:00
hadrian: Fix computation of tables_next_to_code for outOfTreeCompiler
This copy-pasto was introduced in de5fb3489f2a9bd6dc75d0cb8925a27fe9b9084b
- - - - -
15bee123 by Matthew Pickering at 2023-01-04T11:58:42+00:00
hadrian: Add test:all_deps to build just testsuite dependencies
Fixes #22534
- - - - -
fec6638e by Matthew Pickering at 2023-01-04T11:58:42+00:00
hadrian: Add no_split_sections tranformer
This transformer reverts the effect of `split_sections`, which we intend
to use for platforms which don't support split sections.
In order to achieve this we have to modify the implemntation of the
split_sections transformer to store whether we are enabling
split_sections directly in the `Flavour` definition. This is because
otherwise there's no convenient way to turn off split_sections due to
having to pass additional linker scripts when merging objects.
- - - - -
3dc05726 by Matthew Pickering at 2023-01-04T11:58:42+00:00
check-exact: Fix build with -Werror
- - - - -
53a6ae7a by Matthew Pickering at 2023-01-04T11:58:42+00:00
ci: Build all test dependencies with in-tree compiler
This means that these executables will honour flavour transformers such
as "werror".
Fixes #22555
- - - - -
32e264c1 by Matthew Pickering at 2023-01-04T11:58:42+00:00
hadrian: Document using GHC environment variable to select boot compiler
Fixes #22340
- - - - -
be9dd9b0 by Matthew Pickering at 2023-01-04T11:58:42+00:00
packaging: Build perf builds with -split-sections
In 8f71d958 the make build system was made to use split-sections on
linux systems but it appears this logic never made it to hadrian.
There is the split_sections flavour transformer but this doesn't appear
to be used for perf builds on linux.
This is disbled on deb9 and windows due to #21670
Closes #21135
- - - - -
afe78202 by Matthew Pickering at 2023-01-04T10:32:01-05:00
sphinx: Use modern syntax for extlinks
This fixes the following build error:
```
Command line: /opt/homebrew/opt/sphinx-doc/bin/sphinx-build -b man -d /private/tmp/extra-dir-55768274273/.doctrees-man -n -w /private/tmp/extra-dir-55768274273/.log docs/users_guide /private/tmp/extra-dir-55768274273
===> Command failed with error code: 2
Exception occurred:
File "/opt/homebrew/Cellar/sphinx-doc/6.0.0/libexec/lib/python3.11/site-packages/sphinx/ext/extlinks.py", line 101, in role
title = caption % part
~~~~~~~~^~~~~~
TypeError: not all arguments converted during string formatting
```
I tested on Sphinx-5.1.1 and Sphinx-6.0.0
Thanks for sterni for providing instructions about how to test using
sphinx-6.0.0.
Fixes #22690
- - - - -
21 changed files:
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- compiler/GHC/Driver/Session.hs
- docs/users_guide/ghc_config.py.in
- docs/users_guide/phases.rst
- hadrian/README.md
- hadrian/doc/flavours.md
- hadrian/doc/testsuite.md
- hadrian/hadrian.cabal
- hadrian/src/Flavour.hs
- hadrian/src/Flavour/Type.hs
- hadrian/src/Oracles/TestSettings.hs
- hadrian/src/Rules/Test.hs
- hadrian/src/Settings/Builders/RunTest.hs
- + hadrian/src/Settings/Builders/SplitSections.hs
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Flavours/Performance.hs
- libraries/base/Data/OldList.hs
- utils/check-exact/ExactPrint.hs
Changes:
=====================================
.gitlab-ci.yml
=====================================
@@ -500,7 +500,7 @@ doc-tarball:
optional: true
- job: nightly-x86_64-windows-validate
optional: true
- - job: release-x86_64-windows-release
+ - job: release-x86_64-windows-release+no_split_sections
optional: true
tags:
@@ -524,7 +524,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.tar.xz" "$WINDOWS_BINDIST" \
+ || mv "ghc-x86_64-windows-release+no_split_sections.tar.xz" "$WINDOWS_BINDIST" \
|| true
if [ ! -f "$LINUX_BINDIST" ]; then
echo "Error: $LINUX_BINDIST does not exist. Did the Debian 9 job fail?"
=====================================
.gitlab/ci.sh
=====================================
@@ -518,7 +518,7 @@ function build_hadrian() {
if [[ -n "${REINSTALL_GHC:-}" ]]; then
run_hadrian build-cabal -V
else
- run_hadrian binary-dist -V
+ run_hadrian test:all_deps binary-dist -V
mv _build/bindist/ghc*.tar.xz "$BIN_DIST_NAME.tar.xz"
fi
=====================================
.gitlab/gen_ci.hs
=====================================
@@ -130,6 +130,7 @@ data BuildConfig
, fullyStatic :: Bool
, tablesNextToCode :: Bool
, threadSanitiser :: Bool
+ , noSplitSections :: Bool
}
-- Extra arguments to pass to ./configure due to the BuildConfig
@@ -146,13 +147,14 @@ mkJobFlavour BuildConfig{..} = Flavour buildFlavour opts
opts = [Llvm | llvmBootstrap] ++
[Dwarf | withDwarf] ++
[FullyStatic | fullyStatic] ++
- [ThreadSanitiser | threadSanitiser]
+ [ThreadSanitiser | threadSanitiser] ++
+ [NoSplitSections | noSplitSections, buildFlavour == Release ]
data Flavour = Flavour BaseFlavour [FlavourTrans]
-data FlavourTrans = Llvm | Dwarf | FullyStatic | ThreadSanitiser
+data FlavourTrans = Llvm | Dwarf | FullyStatic | ThreadSanitiser | NoSplitSections
-data BaseFlavour = Release | Validate | SlowValidate
+data BaseFlavour = Release | Validate | SlowValidate deriving Eq
-----------------------------------------------------------------------------
-- Build Configs
@@ -174,8 +176,12 @@ vanilla = BuildConfig
, fullyStatic = False
, tablesNextToCode = True
, threadSanitiser = False
+ , noSplitSections = False
}
+splitSectionsBroken :: BuildConfig -> BuildConfig
+splitSectionsBroken bc = bc { noSplitSections = True }
+
nativeInt :: BuildConfig
nativeInt = vanilla { bignumBackend = Native }
@@ -290,6 +296,7 @@ flavourString (Flavour base trans) = baseString base ++ concatMap (("+" ++) . fl
flavourString Dwarf = "debug_info"
flavourString FullyStatic = "fully_static"
flavourString ThreadSanitiser = "thread_sanitizer"
+ flavourString NoSplitSections = "no_split_sections"
-- The path to the docker image (just for linux builders)
dockerImage :: Arch -> Opsys -> Maybe String
@@ -792,24 +799,24 @@ jobs = Map.fromList $ concatMap flattenJobGroup $
, disableValidate (standardBuilds Amd64 (Linux Debian11))
-- We still build Deb9 bindists for now due to Ubuntu 18 and Linux Mint 19
-- not being at EOL until April 2023 and they still need tinfo5.
- , disableValidate (standardBuilds Amd64 (Linux Debian9))
+ , disableValidate (standardBuildsWithConfig Amd64 (Linux Debian9) (splitSectionsBroken vanilla))
, disableValidate (standardBuilds Amd64 (Linux Ubuntu2004))
- , disableValidate (standardBuilds Amd64 (Linux Centos7))
+ , disableValidate (standardBuildsWithConfig Amd64 (Linux Centos7) (splitSectionsBroken vanilla))
-- Fedora33 job is always built with perf so there's one job in the normal
-- validate pipeline which is built with perf.
, (standardBuildsWithConfig Amd64 (Linux Fedora33) releaseConfig)
-- 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 (standardBuilds Amd64 Windows)
- , disableValidate (standardBuildsWithConfig Amd64 Windows nativeInt)
+ , fastCI (standardBuildsWithConfig Amd64 Windows (splitSectionsBroken vanilla))
+ , disableValidate (standardBuildsWithConfig Amd64 Windows (splitSectionsBroken nativeInt))
, standardBuilds Amd64 Darwin
, allowFailureGroup (addValidateRule FreeBSDLabel (standardBuilds Amd64 FreeBSD13))
, standardBuilds AArch64 Darwin
, standardBuilds AArch64 (Linux Debian10)
, disableValidate (standardBuildsWithConfig AArch64 (Linux Debian10) llvm)
- , standardBuilds I386 (Linux Debian9)
- , standardBuildsWithConfig Amd64 (Linux Alpine) static
+ , standardBuildsWithConfig I386 (Linux Debian9) (splitSectionsBroken vanilla)
+ , standardBuildsWithConfig Amd64 (Linux Alpine) (splitSectionsBroken static)
, disableValidate (allowFailureGroup (standardBuildsWithConfig Amd64 (Linux Alpine) staticNativeInt))
, validateBuilds Amd64 (Linux Debian11) (crossConfig "aarch64-linux-gnu" (Emulator "qemu-aarch64 -L /usr/aarch64-linux-gnu") Nothing)
, validateBuilds Amd64 (Linux Debian11) (crossConfig "js-unknown-ghcjs" NoEmulatorNeeded (Just "emconfigure")
=====================================
.gitlab/jobs.yaml
=====================================
@@ -2046,7 +2046,7 @@
"XZ_OPT": "-9"
}
},
- "release-i386-linux-deb9-release": {
+ "release-i386-linux-deb9-release+no_split_sections": {
"after_script": [
".gitlab/ci.sh save_cache",
".gitlab/ci.sh clean",
@@ -2056,7 +2056,7 @@
"artifacts": {
"expire_in": "1 year",
"paths": [
- "ghc-i386-linux-deb9-release.tar.xz",
+ "ghc-i386-linux-deb9-release+no_split_sections.tar.xz",
"junit.xml"
],
"reports": {
@@ -2098,11 +2098,11 @@
],
"variables": {
"BIGNUM_BACKEND": "gmp",
- "BIN_DIST_NAME": "ghc-i386-linux-deb9-release",
- "BUILD_FLAVOUR": "release",
+ "BIN_DIST_NAME": "ghc-i386-linux-deb9-release+no_split_sections",
+ "BUILD_FLAVOUR": "release+no_split_sections",
"CONFIGURE_ARGS": "",
"IGNORE_PERF_FAILURES": "all",
- "TEST_ENV": "i386-linux-deb9-release",
+ "TEST_ENV": "i386-linux-deb9-release+no_split_sections",
"XZ_OPT": "-9"
}
},
@@ -2297,7 +2297,7 @@
"XZ_OPT": "-9"
}
},
- "release-x86_64-linux-alpine3_12-release+fully_static": {
+ "release-x86_64-linux-alpine3_12-release+fully_static+no_split_sections": {
"after_script": [
".gitlab/ci.sh save_cache",
".gitlab/ci.sh clean",
@@ -2307,7 +2307,7 @@
"artifacts": {
"expire_in": "1 year",
"paths": [
- "ghc-x86_64-linux-alpine3_12-release+fully_static.tar.xz",
+ "ghc-x86_64-linux-alpine3_12-release+fully_static+no_split_sections.tar.xz",
"junit.xml"
],
"reports": {
@@ -2349,18 +2349,18 @@
],
"variables": {
"BIGNUM_BACKEND": "gmp",
- "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-release+fully_static",
+ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-release+fully_static+no_split_sections",
"BROKEN_TESTS": "encoding004 T10458 ghcilink002 linker_unload_native",
- "BUILD_FLAVOUR": "release+fully_static",
+ "BUILD_FLAVOUR": "release+fully_static+no_split_sections",
"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",
+ "TEST_ENV": "x86_64-linux-alpine3_12-release+fully_static+no_split_sections",
"XZ_OPT": "-9"
}
},
- "release-x86_64-linux-centos7-release": {
+ "release-x86_64-linux-centos7-release+no_split_sections": {
"after_script": [
".gitlab/ci.sh save_cache",
".gitlab/ci.sh clean",
@@ -2370,7 +2370,7 @@
"artifacts": {
"expire_in": "1 year",
"paths": [
- "ghc-x86_64-linux-centos7-release.tar.xz",
+ "ghc-x86_64-linux-centos7-release+no_split_sections.tar.xz",
"junit.xml"
],
"reports": {
@@ -2412,12 +2412,12 @@
],
"variables": {
"BIGNUM_BACKEND": "gmp",
- "BIN_DIST_NAME": "ghc-x86_64-linux-centos7-release",
- "BUILD_FLAVOUR": "release",
+ "BIN_DIST_NAME": "ghc-x86_64-linux-centos7-release+no_split_sections",
+ "BUILD_FLAVOUR": "release+no_split_sections",
"CONFIGURE_ARGS": "",
"HADRIAN_ARGS": "--docs=no-sphinx",
"IGNORE_PERF_FAILURES": "all",
- "TEST_ENV": "x86_64-linux-centos7-release",
+ "TEST_ENV": "x86_64-linux-centos7-release+no_split_sections",
"XZ_OPT": "-9"
}
},
@@ -2601,7 +2601,7 @@
"XZ_OPT": "-9"
}
},
- "release-x86_64-linux-deb9-release": {
+ "release-x86_64-linux-deb9-release+no_split_sections": {
"after_script": [
".gitlab/ci.sh save_cache",
".gitlab/ci.sh clean",
@@ -2611,7 +2611,7 @@
"artifacts": {
"expire_in": "1 year",
"paths": [
- "ghc-x86_64-linux-deb9-release.tar.xz",
+ "ghc-x86_64-linux-deb9-release+no_split_sections.tar.xz",
"junit.xml"
],
"reports": {
@@ -2653,11 +2653,11 @@
],
"variables": {
"BIGNUM_BACKEND": "gmp",
- "BIN_DIST_NAME": "ghc-x86_64-linux-deb9-release",
- "BUILD_FLAVOUR": "release",
+ "BIN_DIST_NAME": "ghc-x86_64-linux-deb9-release+no_split_sections",
+ "BUILD_FLAVOUR": "release+no_split_sections",
"CONFIGURE_ARGS": "",
"IGNORE_PERF_FAILURES": "all",
- "TEST_ENV": "x86_64-linux-deb9-release",
+ "TEST_ENV": "x86_64-linux-deb9-release+no_split_sections",
"XZ_OPT": "-9"
}
},
@@ -2908,7 +2908,7 @@
"XZ_OPT": "-9"
}
},
- "release-x86_64-windows-int_native-release": {
+ "release-x86_64-windows-int_native-release+no_split_sections": {
"after_script": [
"bash .gitlab/ci.sh save_cache",
"bash .gitlab/ci.sh clean"
@@ -2917,7 +2917,7 @@
"artifacts": {
"expire_in": "1 year",
"paths": [
- "ghc-x86_64-windows-int_native-release.tar.xz",
+ "ghc-x86_64-windows-int_native-release+no_split_sections.tar.xz",
"junit.xml"
],
"reports": {
@@ -2955,8 +2955,8 @@
],
"variables": {
"BIGNUM_BACKEND": "native",
- "BIN_DIST_NAME": "ghc-x86_64-windows-int_native-release",
- "BUILD_FLAVOUR": "release",
+ "BIN_DIST_NAME": "ghc-x86_64-windows-int_native-release+no_split_sections",
+ "BUILD_FLAVOUR": "release+no_split_sections",
"CABAL_INSTALL_VERSION": "3.2.0.0",
"CONFIGURE_ARGS": "",
"GHC_VERSION": "9.2.2",
@@ -2964,11 +2964,11 @@
"IGNORE_PERF_FAILURES": "all",
"LANG": "en_US.UTF-8",
"MSYSTEM": "MINGW64",
- "TEST_ENV": "x86_64-windows-int_native-release",
+ "TEST_ENV": "x86_64-windows-int_native-release+no_split_sections",
"XZ_OPT": "-9"
}
},
- "release-x86_64-windows-release": {
+ "release-x86_64-windows-release+no_split_sections": {
"after_script": [
"bash .gitlab/ci.sh save_cache",
"bash .gitlab/ci.sh clean"
@@ -2977,7 +2977,7 @@
"artifacts": {
"expire_in": "1 year",
"paths": [
- "ghc-x86_64-windows-release.tar.xz",
+ "ghc-x86_64-windows-release+no_split_sections.tar.xz",
"junit.xml"
],
"reports": {
@@ -3015,8 +3015,8 @@
],
"variables": {
"BIGNUM_BACKEND": "gmp",
- "BIN_DIST_NAME": "ghc-x86_64-windows-release",
- "BUILD_FLAVOUR": "release",
+ "BIN_DIST_NAME": "ghc-x86_64-windows-release+no_split_sections",
+ "BUILD_FLAVOUR": "release+no_split_sections",
"CABAL_INSTALL_VERSION": "3.2.0.0",
"CONFIGURE_ARGS": "",
"GHC_VERSION": "9.2.2",
@@ -3024,7 +3024,7 @@
"IGNORE_PERF_FAILURES": "all",
"LANG": "en_US.UTF-8",
"MSYSTEM": "MINGW64",
- "TEST_ENV": "x86_64-windows-release",
+ "TEST_ENV": "x86_64-windows-release+no_split_sections",
"XZ_OPT": "-9"
}
},
=====================================
compiler/GHC/Driver/Session.hs
=====================================
@@ -2192,14 +2192,10 @@ dynamic_flags_deps = [
, make_ord_flag defGhcFlag "split-objs"
(NoArg $ addWarn "ignoring -split-objs")
+ -- N.B. We may someday deprecate this in favor of -fsplit-sections,
+ -- which has the benefit of also having a negating -fno-split-sections.
, make_ord_flag defGhcFlag "split-sections"
- (noArgM (\dflags -> do
- if platformHasSubsectionsViaSymbols (targetPlatform dflags)
- then do addWarn $
- "-split-sections is not useful on this platform " ++
- "since it always uses subsections via symbols. Ignoring."
- return dflags
- else return (gopt_set dflags Opt_SplitSections)))
+ (NoArg $ setGeneralFlag Opt_SplitSections)
-------- ghc -M -----------------------------------------------------
, make_ord_flag defGhcFlag "dep-suffix" (hasArg addDepSuffix)
@@ -3514,7 +3510,8 @@ fFlagsDeps = [
(addWarn "-compact-unwind is only implemented by the darwin platform. Ignoring.")
return dflags)),
flagSpec "show-error-context" Opt_ShowErrorContext,
- flagSpec "cmm-thread-sanitizer" Opt_CmmThreadSanitizer
+ flagSpec "cmm-thread-sanitizer" Opt_CmmThreadSanitizer,
+ flagSpec "split-sections" Opt_SplitSections
]
++ fHoleFlags
@@ -4800,6 +4797,13 @@ makeDynFlagsConsistent dflags
warn = "-dynamic-too is ignored when using -dynamic"
in loop dflags' warn
+ | gopt Opt_SplitSections dflags
+ , platformHasSubsectionsViaSymbols (targetPlatform dflags)
+ = let dflags' = gopt_unset dflags Opt_SplitSections
+ warn = "-fsplit-sections is not useful on this platform " ++
+ "since it uses subsections-via-symbols. Ignoring."
+ in loop dflags' warn
+
-- Via-C backend only supports unregisterised ABI. Switch to a backend
-- supporting it if possible.
| backendUnregisterisedAbiOnly (backend dflags) &&
=====================================
docs/users_guide/ghc_config.py.in
=====================================
@@ -1,6 +1,6 @@
extlinks = {
- 'ghc-ticket': ('https://gitlab.haskell.org/ghc/ghc/issues/%s', '#'),
- 'ghc-wiki': ('https://gitlab.haskell.org/ghc/ghc/wikis/%s', '#'),
+ 'ghc-ticket': ('https://gitlab.haskell.org/ghc/ghc/issues/%s', '%s'),
+ 'ghc-wiki': ('https://gitlab.haskell.org/ghc/ghc/wikis/%s', '#%s'),
}
libs_base_uri = '../libraries'
=====================================
docs/users_guide/phases.rst
=====================================
@@ -909,10 +909,12 @@ for example).
option for Apple's Linker (``-F`` already means something else for
GHC).
-.. ghc-flag:: -split-sections
+.. ghc-flag:: -fsplit-sections
+ -split-sections
:shortdesc: Split sections for link-time dead-code stripping
:type: dynamic
:category: linking
+ :reverse: -fno-split-sections
Place each generated function or data item into its own section in the
output file if the target supports arbitrary sections. The name of the
=====================================
hadrian/README.md
=====================================
@@ -164,6 +164,18 @@ build stage2:lib:text
build stage1:exe:haddock
```
+#### Choosing the compiler used to build Hadrian
+
+The `GHC` environment variable can be used to control which GHC is used to build hadrian. By
+default the version of GHC on your path is used to build hadrian.
+This can be a different version of GHC to the one you want to use as the boot compiler (which
+is selected during ./configure).
+
+```
+GHC=$(which ghc-9.4.2) ./hadrian/build
+-- hadrian is built using ghc-9.4.2
+```
+
#### Fast feedback using ghci
Running the `./hadrian/ghci` script will load the main compiler into
=====================================
hadrian/doc/flavours.md
=====================================
@@ -15,6 +15,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
<table>
<tr>
<th rowspan="3">Flavour</th>
+ <th rowspan="3">Split Sections</th>
<th colspan="8">Extra arguments</th>
</tr>
<tr>
@@ -35,6 +36,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
</tr>
<tr>
<th>default<br></td>
+ <td> </td>
<td>-O<br>-H32m<br></td>
<td>-O2<br>-H32m</td>
<td></td>
@@ -46,6 +48,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
</tr>
<tr>
<th>quick</td>
+ <td> </td>
<td>-O0<br>-H64m</td>
<td>-O0<br>-H64m</td>
<td></td>
@@ -57,6 +60,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
</tr>
<tr>
<th>quick-validate</td>
+ <td></td>
<td>-O0<br>-H64m<br>-Werror</td>
<td>-O0<br>-H64m<br>-Werror</td>
<td></td>
@@ -68,6 +72,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
</tr>
<tr>
<th>quick-debug</td>
+ <td></td>
<td>-O0<br>-H64m</td>
<td>-O0<br>-H64m</td>
<td></td>
@@ -79,6 +84,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
</tr>
<tr>
<th>quickest</td>
+ <td></td>
<td>-O0<br>-H64m</td>
<td>-O0<br>-H64m</td>
<td></td>
@@ -90,6 +96,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
</tr>
<tr>
<th>perf</td>
+ <td> Yes (on supported platforms) </td>
<td>-O<br>-H64m</td>
<td>-O<br>-H64m</td>
<td></td>
@@ -112,6 +119,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
</tr>
<tr>
<th>bench</td>
+ <td></td>
<td>-O<br>-H64m</td>
<td>-O<br>-H64m</td>
<td></td>
@@ -123,6 +131,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
</tr>
<tr>
<th>devel1</td>
+ <td></td>
<td>-O<br>-H64m</td>
<td>-O<br>-H64m</td>
<td></td>
@@ -134,6 +143,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
</tr>
<tr>
<th>devel2</td>
+ <td></td>
<td>-O<br>-H64m</td>
<td>-O<br>-H64m</td>
<td></td>
@@ -145,6 +155,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
</tr>
<tr>
<th>validate</td>
+ <td></td>
<td>-O0<br>-H64m</td>
<td>-fllvm-fill-undef-with-garbage</td>
<td></td>
@@ -156,6 +167,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
</tr>
<tr>
<th>slow-validate</td>
+ <td></td>
<td>-O0<br>-H64m</td>
<td>-fllvm-fill-undef-with-garbage</td>
<td></td>
@@ -167,6 +179,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
</tr>
<tr>
<th>static</td>
+ <td></td>
<td>-O<br>-H64m<br>-fPIC -static</td>
<td>-O<br>-H64m<br>-fPIC -static</td>
<td></td>
@@ -216,6 +229,10 @@ The supported transformers are listed below:
<td>Enable section splitting for all libraries (except for the GHC
library due to the long linking times that this causes).</td>
</tr>
+ <tr>
+ <td><code>no_split_sections</code></td>
+ <td>Disable section splitting for all libraries.</td>
+ </tr>
<tr>
<td><code>thread_sanitizer</code></td>
<td>Build the runtime system with ThreadSanitizer support</td>
=====================================
hadrian/doc/testsuite.md
=====================================
@@ -22,6 +22,19 @@ tested in CI. If you use an untested flavour such as "Quick" then you run the
risk that not all tests will pass. In particular you can rely on the `validate`
and `perf` flavours being tested but no others.
+## Building just the dependencies needed for the testsuite
+
+By default the testsuite is queried to work out what specific dependencies need to
+be built for tests. For example, some linter tests don't require anything to be built.
+If you wish to build all the targets for the testsuite before running any tests there is
+a special meta-target which builds all the dependencies you might need when running the testsuite.
+
+```
+build test:all_deps
+```
+
+
+
## Running only a subset of the testsuite
### Specific tests
=====================================
hadrian/hadrian.cabal
=====================================
@@ -112,6 +112,7 @@ executable hadrian
, Settings.Builders.Ld
, Settings.Builders.Make
, Settings.Builders.MergeObjects
+ , Settings.Builders.SplitSections
, Settings.Builders.RunTest
, Settings.Builders.Win32Tarballs
, Settings.Builders.Xelatex
=====================================
hadrian/src/Flavour.hs
=====================================
@@ -5,7 +5,7 @@ module Flavour
-- * Flavour transformers
, flavourTransformers
, addArgs
- , splitSections, splitSectionsIf
+ , splitSections
, enableThreadSanitizer
, enableDebugInfo, enableTickyGhc
, viaLlvmBackend
@@ -37,7 +37,6 @@ import Text.Parsec.Char as P
import Control.Monad.Except
import UserSettings
import Oracles.Flag
-import Oracles.Setting
flavourTransformers :: Map String (Flavour -> Flavour)
@@ -46,6 +45,7 @@ flavourTransformers = M.fromList
, "debug_info" =: enableDebugInfo
, "ticky_ghc" =: enableTickyGhc
, "split_sections" =: splitSections
+ , "no_split_sections" =: noSplitSections
, "thread_sanitizer" =: enableThreadSanitizer
, "llvm" =: viaLlvmBackend
, "profiled_ghc" =: enableProfiledGhc
@@ -181,31 +181,13 @@ enableHaddock =
]
-- | Transform the input 'Flavour' so as to build with
--- @-split-sections@ whenever appropriate. You can
--- select which package gets built with split sections
--- by passing a suitable predicate. If the predicate holds
--- for a given package, then @split-sections@ is used when
--- building it. Note that this transformer doesn't do anything
+-- @-split-sections@ whenever appropriate.
+-- Note that this transformer doesn't do anything
-- on darwin because on darwin platforms we always enable subsections
-- via symbols.
-splitSectionsIf :: (Package -> Bool) -> Flavour -> Flavour
-splitSectionsIf pkgPredicate = addArgs $ do
- pkg <- getPackage
- osx <- expr isOsxTarget
- not osx ? -- osx doesn't support split sections
- pkgPredicate pkg ? mconcat -- Only apply to these packages
- [ builder (Ghc CompileHs) ? arg "-split-sections"
- , builder MergeObjects ? ifM (expr isWinTarget)
- (pure ["-t", "driver/utils/merge_sections_pe.ld"])
- (pure ["-t", "driver/utils/merge_sections.ld"])
- ]
-
--- | Like 'splitSectionsIf', but with a fixed predicate: use
--- split sections for all packages but the GHC library.
-splitSections :: Flavour -> Flavour
-splitSections = splitSectionsIf (/=ghc)
--- Disable section splitting for the GHC library. It takes too long and
--- there is little benefit.
+splitSections, noSplitSections :: Flavour -> Flavour
+splitSections f = f { ghcSplitSections = True }
+noSplitSections f = f { ghcSplitSections = False }
-- | Build GHC and libraries with ThreadSanitizer support. You likely want to
-- configure with @--disable-large-address-space@ when using this.
=====================================
hadrian/src/Flavour/Type.hs
=====================================
@@ -43,6 +43,8 @@ data Flavour = Flavour {
-- | Build the GHC executable against the threaded runtime system.
ghcThreaded :: Stage -- ^ stage of the /built/ compiler
-> Bool,
+
+ ghcSplitSections :: Bool, -- ^ Whether to enable split sections
-- | Whether to build docs and which ones
-- (haddocks, user manual, haddock manual)
ghcDocs :: Action DocTargets }
=====================================
hadrian/src/Oracles/TestSettings.hs
=====================================
@@ -31,6 +31,7 @@ data TestSetting = TestHostOS
| TestGhcWithInterpreter
| TestGhcWithRtsLinker
| TestGhcUnregisterised
+ | TestGhcTablesNextToCode
| TestGhcWithSMP
| TestGhcDynamic
| TestGhcProfiled
@@ -61,6 +62,7 @@ testSetting key = do
TestGhcWithInterpreter -> "GhcWithInterpreter"
TestGhcWithRtsLinker -> "GhcWithRtsLinker"
TestGhcUnregisterised -> "GhcUnregisterised"
+ TestGhcTablesNextToCode -> "GhcTablesNextToCode"
TestGhcWithSMP -> "GhcWithSMP"
TestGhcDynamic -> "GhcDynamic"
TestGhcProfiled -> "GhcProfiled"
=====================================
hadrian/src/Rules/Test.hs
=====================================
@@ -82,6 +82,9 @@ inTreeOutTree inTree outTree = do
testsuiteDeps :: Rules ()
testsuiteDeps = do
root <- buildRootRules
+ "test:all_deps" ~> do
+ need ("test:ghc" : map cp_target checkPrograms)
+
"test:ghc" ~> inTreeOutTree
(\stg -> do
needTestsuitePackages stg
=====================================
hadrian/src/Settings/Builders/RunTest.hs
=====================================
@@ -145,7 +145,7 @@ outOfTreeCompilerArgs = do
withNativeCodeGen <- getBooleanSetting TestGhcWithNativeCodeGen
withInterpreter <- getBooleanSetting TestGhcWithInterpreter
unregisterised <- getBooleanSetting TestGhcUnregisterised
- tables_next_to_code <- getBooleanSetting TestGhcUnregisterised
+ tables_next_to_code <- getBooleanSetting TestGhcTablesNextToCode
withSMP <- getBooleanSetting TestGhcWithSMP
debugAssertions <- getBooleanSetting TestGhcDebugged
=====================================
hadrian/src/Settings/Builders/SplitSections.hs
=====================================
@@ -0,0 +1,36 @@
+-- | Settings required when split-sections is enabled.
+module Settings.Builders.SplitSections where
+
+import Expression
+import Packages
+import Settings
+import Flavour.Type
+
+import Oracles.Setting
+
+-- | Does it make sense to enable or disable split sections?
+splitSectionsArgs :: Args
+splitSectionsArgs = do
+ pkg <- getPackage
+ osx <- expr isOsxTarget
+ notSt0 <- notStage0
+ flav <- expr flavour
+ if ( ghcSplitSections flav
+ -- Flavour enables split-sections
+ && not osx
+ -- OS X doesn't support split sections
+ && notSt0
+ -- Disable for stage 0 because we aren't going to ship
+ -- the resulting binaries and consequently there is no
+ -- reason to minimize size.
+ && (pkg /= ghc)
+ -- Disable section splitting for the GHC library.
+ -- It takes too long and there is little benefit.
+ ) then
+ ( mconcat
+ [ builder (Ghc CompileHs) ? arg "-fsplit-sections"
+ , builder MergeObjects ? ifM (expr isWinTarget)
+ (pure ["-t", "driver/utils/merge_sections_pe.ld"])
+ (pure ["-t", "driver/utils/merge_sections.ld"])
+ ]
+ ) else mempty
=====================================
hadrian/src/Settings/Default.hs
=====================================
@@ -41,6 +41,7 @@ import Settings.Builders.Ar
import Settings.Builders.Ld
import Settings.Builders.Make
import Settings.Builders.MergeObjects
+import Settings.Builders.SplitSections
import Settings.Builders.RunTest
import Settings.Builders.Xelatex
import Settings.Packages
@@ -243,6 +244,7 @@ defaultFlavour = Flavour
, ghcDebugged = const False
, ghcThreaded = const True
, ghcDebugAssertions = const False
+ , ghcSplitSections = False
, ghcDocs = cmdDocsArgs }
-- | Default logic for determining whether to build
@@ -279,6 +281,7 @@ defaultBuilderArgs = mconcat
, validateBuilderArgs
, xelatexBuilderArgs
, win32TarballsArgs
+ , splitSectionsArgs
-- Generic builders from the Hadrian library:
, builder (Sphinx HtmlMode ) ? Hadrian.Builder.Sphinx.args HtmlMode
, builder (Sphinx LatexMode) ? Hadrian.Builder.Sphinx.args LatexMode
=====================================
hadrian/src/Settings/Flavours/Performance.hs
=====================================
@@ -6,7 +6,7 @@ import {-# SOURCE #-} Settings.Default
-- Please update doc/flavours.md when changing this file.
performanceFlavour :: Flavour
-performanceFlavour = defaultFlavour
+performanceFlavour = splitSections $ defaultFlavour
{ name = "perf"
, args = defaultBuilderArgs <> performanceArgs <> defaultPackageArgs }
=====================================
libraries/base/Data/OldList.hs
=====================================
@@ -1266,15 +1266,42 @@ permutations :: [a] -> [[a]]
-- Related discussions:
-- * https://mail.haskell.org/pipermail/haskell-cafe/2021-December/134920.html
-- * https://mail.haskell.org/pipermail/libraries/2007-December/008788.html
+--
+-- Verification of the equivalences of the auxiliary functions with Liquid Haskell:
+-- https://github.com/ucsd-progsys/liquidhaskell/blob/b86fb5b/tests/ple/pos/Permutations.hs
permutations xs0 = xs0 : perms xs0 []
where
+ -- | @perms ts is@ is equivalent to
+ --
+ -- > concat
+ -- > [ interleave {(ts!!n)} {(drop (n+1)} ts) xs []
+ -- > | n <- [0..length ts - 1]
+ -- > , xs <- permutations (reverse (take n ts) ++ is)
+ -- > ]
+ --
+ -- @{(ts!!n)}@ and @{(drop (n+1)}@ denote the values of variables @t@ and @ts@ which
+ -- appear free in the definition of @interleave@ and @interleave'@.
perms :: forall a. [a] -> [a] -> [[a]]
perms [] _ = []
perms (t:ts) is = foldr interleave (perms ts (t:is)) (permutations is)
where
+ -- @interleave {t} {ts} xs r@ is equivalent to
+ --
+ -- > [ insertAt n t xs ++ ts | n <- [0..length xs - 1] ] ++ r
+ --
+ -- where
+ --
+ -- > insertAt n y xs = take n xs ++ y : drop n xs
+ --
interleave :: [a] -> [[a]] -> [[a]]
interleave xs r = let (_,zs) = interleave' id xs r in zs
+ -- @interleave' f ys r@ is equivalent to
+ --
+ -- > ( ys ++ ts
+ -- > , [ f (insertAt n t ys ++ ts) | n <- [0..length ys - 1] ] ++ r
+ -- > )
+ --
interleave' :: ([a] -> b) -> [a] -> [b] -> ([a], [b])
interleave' _ [] r = (ts, r)
interleave' f (y:ys) r = let (us,zs) = interleave' (f . (y:)) ys r
=====================================
utils/check-exact/ExactPrint.hs
=====================================
@@ -15,6 +15,7 @@
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE UndecidableInstances #-} -- For the (StmtLR GhcPs GhcPs (LocatedA (body GhcPs))) ExactPrint instance
+{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
module ExactPrint
(
@@ -2938,7 +2939,7 @@ instance ExactPrint (HsExpr GhcPs) where
exact (HsUntypedBracket an (DecBrL a e)) = do
an0 <- markEpAnnLMS an lidl AnnOpen (Just "[d|")
- an1 <- markEpAnnL an lidl AnnOpenC
+ an1 <- markEpAnnL an0 lidl AnnOpenC
e' <- markAnnotated e
an2 <- markEpAnnL an1 lidl AnnCloseC
an3 <- markEpAnnL an2 lidl AnnCloseQ -- "|]"
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5cff237e9736ed069b1e9222ed130f7881662c8a...afe7820203ad101fb527295ce01bde77509d1693
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5cff237e9736ed069b1e9222ed130f7881662c8a...afe7820203ad101fb527295ce01bde77509d1693
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/20230104/11bf804f/attachment-0001.html>
More information about the ghc-commits
mailing list