File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -537,6 +537,13 @@ void CodeGenModule::Release() {
537
537
getModule ().addModuleFlag (llvm::Module::Error, " min_enum_size" , EnumWidth);
538
538
}
539
539
540
+ if (Arch == llvm::Triple::riscv32 || Arch == llvm::Triple::riscv64) {
541
+ StringRef ABIStr = Target.getABI ();
542
+ llvm::LLVMContext &Ctx = TheModule.getContext ();
543
+ getModule ().addModuleFlag (llvm::Module::Error, " target-abi" ,
544
+ llvm::MDString::get (Ctx, ABIStr));
545
+ }
546
+
540
547
if (CodeGenOpts.SanitizeCfiCrossDso ) {
541
548
// Indicate that we want cross-DSO control flow integrity checks.
542
549
getModule ().addModuleFlag (llvm::Module::Override, " Cross-DSO CFI" , 1 );
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -triple riscv32 -target-abi ilp32 -emit-llvm -o - %s | FileCheck -check-prefix=ILP32 %s
2
+ // RUN: %clang_cc1 -triple riscv32 -target-feature +f -target-abi ilp32f -emit-llvm -o - %s | FileCheck -check-prefix=ILP32F %s
3
+ // RUN: %clang_cc1 -triple riscv32 -target-feature +d -target-abi ilp32d -emit-llvm -o - %s | FileCheck -check-prefix=ILP32D %s
4
+ // RUN: %clang_cc1 -triple riscv64 -target-abi lp64 -emit-llvm -o - %s | FileCheck -check-prefix=LP64 %s
5
+ // RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-abi lp64f -emit-llvm -o - %s | FileCheck -check-prefix=LP64F %s
6
+ // RUN: %clang_cc1 -triple riscv64 -target-feature +d -target-abi lp64d -emit-llvm -o - %s | FileCheck -check-prefix=LP64D %s
7
+
8
+ // ILP32: !{{[0-9]+}} = !{i32 1, !"target-abi", !"ilp32"}
9
+ // ILP32F: !{{[0-9]+}} = !{i32 1, !"target-abi", !"ilp32f"}
10
+ // ILP32D: !{{[0-9]+}} = !{i32 1, !"target-abi", !"ilp32d"}
11
+
12
+ // LP64: !{{[0-9]+}} = !{i32 1, !"target-abi", !"lp64"}
13
+ // LP64F: !{{[0-9]+}} = !{i32 1, !"target-abi", !"lp64f"}
14
+ // LP64D: !{{[0-9]+}} = !{i32 1, !"target-abi", !"lp64d"}
You can’t perform that action at this time.
0 commit comments