Skip to content
Snippets Groups Projects
  1. Feb 06, 2025
    • Cheng Shao's avatar
      testsuite: bump T17572 timeout · 4fdff7d3
      Cheng Shao authored
      (cherry picked from commit 94673d41)
      (cherry picked from commit f13a2942)
      (cherry picked from commit 97551107)
      4fdff7d3
    • Cheng Shao's avatar
      ci: update wasm jobs configuration · 07d98334
      Cheng Shao authored
      This commit bumps ci-image revision to use updated wasm toolchain, and
      use host_fully_static instead of fully_static for wasm jobs so to
      ensure wasm shared libraries can be properly built.
      
      (cherry picked from commit 5043507c)
      (cherry picked from commit 0ae9f0d5)
      (cherry picked from commit 91fe5d97)
      07d98334
    • Cheng Shao's avatar
      hadrian: add the host_fully_static flavour transformer · c7ebad0f
      Cheng Shao authored
      This commit adds the host_fully_static flavour transformer to hadrian,
      which ensures stage0 is fully statically linked while still permitting
      stage1 libdir to contain shared libraries. This is intended to be used
      by the wasm backend to build portable linux bindists that contain wasm
      shared libraries.
      
      (cherry picked from commit b45080a3)
      (cherry picked from commit 91c0dbd4)
      (cherry picked from commit e077d581)
      c7ebad0f
    • Cheng Shao's avatar
      hadrian: disable internal-interpreter of ghc library when cross compiling · 01228288
      Cheng Shao authored
      This commit disable the internal-interpreter flag of ghc library when
      cross compiling, only external interpreter works in such cases.
      
      (cherry picked from commit f232c872)
      (cherry picked from commit 4e7d0cee)
      (cherry picked from commit 624335b2)
      01228288
    • Cheng Shao's avatar
      rts: fix conflicting StgRun definitions on wasm · 343c7313
      Cheng Shao authored
      This commit fixes conflicting StgRun definition when building dynamic
      ways of RTS for wasm in unregisterised mode.
      
      (cherry picked from commit bef94bde)
      (cherry picked from commit 6f844296)
      (cherry picked from commit e7806b12)
      343c7313
    • Cheng Shao's avatar
      rts: don't build predefined GloblRegs for wasm PIC mode · 9e8be49a
      Cheng Shao authored
      This commit wraps the predefined GlobalRegs in Wasm.S under a CPP
      guard to prevent building for PIC mode. When building dynamic ways of
      RTS, the wasm globals that represent STG GlobalRegs will be created
      and supplied by dyld.mjs. The current wasm dylink convention doesn't
      properly support exporting relocatable wasm globals at all, any wasm
      global exported by a .so is assumed to be a GOT.mem entry.
      
      (cherry picked from commit 98a32ec5)
      (cherry picked from commit cc67ef51)
      (cherry picked from commit 49d340a6)
      9e8be49a
    • Cheng Shao's avatar
      rts: drop interpretBCO support from non-dyn ways on wasm · f3413b7a
      Cheng Shao authored
      This commit drops interpretBCO support from non dynamic rts ways on
      wasm. The bytecode interpreter is only useful when the RTS linker also
      works, and on wasm it only works for dynamic ways anyway. An
      additional benefit of dropping interpretBCO is reduction in code size
      of linked wasm modules, especially since interpretBCO references
      ffi_call which is an auto-generated large function in libffi-wasm and
      unused by most user applications.
      
      (cherry picked from commit 90a35c41)
      (cherry picked from commit 7a16cf7c)
      (cherry picked from commit 5fcee705)
      f3413b7a
    • Cheng Shao's avatar
      ghci: use plain malloc for mkConInfoTable on non-TNTC platforms · 1804f12f
      Cheng Shao authored
      This patch avoids using mmap() to allocate executable memory for
      mkConInfoTable on platforms without tables-next-to-code, see added
      comment for explanation.
      
      (cherry picked from commit 839ac52e)
      (cherry picked from commit e54e3335)
      (cherry picked from commit 23cab8a1)
      1804f12f
    • Cheng Shao's avatar
      Drop obsolete libffi Makefile · fb1bb9cc
      Cheng Shao authored
      This patch drops obsolete libffi Makefile from the tree, given it's
      completely unused since removal of make build system in !7094.
      
      (cherry picked from commit 3fe843c7)
      (cherry picked from commit 81ddb1e7)
      (cherry picked from commit cde02d8d)
      fb1bb9cc
    • Cheng Shao's avatar
      hadrian: remove unused ghciWithDebugger field from flavour config · 6209333d
      Cheng Shao authored
      This patch removes the ghciWithDebugger field from flavour config
      since it's actually not used anywhere.
      
      (cherry picked from commit c6e5fd3d)
      (cherry picked from commit 022d7565)
      (cherry picked from commit f8c17232)
      6209333d
    • Cheng Shao's avatar
      git: remove a.out and include it in .gitignore · 4f70ca63
      Cheng Shao authored
      a.out is a configure script byproduct. It was mistakenly checked into
      the tree in !13118. This patch removes it, and include it in
      .gitignore to prevent a similar error in the future.
      
      (cherry picked from commit f0408eeb)
      (cherry picked from commit 8abb0f19)
      (cherry picked from commit 1e852126)
      4f70ca63
    • Cheng Shao's avatar
      ghci: fix isMinTTY.h casing for Windows targets · 026f250b
      Cheng Shao authored
      This commit fixes isMinTTY.h casing in isMinTTY.c that's compiled for
      Windows targets. While this looks harmless given Windows filesystems
      are case-insensitive by default, it does cause a compilation warning
      with recent versions of clang, so we might as well fix the casing:
      
      ```
      driver\ghci\isMinTTY.c:10:10: error:
           warning: non-portable path to file '"isMinTTY.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
         |
      10 | #include "isMINTTY.h"
         |          ^
      
       #include "isMINTTY.h"
               ^~~~~~~~~~~~
               "isMinTTY.h"
      1 warning generated.
      ```
      
      (cherry picked from commit 3a145315)
      (cherry picked from commit 7bcc3dc6)
      (cherry picked from commit 244fa5a2)
      026f250b
    • Cheng Shao's avatar
      testsuite: remove undesired -fasm flag from test ways · 0c24c478
      Cheng Shao authored
      This patch removes the -fasm flag from test ways, except ways like
      optasm that explicitly state they are meant to be compiled with NCG
      backend. Most test ways should use the default codegen backend, and
      the precense of -fasm can cause stderr mismatches like this when GHC
      is configured with the unregisterised backend:
      
      ```
      --- /dev/null
      +++ /tmp/ghctest-3hydwldj/test   spaces/testsuite/tests/profiling/should_compile/prof-late-cc.run/prof-late-cc.comp.stderr.normalised
      @@ -0,0 +1,2 @@
      +when making flags consistent: warning: [GHC-74335] [-Winconsistent-flags (in -Wdefault)]
      +    Target platform uses unregisterised ABI, so compiling via C
      *** unexpected failure for prof-late-cc(prof_no_auto)
      ```
      
      This has been breaking the wasm unreg nightly job since !12595 landed.
      
      (cherry picked from commit 88488847)
      (cherry picked from commit f603ac9c)
      (cherry picked from commit 4977e2a6)
      0c24c478
    • Cheng Shao's avatar
      testsuite: bump T17572 timeout on wasm32 · 7f072dfc
      Cheng Shao authored
      (cherry picked from commit 64fba310)
      (cherry picked from commit b35707a9)
      (cherry picked from commit ead1c3cc)
      7f072dfc
    • Cheng Shao's avatar
      rts: use page sized mblocks on wasm · 75956767
      Cheng Shao authored
      This patch changes mblock size to page size on wasm. It allows us to
      simplify our wasi-libc fork, makes it much easier to test third party
      libc allocators like emmalloc/mimalloc, as well as experimenting with
      threaded RTS in wasm.
      
      (cherry picked from commit 558353f4)
      (cherry picked from commit f3ea9fb8)
      (cherry picked from commit f747805f)
      75956767
    • Cheng Shao's avatar
      rts: cleanup inlining logic · 8579d06b
      Cheng Shao authored
      This patch removes pre-C11 legacy code paths related to
      INLINE_HEADER/STATIC_INLINE/EXTERN_INLINE macros, ensure EXTERN_INLINE
      is treated as static inline in most cases (fixes #24945), and also
      corrects the comments accordingly.
      
      (cherry picked from commit 35a64220)
      (cherry picked from commit 241f401d)
      (cherry picked from commit 562d9ad7)
      8579d06b
    • Cheng Shao's avatar
      testsuite: skip objc-hi/objcxx-hi when cross compiling · ab6990e6
      Cheng Shao authored
      objc-hi/objcxx-hi should be skipped when cross compiling. The existing
      opsys('darwin') predicate only asserts the host system is darwin but
      tells us nothing about the target, hence the oversight.
      
      (cherry picked from commit 595c0894)
      (cherry picked from commit 5273d3d0)
      (cherry picked from commit 6babf56f)
      ab6990e6
    • Cheng Shao's avatar
      testsuite: bump T7653 timeout for wasm · 677c2c55
      Cheng Shao authored
      (cherry picked from commit 2eee65e1)
      (cherry picked from commit 3f7b718f)
      (cherry picked from commit 77cc78eb)
      677c2c55
    • Cheng Shao's avatar
      testsuite: mark T7773 as fragile on wasm · c98aeaf1
      Cheng Shao authored
      (cherry picked from commit ae50a8eb)
      (cherry picked from commit b7e93bc9)
      (cherry picked from commit f2388ebc)
      c98aeaf1
    • Cheng Shao's avatar
      hadrian: build in-tree GMP with malloc-notreentrant on wasm32 · a3dde201
      Cheng Shao authored
      This patch makes hadrian build in-tree GMP with the
      --enable-alloca=malloc-notreentrant configure option. We will only
      need malloc-reentrant when we have threaded RTS and SMP support on
      wasm32, which will take some time to happen, before which we should
      use malloc-notreentrant to avoid undesired runtime overhead.
      
      (cherry picked from commit 06277d56)
      (cherry picked from commit 0f9a8aaf)
      (cherry picked from commit 3c4f945a)
      a3dde201
    • Cheng Shao's avatar
      hadrian: disable in-tree gmp fft code path for wasm32 · 993e2946
      Cheng Shao authored
      This patch disables in-tree GMP FFT code paths for wasm32 target in
      order to give up some performance of multiplying very large operands
      in exchange for reduced code size.
      
      (cherry picked from commit 1a32f828)
      (cherry picked from commit 097ea6e2)
      (cherry picked from commit 0dac58e1)
      993e2946
    • Cheng Shao's avatar
      hadrian: disable PIC for in-tree GMP on wasm32 · c7faa919
      Cheng Shao authored
      This patch disables PIC for in-tree GMP on wasm32 target. Enabling PIC
      unconditionally adds undesired code size and runtime overhead for
      wasm32.
      
      (cherry picked from commit f9c1ae12)
      (cherry picked from commit 5f728fc4)
      (cherry picked from commit f45b02a8)
      c7faa919
    • Cheng Shao's avatar
      compiler: fix -ddump-cmm-raw when compiling .cmm · 5bc4f5e3
      Cheng Shao authored
      This patch fixes missing -ddump-cmm-raw output when compiling .cmm,
      which is useful for debugging cmm related codegen issues.
      
      (cherry picked from commit 6346c669)
      (cherry picked from commit e5a1dd43)
      (cherry picked from commit 0ddc87c4)
      5bc4f5e3
    • Cheng Shao's avatar
      hadrian: handle findExecutable "" gracefully · 2ee67f47
      Cheng Shao authored
      hadrian may invoke findExecutable "" at run-time due to a certain
      program is not found by configure script. Which is fine and
      findExecutable is supposed to return Nothing in this case. However, on
      Windows there's a directory bug that throws an exception (see
      https://github.com/haskell/directory/issues/180), so we might as well
      use a wrapper for findExecutable and handle exceptions gracefully.
      
      (cherry picked from commit 1e5752f6)
      (cherry picked from commit 78150bfc)
      (cherry picked from commit 10a74dcd)
      2ee67f47
    • Cheng Shao's avatar
      utils: add hie.yaml config file for ghc-config · e5cf1a36
      Cheng Shao authored
      Add hie.yaml to ghc-config project directory so it can be edited using
      HLS.
      
      (cherry picked from commit 7eda4bd2)
      (cherry picked from commit ed81a875)
      (cherry picked from commit 9108734a)
      e5cf1a36
    • Cheng Shao's avatar
      compiler: remove ArchWasm32 special case in cmmDoCmmSwitchPlans · 5338ff59
      Cheng Shao authored
      This patch removes special consideration for ArchWasm32 in
      cmmDoCmmSwitchPlans, which means the compiler will now disable
      cmmImplementSwitchPlans for wasm unreg backend, just like unreg
      backend of other targets. We enabled it in the past to workaround some
      compile-time panic in older versions of LLVM, but those panics are no
      longer present, hence no need to keep this workaround.
      
      (cherry picked from commit bf0737c0)
      (cherry picked from commit 8bd28cf2)
      (cherry picked from commit 2e15c41c)
      5338ff59
    • Cheng Shao's avatar
      driver: build C/C++ with -ffunction-sections -fdata-sections when split sections is enabled · 54da5271
      Cheng Shao authored
      When -fsplit-sections is passed to GHC, pass -ffunction-sections
      -fdata-sections to gcc/clang when building C/C++. Previously,
      -fsplit-sections was only respected by the NCG/LLVM backends, but not
      the unregisterised backend; the GHC driver did not pass
      -fdata-sections and -ffunction-sections to the C compiler, which
      resulted in excessive executable sizes.
      
      Fixes #23381.
      
      -------------------------
      Metric Decrease:
          size_hello_artifact
          size_hello_unicode
      -------------------------
      
      (cherry picked from commit 02b1f91e)
      (cherry picked from commit 74cdf564)
      (cherry picked from commit 03da9015)
      54da5271
    • Cheng Shao's avatar
      hadrian: build C/C++ with split sections when enabled · da656acd
      Cheng Shao authored
      When split sections is enabled, ensure -fsplit-sections is passed to
      GHC as well when invoking GHC to compile C/C++; and pass
      -ffunction-sections -fdata-sections to gcc/clang when compiling C/C++
      with the hadrian Cc builder. Fixes #23381.
      
      (cherry picked from commit 0958937e)
      (cherry picked from commit 7d5a22c2)
      (cherry picked from commit 6de1c17d)
      da656acd
    • Cheng Shao's avatar
      testsuite: bump MultiLayerModulesDefsGhciReload timeout to 10x · bdc39308
      Cheng Shao authored
      (cherry picked from commit e17f2df9)
      (cherry picked from commit 9a2f3313)
      (cherry picked from commit 08acf27f)
      bdc39308
    • Cheng Shao's avatar
      compiler: avoid saving foreign call target to local when there are no caller-save GlobalRegs · 8dff5b23
      Cheng Shao authored
      This patch makes the STG->Cmm backend avoid saving foreign call target
      to local when there are no caller-save GlobalRegs.
      
      Since 321941a8, when we lower a
      foreign call, we unconditionally save the foreign call target to a
      temporary local first, then rely on cmmSink to clean it up later,
      which only happens with -fcmm-sink (implied by -O) and not in
      unoptimized code.
      
      And this is troublesome for the wasm backend NCG, which needs to infer
      a foreign call target symbol's type signature from the Cmm call site.
      Previously, the NCG has been emitting incorrect type signatures for
      unoptimized code, which happens to work with `wasm-ld` most of the
      time, but this is never future-proof against upstream toolchain
      updates, and it causes horrible breakages when LTO objects are
      included in linker input. Hence this patch.
      
      (cherry picked from commit 8dd8a076)
      (cherry picked from commit 2b2a3db8)
      (cherry picked from commit de7c02b5)
      8dff5b23
    • Cheng Shao's avatar
      testsuite: don't attempt to detect host cpu features when testing cross ghc · 6acf211c
      Cheng Shao authored
      The testsuite driver CPU feature detection logic only detects host CPU
      and only makes sense when we are not testing a cross GHC.
      
      (cherry picked from commit c4c6d714)
      (cherry picked from commit 07641012)
      (cherry picked from commit 68bc5d72)
      6acf211c
    • Cheng Shao's avatar
      testsuite: fix T17920 for wasm backend · e8623449
      Cheng Shao authored
      T17920 was marked as fragile on wasm before; it can be trivially fixed
      by avoiding calling variadic printf() in cmm.
      
      (cherry picked from commit 7b4c1998)
      (cherry picked from commit c4060ce3)
      (cherry picked from commit b64e0f63)
      e8623449
    • Cheng Shao's avatar
      autoconf: remove unused context diff check · ea853040
      Cheng Shao authored
      This patch removes redundant autoconf check for the context diff
      program given it isn't actually been used anywhere, especially since
      make removal.
      
      (cherry picked from commit b7bcf729)
      (cherry picked from commit 0e9d2a0f)
      (cherry picked from commit 00d58ab2)
      ea853040
    • Cheng Shao's avatar
      rts: fix I/O manager compilation errors for win32 target · cae5a3b3
      Cheng Shao authored
      This patch fixes I/O manager compilation errors for win32 target
      discovered when cross-compiling to win32 using recent clang:
      
      ```
      rts/win32/ThrIOManager.c:117:7: error:
           error: call to undeclared function 'is_io_mng_native_p'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
            117 |   if (is_io_mng_native_p ()) {
                |       ^
          |
      117 |   if (is_io_mng_native_p ()) {
          |       ^
      
      1 error generated.
      `x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1)
      
      rts/fs.c:143:28: error:
           error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
            143 | int setErrNoFromWin32Error () {
                |                            ^
                |                             void
          |
      143 | int setErrNoFromWin32Error () {
          |                            ^
      
      1 error generated.
      `x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1)
      
      rts/win32/ConsoleHandler.c:227:9: error:
           error: call to undeclared function 'interruptIOManagerEvent'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
            227 |         interruptIOManagerEvent ();
                |         ^
          |
      227 |         interruptIOManagerEvent ();
          |         ^
      
      rts/win32/ConsoleHandler.c:227:9: error:
           note: did you mean 'getIOManagerEvent'?
          |
      227 |         interruptIOManagerEvent ();
          |         ^
      
      rts/include/rts/IOInterface.h:27:10: error:
           note: 'getIOManagerEvent' declared here
             27 | void *   getIOManagerEvent  (void);
                |          ^
         |
      27 | void *   getIOManagerEvent  (void);
         |          ^
      
      1 error generated.
      `x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1)
      
      rts/win32/ConsoleHandler.c:196:9: error:
           error: call to undeclared function 'setThreadLabel'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
            196 |         setThreadLabel(cap, t, "signal handler thread");
                |         ^
          |
      196 |         setThreadLabel(cap, t, "signal handler thread");
          |         ^
      
      rts/win32/ConsoleHandler.c:196:9: error:
           note: did you mean 'postThreadLabel'?
          |
      196 |         setThreadLabel(cap, t, "signal handler thread");
          |         ^
      
      rts/eventlog/EventLog.h:118:6: error:
           note: 'postThreadLabel' declared here
            118 | void postThreadLabel(Capability    *cap,
                |      ^
          |
      118 | void postThreadLabel(Capability    *cap,
          |      ^
      
      1 error generated.
      `x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1)
      ```
      
      (cherry picked from commit 710665bd)
      (cherry picked from commit 9499ed96)
      (cherry picked from commit e19bea4a)
      cae5a3b3
    • Cheng Shao's avatar
      testsuite: bump PartialDownSweep timeout to 5x on wasm32 · afabf77c
      Cheng Shao authored
      (cherry picked from commit b1e0c313)
      (cherry picked from commit 34882192)
      (cherry picked from commit 94adf918)
      afabf77c
    • Cheng Shao's avatar
      autoconf: remove obsolete patch detection · c325e98c
      Cheng Shao authored
      This commit removes obsolete deletection logic of the patch command
      from autoconf scripts, given we no longer need to patch anything in
      the GHC build process.
      
      (cherry picked from commit 71f28958)
      (cherry picked from commit 1e77ded1)
      (cherry picked from commit e5506d09)
      c325e98c
    • Cheng Shao's avatar
      hadrian: remove obsolete Patch logic · 5c7b632a
      Cheng Shao authored
      This commit removes obsolete Patch logic from hadrian, given we no
      longer need to patch the gmp tarball when building in-tree GMP.
      
      (cherry picked from commit 65b4b92f)
      (cherry picked from commit 92065500)
      (cherry picked from commit e3d00525)
      5c7b632a
    • Cheng Shao's avatar
      ghc-bignum: remove obsolete ln script · bb440214
      Cheng Shao authored
      This commit removes an obsolete ln script in ghc-bignum/gmp. See
      060251c2 for its original intention,
      but it's been obsolete for a long time, especially since the removal
      of the make build system. Hence the house cleaning.
      
      (cherry picked from commit c62dc317)
      (cherry picked from commit 5f4848c0)
      (cherry picked from commit 5b9561d6)
      bb440214
    • Cheng Shao's avatar
      rts: assert pointer is indeed heap allocated in Bdescr() · d60121e9
      Cheng Shao authored
      This commit adds an assertion to Bdescr() to assert the pointer is
      indeed heap allocated. This is useful to rule out RTS bugs that
      attempt to access non-existent block descriptor of a static closure, #24492
      being one such example.
      
      (cherry picked from commit d19441d7)
      (cherry picked from commit 8af2c3fd)
      d60121e9
    • Cheng Shao's avatar
      rts: expose HeapAlloc.h as public header · f226e778
      Cheng Shao authored
      This commit exposes HeapAlloc.h as a public header. The intention is
      to expose HEAP_ALLOCED/HEAP_ALLOCED_GC, so they can be used in
      assertions in other public headers, and they may also be useful for
      user code.
      
      (cherry picked from commit dedcf102)
      (cherry picked from commit 8d38b450)
      f226e778
Loading