Browse Source

subsecond/cli: fix linker and passing through -fuse-ld properly (#4222)

* subsecond/cli: fix passing through -fuse-ld for LinkerFlavour::Gnu

* if linker isn't a relative, local path, keep it unresolved since its a command on PATH
laund 4 weeks ago
parent
commit
937e9b9789
2 changed files with 5 additions and 1 deletions
  1. 1 0
      packages/cli/src/build/request.rs
  2. 4 1
      packages/cli/src/cli/link.rs

+ 1 - 0
packages/cli/src/build/request.rs

@@ -1488,6 +1488,7 @@ impl BuildRequest {
                         || arg.starts_with("-m")
                         || arg.starts_with("-Wl,--target=")
                         || arg.starts_with("-Wl,-fuse-ld")
+                        || arg.starts_with("-fuse-ld")
                     {
                         out_args.push(arg.to_string());
                     }

+ 4 - 1
packages/cli/src/cli/link.rs

@@ -98,7 +98,10 @@ impl LinkAction {
         if let Some(linker) = &self.linker {
             env_vars.push((
                 Self::DX_LINK_CUSTOM_LINKER,
-                dunce::canonicalize(linker)?.to_string_lossy().to_string(),
+                dunce::canonicalize(linker)
+                    .unwrap_or(linker.clone())
+                    .to_string_lossy()
+                    .to_string(),
             ));
         }