aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-07-08 00:18:40 +0200
committerRon Evans <[email protected]>2019-07-08 00:37:53 +0200
commit66d8899aa7e17223276b279f10853ef5fb2a4ea0 (patch)
tree028ac3bf2a015ae4c062cd8fcc0158b951d3c7cb
parentb0cad7ed63698dd3ccb1e9782839337a0f610a57 (diff)
downloadtinygo-66d8899aa7e17223276b279f10853ef5fb2a4ea0.tar.gz
tinygo-66d8899aa7e17223276b279f10853ef5fb2a4ea0.zip
main: set the current working directory when calling an external linker
In particular, while LLVM lld supports -L for linker scripts imported with the `INCLUDE` command, GNU ld does not seem to support this. This is a prerequisite for supporting the HiFive1 board in the TinyGo Playground.
-rw-r--r--linker-builtin.go1
-rw-r--r--linker-external.go1
2 files changed, 2 insertions, 0 deletions
diff --git a/linker-builtin.go b/linker-builtin.go
index d0a016811..f11d56865 100644
--- a/linker-builtin.go
+++ b/linker-builtin.go
@@ -63,6 +63,7 @@ func Link(linker string, flags ...string) error {
cmd := exec.Command(linker, flags...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
+ cmd.Dir = sourceDir()
return cmd.Run()
}
}
diff --git a/linker-external.go b/linker-external.go
index 48e4d2ecd..f114b39bb 100644
--- a/linker-external.go
+++ b/linker-external.go
@@ -20,5 +20,6 @@ func Link(linker string, flags ...string) error {
cmd := exec.Command(linker, flags...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
+ cmd.Dir = sourceDir()
return cmd.Run()
}