Author: Dan Liew Date: 2024-05-16T15:24:11-07:00 New Revision: 84abe0a6d4face73c15ed6344be74ae231f18718
URL: https://github.com/llvm/llvm-project/commit/84abe0a6d4face73c15ed6344be74ae231f18718 DIFF: https://github.com/llvm/llvm-project/commit/84abe0a6d4face73c15ed6344be74ae231f18718.diff LOG: [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 <d...@su-root.co.uk> Added: Modified: clang/lib/CodeGen/CodeGenFunction.h Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 362f4a5fe72a6..5f3ee7eb943f9 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -137,7 +137,8 @@ enum TypeEvaluationKind { SANITIZER_CHECK(SubOverflow, sub_overflow, 0) \ SANITIZER_CHECK(TypeMismatch, type_mismatch, 1) \ SANITIZER_CHECK(AlignmentAssumption, alignment_assumption, 0) \ - SANITIZER_CHECK(VLABoundNotPositive, vla_bound_not_positive, 0) + SANITIZER_CHECK(VLABoundNotPositive, vla_bound_not_positive, 0) \ + SANITIZER_CHECK(BoundsSafety, bounds_safety, 0) enum SanitizerHandler { #define SANITIZER_CHECK(Enum, Name, Version) Enum, _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits