aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2024-10-25 15:32:20 +0200
committerAyke <[email protected]>2024-11-01 09:10:49 +0100
commit058f62ac08ace927f01b005e7b0a21b1a41590a7 (patch)
tree2aff4b24813e27f63b49a433dd13ed9d8fa9eb05 /main.go
parent4e49ba597dc20e0bfd13fc39e0a1c89959576ec5 (diff)
downloadtinygo-058f62ac08ace927f01b005e7b0a21b1a41590a7.tar.gz
tinygo-058f62ac08ace927f01b005e7b0a21b1a41590a7.zip
main: parse extldflags early so we can report the error message
This avoids some weird behavior when the -extldflags flag cannot be parsed by TinyGo.
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.go b/main.go
index 254e140cf..8ae5ce316 100644
--- a/main.go
+++ b/main.go
@@ -1641,12 +1641,19 @@ func main() {
Timeout: *timeout,
WITPackage: witPackage,
WITWorld: witWorld,
- ExtLDFlags: extLDFlags,
}
if *printCommands {
options.PrintCommands = printCommand
}
+ if extLDFlags != "" {
+ options.ExtLDFlags, err = shlex.Split(extLDFlags)
+ if err != nil {
+ fmt.Fprintln(os.Stderr, "could not parse -extldflags:", err)
+ os.Exit(1)
+ }
+ }
+
err = options.Verify()
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())