1; RUN: llvm-as %s -o %t.o 2; RUN: llvm-as %p/Inputs/comdat.ll -o %t2.o 3; RUN: %gold -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t.o %t2.o \ 4; RUN: -plugin-opt=emit-llvm 5; RUN: llvm-dis %t3.o -o - | FileCheck %s 6 7$c1 = comdat any 8 9@v1 = weak_odr global i32 42, comdat($c1) 10define weak_odr i32 @f1(i8*) comdat($c1) { 11bb10: 12 br label %bb11 13bb11: 14 ret i32 42 15} 16 17@r11 = global i32* @v1 18@r12 = global i32 (i8*)* @f1 19 20@a11 = alias i32, i32* @v1 21@a12 = alias i16, bitcast (i32* @v1 to i16*) 22 23@a13 = alias i32 (i8*), i32 (i8*)* @f1 24@a14 = alias i16, bitcast (i32 (i8*)* @f1 to i16*) 25@a15 = alias i16, i16* @a14 26 27; CHECK: $c1 = comdat any 28; CHECK: $c2 = comdat any 29 30; CHECK-DAG: @v1 = weak_odr global i32 42, comdat($c1) 31 32; CHECK-DAG: @r11 = global i32* @v1{{$}} 33; CHECK-DAG: @r12 = global i32 (i8*)* @f1{{$}} 34 35; CHECK-DAG: @r21 = global i32* @v1{{$}} 36; CHECK-DAG: @r22 = global i32 (i8*)* @f1{{$}} 37 38; CHECK-DAG: @v1.1 = internal global i32 41, comdat($c2) 39 40; CHECK-DAG: @a11 = alias i32, i32* @v1{{$}} 41; CHECK-DAG: @a12 = alias i16, bitcast (i32* @v1 to i16*) 42 43; CHECK-DAG: @a13 = alias i32 (i8*), i32 (i8*)* @f1{{$}} 44; CHECK-DAG: @a14 = alias i16, bitcast (i32 (i8*)* @f1 to i16*) 45 46; CHECK-DAG: @a21 = alias i32, i32* @v1.1{{$}} 47; CHECK-DAG: @a22 = alias i16, bitcast (i32* @v1.1 to i16*) 48 49; CHECK-DAG: @a23 = alias i32 (i8*), i32 (i8*)* @f1.2{{$}} 50; CHECK-DAG: @a24 = alias i16, bitcast (i32 (i8*)* @f1.2 to i16*) 51 52; CHECK: define weak_odr protected i32 @f1(i8*) comdat($c1) { 53; CHECK-NEXT: bb10: 54; CHECK-NEXT: br label %bb11{{$}} 55; CHECK: bb11: 56; CHECK-NEXT: ret i32 42 57; CHECK-NEXT: } 58 59; CHECK: define internal i32 @f1.2(i8* %this) comdat($c2) { 60; CHECK-NEXT: bb20: 61; CHECK-NEXT: store i8* %this, i8** null 62; CHECK-NEXT: br label %bb21 63; CHECK: bb21: 64; CHECK-NEXT: ret i32 41 65; CHECK-NEXT: } 66