Skip to content
Snippets Groups Projects
  1. Mar 26, 2025
  2. Jan 14, 2025
  3. Dec 18, 2024
    • Arsen Arsenović's avatar
      Split out the C-- preprocessor, and make it pass -g0 · 5a8790db
      Arsen Arsenović authored and Andreas Klebinger's avatar Andreas Klebinger 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: ghc/ghc#24474
      (cherry picked from commit 25b0b404)
      5a8790db
    • Serge S. Gulin's avatar
      JS: Add special preprocessor for js files due of needing to keep jsdoc comments (fixes #24602) · 68da8237
      Serge S. Gulin authored and Andreas Klebinger's avatar Andreas Klebinger committed
      Our js files have defined google closure compiler types at jsdoc entries but these jsdoc entries are removed by cpp preprocessor. I considered that reusing them in javascript-backend would be a nice thing. Right now haskell processor uses `-traditional` option to deal with comments and `//` operators.
      But now there are following compiler options: `-C` and `-CC`.
      You can read about them at GCC (see https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#index-CC) and CLang (see https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-CC).
      It seems that `-CC` works better for javascript jsdoc than `-traditional`.
      At least it leaves `/* ... */` comments w/o changes.
      
      (cherry picked from commit 83eb10da)
      68da8237
  4. May 09, 2024
  5. Apr 25, 2024
  6. Mar 10, 2024
  7. Mar 01, 2024
  8. Feb 27, 2024
  9. Feb 08, 2024
    • John Ericson's avatar
      Generate LLVM min/max bound policy via Hadrian · c37931b3
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      Per #23966, I want the top-level configure to only generate
      configuration data for Hadrian, not do any "real" tasks on its own.
      This is part of that effort --- one less file generated by it.
      
      (It is still done with a `.in` file, so in a future world non-Hadrian
      also can easily create this file.)
      
      Split modules:
      
      - GHC.CmmToLlvm.Config
      - GHC.CmmToLlvm.Version
      - GHC.CmmToLlvm.Version.Bounds
      - GHC.CmmToLlvm.Version.Type
      
      This also means we can get rid of the silly `unused.h` introduced in
      !6803 / 7dfcab2f as temporary kludge.
      
      Part of #23966
      c37931b3
    • 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
    • Ben Gamari's avatar
      Move `base` to `ghc-internal` · 44f6557a
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Here we move a good deal of the implementation of `base` into a new
      package, `ghc-internal` such that it can be evolved independently
      from the user-visible interfaces of `base`.
      
      While we want to isolate implementation from interfaces, naturally, we
      would like to avoid turning `base` into a mere set of module re-exports.
      However, this is a non-trivial undertaking for a variety of reasons:
      
       * `base` contains numerous known-key and wired-in things, requiring
         corresponding changes in the compiler
      
       * `base` contains a significant amount of C code and corresponding
         autoconf logic, which is very fragile and difficult to break apart
      
       * `base` has numerous import cycles, which are currently dealt with via
         carefully balanced `hs-boot` files
      
       * We must not break existing users
      
      To accomplish this migration, I tried the following approaches:
      
      * [Split-GHC.Base]: Break apart the GHC.Base knot to allow incremental
        migration of modules into ghc-internal: this knot is simply too
        intertwined to be easily pulled apart, especially given the rather
        tricky import cycles that it contains)
      
      * [Move-Core]: Moving the "core" connected component of base (roughly
        150 modules) into ghc-internal. While the Haskell side of this seems
        tractable, the C dependencies are very subtle to break apart.
      
      * [Move-Incrementally]:
      
        1. Move all of base into ghc-internal
        2. Examine the module structure and begin moving obvious modules (e.g.
           leaves of the import graph) back into base
        3. Examine the modules remaining in ghc-internal, refactor as necessary
           to facilitate further moves
        4. Go to (2) iterate until the cost/benefit of further moves is
           insufficient to justify continuing
        5. Rename the modules moved into ghc-internal to ensure that they don't
           overlap with those in base
        6. For each module moved into ghc-internal, add a shim module to base
           with the declarations which should be exposed and any requisite
           Haddocks (thus guaranteeing that base will be insulated from changes
           in the export lists of modules in ghc-internal
      
      Here I am using the [Move-Incrementally] approach, which is empirically
      the least painful of the unpleasant options above
      
      Bumps haddock submodule.
      
      Metric Decrease:
          haddock.Cabal
          haddock.base
      Metric Increase:
          MultiComponentModulesRecomp
          T16875
          size_hello_artifact
      44f6557a
  10. Feb 03, 2024
    • Rodrigo Mesquita's avatar
      Work around autotools setting C11 standard in CC/CXX · cdddeb0f
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      In autoconf >=2.70, C11 is set by default for $CC and $CXX via the
      -std=...11 flag. In this patch, we split the "-std" flag out of the $CC
      and $CXX variables, which we traditionally assume to be just the
      executable name/path, and move it to $CFLAGS/$CXXFLAGS instead.
      
      Fixes #24324
      cdddeb0f
  11. 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
  12. 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
  13. Oct 22, 2023
  14. Oct 18, 2023
  15. Oct 12, 2023
  16. Oct 11, 2023
    • John Ericson's avatar
      Split `FP_CHECK_PTHREADS` and move part to RTS configure · 58f3babf
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      `NEED_PTHREAD_LIB` is unused since
      36093407 (part of the make build
      system), and so is no longer defined.
      
      Progress towards #17191
      58f3babf
    • John Ericson's avatar
      RTS configure: Move over `eventfd` check · 809e7c2d
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      This check is for the RTS part of the event manager and has a
      corresponding part in `base`.
      
      All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it
      belongs in the RTS configure and should be safe to move without
      modification.
      
      Progress towards #17191
      809e7c2d
    • John Ericson's avatar
      RTS configure: Move over misc function checks · cc5ec2bd
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      These are for general use in the RTS.
      
      All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it
      belongs in the RTS configure and should be safe to move without
      modification.
      
      Progress towards #17191
      cc5ec2bd
    • John Ericson's avatar
      RTS configure: Move over `__thread` check · 41130a65
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      This used by (@bgamari thinks) the `GCThread` abstraction in the RTS.
      
      All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it
      belongs in the RTS configure and should be safe to move without
      modification.
      
      Progress towards #17191
      41130a65
    • John Ericson's avatar
      RTS configure: Move over mem management checks · b7df0732
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      These are for heap allocation, a strictly RTS concern.
      
      All of this should boil down to `AC_DEFINE` not `AC_SUBST`, so it
      belongs in the RTS configure and should be safe to move without
      modification.
      
      The RTS configure one has a new
      ```
      AC_CHECK_SIZEOF([void *])
      ```
      that the top-level configure version didn't have, so that
      `ac_cv_sizeof_void_p` is defined. Once more code is moved over in latter
      commits, that can go away.
      
      Progress towards #17191
      b7df0732
Loading