51 lines · plain
1; RUN: llvm-as %s -o %t1.o2; RUN: llvm-as %p/Inputs/common.ll -o %t2.o3; RUN: llvm-as %p/Inputs/common2.ll -o %t2b.o4; RUN: llvm-as %p/Inputs/common3.ll -o %t2c.o5 6target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"7target triple = "x86_64-unknown-linux-gnu"8 9@a = common global i16 0, align 810 11; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \12; RUN: --plugin-opt=emit-llvm \13; RUN: -shared %t1.o %t2.o -o %t3.o14; RUN: llvm-dis %t3.o -o - | FileCheck %s --check-prefix=A15 16; Shared library case, we merge @a as common and keep it for the symbol table.17; A: @a = common global [4 x i8] zeroinitializer, align 818 19; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \20; RUN: --plugin-opt=emit-llvm \21; RUN: -shared %t1.o %t2b.o -o %t3.o22; RUN: llvm-dis %t3.o -o - | FileCheck %s --check-prefix=B23 24; (i16 align 8) + (i8 align 16) = i16 align 1625; B: @a = common global i16 0, align 1626 27; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \28; RUN: --plugin-opt=emit-llvm \29; RUN: -shared %t1.o %t2c.o -o %t3.o30; RUN: llvm-dis %t3.o -o - | FileCheck %s --check-prefix=C31 32; (i16 align 8) + (i8 align 1) = i16 align 8.33; C: @a = common global i16 0, align 834 35; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \36; RUN: --plugin-opt=emit-llvm \37; RUN: %t1.o %t2.o -o %t3.o38; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=EXEC %s39 40; All IR case, we internalize a after merging.41; EXEC: @a = internal global [4 x i8] zeroinitializer, align 842 43; RUN: llc %p/Inputs/common.ll -o %t2native.o -filetype=obj44; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \45; RUN: --plugin-opt=emit-llvm \46; RUN: %t1.o %t2native.o -o %t3.o47; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=MIXED %s48 49; Mixed ELF and IR. We keep ours as common so the linker will finish the merge.50; MIXED: @a = common dso_local global i16 0, align 851