1; Testcase to check that module with different branch-target-enforcement can 2; be mixed. 3; 4; RUN: llvm-as %s -o %t1.bc 5; RUN: llvm-as %p/Inputs/foo.ll -o %t2.bc 6; RUN: llvm-lto -exported-symbol main \ 7; RUN: -exported-symbol foo \ 8; RUN: -filetype=obj \ 9; RUN: %t1.bc %t2.bc \ 10; RUN: -o %t1.exe 2>&1 | FileCheck --allow-empty %s 11; RUN: llvm-objdump -d %t1.exe | FileCheck --check-prefix=CHECK-DUMP %s 12; RUN: llvm-readelf -n %t1.exe | FileCheck --check-prefix=CHECK-PROP %s 13 14target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 15target triple = "aarch64-unknown-linux-gnu" 16 17declare i32 @foo(); 18 19define i32 @main() "sign-return-address"="non-leaf" "sign-return-address-key"="a_key" { 20entry: 21 %add = call i32 @foo() 22 ret i32 %add 23} 24 25!llvm.module.flags = !{!0, !1, !2, !3 } 26!0 = !{i32 8, !"branch-target-enforcement", i32 0} 27!1 = !{i32 8, !"sign-return-address", i32 1} 28!2 = !{i32 8, !"sign-return-address-all", i32 0} 29!3 = !{i32 8, !"sign-return-address-with-bkey", i32 0} 30 31; CHECK-NOT: linking module flags 'branch-target-enforcement': IDs have conflicting values in 32; CHECK-DUMP: <main>: 33; CHECK-DUMP: bl 0x8 <main+0x8> 34; CHECK-DUMP: <foo>: 35 36; `main` doesn't support BTI while `foo` does, so in the binary 37; we should see only PAC which is supported by both. 38; CHECK-PROP: Properties: aarch64 feature: PAC