[Git][ghc/ghc][master] 2 commits: Add necessary flag for js linking

Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 1d99d3e4 by maralorn at 2025-06-12T03:47:39-04:00 Add necessary flag for js linking - - - - - 974d5734 by maralorn at 2025-06-12T03:47:39-04:00 Don’t use additional linker flags to detect presence of -fno-pie in configure.ac This mirrors the behavior of ghc-toolchain - - - - - 3 changed files: - m4/fp_gcc_supports_no_pie.m4 - m4/fptools_set_c_ld_flags.m4 - utils/ghc-toolchain/src/GHC/Toolchain/Tools/Link.hs Changes: ===================================== m4/fp_gcc_supports_no_pie.m4 ===================================== @@ -7,9 +7,9 @@ AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE], AC_REQUIRE([AC_PROG_CC]) AC_MSG_CHECKING([whether CC supports -no-pie]) echo 'int main() { return 0; }' > conftest.c - "$CC" $CONF_GCC_CC_OPTS_STAGE2 -c conftest.c + "$CC" -c conftest.c # Some GCC versions only warn when passed an unrecognized flag. - if "$CC" $CONF_GCC_LINKER_OPTS_STAGE2 -no-pie -Werror conftest.o -o conftest > conftest.txt 2>&1 && ! grep -i unrecognized conftest.txt > /dev/null 2>&1; then + if "$CC" -no-pie -Werror conftest.o -o conftest > conftest.txt 2>&1 && ! grep -i unrecognized conftest.txt > /dev/null 2>&1; then CONF_GCC_SUPPORTS_NO_PIE=YES AC_MSG_RESULT([yes]) else ===================================== m4/fptools_set_c_ld_flags.m4 ===================================== @@ -109,6 +109,9 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS], $2="$$2 -mcmodel=medium" ;; + javascript*) + $3="$$3 -sEXPORTED_RUNTIME_METHODS=HEAP8,HEAPU8" + esac AC_MSG_RESULT([done]) ===================================== utils/ghc-toolchain/src/GHC/Toolchain/Tools/Link.hs ===================================== @@ -324,6 +324,10 @@ addPlatformDepLinkFlags archOs cc ccLink0 = do ArchOS ArchPPC OSAIX -> -- We need `-D_THREAD_SAFE` to unlock the thread-local `errno`. return $ ccLink2 & over _prgFlags (++["-D_THREAD_SAFE","-Wl,-bnotextro"]) + ArchOS ArchJavaScript OSGhcjs -> + -- Since https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#407---0... + -- the emcc linker does not export the HEAP8 memory view which is used by the js RTS by default anymore. + return $ ccLink2 & _prgFlags %++ "-sEXPORTED_RUNTIME_METHODS=HEAP8,HEAPU8" _ -> return ccLink2 View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e2467dbd01bd55a5cd279f628d18bde... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e2467dbd01bd55a5cd279f628d18bde... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)