fix(arm64): reject bare BTI with a diagnostic and accept the full family

Assisted-by: GLM 5.3 Flash
This commit is contained in:
2026-09-20 19:15:05 +02:00
parent 6556b85abf
commit 241e7256f6
2 changed files with 37 additions and 1 deletions
+7 -1
View File
@@ -2856,8 +2856,14 @@ func encodeARM64Sys(mnem string, ops []*ast.Operand) ([]byte, error) {
}
return a64wordLE(0xd503201f | uint32(v)<<5), nil
case "BTI":
// The toolchain requires the landing-pad kind: bare BTI is
// rejected ("missing operand"), and only the uppercase C/J/JC
// spellings assemble (0xd503245f/49f/4df).
if len(ops) != 1 {
return nil, fmt.Errorf("%s expects C, J, or JC", mnem)
}
op := operandRegName(ops[0])
base, ok := map[string]uint32{"C": 0xd503245f}[op]
base, ok := map[string]uint32{"C": 0xd503245f, "J": 0xd503249f, "JC": 0xd50324df}[op]
if !ok {
return nil, fmt.Errorf("%s: unknown kind %q", mnem, op)
}