1; RUN: llvm-as %s -o %t1.o
2; RUN: llvm-as %p/Inputs/comdat.ll -o %t2.o
3; RUN: %gold -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold%shlibext %t1.o %t2.o \
4; RUN:  -m elf_x86_64 \
5; RUN:  -plugin-opt=save-temps
6; RUN: FileCheck --check-prefix=RES %s < %t3.o.resolution.txt
7; RUN: llvm-readobj --symbols %t3.o | FileCheck --check-prefix=OBJ %s
8
9target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
10target triple = "x86_64-unknown-linux-gnu"
11
12$c1 = comdat any
13
14@v1 = weak_odr global i32 42, comdat($c1)
15define weak_odr i32 @f1(i8*) comdat($c1) {
16bb10:
17  br label %bb11
18bb11:
19  ret i32 42
20}
21
22@r11 = global i32* @v1
23@r12 = global i32 (i8*)* @f1
24
25@a11 = alias i32, i32* @v1
26@a12 = alias i16, bitcast (i32* @v1 to i16*)
27
28@a13 = alias i32 (i8*), i32 (i8*)* @f1
29@a14 = alias i16, bitcast (i32 (i8*)* @f1 to i16*)
30@a15 = alias i16, i16* @a14
31
32; gold's resolutions should tell us that our $c1 wins, and the other input's $c2
33; wins. f1 is also local due to having protected visibility in the other object.
34
35; RES: 1.o,f1,plx{{$}}
36; RES: 1.o,v1,px{{$}}
37; RES: 1.o,r11,px{{$}}
38; RES: 1.o,r12,px{{$}}
39; RES: 1.o,a11,px{{$}}
40; RES: 1.o,a12,px{{$}}
41; RES: 1.o,a13,px{{$}}
42; RES: 1.o,a14,px{{$}}
43; RES: 1.o,a15,px{{$}}
44
45; RES: 2.o,f1,l{{$}}
46; RES: 2.o,will_be_undefined,{{$}}
47; RES: 2.o,v1,{{$}}
48; RES: 2.o,r21,px{{$}}
49; RES: 2.o,r22,px{{$}}
50; RES: 2.o,a21,px{{$}}
51; RES: 2.o,a22,px{{$}}
52; RES: 2.o,a23,px{{$}}
53; RES: 2.o,a24,px{{$}}
54; RES: 2.o,a25,px{{$}}
55
56; f1's protected visibility should be reflected in the DSO.
57
58; OBJ:      Name: f1 (
59; OBJ-NEXT: Value:
60; OBJ-NEXT: Size:
61; OBJ-NEXT: Binding:
62; OBJ-NEXT: Type:
63; OBJ-NEXT: Other [
64; OBJ-NEXT:   STV_PROTECTED
65; OBJ-NEXT: ]
66