[Git][ghc/ghc][master] 2 commits: compiler: make .wasm the default executable extension on wasm32

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Sat Dec 17 13:08:12 UTC 2022



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
da3f1e91 by Cheng Shao at 2022-12-17T08:07:51-05:00
compiler: make .wasm the default executable extension on wasm32

Following convention as in other wasm toolchains. Fixes #22594.

- - - - -
ad21f4ef by Cheng Shao at 2022-12-17T08:07:51-05:00
ci: support hello.wasm in ci.sh cross testing logic

- - - - -


3 changed files:

- .gitlab/ci.sh
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Linker/Static/Utils.hs


Changes:

=====================================
.gitlab/ci.sh
=====================================
@@ -608,6 +608,10 @@ function test_hadrian() {
     install_bindist _build/bindist/ghc-*/ "$instdir"
     echo 'main = putStrLn "hello world"' > expected
     run "$test_compiler" -package ghc "$TOP/.gitlab/hello.hs" -o hello
+    # Despite "-o hello", ghc may output something like hello.exe or
+    # hello.wasm depending on the backend. For the time being let's
+    # just move it to hello before proceeding to running it.
+    mv hello.wasm hello || true
     ${CROSS_EMULATOR:-} ./hello > actual
     run diff expected actual
   elif [[ -n "${REINSTALL_GHC:-}" ]]; then


=====================================
compiler/GHC/Driver/Make.hs
=====================================
@@ -788,9 +788,10 @@ guessOutputFile = modifySession $ \env ->
                   -- we must add the .exe extension unconditionally here, otherwise
                   -- when name has an extension of its own, the .exe extension will
                  -- not be added by GHC.Driver.Pipeline.exeFileName.  See #2248
-                 !name' <- if platformOS platform == OSMinGW32
-                           then fmap (<.> "exe") name
-                           else name
+                 !name' <- case platformArchOS platform of
+                             ArchOS _ OSMinGW32  -> fmap (<.> "exe") name
+                             ArchOS ArchWasm32 _ -> fmap (<.> "wasm") name
+                             _ -> name
                  mainModuleSrcPath' <- mainModuleSrcPath
                  -- #9930: don't clobber input files (unless they ask for it)
                  if name' == mainModuleSrcPath'


=====================================
compiler/GHC/Linker/Static/Utils.hs
=====================================
@@ -19,6 +19,7 @@ exeFileName (ArchOS arch os) staticLink output_fn
   | Just s <- output_fn = if
       | OSMinGW32      <- os   -> s <?.> "exe"
       | ArchJavaScript <- arch -> s <?.> "jsexe"
+      | ArchWasm32     <- arch -> s <?.> "wasm"
       | staticLink             -> s <?.> "a"
       | otherwise              -> s
   | otherwise = if
@@ -28,4 +29,3 @@ exeFileName (ArchOS arch os) staticLink output_fn
       | otherwise              -> "a.out"
  where s <?.> ext | null (takeExtension s) = s <.> ext
                   | otherwise              = s
-



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d1431cc06597b38d876a518e7769f04dcd2c0f32...ad21f4efe6882ca0929db6bd331db174a36e41aa

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d1431cc06597b38d876a518e7769f04dcd2c0f32...ad21f4efe6882ca0929db6bd331db174a36e41aa
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221217/c64e05b6/attachment-0001.html>


More information about the ghc-commits mailing list