Skip to content

Commit 76ad058

Browse files
committed
[BOLT] Review nits
- fix spelling in MarkRAStates - improve negate-ra-state.s test - improve pacret-split-funcs.s test
1 parent bbc6981 commit 76ad058

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

bolt/lib/Passes/MarkRAStates.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
7373
BF.setIgnored();
7474
return false;
7575
}
76-
// The signing instruction itself is unsinged, but the next will be
76+
// The signing instruction itself is unsigned, the next will be
7777
// signed.
7878
BC.MIB->setRAUnsigned(Inst);
7979
} else if (BC.MIB->isPAuthOnLR(Inst)) {

bolt/test/AArch64/negate-ra-state.s

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# Checking that .cfi-negate_ra_state directives are emitted in the same location as in the input in the case of no optimizations.
22

3+
# The foo and bar functions are a pair, with the first signing the return address,
4+
# and the second authenticating it. We have a tailcall between the two.
5+
# This is testing that BOLT can handle functions starting in signed RA state.
6+
37
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
48
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
59
# RUN: llvm-bolt %t.exe -o %t.exe.bolt --no-threads --print-all | FileCheck %s --check-prefix=CHECK-BOLT
610

711
# Check that the negate-ra-state at the start of bar is not discarded.
812
# If it was discarded, MarkRAState would report bar as having inconsistent RAStates.
13+
# This is testing the handling of initialRAState on the BinaryFunction.
914
# CHECK-BOLT-NOT: BOLT-INFO: inconsistent RAStates in function foo
1015
# CHECK-BOLT-NOT: BOLT-INFO: inconsistent RAStates in function bar
1116

@@ -69,8 +74,3 @@ bar:
6974
ret
7075
.cfi_endproc
7176
.size bar, .-bar
72-
73-
.global _start
74-
.type _start, %function
75-
_start:
76-
b foo

bolt/test/AArch64/pacret-split-funcs.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,17 @@
3636
foo:
3737
.cfi_startproc
3838
.entry_bb:
39+
# FDATA: 1 foo #.entry_bb# 10
3940
paciasp
4041
.cfi_negate_ra_state // indicating that paciasp changed the RA state to signed
41-
# FDATA: 1 foo #.entry_bb# 10
4242
cmp x0, #0
4343
b.eq .Lcold_bb1
44+
.Lfallthrough:
4445
autiasp
4546
.cfi_negate_ra_state // indicating that autiasp changed the RA state to unsigned
4647
ret
4748
.cfi_negate_ra_state // ret has unsigned RA state, but the next inst (autiasp) has signed RA state
48-
.Lcold_bb1:
49+
.Lcold_bb1: // split point
4950
autiasp
5051
.cfi_negate_ra_state // indicating that autiasp changed the RA state to unsigned
5152
ret

0 commit comments

Comments
 (0)