diff options
author | Cheng Shao <terrorjack@type.dance> | 2022-12-13 11:37:16 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-12-17 08:07:51 -0500 |
commit | da3f1e91a353f7fe37b3a25144f99c84d4a8dd70 (patch) | |
tree | 2cc94ae3a294200b35bebedc19c411f105fb03b3 | |
parent | d1431cc06597b38d876a518e7769f04dcd2c0f32 (diff) | |
download | haskell-da3f1e91a353f7fe37b3a25144f99c84d4a8dd70.tar.gz |
compiler: make .wasm the default executable extension on wasm32
Following convention as in other wasm toolchains. Fixes #22594.
-rw-r--r-- | compiler/GHC/Driver/Make.hs | 7 | ||||
-rw-r--r-- | compiler/GHC/Linker/Static/Utils.hs | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/compiler/GHC/Driver/Make.hs b/compiler/GHC/Driver/Make.hs index 25e2bdad9e..0d1cf892bd 100644 --- a/compiler/GHC/Driver/Make.hs +++ b/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' diff --git a/compiler/GHC/Linker/Static/Utils.hs b/compiler/GHC/Linker/Static/Utils.hs index 787147caac..592a87da6f 100644 --- a/compiler/GHC/Linker/Static/Utils.hs +++ b/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 - |