1; RUN: split-file %s %t
2; RUN: not llvm-link %t/a.ll %t/b.ll 2>&1 | FileCheck --check-prefix=CHECK-KIND %s
3; RUN: not llvm-link %t/c.ll %t/d.ll 2>&1 | FileCheck --check-prefix=CHECK-REG %s
4; RUN: not llvm-link %t/e.ll %t/f.ll 2>&1 | FileCheck --check-prefix=CHECK-OFFSET %s
5; RUN: llvm-link %t/g.ll %t/h.ll
6
7; CHECK-KIND: error: linking module flags 'stack-protector-guard': IDs have conflicting values
8; CHECK-REG: error: linking module flags 'stack-protector-guard-reg': IDs have conflicting values
9; CHECK-OFFSET: error: linking module flags 'stack-protector-guard-offset': IDs have conflicting values
10
11;--- a.ll
12; Test that different values of stack-protector-guard fail.
13define void @foo() sspstrong {
14  ret void
15}
16!llvm.module.flags = !{!0}
17!0 = !{i32 1, !"stack-protector-guard", !"sysreg"}
18;--- b.ll
19declare void @foo() sspstrong
20define void @bar() sspstrong {
21  call void @foo()
22  ret void
23}
24!llvm.module.flags = !{!0}
25!0 = !{i32 1, !"stack-protector-guard", !"global"}
26
27;--- c.ll
28; Test that different values of stack-protector-guard-reg fail.
29define void @foo() sspstrong {
30  ret void
31}
32!llvm.module.flags = !{!0}
33!0 = !{i32 1, !"stack-protector-guard-reg", !"sp_el0"}
34;--- d.ll
35declare void @foo() sspstrong
36define void @bar() sspstrong {
37  call void @foo()
38  ret void
39}
40!llvm.module.flags = !{!0}
41!0 = !{i32 1, !"stack-protector-guard-reg", !"sp_el1"}
42
43;--- e.ll
44; Test that different values of stack-protector-guard-offset fail.
45define void @foo() sspstrong {
46  ret void
47}
48!llvm.module.flags = !{!0}
49!0 = !{i32 1, !"stack-protector-guard-offset", i32 257}
50;--- f.ll
51declare void @foo() sspstrong
52define void @bar() sspstrong {
53  call void @foo()
54  ret void
55}
56!llvm.module.flags = !{!0}
57!0 = !{i32 1, !"stack-protector-guard-offset", i32 256}
58
59;--- g.ll
60; Test that the same values for the three module attributes succeed.
61define void @foo() sspstrong {
62  ret void
63}
64!llvm.module.flags = !{!0, !1, !2}
65!0 = !{i32 1, !"stack-protector-guard", !"sysreg"}
66!1 = !{i32 1, !"stack-protector-guard-reg", !"sp_el0"}
67!2 = !{i32 1, !"stack-protector-guard-offset", i32 257}
68;--- h.ll
69declare void @foo() sspstrong
70define void @bar() sspstrong {
71  call void @foo()
72  ret void
73}
74!llvm.module.flags = !{!0, !1, !2}
75!0 = !{i32 1, !"stack-protector-guard", !"sysreg"}
76!1 = !{i32 1, !"stack-protector-guard-reg", !"sp_el0"}
77!2 = !{i32 1, !"stack-protector-guard-offset", i32 257}
78