From 9eb13884de31ba80804c4a7732b1fcef4af36af7 Mon Sep 17 00:00:00 2001 From: Damian Gryski Date: Sat, 18 Dec 2021 10:58:20 -0800 Subject: [PATCH] compileopts,targets: replace '{root}' in target files --- compileopts/target.go | 7 +++++++ targets/wasm.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/compileopts/target.go b/compileopts/target.go index c49759da..3df128a4 100644 --- a/compileopts/target.go +++ b/compileopts/target.go @@ -232,6 +232,13 @@ func LoadTarget(options *Options) (*TargetSpec, error) { spec.ExtraFiles = append(spec.ExtraFiles, "src/internal/task/task_asyncify_wasm.S") } + // TODO(dgryski): handle CFLAGS and LDFLAGS here too? + var emu []string + for _, s := range spec.Emulator { + emu = append(emu, strings.ReplaceAll(s, "{root}", goenv.Get("TINYGOROOT"))) + } + spec.Emulator = emu + return spec, nil } diff --git a/targets/wasm.json b/targets/wasm.json index 8a033fa9..58f01928 100644 --- a/targets/wasm.json +++ b/targets/wasm.json @@ -13,6 +13,6 @@ "--stack-first", "--no-demangle" ], - "emulator": ["node", "targets/wasm_exec.js"], + "emulator": ["node", "{root}/targets/wasm_exec.js"], "wasm-abi": "js" }