57 lines · plain
1; REQUIRES: x862 3;; Show that common symbols defined in both native objects and bitcode files are4;; properly resolved.5 6; RUN: rm -rf %t.dir7; RUN: split-file %s %t.dir8; RUN: cd %t.dir9 10;; Case 1: bitcode file has smaller symbol but larger alignment.11; RUN: llvm-as smaller-sym.ll -o smaller-sym.bc12; RUN: llc -filetype=obj larger-sym.ll -o larger-sym.o13; RUN: ld.lld smaller-sym.bc larger-sym.o -o 1.so -shared14; RUN: llvm-readobj -S --symbols 1.so | FileCheck %s -DALIGN=815 16;; Case 2: bitcode file has larger symbol but smaller alignment.17; RUN: llvm-as larger-sym.ll -o larger-sym.bc18; RUN: llc -filetype=obj smaller-sym.ll -o smaller-sym.o19; RUN: ld.lld smaller-sym.o larger-sym.bc -o 2.so -shared20;; FIXME: This alignment should be 8, but LLD is ignoring the alignment of a21;; 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=424 25; CHECK: Name: .bss26; CHECK-NEXT: Type: SHT_NOBITS27; CHECK-NEXT: Flags [28; CHECK-NEXT: SHF_ALLOC29; CHECK-NEXT: SHF_WRITE30; CHECK-NEXT: ]31; CHECK-NEXT: Address:32; CHECK-NEXT: Offset:33; CHECK-NEXT: Size: 234; CHECK-NEXT: Link: 035; CHECK-NEXT: Info: 036; CHECK-NEXT: AddressAlignment: [[ALIGN]]37 38; CHECK: Name: a39; CHECK-NEXT: Value:40; CHECK-NEXT: Size: 241; CHECK-NEXT: Binding: Global42; CHECK-NEXT: Type: Object43; CHECK-NEXT: Other: 044; CHECK-NEXT: Section: .bss45 46;--- smaller-sym.ll47target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"48target triple = "x86_64-unknown-linux-gnu"49 50@a = common global i8 0, align 851 52;--- larger-sym.ll53target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"54target triple = "x86_64-unknown-linux-gnu"55 56@a = common global i16 0, align 457