1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

On elf, undefined symbols can start with .L.

llvm-svn: 114958
This commit is contained in:
Rafael Espindola 2010-09-28 16:19:11 +00:00
parent b8b0209acb
commit c604f87ba4
2 changed files with 19 additions and 1 deletions

View File

@ -689,12 +689,15 @@ void ELFObjectWriterImpl::ComputeSymbolTable(MCAssembler &Asm) {
const MCSymbol &Symbol = it->getSymbol();
// Ignore non-linker visible symbols.
if (!Asm.isSymbolLinkerVisible(Symbol))
if (!Asm.isSymbolLinkerVisible(Symbol) && !Symbol.isUndefined())
continue;
if (!it->isExternal() && !Symbol.isUndefined())
continue;
if (Symbol.isVariable())
continue;
uint64_t &Entry = StringIndexMap[Symbol.getName()];
if (!Entry) {
Entry = StringTable.size();

15
test/MC/ELF/undef.s Normal file
View File

@ -0,0 +1,15 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
// Test that there is an undefined reference to .Lset0, but not .Lset1
.long .Lset0
foo:
bar:
.Lset1 = foo - bar
.long .Lset1
// CHECK: ('_symbols', [
// CHECK-NOT: Lset1
// CHECK: (('st_name', 9) # '.Lset0'
// CHECK-NOT: Lset1
// CHECK: (('sh_name', 36) # '.strtab'