2 ; RUN: llvm-as %s -o %t.o
3 ; RUN: llvm-as %p/Inputs/internalize-exportdyn.ll -o %t2.o
4 ; RUN: ld.lld %t.o %t2.o -o %t2 --export-dynamic -save-temps
5 ; RUN: llvm-dis < %t2.0.2.internalize.bc | FileCheck %s
6 ; RUN: ld.lld %t.o %t2.o -o %t3 -shared -save-temps
7 ; RUN: llvm-dis < %t3.0.2.internalize.bc | FileCheck %s --check-prefix=DSO
9 target triple = "x86_64-unknown-linux-gnu"
10 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
12 @c = linkonce_odr constant i32 1
13 @g = linkonce_odr global i32 1
14 @u_c = linkonce_odr unnamed_addr constant i32 1
15 @u_g = linkonce_odr unnamed_addr global i32 1
16 @lu_c = linkonce_odr local_unnamed_addr constant i32 1
17 @lu_g = linkonce_odr local_unnamed_addr global i32 1
19 define void @_start() {
27 define hidden void @bar() {
31 define linkonce_odr void @zed() local_unnamed_addr {
35 define linkonce_odr void @zed2() unnamed_addr {
39 define linkonce_odr void @bah() {
43 define linkonce_odr void @baz() {
47 @use_baz = global ptr @baz
49 ; Check what gets internalized.
50 ; CHECK: @c = weak_odr dso_local constant i32 1
51 ; CHECK: @g = weak_odr dso_local global i32 1
52 ; CHECK: @u_c = internal unnamed_addr constant i32 1
53 ; CHECK: @u_g = internal unnamed_addr global i32 1
54 ; CHECK: @lu_c = internal constant i32 1
55 ; CHECK: @lu_g = weak_odr dso_local global i32 1
56 ; CHECK: define dso_local void @_start()
57 ; CHECK: define dso_local void @foo()
58 ; CHECK: define internal void @bar()
59 ; CHECK: define internal void @zed()
60 ; CHECK: define internal void @zed2()
61 ; CHECK: define weak_odr dso_local void @bah()
62 ; CHECK: define weak_odr dso_local void @baz()
64 ; DSO: @c = weak_odr constant i32 1
65 ; DSO: @g = weak_odr global i32 1
66 ; DSO: @u_c = internal unnamed_addr constant i32 1
67 ; DSO: @u_g = internal unnamed_addr global i32 1
68 ; DSO: @lu_c = internal constant i32 1
69 ; DSO: @lu_g = weak_odr global i32 1
70 ; DSO: define void @_start()
71 ; DSO: define void @foo()
72 ; DSO: define internal void @bar()
73 ; DSO: define internal void @zed()
74 ; DSO: define internal void @zed2()
75 ; DSO: define weak_odr void @bah()
76 ; DSO: define weak_odr void @baz()