feat(lint): flag writes to the platform-reserved register
This commit is contained in:
@@ -81,6 +81,7 @@ const (
|
||||
CodeABI0RegisterArgs = "abi0-register-args"
|
||||
CodeNonportableRegister = "nonportable-register-name"
|
||||
CodeUnencodable = "unencodable-instruction"
|
||||
CodeReservedRegister = "reserved-register-write"
|
||||
)
|
||||
|
||||
// knownTextFlags are the flags recognised by the Go assembler's textflag.h.
|
||||
@@ -469,6 +470,12 @@ func lintText(t *ast.Text, tab *arch.Table, archKnown bool, cfg Config, macros m
|
||||
out = append(out, scanNonportableRegisters(t)...)
|
||||
}
|
||||
|
||||
// Writes to the platform-reserved register (arm64 R18), which the ABI
|
||||
// checks cannot observe at runtime.
|
||||
if cfg.Arch == arch.ARM64 && !hasMacro && !cfg.Disable[CodeReservedRegister] {
|
||||
out = append(out, scanReservedRegisterWrites(t, cfg.Arch)...)
|
||||
}
|
||||
|
||||
// FUNCDATA / PCDATA structural validation.
|
||||
out = append(out, checkFuncdata(t, cfg)...)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user