summaryrefslogtreecommitdiffstats
path: root/lld/lib/Core
diff options
context:
space:
mode:
Diffstat (limited to 'lld/lib/Core')
-rw-r--r--lld/lib/Core/DefinedAtom.cpp1
-rw-r--r--lld/lib/Core/Resolver.cpp28
2 files changed, 5 insertions, 24 deletions
diff --git a/lld/lib/Core/DefinedAtom.cpp b/lld/lib/Core/DefinedAtom.cpp
index 806bd6f4521..8362aadb21c 100644
--- a/lld/lib/Core/DefinedAtom.cpp
+++ b/lld/lib/Core/DefinedAtom.cpp
@@ -72,7 +72,6 @@ DefinedAtom::ContentPermissions DefinedAtom::permissions(ContentType type) {
return permRW_L;
case typeGroupComdat:
- case typeGnuLinkOnce:
case typeUnknown:
case typeTempLTO:
return permUnknown;
diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp
index 6ff898726b3..9555fef22ba 100644
--- a/lld/lib/Core/Resolver.cpp
+++ b/lld/lib/Core/Resolver.cpp
@@ -184,22 +184,11 @@ void Resolver::doUndefinedAtom(const UndefinedAtom &atom) {
}
/// \brief Add the section group and the group-child reference members.
-bool Resolver::maybeAddSectionGroupOrGnuLinkOnce(const DefinedAtom &atom) {
+void Resolver::maybeAddSectionGroup(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 = llvm::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.
- if (atom.contentType() != prevGroup->contentType())
- return false;
- return true;
- }
+ if (!isFirstTime)
+ return;
for (const Reference *r : atom) {
if ((r->kindNamespace() == lld::Reference::KindNamespace::all) &&
@@ -211,7 +200,6 @@ bool Resolver::maybeAddSectionGroupOrGnuLinkOnce(const DefinedAtom &atom) {
_symbolTable.add(*target);
}
}
- return true;
}
// called on each atom when a file is added
@@ -241,14 +229,8 @@ void Resolver::doDefinedAtom(const DefinedAtom &atom) {
// add to list of known atoms
_atoms.push_back(&atom);
- if ((atom.contentType() == DefinedAtom::typeGroupComdat) ||
- (atom.contentType() == DefinedAtom::typeGnuLinkOnce)) {
- // 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");
- }
- }
+ if (atom.contentType() == DefinedAtom::typeGroupComdat)
+ maybeAddSectionGroup(atom);
else
_symbolTable.add(atom);
OpenPOWER on IntegriCloud