summaryrefslogtreecommitdiffstats
path: root/lld/lib/Core/Resolver.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-04-03 22:21:59 +0000
committerRui Ueyama <ruiu@google.com>2014-04-03 22:21:59 +0000
commit70625fb16395c2b5ae0140429e7df854006cc4d1 (patch)
tree24876ad2b31e00f796dd43e121589b969b599a8f /lld/lib/Core/Resolver.cpp
parentfd0d20fae7b4b55769122b8b38348baec65e8dc9 (diff)
downloadbcm5719-llvm-70625fb16395c2b5ae0140429e7df854006cc4d1.tar.gz
bcm5719-llvm-70625fb16395c2b5ae0140429e7df854006cc4d1.zip
Move code into a helper function.
Move code that always runs after doUndefinedAtom into doUndefinedAtom for readability. llvm-svn: 205574
Diffstat (limited to 'lld/lib/Core/Resolver.cpp')
-rw-r--r--lld/lib/Core/Resolver.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp
index cf4af5cd0f1..2ed88c9d1a4 100644
--- a/lld/lib/Core/Resolver.cpp
+++ b/lld/lib/Core/Resolver.cpp
@@ -69,27 +69,15 @@ private:
} // namespace
void Resolver::handleFile(const File &file) {
- bool isEmpty = file.defined().empty() && file.sharedLibrary().empty() &&
- file.absolute().empty() && file.undefined().empty();
+ bool isEmpty = file.defined().empty() && file.undefined().empty() &&
+ file.sharedLibrary().empty() && file.absolute().empty();
if (isEmpty)
return;
for (const DefinedAtom *atom : file.defined())
doDefinedAtom(*atom);
-
- for (const UndefinedAtom *undefAtom : file.undefined()) {
- doUndefinedAtom(*undefAtom);
- // If the undefined symbol has an alternative name, try to resolve the
- // symbol with the name to give it a second chance. This feature is used
- // for COFF "weak external" symbol.
- if (!_symbolTable.isDefined(undefAtom->name())) {
- if (const UndefinedAtom *fallbackAtom = undefAtom->fallback()) {
- doUndefinedAtom(*fallbackAtom);
- _symbolTable.addReplacement(undefAtom, fallbackAtom);
- }
- }
- }
-
+ for (const UndefinedAtom *atom : file.undefined())
+ doUndefinedAtom(*atom);
for (const SharedLibraryAtom *atom : file.sharedLibrary())
doSharedLibraryAtom(*atom);
for (const AbsoluteAtom *atom : file.absolute())
@@ -165,15 +153,23 @@ void Resolver::doUndefinedAtom(const UndefinedAtom &atom) {
DEBUG_WITH_TYPE("resolver", llvm::dbgs()
<< " UndefinedAtom: "
<< llvm::format("0x%09lX", &atom)
- << ", name="
- << atom.name()
- << "\n");
+ << ", name=" << atom.name() << "\n");
// add to list of known atoms
_atoms.push_back(&atom);
// tell symbol table
_symbolTable.add(atom);
+
+ // If the undefined symbol has an alternative name, try to resolve the
+ // symbol with the name to give it a second chance. This feature is used
+ // for COFF "weak external" symbol.
+ if (!_symbolTable.isDefined(atom.name())) {
+ if (const UndefinedAtom *fallbackAtom = atom.fallback()) {
+ doUndefinedAtom(*fallbackAtom);
+ _symbolTable.addReplacement(&atom, fallbackAtom);
+ }
+ }
}
/// \brief Add the section group and the group-child reference members.
OpenPOWER on IntegriCloud