Skip to content

Commit 66d8899

Browse files
aykevldeadprogram
authored andcommitted
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.
1 parent b0cad7e commit 66d8899

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

linker-builtin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func Link(linker string, flags ...string) error {
6363
cmd := exec.Command(linker, flags...)
6464
cmd.Stdout = os.Stdout
6565
cmd.Stderr = os.Stderr
66+
cmd.Dir = sourceDir()
6667
return cmd.Run()
6768
}
6869
}

linker-external.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ func Link(linker string, flags ...string) error {
2020
cmd := exec.Command(linker, flags...)
2121
cmd.Stdout = os.Stdout
2222
cmd.Stderr = os.Stderr
23+
cmd.Dir = sourceDir()
2324
return cmd.Run()
2425
}

0 commit comments

Comments
 (0)