| 1 |
; RUN: llvm-as %s -o %t1.o |
| 2 |
; RUN: llvm-as %p/Inputs/common.ll -o %t2.o |
| 3 |
; RUN: llvm-as %p/Inputs/common2.ll -o %t2b.o |
| 4 |
; RUN: llvm-as %p/Inputs/common3.ll -o %t2c.o |
| 5 |
|
| 6 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 7 |
target triple = "x86_64-unknown-linux-gnu" |
| 8 |
|
| 9 |
@a = common global i16 0, align 8 |
| 10 |
|
| 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.o |
| 14 |
; RUN: llvm-dis %t3.o -o - | FileCheck %s --check-prefix=A |
| 15 |
|
| 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 8 |
| 18 |
|
| 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.o |
| 22 |
; RUN: llvm-dis %t3.o -o - | FileCheck %s --check-prefix=B |
| 23 |
|
| 24 |
; (i16 align 8) + (i8 align 16) = i16 align 16 |
| 25 |
; B: @a = common global i16 0, align 16 |
| 26 |
|
| 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.o |
| 30 |
; RUN: llvm-dis %t3.o -o - | FileCheck %s --check-prefix=C |
| 31 |
|
| 32 |
; (i16 align 8) + (i8 align 1) = i16 align 8. |
| 33 |
; C: @a = common global i16 0, align 8 |
| 34 |
|
| 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.o |
| 38 |
; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=EXEC %s |
| 39 |
|
| 40 |
; All IR case, we internalize a after merging. |
| 41 |
; EXEC: @a = internal global [4 x i8] zeroinitializer, align 8 |
| 42 |
|
| 43 |
; RUN: llc %p/Inputs/common.ll -o %t2native.o -filetype=obj |
| 44 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 45 |
; RUN: --plugin-opt=emit-llvm \ |
| 46 |
; RUN: %t1.o %t2native.o -o %t3.o |
| 47 |
; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=MIXED %s |
| 48 |
|
| 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 8 |