Revert "[core] support .gnu.linkonce sections"
This reverts commit 5d5ca72a7876c3dd3dd1db83dc6a0d74be9e2cd1.
Discuss on a better design to raise error when there is a similar group with Gnu
linkonce sections and COMDAT sections.
llvm-svn: 205224
diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp
index 6ff8987..9555fef 100644
--- a/lld/lib/Core/Resolver.cpp
+++ b/lld/lib/Core/Resolver.cpp
@@ -184,22 +184,11 @@
}
/// \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 @@
_symbolTable.add(*target);
}
}
- return true;
}
// called on each atom when a file is added
@@ -241,14 +229,8 @@
// 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);