-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit an error instead of crashing on invalid use of __capability
Previously, attempting to generate code that contained __capability while using a target without support for CHERI would assert with `Assertion `llvm::isPowerOf2_32(Align) && "Alignment must be power of 2"' failed.` Fix this by emitting a more user-friendly error message instead of crashing when we encounter __capability but CHERI is not supported.
- Loading branch information
1 parent
6812917
commit f274b26
Showing
2 changed files
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py | ||
/// Using __capability without the appropriate -march string previously | ||
/// crashed clang during codegen instead of emitting an error | ||
// RUN: %clang_cc1 -triple riscv64 -o - -emit-llvm %s -verify=no-cheri | ||
// RUN: %clang_cc1 -triple riscv64 -target-feature +xcheri -o - -emit-llvm %s | FileCheck %s | ||
|
||
// CHECK-LABEL: @test( | ||
// CHECK-NEXT: entry: | ||
// CHECK-NEXT: ret i8 addrspace(200)* null | ||
// | ||
void *__capability test(void) { return 0; } // no-cheri-error{{__capability attribute is not supported on targets missing CHERI; specify an appropriate -march= or -mcpu=}} |