summaryrefslogtreecommitdiffstats
path: root/lld/lib/Core/Resolver.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-05-14 17:29:27 +0000
committerRui Ueyama <ruiu@google.com>2014-05-14 17:29:27 +0000
commit2a522511535cade4e6470666e0ac1f4e33a903d3 (patch)
treee540e40b7da2a010006475be54b5ac9ef13a6c80 /lld/lib/Core/Resolver.cpp
parent24feaf70aaeee0325d8008f7cb22d58c5282e46e (diff)
downloadbcm5719-llvm-2a522511535cade4e6470666e0ac1f4e33a903d3.tar.gz
bcm5719-llvm-2a522511535cade4e6470666e0ac1f4e33a903d3.zip
Fix regression introduced in r205566.
In r205566, I made a change to Resolver so that Resolver revisit only archive files in --start-group and --end-group pair. That's not correct, as it also has to revisit DSO files. This patch is to fix the issue. Added a test to demonstrate the fix. I confirmed that it succeeded before r205566, failed after r205566, and is ok with this patch. Differential Revision: http://reviews.llvm.org/D3734 llvm-svn: 208797
Diffstat (limited to 'lld/lib/Core/Resolver.cpp')
-rw-r--r--lld/lib/Core/Resolver.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp
index d139f8a4625..6ed35598d60 100644
--- a/lld/lib/Core/Resolver.cpp
+++ b/lld/lib/Core/Resolver.cpp
@@ -48,15 +48,12 @@ private:
} // namespace
void Resolver::handleFile(const File &file) {
- bool isEmpty = file.defined().empty() && file.undefined().empty() &&
- file.sharedLibrary().empty() && file.absolute().empty();
- if (isEmpty)
- return;
-
+ bool undefAdded = false;
for (const DefinedAtom *atom : file.defined())
doDefinedAtom(*atom);
for (const UndefinedAtom *atom : file.undefined())
- doUndefinedAtom(*atom);
+ if (doUndefinedAtom(*atom))
+ undefAdded = true;
for (const SharedLibraryAtom *atom : file.sharedLibrary())
doSharedLibraryAtom(*atom);
for (const AbsoluteAtom *atom : file.absolute())
@@ -65,7 +62,9 @@ void Resolver::handleFile(const File &file) {
// Notify the input file manager of the fact that we have made some progress
// on linking using the current input file. It may want to know the fact for
// --start-group/--end-group.
- _context.getInputGraph().notifyProgress();
+ if (undefAdded) {
+ _context.getInputGraph().notifyProgress();
+ }
}
void Resolver::forEachUndefines(bool searchForOverrides,
@@ -124,7 +123,7 @@ void Resolver::handleSharedLibrary(const File &file) {
});
}
-void Resolver::doUndefinedAtom(const UndefinedAtom &atom) {
+bool Resolver::doUndefinedAtom(const UndefinedAtom &atom) {
DEBUG_WITH_TYPE("resolver", llvm::dbgs()
<< " UndefinedAtom: "
<< llvm::format("0x%09lX", &atom)
@@ -134,7 +133,7 @@ void Resolver::doUndefinedAtom(const UndefinedAtom &atom) {
_atoms.push_back(&atom);
// tell symbol table
- _symbolTable.add(atom);
+ bool newUndefAdded = _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
@@ -145,6 +144,7 @@ void Resolver::doUndefinedAtom(const UndefinedAtom &atom) {
_symbolTable.addReplacement(&atom, fallbackAtom);
}
}
+ return newUndefAdded;
}
/// \brief Add the section group and the group-child reference members.
@@ -178,7 +178,8 @@ bool Resolver::maybeAddSectionGroupOrGnuLinkOnce(const DefinedAtom &atom) {
return true;
}
-// called on each atom when a file is added
+// Called on each atom when a file is added. Returns true if a given
+// atom is added to the symbol table.
void Resolver::doDefinedAtom(const DefinedAtom &atom) {
DEBUG_WITH_TYPE("resolver", llvm::dbgs()
<< " DefinedAtom: "
OpenPOWER on IntegriCloud