Currently `avo` uses `BP` as a standard general-purpose register. However, `BP` is used for the frame pointer and should be callee-save. Under some circumstances, the Go assembler will do this automatically, but not always. At the moment `avo` can produce code that clobbers the `BP` register. Since Go 1.16 this code will also fail a new `go vet` check. This PR provides a (currently sub-optimal) fix for the issue. It introduces an `EnsureBasePointerCalleeSaved` pass which will check if the base pointer is written to by a function, and if so will artificially ensure that the function has a non-zero frame size. This will trigger the Go assembler to automatically save and restore the BP register. In addition, we update the `asmdecl` tool to `asmvet`, which includes the `framepointer` vet check. Updates #156
25 lines
660 B
Bash
Executable File
25 lines
660 B
Bash
Executable File
#!/bin/bash -ex
|
|
|
|
# Ensure the repository is clean after code generation.
|
|
./script/generate
|
|
test -z "$(git status --porcelain)"
|
|
|
|
# Still clean after formatting.
|
|
./script/fmt
|
|
test -z "$(git status --porcelain)"
|
|
|
|
# And it's still clean after asmfmt.
|
|
# Note: we want to confirm we agree with asmfmt without actually depending on it.
|
|
find . -name '*.s' | xargs asmfmt -w
|
|
test -z "$(git status --porcelain)"
|
|
|
|
# Run suite of golangci-lint checks.
|
|
# (Provide examples directory explicitly since it is skipped by default.)
|
|
golangci-lint run ./... ./examples/...
|
|
|
|
# Check asm declarations.
|
|
go vet -vettool=$(which asmvet) ./...
|
|
|
|
# Custom linters.
|
|
./script/linter/pkgdoc
|