diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-03-19 03:18:09 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-03-19 03:18:09 +0000 |
commit | 238698566311e9dba4092dfa6c0bfe253279702e (patch) | |
tree | 71c78de91d210b0e659bb3654608d45c08720ff6 /lib | |
parent | 9bdda3a75ebf94bb9259764af1b6c2b383a1fa63 (diff) | |
download | external_llvm-238698566311e9dba4092dfa6c0bfe253279702e.zip external_llvm-238698566311e9dba4092dfa6c0bfe253279702e.tar.gz external_llvm-238698566311e9dba4092dfa6c0bfe253279702e.tar.bz2 |
MC/Mach-O: Factor out isSymbolLinkerVisible method; "linker visible" is a made up term to refer to non-temporary labels + temporary labels in sections-which-require symbols. For Darwin, it corresponds to symbols which effectively define an atom.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98923 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/MCAssembler.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp index 51b1273..065c49e 100644 --- a/lib/MC/MCAssembler.cpp +++ b/lib/MC/MCAssembler.cpp @@ -673,11 +673,8 @@ public: ie = Asm.symbol_end(); it != ie; ++it) { const MCSymbol &Symbol = it->getSymbol(); - // Ignore assembler temporaries. - if (it->getSymbol().isTemporary() && - (!it->getFragment() || - !Asm.getBackend().doesSectionRequireSymbols( - it->getFragment()->getParent()->getSection()))) + // Ignore non-linker visible symbols. + if (!Asm.isSymbolLinkerVisible(it)) continue; if (!it->isExternal() && !Symbol.isUndefined()) @@ -712,11 +709,8 @@ public: ie = Asm.symbol_end(); it != ie; ++it) { const MCSymbol &Symbol = it->getSymbol(); - // Ignore assembler temporaries. - if (it->getSymbol().isTemporary() && - (!it->getFragment() || - !Asm.getBackend().doesSectionRequireSymbols( - it->getFragment()->getParent()->getSection()))) + // Ignore non-linker visible symbols. + if (!Asm.isSymbolLinkerVisible(it)) continue; if (it->isExternal() || Symbol.isUndefined()) @@ -1016,6 +1010,20 @@ MCAssembler::MCAssembler(MCContext &_Context, TargetAsmBackend &_Backend, MCAssembler::~MCAssembler() { } +bool MCAssembler::isSymbolLinkerVisible(const MCSymbolData *SD) const { + // Non-temporary labels should always be visible to the linker. + if (!SD->getSymbol().isTemporary()) + return true; + + // Absolute temporary labels are never visible. + if (!SD->getFragment()) + return false; + + // Otherwise, check if the section requires symbols even for temporary labels. + return getBackend().doesSectionRequireSymbols( + SD->getFragment()->getParent()->getSection()); +} + bool MCAssembler::EvaluateFixup(const MCAsmLayout &Layout, MCAsmFixup &Fixup, MCDataFragment *DF, MCValue &Target, uint64_t &Value) const { |