summaryrefslogtreecommitdiffstats
path: root/lld/lib/Core/Resolver.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-06-05 07:37:25 +0000
committerRui Ueyama <ruiu@google.com>2014-06-05 07:37:25 +0000
commit52edc4903136edda614e31bf08c5d5118ba071bf (patch)
tree05e023d3a4a831726336591ac7a75d628784c647 /lld/lib/Core/Resolver.cpp
parentf3cb9d1d57a763d46d4e7e46e660f06c9fb8ad55 (diff)
downloadbcm5719-llvm-52edc4903136edda614e31bf08c5d5118ba071bf.tar.gz
bcm5719-llvm-52edc4903136edda614e31bf08c5d5118ba071bf.zip
Print error message in LinkOnce handler.
Rather than outside of the handler function to make the code simple. llvm-svn: 210241
Diffstat (limited to 'lld/lib/Core/Resolver.cpp')
-rw-r--r--lld/lib/Core/Resolver.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp
index ba4b61bb886..03e6596893e 100644
--- a/lld/lib/Core/Resolver.cpp
+++ b/lld/lib/Core/Resolver.cpp
@@ -148,26 +148,30 @@ bool Resolver::doUndefinedAtom(const UndefinedAtom &atom) {
}
/// \brief Add the section group and the group-child reference members.
-bool Resolver::maybeAddSectionGroupOrGnuLinkOnce(const DefinedAtom &atom) {
+void Resolver::maybeAddSectionGroupOrGnuLinkOnce(const DefinedAtom &atom) {
// First time adding a group?
bool isFirstTime = _symbolTable.addGroup(atom);
if (!isFirstTime) {
// If duplicate symbols are allowed, select the first group.
if (_context.getAllowDuplicates())
- return true;
- const DefinedAtom *prevGroup =
- dyn_cast<DefinedAtom>(_symbolTable.findGroup(atom.name()));
+ return;
+ auto *prevGroup = dyn_cast<DefinedAtom>(_symbolTable.findGroup(atom.name()));
assert(prevGroup &&
"Internal Error: The group atom could only be a defined atom");
// The atoms should be of the same content type, reject invalid group
// resolution behaviors.
- return atom.contentType() == prevGroup->contentType();
+ if (atom.contentType() == prevGroup->contentType())
+ return;
+ llvm::errs() << "SymbolTable: error while merging " << atom.name()
+ << "\n";
+ llvm::report_fatal_error("duplicate symbol error");
+ return;
}
for (const Reference *r : atom) {
- if ((r->kindNamespace() == lld::Reference::KindNamespace::all) &&
- (r->kindValue() == lld::Reference::kindGroupChild)) {
+ if (r->kindNamespace() == lld::Reference::KindNamespace::all &&
+ r->kindValue() == lld::Reference::kindGroupChild) {
const DefinedAtom *target = dyn_cast<DefinedAtom>(r->target());
assert(target && "Internal Error: kindGroupChild references need to "
"be associated with Defined Atoms only");
@@ -175,7 +179,6 @@ bool Resolver::maybeAddSectionGroupOrGnuLinkOnce(const DefinedAtom &atom) {
_symbolTable.add(*target);
}
}
- return true;
}
// Called on each atom when a file is added. Returns true if a given
@@ -202,12 +205,7 @@ void Resolver::doDefinedAtom(const DefinedAtom &atom) {
_atoms.push_back(&atom);
if (atom.isGroupParent()) {
- // Raise error if there exists a similar gnu linkonce section.
- if (!maybeAddSectionGroupOrGnuLinkOnce(atom)) {
- llvm::errs() << "SymbolTable: error while merging " << atom.name()
- << "\n";
- llvm::report_fatal_error("duplicate symbol error");
- }
+ maybeAddSectionGroupOrGnuLinkOnce(atom);
} else {
_symbolTable.add(atom);
}
OpenPOWER on IntegriCloud