Skip to content
Snippets Groups Projects
  1. May 07, 2024
    • Arsen Arsenović's avatar
      Split out the C-- preprocessor, and make it pass -g0 · 25b0b404
      Arsen Arsenović authored and Marge Bot's avatar Marge Bot committed
      Previously, C-- was processed with the C preprocessor program.  This
      means that it inherited flags passed via -optc.  A flag that is somewhat
      often passed through -optc is -g.  At certain -g levels (>=2), GCC
      starts emitting defines *after* preprocessing, for the purposes of
      debug info generation.  This is not useful for the C-- compiler, and, in
      fact, causes lexer errors.  We can suppress this effect (safely, if
      supported) via -g0.
      
      As a workaround, in older versions of GCC (<=10), GCC only emitted
      defines if a certain set of -g*3 flags was passed.  Newer versions check
      the debug level.  For the former, we filter out those -g*3 flags and,
      for the latter, we specify -g0 on top of that.
      
      As a compatible and effective solution, this change adds a C--
      preprocessor distinct from the C compiler and preprocessor, but that
      keeps its flags.  The command line produced for C-- preprocessing now
      looks like:
      
        $pgmCmmP $optCs_without_g3 $g0_if_supported $optCmmP
      
      Closes: #24474
      25b0b404
  2. May 05, 2024
    • John Ericson's avatar
      Substitute bindist files with Hadrian not configure · adba68e7
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      
      The `ghc-toolchain` overhaul will eventually replace all this stuff with
      something much more cleaned up, but I think it is still worth making
      this sort of cleanup in the meantime so other untanglings and dead code
      cleaning can procede.
      
      I was able to delete a fair amount of dead code doing this too.
      
      `LLVMTarget_CPP` is renamed to / merged with `LLVMTarget` because it
      wasn't actually turned into a valid CPP identifier. (Original to
      1345c7cc, actually.)
      
      Progress on #23966
      
      Co-Authored-By: default avatarSylvain Henry <hsyl20@gmail.com>
      adba68e7
  3. Apr 27, 2024
    • Rodrigo Mesquita's avatar
      bindist: Fix xattr cleaning · 64feadcd
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      The original fix (725343aa) was incorrect because it used the shell
      bracket syntax which is the quoting syntax in autoconf, making the test
      for existence be incorrect and therefore `xattr` was never run.
      
      Fixes #24554
      64feadcd
  4. Apr 17, 2024
    • Teo Camarasu's avatar
      Fix documentation preview from doc-tarball job · 9f99126a
      Teo Camarasu authored and Marge Bot's avatar Marge Bot committed
      - Include all the .html files and assets in the job artefacts
      - Include all the .pdf files in the job artefacts
      - Mark the artefact as an "exposed" artefact meaning it turns up in the
        UI.
      
      Resolves #24651
      9f99126a
  5. Mar 27, 2024
    • Rodrigo Mesquita's avatar
      bindist: Clean xattrs of bin and lib at configure time · bf65a7c3
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      For issue #21506, we started cleaning the extended attributes of
      binaries and libraries from the bindist *after* they were installed to
      workaround notarisation (#17418), as part of `make install`.
      
      However, the `ghc-toolchain` binary that is now shipped with the bindist
      must be run at `./configure` time. Since we only cleaned the xattributes
      of the binaries and libs after they were installed, in some situations
      users would be unable to run `ghc-toolchain` from the bindist, failing
      at configure time (#24554).
      
      In this commit we move the xattr cleaning logic to the configure script.
      
      Fixes #24554
      bf65a7c3
  6. Feb 21, 2024
    • Matthew Pickering's avatar
      configure: Correctly set --target flag for linker opts · ab9281a2
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4
      arguments, when it only takes 3 arguments. Instead we need to use the
      `FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags.
      
      Actually fixes #24414
      ab9281a2
    • Ben Gamari's avatar
      hadrian: Generate HSC2HS_EXTRAS variable in bindist installation · efcbad2d
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      We must generate the hsc2hs wrapper at bindist installation time since
      it must contain `--lflag` and `--cflag` arguments which depend upon the
      installation path.
      
      The solution here is to substitute these variables in the configure
      script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in
      the install rules.
      
      Fixes #24050.
      efcbad2d
  7. Feb 08, 2024
    • Matthew Pickering's avatar
      Use specific clang assembler when compiling with -fllvm · ab533e71
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      There are situations where LLVM will produce assembly which older gcc
      toolchains can't handle. For example on Deb10, it seems that LLVM >= 13
      produces assembly which the default gcc doesn't support.
      
      A more robust solution in the long term is to require a specific LLVM
      compatible assembler when using -fllvm.
      
      Fixes #16354
      ab533e71
  8. Feb 07, 2024
  9. Dec 13, 2023
    • Moritz Angermann's avatar
      Drop hard Xcode dependency · a3ee3b99
      Moritz Angermann authored and Marge Bot's avatar Marge Bot committed
      XCODE_VERSION calls out to `xcodebuild`, which is only available
      when having `Xcode` installed. The CommandLineTools are not
      sufficient. To install Xcode, you must have an apple id to download
      the Xcode.xip from apple.
      
      We do not use xcodebuild anywhere in our build explicilty. At best
      it appears to be a proxy for checking the linker or the compiler.
      These should rather be done with
      ```
      xcrun ld -version
      ```
      or similar, and not by proxy through Xcode. The CLR should be
      sufficient for building software on macOS.
      a3ee3b99
  10. Nov 29, 2023
  11. Nov 15, 2023
    • Rodrigo Mesquita's avatar
      darwin: Fix single_module is obsolete warning · e6c803f7
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      In XCode 15's linker, -single_module is the default and otherwise
      passing it as a flag results in a warning being raised:
      
          ld: warning: -single_module is obsolete
      
      This patch fixes this warning by, at configure time, determining whether
      the linker supports -single_module (which is likely false for all
      non-darwin linkers, and true for darwin linkers in previous versions of
      macOS), and using that information at runtime to decide to pass or not
      the flag in the invocation.
      
      Fixes #24168
      e6c803f7
    • Rodrigo Mesquita's avatar
      Suppress duplicate librares linker warning of new macOS linker · e98051a5
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      Fixes #24167
      
      XCode 15 introduced a new linker which warns on duplicate libraries being
      linked. To disable this warning, we pass -Wl,-no_warn_duplicate_libraries as
      suggested by Brad King in CMake issue #25297.
      
      This flag isn't necessarily available to other linkers on darwin, so we must
      only configure it into the CC linker arguments if valid.
      e98051a5
  12. Oct 22, 2023
  13. Aug 23, 2023
  14. Aug 16, 2023
  15. Aug 05, 2023
    • Luite Stegeman's avatar
      JS: Improve compatibility with recent emsdk · aa07402e
      Luite Stegeman authored
      The JavaScript code in libraries/base/jsbits/base.js had some
      hardcoded offsets for fields in structs, because we expected
      the layout of the data structures to remain unchanged. Emsdk
      3.1.42 changed the layout of the stat struct, breaking this
      assumption, and causing code in .hsc files accessing the
      stat struct to fail.
      
      This patch improves compatibility with recent emsdk by
      removing the assumption that data layouts stay unchanged:
      
          1. offsets of fields in structs used by JavaScript code are
             now computed by the configure script, so both the .js and
             .hsc files will automatically use the new layout if anything
             changes.
          2. the distrib/configure script checks that the emsdk version
             on a user's system is the same version that a bindist was
             booted with, to avoid data layout inconsistencies
      
      See #23641
      aa07402e
  16. Jul 24, 2023
    • Rodrigo Mesquita's avatar
      Ship ghc-toolchain in the bindist · 38e795ff
      Rodrigo Mesquita authored and Matthew Pickering's avatar Matthew Pickering committed
      Add the ghc-toolchain binary to the binary distribution we ship to
      users, and teach the bindist configure to use the existing ghc-toolchain.
      38e795ff
    • Rodrigo Mesquita's avatar
      ghc-toolchain: Toolchain Selection · 31dcd26c
      Rodrigo Mesquita authored and Matthew Pickering's avatar Matthew Pickering committed
      This commit integrates ghc-toolchain, the brand new way of configuring
      toolchains for GHC, with the Hadrian build system, with configure, and
      extends and improves the first iteration of ghc-toolchain.
      
      The general overview is
      
      * We introduce a program invoked `ghc-toolchain --triple=...` which, when run,
        produces a file with a `Target`. A `GHC.Toolchain.Target.Target`
        describes the properties of a target and the toolchain (executables
        and configured flags) to produce code for that target
      
      * Hadrian was modified to read Target files, and will both
        * Invoke the toolchain configured in the Target file as needed
        * Produce a `settings` file for GHC based on the Target file for that stage
      
      * `./configure` will invoke ghc-toolchain to generate target files, but
        it will also generate target files based on the flags configure itself
        configured (through `.in` files that are substituted)
      
        * By default, the Targets generated by configure are still (for now) the ones used by Hadrian
      
        * But we additionally validate the Target files generated by
          ghc-toolchain against the ones generated by configure, to get a head
          start on catching configuration bugs before we transition
          completely.
      
        * When we make that transition, we will want to drop a lot of the
          toolchain configuration logic from configure, but keep it otherwise.
      
      * For each compiler stage we should have 1 target file (up to a stage compiler we can't run in our machine)
        * We just have a HOST target file, which we use as the target for stage0
        * And a TARGET target file, which we use for stage1 (and later stages, if not cross compiling)
        * Note there is no BUILD target file, because we only support cross compilation where BUILD=HOST
        * (for more details on cross-compilation see discussion on !9263)
      
      See also
      * Note [How we configure the bundled windows toolchain]
      * Note [ghc-toolchain consistency checking]
      * Note [ghc-toolchain overview]
      
      Ticket: #19877
      MR: !9263
      31dcd26c
  17. Jun 29, 2023
    • Rodrigo Mesquita's avatar
      Configure MergeObjs supports response files rather than Ld · fcf310e7
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      The previous configuration script to test whether Ld supported response
      files was
      * Incorrect (see #23542)
      * Used, in practice, to check if the *merge objects tool* supported
        response files.
      
      This commit modifies the macro to run the merge objects tool (rather
      than Ld), using a response file, and checking the result with $NM
      
      Fixes #23542
      fcf310e7
    • Rodrigo Mesquita's avatar
      Configure CPP into settings · 5ffc7d7b
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      There is a distinction to be made between the Haskell Preprocessor and
      the C preprocessor. The former is used to preprocess Haskell files,
      while the latter is used in C preprocessing such as Cmm files.
      
      In practice, they are both the same program (usually the C compiler) but
      invoked with different flags.
      
      Previously we would, at configure time, configure the haskell
      preprocessor and save the configuration in the settings file, but,
      instead of doing the same for CPP, we had hardcoded in GHC that the CPP
      program was either `cc -E` or `cpp`.
      
      This commit fixes that asymmetry by also configuring CPP at configure
      time, and tries to make more explicit the difference between HsCpp and
      Cpp (see Note [Preprocessing invocations]).
      
      Note that we don't use the standard CPP and CPPFLAGS to configure Cpp,
      but instead use the non-standard --with-cpp and --with-cpp-flags.
      The reason is that autoconf sets CPP to "$CC -E", whereas we expect the
      CPP command to be configured as a standalone executable rather than a
      command. These are symmetrical with --with-hs-cpp and
      --with-hs-cpp-flags.
      
      Cleanup: Hadrian no longer needs to pass the CPP configuration for CPP
               to be C99 compatible through -optP, since we now configure that
               into settings.
      
      Closes #23422
      5ffc7d7b
  18. Jun 28, 2023
    • Rodrigo Mesquita's avatar
      Stop configuring unused Ld command in `settings` · ecdc4353
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      GHC has no direct dependence on the linker. Rather, we depend upon the C
      compiler for linking and an object-merging program (which is typically
      `ld`) for production of GHCi objects and merging of C stubs into final
      object files.
      
      Despite this, for historical reasons we still recorded information about
      the linker into `settings`. Remove these entries from `settings`,
      `hadrian/cfg/system.config`, as well as the `configure` logic
      responsible for this information.
      
      Closes #23566.
      ecdc4353
  19. Jun 27, 2023
  20. Jun 13, 2023
    • Rodrigo Mesquita's avatar
      Configure -Qunused-arguments instead of hardcoding it · c6741e72
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      When GHC invokes clang, it currently passes -Qunused-arguments to
      discard warnings resulting from GHC using multiple options that aren't
      used.
      
      In this commit, we configure -Qunused-arguments into the Cc options
      instead of checking if the compiler is clang at runtime and hardcoding
      the flag into GHC.
      
      This is part of the effort to centralise toolchain information in
      toolchain target files at configure time with the end goal of a runtime
      retargetable GHC.
      
      This also means we don't need to call getCompilerInfo ever, which
      improves performance considerably (see !10589).
      
      Metric Decrease:
          PmSeriesG
          T10421
          T11303b
          T12150
          T12227
          T12234
          T12425
          T13035
          T13253-spj
          T13386
          T15703
          T16875
          T17836b
          T17977
          T17977b
          T18140
          T18282
          T18304
          T18698a
          T18698b
          T18923
          T20049
          T21839c
          T3064
          T5030
          T5321FD
          T5321Fun
          T5837
          T6048
          T9020
          T9198
          T9872d
          T9961
      c6741e72
  21. May 30, 2023
    • Ben Gamari's avatar
      Move via-C flags into GHC · 6629f1c5
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      These were previously hardcoded in configure (with no option for
      overriding them) and simply passed onto ghc through the settings file.
      
      Since configure already guarantees gcc supports those flags, we simply
      move them into GHC.
      6629f1c5
  22. May 11, 2023
    • Rodrigo Mesquita's avatar
      Move "target has RTS linker" out of settings · c17bb82f
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      We move the "target has RTS linker" information out of configure into a
      predicate in GHC, and remove this option from the settings file where it
      is unnecessary -- it's information statically known from the platform.
      
      Note that previously we would consider `powerpc`s and `s390x`s other
      than `powerpc-ibm-aix*` and `s390x-ibm-linux` to have an RTS linker,
      but the RTS linker supports neither platform.
      
      Closes #23361
      c17bb82f
  23. Mar 06, 2023
  24. Jan 28, 2023
  25. Jan 10, 2023
  26. Jan 06, 2023
  27. Dec 21, 2022
  28. Nov 11, 2022
  29. Aug 26, 2022
  30. Aug 07, 2022
    • Ben Gamari's avatar
      hadrian: Don't use mk/config.mk.in · afa584a3
      Ben Gamari authored
      Ultimately we want to drop mk/config.mk so here I extract the bits
      needed by the Hadrian bindist installation logic into a Hadrian-specific
      file. While doing this I fixed binary distribution installation, #21901.
      afa584a3
    • Ben Gamari's avatar
      hadrian: Fix binary distribution install attributes · 09bca1de
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Previously we would use plain `cp` to install various parts of the
      binary distribution. However, `cp`'s behavior w.r.t. file attributes is
      quite unclear; for this reason it is much better to rather use
      `install`.
      
      Fixes #21965.
      09bca1de
  31. Jul 18, 2022
Loading