[lld] r231718 - Add SimpleAbsoluteAtom which is analogous to other Simple* atoms.
Rui Ueyama
ruiu at google.com
Mon Mar 9 15:34:59 PDT 2015
Author: ruiu
Date: Mon Mar 9 17:34:59 2015
New Revision: 231718
URL: http://llvm.org/viewvc/llvm-project?rev=231718&view=rev
Log:
Add SimpleAbsoluteAtom which is analogous to other Simple* atoms.
Modified:
lld/trunk/include/lld/Core/Simple.h
lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h
lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
Modified: lld/trunk/include/lld/Core/Simple.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Simple.h?rev=231718&r1=231717&r2=231718&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Simple.h (original)
+++ lld/trunk/include/lld/Core/Simple.h Mon Mar 9 17:34:59 2015
@@ -276,6 +276,23 @@ private:
StringRef _name;
};
+class SimpleAbsoluteAtom : public AbsoluteAtom {
+public:
+ SimpleAbsoluteAtom(const File &f, StringRef name, Scope s, uint64_t value)
+ : _file(f), _name(name), _scope(s), _value(value) {}
+
+ const File &file() const override { return _file; }
+ StringRef name() const override { return _name; }
+ uint64_t value() const override { return _value; }
+ Scope scope() const override { return _scope; }
+
+private:
+ const File &_file;
+ StringRef _name;
+ Scope _scope;
+ uint64_t _value;
+};
+
} // end namespace lld
#endif
Modified: lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp?rev=231718&r1=231717&r2=231718&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp Mon Mar 9 17:34:59 2015
@@ -27,22 +27,6 @@
namespace lld {
-class CommandLineAbsoluteAtom : public AbsoluteAtom {
-public:
- CommandLineAbsoluteAtom(const File &file, StringRef name, uint64_t value)
- : _file(file), _name(name), _value(value) {}
-
- const File &file() const override { return _file; }
- StringRef name() const override { return _name; }
- uint64_t value() const override { return _value; }
- Scope scope() const override { return scopeGlobal; }
-
-private:
- const File &_file;
- StringRef _name;
- uint64_t _value;
-};
-
class CommandLineUndefinedAtom : public SimpleUndefinedAtom {
public:
CommandLineUndefinedAtom(const File &f, StringRef name)
@@ -197,7 +181,8 @@ void ELFLinkingContext::createInternalFi
for (auto &i : getAbsoluteSymbols()) {
StringRef sym = i.first;
uint64_t val = i.second;
- file->addAtom(*(new (_allocator) CommandLineAbsoluteAtom(*file, sym, val)));
+ file->addAtom(*(new (_allocator) SimpleAbsoluteAtom(
+ *file, sym, Atom::scopeGlobal, val)));
}
files.push_back(std::move(file));
LinkingContext::createInternalFiles(files);
Modified: lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h?rev=231718&r1=231717&r2=231718&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h Mon Mar 9 17:34:59 2015
@@ -20,23 +20,6 @@ namespace lld {
namespace pecoff {
class COFFDefinedAtom;
-class COFFAbsoluteAtom : public AbsoluteAtom {
-public:
- COFFAbsoluteAtom(const File &f, StringRef name, Scope scope, uint64_t value)
- : _owningFile(f), _name(name), _scope(scope), _value(value) {}
-
- const File &file() const override { return _owningFile; }
- Scope scope() const override { return _scope; }
- StringRef name() const override { return _name; }
- uint64_t value() const override { return _value; }
-
-private:
- const File &_owningFile;
- StringRef _name;
- Scope _scope;
- uint64_t _value;
-};
-
class COFFUndefinedAtom : public UndefinedAtom {
public:
COFFUndefinedAtom(const File &file, StringRef name,
Modified: lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h?rev=231718&r1=231717&r2=231718&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h Mon Mar 9 17:34:59 2015
@@ -137,7 +137,7 @@ public:
};
private:
- COFFAbsoluteAtom _imageBaseAtom;
+ SimpleAbsoluteAtom _imageBaseAtom;
};
// A LocallyImporteSymbolFile is an archive file containing __imp_
Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=231718&r1=231717&r2=231718&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Mon Mar 9 17:34:59 2015
@@ -39,7 +39,6 @@
#define DEBUG_TYPE "ReaderCOFF"
-using lld::pecoff::COFFAbsoluteAtom;
using lld::pecoff::COFFBSSAtom;
using lld::pecoff::COFFDefinedAtom;
using lld::pecoff::COFFDefinedFileAtom;
@@ -440,8 +439,8 @@ void FileCOFF::createAbsoluteAtoms(const
for (llvm::object::COFFSymbolRef sym : symbols) {
if (sym.getSectionNumber() != llvm::COFF::IMAGE_SYM_ABSOLUTE)
continue;
- auto *atom = new (_alloc) COFFAbsoluteAtom(*this, _symbolName[sym],
- getScope(sym), sym.getValue());
+ auto *atom = new (_alloc) SimpleAbsoluteAtom(*this, _symbolName[sym],
+ getScope(sym), sym.getValue());
result.push_back(atom);
_symbolAtom[sym] = atom;
More information about the llvm-commits
mailing list