1; RUN: llvm-as %s -o %t1.o
2; RUN: llvm-as %p/Inputs/common.ll -o %t2.o
3
4; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
5; RUN:    --plugin-opt=emit-llvm \
6; RUN:    -shared %t1.o %t2.o -o %t3.o
7; RUN: llvm-dis %t3.o -o - | FileCheck %s
8
9@a = common global i8 0, align 8
10
11; Shared library case, we merge @a as common and keep it for the symbol table.
12; CHECK: @a = common global i16 0, align 8
13
14; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
15; RUN:    --plugin-opt=emit-llvm \
16; RUN:    %t1.o %t2.o -o %t3.o
17; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=EXEC %s
18
19; All IR case, we internalize a after merging.
20; EXEC: @a = internal global i16 0, align 8
21
22; RUN: llc %p/Inputs/common.ll -o %t2.o -filetype=obj
23; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
24; RUN:    --plugin-opt=emit-llvm \
25; RUN:    %t1.o %t2.o -o %t3.o
26; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=MIXED %s
27
28; Mixed ELF and IR. We keep ours as common so the linker will finish the merge.
29; MIXED: @a = common global i8 0, align 8
30