compileopts, targets, main: support Wasmtime v14 (#3972)
compileopts, targets, main: support Wasmtime v14
Этот коммит содержится в:
родитель
5355473dce
коммит
174d492355
5 изменённых файлов: 15 добавлений и 14 удалений
8
.github/workflows/linux.yml
предоставленный
8
.github/workflows/linux.yml
предоставленный
|
@ -140,8 +140,8 @@ jobs:
|
||||||
- name: Install wasmtime
|
- name: Install wasmtime
|
||||||
run: |
|
run: |
|
||||||
mkdir -p $HOME/.wasmtime $HOME/.wasmtime/bin
|
mkdir -p $HOME/.wasmtime $HOME/.wasmtime/bin
|
||||||
curl https://github.com/bytecodealliance/wasmtime/releases/download/v13.0.0/wasmtime-v13.0.0-x86_64-linux.tar.xz -o wasmtime-v13.0.0-x86_64-linux.tar.xz -SfL
|
curl https://github.com/bytecodealliance/wasmtime/releases/download/v14.0.4/wasmtime-v14.0.4-x86_64-linux.tar.xz -o wasmtime-v14.0.4-x86_64-linux.tar.xz -SfL
|
||||||
tar -C $HOME/.wasmtime/bin --wildcards -xf wasmtime-v13.0.0-x86_64-linux.tar.xz --strip-components=1 wasmtime-v13.0.0-x86_64-linux/*
|
tar -C $HOME/.wasmtime/bin --wildcards -xf wasmtime-v14.0.4-x86_64-linux.tar.xz --strip-components=1 wasmtime-v14.0.4-x86_64-linux/*
|
||||||
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
|
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
|
||||||
- name: Download release artifact
|
- name: Download release artifact
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
|
@ -187,8 +187,8 @@ jobs:
|
||||||
- name: Install wasmtime
|
- name: Install wasmtime
|
||||||
run: |
|
run: |
|
||||||
mkdir -p $HOME/.wasmtime $HOME/.wasmtime/bin
|
mkdir -p $HOME/.wasmtime $HOME/.wasmtime/bin
|
||||||
curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v13.0.0/wasmtime-v13.0.0-x86_64-linux.tar.xz -o wasmtime-v13.0.0-x86_64-linux.tar.xz -SfL
|
curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v14.0.4/wasmtime-v14.0.4-x86_64-linux.tar.xz -o wasmtime-v14.0.4-x86_64-linux.tar.xz -SfL
|
||||||
tar -C $HOME/.wasmtime/bin --wildcards -xf wasmtime-v13.0.0-x86_64-linux.tar.xz --strip-components=1 wasmtime-v13.0.0-x86_64-linux/*
|
tar -C $HOME/.wasmtime/bin --wildcards -xf wasmtime-v14.0.4-x86_64-linux.tar.xz --strip-components=1 wasmtime-v14.0.4-x86_64-linux/*
|
||||||
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
|
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
|
||||||
- name: Restore LLVM source cache
|
- name: Restore LLVM source cache
|
||||||
uses: actions/cache/restore@v3
|
uses: actions/cache/restore@v3
|
||||||
|
|
4
.github/workflows/windows.yml
предоставленный
4
.github/workflows/windows.yml
предоставленный
|
@ -96,7 +96,7 @@ jobs:
|
||||||
run: make wasi-libc
|
run: make wasi-libc
|
||||||
- name: Install wasmtime
|
- name: Install wasmtime
|
||||||
run: |
|
run: |
|
||||||
scoop install wasmtime@13.0.0
|
scoop install wasmtime@14.0.4
|
||||||
- name: make gen-device
|
- name: make gen-device
|
||||||
run: make -j3 gen-device
|
run: make -j3 gen-device
|
||||||
- name: Test TinyGo
|
- name: Test TinyGo
|
||||||
|
@ -203,7 +203,7 @@ jobs:
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
scoop install binaryen && scoop install wasmtime@13.0.0
|
scoop install binaryen && scoop install wasmtime@14.0.4
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
|
|
|
@ -386,7 +386,7 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) {
|
||||||
"--stack-first",
|
"--stack-first",
|
||||||
"--no-demangle",
|
"--no-demangle",
|
||||||
)
|
)
|
||||||
spec.Emulator = "wasmtime --mapdir=/tmp::{tmpDir} {}"
|
spec.Emulator = "wasmtime --dir={tmpDir}::/tmp {}"
|
||||||
spec.ExtraFiles = append(spec.ExtraFiles,
|
spec.ExtraFiles = append(spec.ExtraFiles,
|
||||||
"src/runtime/asm_tinygowasm.S",
|
"src/runtime/asm_tinygowasm.S",
|
||||||
"src/internal/task/task_asyncify_wasm.S",
|
"src/internal/task/task_asyncify_wasm.S",
|
||||||
|
|
13
main.go
13
main.go
|
@ -797,7 +797,7 @@ func buildAndRun(pkgName string, config *compileopts.Config, stdout io.Writer, c
|
||||||
needsEnvInVars = true
|
needsEnvInVars = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var args, env []string
|
var args, emuArgs, env []string
|
||||||
var extraCmdEnv []string
|
var extraCmdEnv []string
|
||||||
if needsEnvInVars {
|
if needsEnvInVars {
|
||||||
runtimeGlobals := make(map[string]string)
|
runtimeGlobals := make(map[string]string)
|
||||||
|
@ -820,13 +820,14 @@ func buildAndRun(pkgName string, config *compileopts.Config, stdout io.Writer, c
|
||||||
} else if config.EmulatorName() == "wasmtime" {
|
} else if config.EmulatorName() == "wasmtime" {
|
||||||
// Wasmtime needs some special flags to pass environment variables
|
// Wasmtime needs some special flags to pass environment variables
|
||||||
// and allow reading from the current directory.
|
// and allow reading from the current directory.
|
||||||
args = append(args, "--dir=.")
|
emuArgs = append(emuArgs, "--dir=.")
|
||||||
for _, v := range environmentVars {
|
for _, v := range environmentVars {
|
||||||
args = append(args, "--env", v)
|
emuArgs = append(emuArgs, "--env", v)
|
||||||
}
|
}
|
||||||
if len(cmdArgs) != 0 {
|
if len(cmdArgs) != 0 {
|
||||||
// mark end of wasmtime arguments and start of program ones: --
|
// Use of '--' argument no longer necessary as of Wasmtime v14:
|
||||||
args = append(args, "--")
|
// https://github.com/bytecodealliance/wasmtime/pull/6946
|
||||||
|
// args = append(args, "--")
|
||||||
args = append(args, cmdArgs...)
|
args = append(args, cmdArgs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -876,7 +877,7 @@ func buildAndRun(pkgName string, config *compileopts.Config, stdout io.Writer, c
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
name = emulator[0]
|
name = emulator[0]
|
||||||
emuArgs := append([]string(nil), emulator[1:]...)
|
emuArgs = append(emuArgs, emulator[1:]...)
|
||||||
args = append(emuArgs, args...)
|
args = append(emuArgs, args...)
|
||||||
}
|
}
|
||||||
var cmd *exec.Cmd
|
var cmd *exec.Cmd
|
||||||
|
|
|
@ -22,5 +22,5 @@
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"src/runtime/asm_tinygowasm.S"
|
"src/runtime/asm_tinygowasm.S"
|
||||||
],
|
],
|
||||||
"emulator": "wasmtime --mapdir=/tmp::{tmpDir} {}"
|
"emulator": "wasmtime --dir={tmpDir}::/tmp {}"
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче