Skip to content

Commit 84abe0a

Browse files
authored
[Bounds-Safety] Reserve slot in SanitizerHandler enum for Bounds-Safety (#91032)
Due to how `CodeGenFunction::EmitTrapCheck` is implemented `SanitizerHandler` with numeric value 0x19 needs to be reserved because `-fbounds-safety` generates trap instructions with that value embedded in the trap instructions for x86_64 and arm64 just like for UBSan traps. ** x86_64 ** ``` ud1l 0x19(%eax), %eax ``` ** arm64 ** ``` brk #0x5519 ``` To avoid upstream Clang and AppleClang diverging their ABIs for `-fbounds-safety` the slot is being reserved in this patch. `SanitizerHandler::BoundsSafety` currently has no uses in the code but uses will be introduced when the CodeGen side of `-fbounds-safety`'s implementation is upstreamed. rdar://126884014 Co-authored-by: Dan Liew <[email protected]>
1 parent e578314 commit 84abe0a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/CodeGen/CodeGenFunction.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ enum TypeEvaluationKind {
137137
SANITIZER_CHECK(SubOverflow, sub_overflow, 0) \
138138
SANITIZER_CHECK(TypeMismatch, type_mismatch, 1) \
139139
SANITIZER_CHECK(AlignmentAssumption, alignment_assumption, 0) \
140-
SANITIZER_CHECK(VLABoundNotPositive, vla_bound_not_positive, 0)
140+
SANITIZER_CHECK(VLABoundNotPositive, vla_bound_not_positive, 0) \
141+
SANITIZER_CHECK(BoundsSafety, bounds_safety, 0)
141142

142143
enum SanitizerHandler {
143144
#define SANITIZER_CHECK(Enum, Name, Version) Enum,

0 commit comments

Comments
 (0)