1 ; Testcase to check that module with different branch-target-enforcement can
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 \
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
14 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
15 target triple = "aarch64-unknown-linux-gnu"
19 define i32 @main() "sign-return-address"="non-leaf" "sign-return-address-key"="a_key" {
21 %add = call i32 @foo()
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}
31 ; CHECK-NOT: linking module flags 'branch-target-enforcement': IDs have conflicting values in
33 ; CHECK-DUMP: bl 0x8 <main+0x8>
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