aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-05-29 15:07:27 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-05-29 15:07:27 +0000
commitf4b4430f8c9c66c32a49e4c72bf594580d198501 (patch)
tree35dd183bf03bd0c051183411950fdc9dc92b5809 /llvm/lib/MC/ELFObjectWriter.cpp
parent674bc7b0c4d3f2f3edac0b6889d5e0bf2a02edfb (diff)
downloadllvm-f4b4430f8c9c66c32a49e4c72bf594580d198501.zip
llvm-f4b4430f8c9c66c32a49e4c72bf594580d198501.tar.gz
llvm-f4b4430f8c9c66c32a49e4c72bf594580d198501.tar.bz2
Simplify now that symbols contain the correct section.
The complexity in here was because before r233995 variable symbols would report the incorrect section. llvm-svn: 238559
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index 827a1e3..27b8b9b 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -823,24 +823,19 @@ void ELFObjectWriter::computeSymbolTable(
ELFSymbolData MSD;
MSD.Symbol = &Symbol;
- const MCSymbol *BaseSymbol = Layout.getBaseSymbol(Symbol);
// Undefined symbols are global, but this is the first place we
// are able to set it.
bool Local = isLocal(Symbol, Used, isSignature);
- if (!Local && MCELF::GetBinding(SD) == ELF::STB_LOCAL) {
- assert(BaseSymbol);
- MCSymbolData &BaseData = BaseSymbol->getData();
+ if (!Local && MCELF::GetBinding(SD) == ELF::STB_LOCAL)
MCELF::SetBinding(SD, ELF::STB_GLOBAL);
- MCELF::SetBinding(BaseData, ELF::STB_GLOBAL);
- }
- if (!BaseSymbol) {
+ if (Symbol.isAbsolute()) {
MSD.SectionIndex = ELF::SHN_ABS;
} else if (SD.isCommon()) {
assert(!Local);
MSD.SectionIndex = ELF::SHN_COMMON;
- } else if (BaseSymbol->isUndefined()) {
+ } else if (Symbol.isUndefined()) {
if (isSignature && !Used) {
MSD.SectionIndex = RevGroupMap.lookup(&Symbol);
if (MSD.SectionIndex >= ELF::SHN_LORESERVE)
@@ -852,7 +847,7 @@ void ELFObjectWriter::computeSymbolTable(
MCELF::SetBinding(SD, ELF::STB_WEAK);
} else {
const MCSectionELF &Section =
- static_cast<const MCSectionELF&>(BaseSymbol->getSection());
+ static_cast<const MCSectionELF &>(Symbol.getSection());
MSD.SectionIndex = SectionIndexMap.lookup(&Section);
assert(MSD.SectionIndex && "Invalid section index!");
if (MSD.SectionIndex >= ELF::SHN_LORESERVE)