From 724a9240d0122f11254bdb7875dd8f1ac677f2fa Mon Sep 17 00:00:00 2001 From: Cheng Shao <terrorjack@type.dance> Date: Thu, 19 Sep 2024 20:29:15 +0000 Subject: [PATCH] driver: enforce -fno-use-rpaths for wasm This commit ensures the GHC driver never passes any RPATH-related link-time flags on wasm, which is not supported at all. (cherry picked from commit 649aae00c34014fcb64244de59961635563bf06a) (cherry picked from commit 55d8b48d125fc92c5e7679c0be6202d002f8e3c1) --- compiler/GHC/Driver/Session.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index f7afe599cd1..fd58f82d04c 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -3609,6 +3609,9 @@ needSourceNotes dflags = debugLevel dflags > 0 -- | Should we use `-XLinker -rpath` when linking or not? -- See Note [-fno-use-rpaths] useXLinkerRPath :: DynFlags -> OS -> Bool +-- wasm shared libs don't have RPATH at all and wasm-ld doesn't accept +-- any RPATH-related flags +useXLinkerRPath dflags _ | ArchWasm32 <- platformArch $ targetPlatform dflags = False useXLinkerRPath _ OSDarwin = False -- See Note [Dynamic linking on macOS] useXLinkerRPath dflags _ = gopt Opt_RPath dflags -- GitLab