forked from OSchip/llvm-project
parent
e71d59fc4f
commit
37bcaac179
|
@ -439,7 +439,8 @@ void BitcodeFile::parse(DenseSet<StringRef> &ComdatGroups) {
|
||||||
|
|
||||||
for (const BasicSymbolRef &Sym : Obj->symbols()) {
|
for (const BasicSymbolRef &Sym : Obj->symbols()) {
|
||||||
uint8_t Visibility = STV_DEFAULT;
|
uint8_t Visibility = STV_DEFAULT;
|
||||||
if (const GlobalValue *GV = Obj->getSymbolGV(Sym.getRawDataRefImpl())) {
|
const GlobalValue *GV = Obj->getSymbolGV(Sym.getRawDataRefImpl());
|
||||||
|
if (GV) {
|
||||||
if (const Comdat *C = GV->getComdat())
|
if (const Comdat *C = GV->getComdat())
|
||||||
if (!KeptComdats.count(C))
|
if (!KeptComdats.count(C))
|
||||||
continue;
|
continue;
|
||||||
|
@ -454,10 +455,16 @@ void BitcodeFile::parse(DenseSet<StringRef> &ComdatGroups) {
|
||||||
SymbolBody *Body;
|
SymbolBody *Body;
|
||||||
uint32_t Flags = Sym.getFlags();
|
uint32_t Flags = Sym.getFlags();
|
||||||
bool IsWeak = Flags & BasicSymbolRef::SF_Weak;
|
bool IsWeak = Flags & BasicSymbolRef::SF_Weak;
|
||||||
if (Flags & BasicSymbolRef::SF_Undefined)
|
if (Flags & BasicSymbolRef::SF_Undefined) {
|
||||||
Body = new (Alloc) Undefined(NameRef, IsWeak, Visibility, false);
|
Body = new (Alloc) Undefined(NameRef, IsWeak, Visibility, false);
|
||||||
else
|
} else if (Flags & BasicSymbolRef::SF_Common) {
|
||||||
|
const DataLayout &DL = M.getDataLayout();
|
||||||
|
uint64_t Size = DL.getTypeAllocSize(GV->getValueType());
|
||||||
|
Body = new (Alloc)
|
||||||
|
DefinedCommon(NameRef, Size, GV->getAlignment(), IsWeak, Visibility);
|
||||||
|
} else {
|
||||||
Body = new (Alloc) DefinedBitcode(NameRef, IsWeak, Visibility);
|
Body = new (Alloc) DefinedBitcode(NameRef, IsWeak, Visibility);
|
||||||
|
}
|
||||||
SymbolBodies.push_back(Body);
|
SymbolBodies.push_back(Body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
.comm a,8,4
|
|
@ -0,0 +1,31 @@
|
||||||
|
; REQUIRES: x86
|
||||||
|
; RUN: llvm-as %s -o %t1.o
|
||||||
|
; RUN: llvm-mc -triple=x86_64-pc-linux %p/Inputs/common.s -o %t2.o -filetype=obj
|
||||||
|
; RUN: ld.lld %t1.o %t2.o -o %t.so -shared
|
||||||
|
; RUN: llvm-readobj -s -t %t.so | FileCheck %s
|
||||||
|
|
||||||
|
; CHECK: Name: .bss
|
||||||
|
; CHECK-NEXT: Type: SHT_NOBITS
|
||||||
|
; CHECK-NEXT: Flags [
|
||||||
|
; CHECK-NEXT: SHF_ALLOC
|
||||||
|
; CHECK-NEXT: SHF_WRITE
|
||||||
|
; CHECK-NEXT: ]
|
||||||
|
; CHECK-NEXT: Address:
|
||||||
|
; CHECK-NEXT: Offset:
|
||||||
|
; CHECK-NEXT: Size: 8
|
||||||
|
; CHECK-NEXT: Link: 0
|
||||||
|
; CHECK-NEXT: Info: 0
|
||||||
|
; CHECK-NEXT: AddressAlignment: 8
|
||||||
|
|
||||||
|
; CHECK: Name: a
|
||||||
|
; CHECK-NEXT: Value:
|
||||||
|
; CHECK-NEXT: Size: 8
|
||||||
|
; CHECK-NEXT: Binding: Global
|
||||||
|
; CHECK-NEXT: Type: Object
|
||||||
|
; CHECK-NEXT: Other: 0
|
||||||
|
; CHECK-NEXT: Section: .bss
|
||||||
|
|
||||||
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
|
@a = common global i32 0, align 8
|
Loading…
Reference in New Issue