mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 06:25:18 +00:00
Omit unused section symbols from the symbol table.
Section symbols exist as an optimization: instead of having multiple relocations point to different symbols, many of them can point to a single section symbol. When that optimization is unused, a section symbol is also unused and adds no extra information to the object file. This saves a bit of space on the object files and makes the output of llvm-objdump -t easier to read and consequently some tests get quite a bit simpler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239045 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -688,6 +688,8 @@ void ELFObjectWriter::RecordRelocation(MCAssembler &Asm,
|
||||
auto *ELFSec = cast_or_null<MCSectionELF>(SecA);
|
||||
const auto *SectionSymbol =
|
||||
ELFSec ? cast<MCSymbolELF>(ELFSec->getBeginSymbol()) : nullptr;
|
||||
if (SectionSymbol)
|
||||
SectionSymbol->setUsedInReloc();
|
||||
ELFRelocationEntry Rec(FixupOffset, SectionSymbol, Type, Addend);
|
||||
Relocations[&FixupSection].push_back(Rec);
|
||||
return;
|
||||
@@ -733,12 +735,12 @@ bool ELFObjectWriter::isInSymtab(const MCAsmLayout &Layout,
|
||||
if (Symbol.isUndefined() && !Symbol.isBindingSet())
|
||||
return false;
|
||||
|
||||
if (Symbol.getType() == ELF::STT_SECTION)
|
||||
return true;
|
||||
|
||||
if (Symbol.isTemporary())
|
||||
return false;
|
||||
|
||||
if (Symbol.getType() == ELF::STT_SECTION)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user