1; RUN: opt -module-summary %s -o %t1.bc
2; RUN: opt -module-summary %S/Inputs/personality.ll -o %t2.bc
3
4; RUN: llvm-lto2 run -o %t.o %t1.bc %t2.bc -save-temps \
5; RUN:   -r %t2.bc,bar,p \
6; RUN:   -r %t2.bc,personality_routine,p \
7; RUN:   -r %t2.bc,personality_routine2,p \
8; RUN:   -r %t2.bc,personality_routine3,p \
9; RUN:   -r %t1.bc,foo,p \
10; RUN:   -r %t1.bc,foo2,p \
11; RUN:   -r %t1.bc,foo3,p \
12; RUN:   -r %t1.bc,personality_routine,l \
13; RUN:   -r %t1.bc,personality_routine2,l \
14; RUN:   -r %t1.bc,personality_routine3,l \
15; RUN:   -r %t1.bc,main,xp \
16; RUN:   -r %t1.bc,bar,l
17; RUN: llvm-readobj --symbols %t.o.2 | FileCheck %s --check-prefix=BINDING
18
19; BINDING:     Symbol {
20; BINDING:       Name: personality_routine
21; BINDING-NEXT:  Value:
22; BINDING-NEXT:  Size:
23; BINDING-NEXT:  Binding: Global
24; BINDING-NEXT:  Type: Function
25; BINDING-NEXT:  Other [
26; BINDING-NEXT:    STV_PROTECTED
27; BINDING-NEXT:  ]
28; BINDING-NEXT:  Section: .text
29; BINDING-NEXT: }
30
31; BINDING-NEXT: Symbol {
32; BINDING-NEXT:  Name: personality_routine2
33; BINDING-NEXT:  Value:
34; BINDING-NEXT:  Size:
35; BINDING-NEXT:  Binding: Global
36; BINDING-NEXT:  Type: Function
37; BINDING-NEXT:  Other [
38; BINDING-NEXT:    STV_PROTECTED
39; BINDING-NEXT:  ]
40; BINDING-NEXT:  Section: .text
41; BINDING-NEXT: }
42
43; BINDING-NOT:  Name: personality_routine3
44
45target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
46target triple = "x86_64-pc-linux-gnu"
47
48declare protected i32 @personality_routine(i32, i32, i64, i8*, i8*)
49declare protected i32 @personality_routine2(i32, i32, i64, i8*, i8*)
50declare protected i32 @personality_routine3(i32, i32, i64, i8*, i8*)
51declare void @bar()
52
53define void @foo() personality i32 (i32, i32, i64, i8*, i8*)* @personality_routine {
54  ret void
55}
56
57define internal void @foo2b() personality i8* bitcast (i32 (i32, i32, i64, i8*, i8*)* @personality_routine2 to i8*) {
58  ret void
59}
60
61define internal void @foo2a() prologue void ()* @foo2b {
62  ret void
63}
64
65define void @foo2() prefix void ()* @foo2a {
66  ret void
67}
68
69define void @foo3() personality i8* bitcast (i32 (i32, i32, i64, i8*, i8*)* @personality_routine3 to i8*) {
70  ret void
71}
72
73define i32 @main() {
74  call void @foo()
75  call void @foo2()
76  call void @bar()
77  ret i32 0
78}
79
80