diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6813d8be..aa77afc4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,6 +39,12 @@ jobs: run: | go vet -v ./... + - name: go build plugin + if: runner.os == 'Linux' || runner.os == 'macOS' + run: + # Make sure that plugin buildmode works since we save the R15 register (#254) + go build -buildmode=plugin ./examples/libc + - name: go build run: | go build -v ./... @@ -97,6 +103,11 @@ jobs: env QEMU_LD_PREFIX=/usr/aarch64-linux-gnu qemu-aarch64 ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10 env GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go test -c -o=purego-test-cgo . env QEMU_LD_PREFIX=/usr/aarch64-linux-gnu qemu-aarch64 ./purego-test-cgo -test.shuffle=on -test.v -test.count=10 + + echo "=> go build plugin" + # Make sure that plugin buildmode works since we save the R15 register (#254) + env GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -buildmode=plugin ./examples/libc + go env -u CC go env -u CXX @@ -147,6 +158,10 @@ jobs: # verify Go is available go version + + echo "=> go build plugin" + # Make sure that plugin buildmode works since we save the R15 register (#254) + go build -buildmode=plugin ./examples/libc echo "=> go build" go build -v ./... diff --git a/sys_amd64.s b/sys_amd64.s index 4eb26d65..cabde1a5 100644 --- a/sys_amd64.s +++ b/sys_amd64.s @@ -122,6 +122,9 @@ TEXT callbackasm1(SB), NOSPLIT|NOFRAME, $0 PUSHQ R10 // push the stack pointer below registers + // Switch from the host ABI to the Go ABI. + PUSH_REGS_HOST_TO_ABI0() + // determine index into runtime·cbs table MOVQ $callbackasm(SB), DX SUBQ DX, AX @@ -130,9 +133,6 @@ TEXT callbackasm1(SB), NOSPLIT|NOFRAME, $0 DIVL CX SUBQ $1, AX // subtract 1 because return PC is to the next slot - // Switch from the host ABI to the Go ABI. - PUSH_REGS_HOST_TO_ABI0() - // Create a struct callbackArgs on our stack to be passed as // the "frame" to cgocallback and on to callbackWrap. // $24 to make enough room for the arguments to runtime.cgocallback