[Git][ghc/ghc][wip/various-hadrian-fixes] packaging: Build perf builds with -split-sections

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Dec 15 00:59:54 UTC 2022



Ben Gamari pushed to branch wip/various-hadrian-fixes at Glasgow Haskell Compiler / GHC


Commits:
e8069bef by Matthew Pickering at 2022-12-14T19:59:33-05: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

- - - - -


6 changed files:

- .gitlab-ci.yml
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- compiler/GHC/Driver/Session.hs
- hadrian/doc/flavours.md
- hadrian/src/Settings/Flavours/Performance.hs


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -501,7 +501,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:
@@ -525,7 +525,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/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,23 +799,23 @@ 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)
-     , 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
=====================================
@@ -1869,7 +1869,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",
@@ -1879,7 +1879,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": {
@@ -1921,11 +1921,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"
     }
   },
@@ -2120,7 +2120,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",
@@ -2130,7 +2130,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": {
@@ -2172,18 +2172,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",
@@ -2193,7 +2193,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": {
@@ -2235,12 +2235,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"
     }
   },
@@ -2424,7 +2424,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",
@@ -2434,7 +2434,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": {
@@ -2476,11 +2476,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"
     }
   },
@@ -2731,7 +2731,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"
@@ -2740,7 +2740,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": {
@@ -2778,8 +2778,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",
@@ -2787,11 +2787,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"
@@ -2800,7 +2800,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": {
@@ -2838,8 +2838,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",
@@ -2847,7 +2847,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
=====================================
@@ -4797,7 +4797,7 @@ makeDynFlagsConsistent dflags
 
  | gopt Opt_SplitSections dflags
  , platformHasSubsectionsViaSymbols (targetPlatform dflags)
-    = let dflags' = gopt_unuset dflags Opt_SplitSections
+    = 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


=====================================
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>


=====================================
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 }
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e8069bef782ba42ffbf71d1fcec8899c8a540625

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e8069bef782ba42ffbf71d1fcec8899c8a540625
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/20221214/80ad0a8e/attachment-0001.html>


More information about the ghc-commits mailing list