3 ;; Show that common symbols defined in both native objects and bitcode files are
7 ; RUN: split-file %s %t.dir
10 ;; Case 1: bitcode file has smaller symbol but larger alignment.
11 ; RUN: llvm-as smaller-sym.ll -o smaller-sym.bc
12 ; RUN: llc -filetype=obj larger-sym.ll -o larger-sym.o
13 ; RUN: ld.lld smaller-sym.bc larger-sym.o -o 1.so -shared
14 ; RUN: llvm-readobj -S --symbols 1.so | FileCheck %s -DALIGN=8
16 ;; Case 2: bitcode file has larger symbol but smaller alignment.
17 ; RUN: llvm-as larger-sym.ll -o larger-sym.bc
18 ; RUN: llc -filetype=obj smaller-sym.ll -o smaller-sym.o
19 ; RUN: ld.lld smaller-sym.o larger-sym.bc -o 2.so -shared
20 ;; FIXME: This alignment should be 8, but LLD is ignoring the alignment of a
21 ;; symbol in a native object file when the larger symbol is in a bitcode file.
22 ;; See https://bugs.llvm.org/show_bug.cgi?id=47819.
23 ; RUN: llvm-readobj -S --symbols 2.so | FileCheck %s -DALIGN=4
26 ; CHECK-NEXT: Type: SHT_NOBITS
28 ; CHECK-NEXT: SHF_ALLOC
29 ; CHECK-NEXT: SHF_WRITE
31 ; CHECK-NEXT: Address:
36 ; CHECK-NEXT: AddressAlignment: [[ALIGN]]
41 ; CHECK-NEXT: Binding: Global
42 ; CHECK-NEXT: Type: Object
43 ; CHECK-NEXT: Other: 0
44 ; CHECK-NEXT: Section: .bss
47 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
48 target triple = "x86_64-unknown-linux-gnu"
50 @a = common global i8 0, align 8
53 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
54 target triple = "x86_64-unknown-linux-gnu"
56 @a = common global i16 0, align 4