[lld] r262184 - Delete more COFF and ELF bits from the old linker.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 28 08:27:08 PST 2016
Author: rafael
Date: Sun Feb 28 10:27:08 2016
New Revision: 262184
URL: http://llvm.org/viewvc/llvm-project?rev=262184&view=rev
Log:
Delete more COFF and ELF bits from the old linker.
Removed:
lld/trunk/test/core/undef-fallback.objtxt
Modified:
lld/trunk/include/lld/Core/File.h
lld/trunk/include/lld/Core/Reader.h
lld/trunk/include/lld/Core/SharedLibraryFile.h
lld/trunk/include/lld/Core/UndefinedAtom.h
lld/trunk/include/lld/Core/Writer.h
lld/trunk/lib/Core/Resolver.cpp
lld/trunk/lib/Core/SymbolTable.cpp
lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
Modified: lld/trunk/include/lld/Core/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/File.h?rev=262184&r1=262183&r2=262184&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/File.h (original)
+++ lld/trunk/include/lld/Core/File.h Sun Feb 28 10:27:08 2016
@@ -146,14 +146,6 @@ public:
std::error_code parse();
- // This function is called just before the core linker tries to use
- // a file. Currently the PECOFF reader uses this to trigger the
- // driver to parse .drectve section (which contains command line options).
- // If you want to do something having side effects, don't do that in
- // doParse() because a file could be pre-loaded speculatively.
- // Use this hook instead.
- virtual void beforeLink() {}
-
// Usually each file owns a std::unique_ptr<MemoryBuffer>.
// However, there's one special case. If a file is an archive file,
// the archive file and its children all shares the same memory buffer.
Modified: lld/trunk/include/lld/Core/Reader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Reader.h?rev=262184&r1=262183&r2=262184&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Reader.h (original)
+++ lld/trunk/include/lld/Core/Reader.h Sun Feb 28 10:27:08 2016
@@ -34,8 +34,7 @@ class MachOLinkingContext;
/// \brief An abstract class for reading object files, library files, and
/// executable files.
///
-/// Each file format (e.g. ELF, mach-o, PECOFF, etc) have a concrete
-/// subclass of Reader.
+/// Each file format (e.g. mach-o, etc) has a concrete subclass of Reader.
class Reader {
public:
virtual ~Reader() {}
Modified: lld/trunk/include/lld/Core/SharedLibraryFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/SharedLibraryFile.h?rev=262184&r1=262183&r2=262184&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/SharedLibraryFile.h (original)
+++ lld/trunk/include/lld/Core/SharedLibraryFile.h Sun Feb 28 10:27:08 2016
@@ -30,8 +30,7 @@ public:
virtual const SharedLibraryAtom *exports(StringRef name,
bool dataSymbolOnly) const = 0;
- // Returns DSO name. It's the soname (ELF), the install name (MachO) or
- // the import name (Windows).
+ // Returns the install name.
virtual StringRef getDSOName() const = 0;
const AtomVector<DefinedAtom> &defined() const override {
Modified: lld/trunk/include/lld/Core/UndefinedAtom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/UndefinedAtom.h?rev=262184&r1=262183&r2=262184&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/UndefinedAtom.h (original)
+++ lld/trunk/include/lld/Core/UndefinedAtom.h Sun Feb 28 10:27:08 2016
@@ -57,14 +57,6 @@ public:
static bool classof(const UndefinedAtom *) { return true; }
- /// Returns an undefined atom if this undefined symbol has a synonym. This is
- /// mainly used in COFF. In COFF, an unresolved external symbol can have up to
- /// one optional name (sym2) in addition to its regular name (sym1). If a
- /// definition of sym1 exists, sym1 is resolved normally. Otherwise, all
- /// references to sym1 refer to sym2 instead. In that case sym2 must be
- /// resolved, or link will fail.
- virtual const UndefinedAtom *fallback() const { return nullptr; }
-
protected:
UndefinedAtom() : Atom(definitionUndefined) {}
};
Modified: lld/trunk/include/lld/Core/Writer.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Writer.h?rev=262184&r1=262183&r2=262184&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Writer.h (original)
+++ lld/trunk/include/lld/Core/Writer.h Sun Feb 28 10:27:08 2016
@@ -20,8 +20,8 @@ class LinkingContext;
class MachOLinkingContext;
/// \brief The Writer is an abstract class for writing object files, shared
-/// library files, and executable files. Each file format (e.g. ELF, mach-o,
-/// PECOFF, etc) have a concrete subclass of Writer.
+/// library files, and executable files. Each file format (e.g. mach-o, etc)
+/// has a concrete subclass of Writer.
class Writer {
public:
virtual ~Writer();
Modified: lld/trunk/lib/Core/Resolver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Resolver.cpp?rev=262184&r1=262183&r2=262184&view=diff
==============================================================================
--- lld/trunk/lib/Core/Resolver.cpp (original)
+++ lld/trunk/lib/Core/Resolver.cpp Sun Feb 28 10:27:08 2016
@@ -98,7 +98,6 @@ ErrorOr<bool> Resolver::handleArchiveFil
bool dataSymbolOnly)->ErrorOr<bool> {
if (File *member = archiveFile->find(undefName, dataSymbolOnly)) {
member->setOrdinal(_ctx.getNextOrdinalAndIncrement());
- member->beforeLink();
updatePreloadArchiveMap();
return handleFile(*member);
}
@@ -142,15 +141,6 @@ bool Resolver::doUndefinedAtom(const Und
if (newUndefAdded)
_undefines.push_back(atom.name());
- // 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 (newUndefAdded || !_symbolTable.isDefined(atom.name())) {
- if (const UndefinedAtom *fallbackAtom = atom.fallback()) {
- doUndefinedAtom(*fallbackAtom);
- _symbolTable.addReplacement(&atom, fallbackAtom);
- }
- }
return newUndefAdded;
}
@@ -297,7 +287,6 @@ bool Resolver::resolveUndefines() {
}
DEBUG_WITH_TYPE("resolver",
llvm::dbgs() << "Loaded file: " << file->path() << "\n");
- file->beforeLink();
updatePreloadArchiveMap();
switch (file->kind()) {
case File::kindErrorObject:
Modified: lld/trunk/lib/Core/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/SymbolTable.cpp?rev=262184&r1=262183&r2=262184&view=diff
==============================================================================
--- lld/trunk/lib/Core/SymbolTable.cpp (original)
+++ lld/trunk/lib/Core/SymbolTable.cpp Sun Feb 28 10:27:08 2016
@@ -196,23 +196,8 @@ bool SymbolTable::addByName(const Atom &
<< " and in " << newUndef->file().path() << "\n";
}
- const UndefinedAtom *existingFallback = existingUndef->fallback();
- const UndefinedAtom *newFallback = newUndef->fallback();
- bool hasDifferentFallback =
- (existingFallback && newFallback &&
- existingFallback->name() != newFallback->name());
- if (hasDifferentFallback) {
- llvm::errs() << "lld warning: undefined symbol "
- << existingUndef->name() << " has different fallback: "
- << existingFallback->name() << " in "
- << existingUndef->file().path() << " and "
- << newFallback->name() << " in "
- << newUndef->file().path() << "\n";
- }
-
- bool hasNewFallback = newUndef->fallback();
if (sameCanBeNull)
- useNew = hasNewFallback;
+ useNew = false;
else
useNew = (newUndef->canBeNull() < existingUndef->canBeNull());
break;
Modified: lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp?rev=262184&r1=262183&r2=262184&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp (original)
+++ lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp Sun Feb 28 10:27:08 2016
@@ -940,12 +940,11 @@ template <> struct MappingTraits<const l
class NormalizedAtom : public lld::UndefinedAtom {
public:
NormalizedAtom(IO &io)
- : _file(fileFromContext(io)), _name(), _canBeNull(canBeNullNever),
- _fallback(nullptr) {}
+ : _file(fileFromContext(io)), _name(), _canBeNull(canBeNullNever) {}
NormalizedAtom(IO &io, const lld::UndefinedAtom *atom)
: _file(fileFromContext(io)), _name(atom->name()),
- _canBeNull(atom->canBeNull()), _fallback(atom->fallback()) {}
+ _canBeNull(atom->canBeNull()) {}
const lld::UndefinedAtom *denormalize(IO &io) {
YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
@@ -973,12 +972,10 @@ template <> struct MappingTraits<const l
const lld::File &file() const override { return _file; }
StringRef name() const override { return _name; }
CanBeNull canBeNull() const override { return _canBeNull; }
- const UndefinedAtom *fallback() const override { return _fallback; }
const lld::File &_file;
StringRef _name;
CanBeNull _canBeNull;
- const UndefinedAtom *_fallback;
};
static void mapping(IO &io, const lld::UndefinedAtom *&atom) {
@@ -988,8 +985,6 @@ template <> struct MappingTraits<const l
io.mapRequired("name", keys->_name);
io.mapOptional("can-be-null", keys->_canBeNull,
lld::UndefinedAtom::canBeNullNever);
- io.mapOptional("fallback", keys->_fallback,
- (const lld::UndefinedAtom *)nullptr);
}
};
Removed: lld/trunk/test/core/undef-fallback.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/core/undef-fallback.objtxt?rev=262183&view=auto
==============================================================================
--- lld/trunk/test/core/undef-fallback.objtxt (original)
+++ lld/trunk/test/core/undef-fallback.objtxt (removed)
@@ -1,29 +0,0 @@
-# RUN: lld -core %p/undef-fallback.objtxt %p/Inputs/undef-fallback.objtxt | FileCheck %s
-
-# Test that fallback atoms can be parsed by YAML reader and processed by the
-# core linker.
-
----
-defined-atoms:
- - name: def1
- scope: global
-
-undefined-atoms:
- - name: undef1
- fallback:
- name: fallback1
- - name: undef2
- fallback:
- name: fallback2
-...
-
-# CHECK: defined-atoms:
-# CHECK-NEXT: - name: def1
-# CHECK-NEXT: scope: global
-# CHECK-NEXT: - name: fallback1
-# CHECK-NEXT: ref-name: fallback1
-# CHECK-NEXT: undefined-atoms:
-# CHECK-NEXT: - name: fallback1
-# CHECK-NEXT: - name: fallback2
-
-# CHECK-NOT: - name: fallback3
More information about the llvm-commits
mailing list