mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
On elf, undefined symbols can start with .L.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114958 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -689,12 +689,15 @@ void ELFObjectWriterImpl::ComputeSymbolTable(MCAssembler &Asm) {
|
|||||||
const MCSymbol &Symbol = it->getSymbol();
|
const MCSymbol &Symbol = it->getSymbol();
|
||||||
|
|
||||||
// Ignore non-linker visible symbols.
|
// Ignore non-linker visible symbols.
|
||||||
if (!Asm.isSymbolLinkerVisible(Symbol))
|
if (!Asm.isSymbolLinkerVisible(Symbol) && !Symbol.isUndefined())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!it->isExternal() && !Symbol.isUndefined())
|
if (!it->isExternal() && !Symbol.isUndefined())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (Symbol.isVariable())
|
||||||
|
continue;
|
||||||
|
|
||||||
uint64_t &Entry = StringIndexMap[Symbol.getName()];
|
uint64_t &Entry = StringIndexMap[Symbol.getName()];
|
||||||
if (!Entry) {
|
if (!Entry) {
|
||||||
Entry = StringTable.size();
|
Entry = StringTable.size();
|
||||||
|
15
test/MC/ELF/undef.s
Normal file
15
test/MC/ELF/undef.s
Normal 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'
|
Reference in New Issue
Block a user