Skip to content
Snippets Groups Projects
  1. Feb 28, 2025
    • Cheng Shao's avatar
      ci: update wasm jobs configuration · 266a1536
      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)
      266a1536
    • Matthew Pickering's avatar
      Update alpine release job to 3.20 · 5220d425
      Matthew Pickering authored and Cheng Shao's avatar Cheng Shao committed
      alpine 3.20 was recently released and uses a new python and sphinx
      toolchain which could be useful to test.
      
      (cherry picked from commit 7bcda869)
      5220d425
    • Cheng Shao's avatar
      hadrian: add the host_fully_static flavour transformer · 6852ffb7
      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)
      6852ffb7
    • Cheng Shao's avatar
      hadrian: re-enable PIC for gmp on wasm · 27aaa2de
      Cheng Shao authored
      This commit re-enables --with-pic=yes configuration option of gmp when
      building for wasm, given we're about to include support for shared
      libraries, TH and ghci.
      
      (cherry picked from commit 775410fd)
      27aaa2de
    • Cheng Shao's avatar
      hadrian: fix CFLAGS for gmp shared objs on wasm · 8d777d67
      Cheng Shao authored
      This commit adds -fvisibility=default to CFLAGS of gmp when building
      for wasm. This is required to generate the ghc-bignum shared library
      without linking errors. Clang defaults to -fvisibility=hidden for wasm
      targets, which will cause issues when a symbol is expected to be
      exported in a shared library but without explicit visibility attribute
      annotation.
      
      (cherry picked from commit c247f2ee)
      8d777d67
    • Cheng Shao's avatar
      hadrian: enable internal-interpreter for ghc-bin stage0 · 8d805552
      Cheng Shao authored
      This commit enables internal-interpreter flag for ghc-bin even when
      compiling stage0, as long as target supports ghci. It enables ghci
      functionality for cross targets that support ghci, since cross ghc-bin
      is really stage0.
      
      (cherry picked from commit 577c1819)
      8d805552
    • Cheng Shao's avatar
      hadrian: disable internal-interpreter of ghc library when cross compiling · 9f81b8d9
      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)
      9f81b8d9
    • Cheng Shao's avatar
      hadrian: use targetSupportsRPaths predicate · 7829cafd
      Cheng Shao authored
      This commit changes the hostSupportsRPaths predicate to
      targetSupportsRPaths and use that to decide whether to pass
      RPATH-related link-time options. It's not applied to stage0, we should
      just use the default link-time options of stageBoot ghc.
      
      (cherry picked from commit a6a82cdb)
      7829cafd
    • Cheng Shao's avatar
      rts: fix conflicting StgRun definitions on wasm · 1806cb7b
      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)
      1806cb7b
    • Cheng Shao's avatar
      rts: don't build predefined GloblRegs for wasm PIC mode · 6543f8e2
      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)
      6543f8e2
    • Cheng Shao's avatar
      rts: drop interpretBCO support from non-dyn ways on wasm · 414685cb
      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)
      414685cb
    • Cheng Shao's avatar
      rts: correct stale link in comment · 0d74db21
      Cheng Shao authored
      (cherry picked from commit 0d0a16a8)
      0d74db21
    • Cheng Shao's avatar
      rts: add __wrapped_freeJSVal · 12874c2c
      Cheng Shao authored
      This commit wraps imported freeJSVal in a __wrapped_freeJSVal C
      function for wasm backend RTS. In general, wasm imports are only
      supposed to be directly called by C; they shouldn't be used as
      function pointers, which confuses wasm-ld at link-time when generating
      shared libraries.
      
      (cherry picked from commit 33d9db17)
      12874c2c
    • Cheng Shao's avatar
      rts: rename prelude.js to prelude.mjs · c6d2c6ae
      Cheng Shao authored
      This commit renames prelude.js to prelude.mjs for wasm backend rts
      jsbits, and slightly adjusts the jsbits contents. This is for
      preparing the implementation of dyld.mjs that contains wasm dynamic
      linker logic, which needs to import prelude.mjs as a proper ESM
      module.
      
      (cherry picked from commit 71a471e7)
      c6d2c6ae
    • Cheng Shao's avatar
      ghc-internal: add missing CPPs for wasm · 31ce4868
      Cheng Shao authored
      This patch adds some missing CPP guards to ghc-internal, given those
      functions are non existent on wasm and would cause linking issues.
      
      (cherry picked from commit a998f69d)
      31ce4868
    • Cheng Shao's avatar
      ghci: use plain malloc for mkConInfoTable on non-TNTC platforms · 664f737a
      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)
      664f737a
    • Cheng Shao's avatar
      ghci: mitigate host/target word size mismatch in BCOByteArray serialization · 30fca14e
      Cheng Shao authored
      This patch mitigates a severe host/target word size mismatch issue in
      BCOByteArray serialization logic introduced since !12142, see added
      note for detailed explanation.
      
      (cherry picked from commit 90891962)
      (cherry picked from commit 86059632)
      (cherry picked from commit 30d12c46)
      30fca14e
    • Cheng Shao's avatar
      Drop obsolete libffi Makefile · 217f3ebc
      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)
      217f3ebc
    • Cheng Shao's avatar
      hadrian: remove unused ghciWithDebugger field from flavour config · 6938ee4c
      Cheng Shao authored
      This patch removes the ghciWithDebugger field from flavour config
      since it's actually not used anywhere.
      
      (cherry picked from commit c6e5fd3d)
      6938ee4c
    • Cheng Shao's avatar
      driver: fix runWorkerLimit on wasm · 0764f349
      Cheng Shao authored
      This commit fixes link-time unresolved symbol errors for sem_open etc
      on wasm, by making runWorkerLimit always behave single-threaded. This
      avoids introducing the jobserver logic into the final wasm module and
      thus avoids referencing the posix semaphore symbols.
      
      (cherry picked from commit ceca9efb)
      0764f349
    • Cheng Shao's avatar
      git: remove a.out and include it in .gitignore · d67a817b
      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)
      d67a817b
    • Cheng Shao's avatar
      ghci: fix isMinTTY.h casing for Windows targets · f6fe1dd5
      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)
      f6fe1dd5
    • Cheng Shao's avatar
      testsuite: remove undesired -fasm flag from test ways · 88cf0b89
      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)
      88cf0b89
    • Cheng Shao's avatar
      testsuite: bump T17572 timeout on wasm32 · fea2265b
      Cheng Shao authored
      (cherry picked from commit 64fba310)
      fea2265b
    • Cheng Shao's avatar
      rts: replace ad-hoc MYTASK_USE_TLV with proper CC_SUPPORTS_TLS · e54772b4
      Cheng Shao authored
      This patch replaces the ad-hoc `MYTASK_USE_TLV` with the
      `CC_SUPPORTS_TLS` macro. If TLS support is detected by autoconf, then
      we should use that for managing `myTask` in the threaded RTS.
      
      (cherry picked from commit f3017dd3)
      e54772b4
    • Cheng Shao's avatar
      rts: cleanup inlining logic · dc6ab654
      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)
      dc6ab654
    • Cheng Shao's avatar
      testsuite: skip objc-hi/objcxx-hi when cross compiling · 0b784e67
      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)
      0b784e67
    • Cheng Shao's avatar
      testsuite: bump T7653 timeout for wasm · 9d72670d
      Cheng Shao authored
      (cherry picked from commit 2eee65e1)
      9d72670d
    • Cheng Shao's avatar
      compiler: remove unused CompilerInfo/LinkerInfo types · 9d8390d4
      Cheng Shao authored
      This patch removes CompilerInfo/LinkerInfo types from the compiler
      since they aren't actually used anywhere.
      
      (cherry picked from commit 98ad1ea5)
      9d8390d4
    • Cheng Shao's avatar
      testsuite: mark T7773 as fragile on wasm · 49b98d30
      Cheng Shao authored
      (cherry picked from commit ae50a8eb)
      49b98d30
    • Cheng Shao's avatar
      compiler: fix -ddump-cmm-raw when compiling .cmm · a056e89d
      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)
      a056e89d
    • Cheng Shao's avatar
      configure: do not set LLC/OPT/LLVMAS fallback values when FIND_LLVM_PROG fails · a0e12d2c
      Cheng Shao authored
      When configure fails to find LLC/OPT/LLVMAS within supported version
      range, it used to set "llc"/"opt"/"clang" as fallback values. This
      behavior is particularly troublesome when the user has llc/opt/clang
      with other versions in their PATH and run the testsuite, since hadrian
      will incorrectly assume have_llvm=True and pass that to the testsuite
      driver, resulting in annoying optllvm test failures (#23186). If
      configure determines llc/opt/clang wouldn't work, then we shouldn't
      pretend it'll work at all, and the bindist configure will invoke
      FIND_LLVM_PROG check again at install time anyway.
      
      (cherry picked from commit 4eb5ad09)
      a0e12d2c
    • Cheng Shao's avatar
      hadrian: handle findExecutable "" gracefully · c4df1a23
      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)
      c4df1a23
    • Cheng Shao's avatar
      utils: add hie.yaml config file for ghc-config · 7208e63b
      Cheng Shao authored
      Add hie.yaml to ghc-config project directory so it can be edited using
      HLS.
      
      (cherry picked from commit 7eda4bd2)
      7208e63b
    • Cheng Shao's avatar
      compiler: remove ArchWasm32 special case in cmmDoCmmSwitchPlans · 9184a31b
      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)
      9184a31b
    • Cheng Shao's avatar
      testsuite: mark process005 as fragile on JS · ecfaba63
      Cheng Shao authored
      (cherry picked from commit fd47e2e3)
      ecfaba63
    • Cheng Shao's avatar
      driver: build C/C++ with -ffunction-sections -fdata-sections when split sections is enabled · 9bb65428
      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)
      9bb65428
    • Cheng Shao's avatar
      hadrian: build C/C++ with split sections when enabled · 9fc3bb9e
      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)
      9fc3bb9e
    • Cheng Shao's avatar
      testsuite: bump MultiLayerModulesDefsGhciReload timeout to 10x · fd08d62e
      Cheng Shao authored
      (cherry picked from commit e17f2df9)
      fd08d62e
    • Cheng Shao's avatar
      testsuite: don't attempt to detect host cpu features when testing cross ghc · 83b27c80
      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)
      83b27c80
Loading