Defined weak symbols should have non-zero value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117585 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2010-10-28 19:39:57 +00:00
parent 9f36e7389f
commit 1973d43792
2 changed files with 5 additions and 6 deletions

View File

@ -438,7 +438,6 @@ static uint64_t SymbolValue(MCSymbolData &Data, const MCAsmLayout &Layout) {
if (!Symbol.isInSection())
return 0;
if (!Data.isCommon() && !(Data.getFlags() & ELF_STB_Weak))
if (MCFragment *FF = Data.getFragment())
return Layout.getSymbolAddress(&Data) -
Layout.getSectionAddress(FF->getParent());

View File

@ -5,7 +5,7 @@
.weak foo
.long foo
// And that bar is after all local symbols
// And that bar is after all local symbols and has non zero value.
.weak bar
bar:
@ -15,7 +15,7 @@ bar:
//CHECK-NEXT: ('st_type', 0x00000000)
//CHECK-NEXT: ('st_other', 0x00000000)
//CHECK-NEXT: ('st_shndx', 0x00000001)
//CHECK-NEXT: ('st_value', 0x00000000)
//CHECK-NEXT: ('st_value', 0x00000004)
//CHECK-NEXT: ('st_size', 0x00000000)
//CHECK-NEXT: ),
//CHECK-NEXT: # Symbol 0x00000005