[lld] r197788 - Run clang-format on r197727.
Rui Ueyama
ruiu at google.com
Thu Dec 19 23:48:29 PST 2013
Author: ruiu
Date: Fri Dec 20 01:48:29 2013
New Revision: 197788
URL: http://llvm.org/viewvc/llvm-project?rev=197788&view=rev
Log:
Run clang-format on r197727.
Modified:
lld/trunk/include/lld/Core/ArchiveLibraryFile.h
lld/trunk/include/lld/Core/File.h
lld/trunk/include/lld/Core/LinkingContext.h
lld/trunk/include/lld/Core/Reference.h
lld/trunk/include/lld/Core/Resolver.h
lld/trunk/include/lld/Driver/DarwinInputGraph.h
lld/trunk/include/lld/ReaderWriter/CoreLinkingContext.h
lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
lld/trunk/include/lld/ReaderWriter/Reader.h
lld/trunk/include/lld/ReaderWriter/Simple.h
lld/trunk/include/lld/ReaderWriter/YamlContext.h
lld/trunk/lib/Driver/CoreDriver.cpp
lld/trunk/lib/Driver/DarwinLdDriver.cpp
lld/trunk/lib/Driver/GnuLdDriver.cpp
lld/trunk/lib/Driver/GnuLdInputGraph.cpp
lld/trunk/lib/Passes/LayoutPass.cpp
lld/trunk/lib/Passes/RoundTripNativePass.cpp
lld/trunk/lib/Passes/RoundTripYAMLPass.cpp
lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp
lld/trunk/lib/ReaderWriter/ELF/Atoms.h
lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h
lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
lld/trunk/lib/ReaderWriter/ELF/File.h
lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp
lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h
lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp
lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h
lld/trunk/lib/ReaderWriter/ELF/Reader.cpp
lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp
lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h
lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp
lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp
lld/trunk/lib/ReaderWriter/FileArchive.cpp
lld/trunk/lib/ReaderWriter/MachO/ExecutableAtoms.hpp
lld/trunk/lib/ReaderWriter/MachO/GOTPass.hpp
lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
lld/trunk/lib/ReaderWriter/MachO/ReferenceKinds.cpp
lld/trunk/lib/ReaderWriter/MachO/ReferenceKinds.h
lld/trunk/lib/ReaderWriter/MachO/StubAtoms_x86.hpp
lld/trunk/lib/ReaderWriter/MachO/StubAtoms_x86_64.hpp
lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp
lld/trunk/lib/ReaderWriter/Native/NativeFileFormat.h
lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp
lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h
lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
lld/trunk/lib/ReaderWriter/Reader.cpp
lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
lld/trunk/unittests/DriverTests/InputGraphTest.cpp
Modified: lld/trunk/include/lld/Core/ArchiveLibraryFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/ArchiveLibraryFile.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/ArchiveLibraryFile.h (original)
+++ lld/trunk/include/lld/Core/ArchiveLibraryFile.h Fri Dec 20 01:48:29 2013
@@ -33,14 +33,12 @@ public:
/// specified name and return the File object for that member, or nullptr.
virtual const File *find(StringRef name, bool dataSymbolOnly) const = 0;
- virtual error_code parseAllMembers(
- std::vector<std::unique_ptr<File>> &result) const = 0;
+ virtual error_code
+ parseAllMembers(std::vector<std::unique_ptr<File>> &result) const = 0;
protected:
/// only subclasses of ArchiveLibraryFile can be instantiated
- ArchiveLibraryFile(StringRef path)
- : File(path, kindArchiveLibrary) {}
-
+ ArchiveLibraryFile(StringRef path) : File(path, kindArchiveLibrary) {}
};
} // namespace lld
Modified: lld/trunk/include/lld/Core/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/File.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/File.h (original)
+++ lld/trunk/include/lld/Core/File.h Fri Dec 20 01:48:29 2013
@@ -234,8 +234,7 @@ public:
protected:
/// \brief only subclasses of MutableFile can be instantiated
- MutableFile(StringRef p)
- : File(p, kindObject){}
+ MutableFile(StringRef p) : File(p, kindObject) {}
};
} // end namespace lld
Modified: lld/trunk/include/lld/Core/LinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LinkingContext.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/LinkingContext.h (original)
+++ lld/trunk/include/lld/Core/LinkingContext.h Fri Dec 20 01:48:29 2013
@@ -312,9 +312,9 @@ public:
/// Return the next ordinal and Increment it.
virtual uint64_t getNextOrdinalAndIncrement() const { return _nextOrdinal++; }
-
+
/// @}
-
+
protected:
LinkingContext(); // Must be subclassed
@@ -347,7 +347,7 @@ protected:
mutable llvm::BumpPtrAllocator _allocator;
InputElement *_currentInputElement;
mutable uint64_t _nextOrdinal;
- Registry _registry;
+ Registry _registry;
private:
/// Validate the subclass bits. Only called by validate.
Modified: lld/trunk/include/lld/Core/Reference.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Reference.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Reference.h (original)
+++ lld/trunk/include/lld/Core/Reference.h Fri Dec 20 01:48:29 2013
@@ -31,52 +31,54 @@ class Atom;
/// another), marking data-in-code (jump tables or ARM constants), etc.
///
/// The "kind" of a reference is a tuple of <namespace, arch, value>. This
-/// enable us to re-use existing relocation types definded for various
+/// enable us to re-use existing relocation types definded for various
/// file formats and architectures. For instance, in ELF the relocation type 10
-/// means R_X86_64_32 for x86_64, and R_386_GOTPC for i386. For PE/COFF
-/// relocation 10 means IMAGE_REL_AMD64_SECTION.
+/// means R_X86_64_32 for x86_64, and R_386_GOTPC for i386. For PE/COFF
+/// relocation 10 means IMAGE_REL_AMD64_SECTION.
///
class Reference {
public:
- /// Which universe defines the kindValue().
- enum class KindNamespace {
- all = 0,
+ /// Which universe defines the kindValue().
+ enum class KindNamespace {
+ all = 0,
testing = 1,
- ELF = 2,
- COFF = 3,
- mach_o = 4,
+ ELF = 2,
+ COFF = 3,
+ mach_o = 4,
};
KindNamespace kindNamespace() const { return (KindNamespace)_kindNamespace; }
void setKindNamespace(KindNamespace ns) { _kindNamespace = (uint8_t)ns; }
- // Which architecture the kind value is for.
- enum class KindArch {
- all = 0,
- x86_64 = 1,
- x86 = 2,
- ARM = 3,
- PowerPC = 4,
- Hexagon = 5,
- Mips = 6
+ // Which architecture the kind value is for.
+ enum class KindArch {
+ all = 0,
+ x86_64 = 1,
+ x86 = 2,
+ ARM = 3,
+ PowerPC = 4,
+ Hexagon = 5,
+ Mips = 6
};
-
+
KindArch kindArch() const { return (KindArch)_kindArch; }
void setKindArch(KindArch a) { _kindArch = (uint8_t)a; }
typedef uint16_t KindValue;
-
+
KindValue kindValue() const { return _kindValue; }
-
- /// setKindValue() is needed because during linking, some optimizations may
+
+ /// setKindValue() is needed because during linking, some optimizations may
/// change the codegen and hence the reference kind.
- void setKindValue(KindValue value) { _kindValue = value; };
+ void setKindValue(KindValue value) {
+ _kindValue = value;
+ };
/// KindValues used with KindNamespace::all and KindArch::all.
enum {
- kindInGroup = 1,
- kindLayoutAfter = 2,
- kindLayoutBefore = 3
+ kindInGroup = 1,
+ kindLayoutAfter = 2,
+ kindLayoutBefore = 3
};
// A value to be added to the value of a target
@@ -102,8 +104,8 @@ public:
protected:
/// Reference is an abstract base class. Only subclasses can use constructor.
- Reference(KindNamespace ns, KindArch a, KindValue value)
- : _kindValue(value), _kindNamespace((uint8_t)ns), _kindArch((uint8_t)a) {}
+ Reference(KindNamespace ns, KindArch a, KindValue value)
+ : _kindValue(value), _kindNamespace((uint8_t)ns), _kindArch((uint8_t)a) {}
/// The memory for Reference objects is always managed by the owning File
/// object. Therefore, no one but the owning File object should call
@@ -112,8 +114,8 @@ protected:
virtual ~Reference() {}
KindValue _kindValue;
- uint8_t _kindNamespace;
- uint8_t _kindArch;
+ uint8_t _kindNamespace;
+ uint8_t _kindArch;
};
} // namespace lld
Modified: lld/trunk/include/lld/Core/Resolver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Resolver.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Resolver.h (original)
+++ lld/trunk/include/lld/Core/Resolver.h Fri Dec 20 01:48:29 2013
@@ -37,9 +37,8 @@ public:
};
Resolver(LinkingContext &context)
- : _context(context), _symbolTable(context),
- _result(new MergedFile()), _haveLLVMObjs(false),
- _addToFinalSection(false) {}
+ : _context(context), _symbolTable(context), _result(new MergedFile()),
+ _haveLLVMObjs(false), _addToFinalSection(false) {}
virtual ~Resolver() {}
@@ -84,9 +83,8 @@ private:
class MergedFile : public MutableFile {
public:
- MergedFile()
- : MutableFile("<linker-internal>") {}
-
+ MergedFile() : MutableFile("<linker-internal>") {}
+
virtual const atom_collection<DefinedAtom> &defined() const {
return _definedAtoms;
}
Modified: lld/trunk/include/lld/Driver/DarwinInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/DarwinInputGraph.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/DarwinInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/DarwinInputGraph.h Fri Dec 20 01:48:29 2013
@@ -56,7 +56,8 @@ public:
return ec;
assert(parsedFiles.size() == 1);
std::unique_ptr<File> f(parsedFiles[0].release());
- if (auto archive = reinterpret_cast<const ArchiveLibraryFile*>(f.get())) {
+ if (auto archive =
+ reinterpret_cast<const ArchiveLibraryFile *>(f.get())) {
// FIXME: something needs to own archive File
//_files.push_back(std::move(archive));
return archive->parseAllMembers(_files);
Modified: lld/trunk/include/lld/ReaderWriter/CoreLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/CoreLinkingContext.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/CoreLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/CoreLinkingContext.h Fri Dec 20 01:48:29 2013
@@ -18,19 +18,18 @@
namespace lld {
-
class CoreLinkingContext : public LinkingContext {
public:
CoreLinkingContext();
enum {
- TEST_RELOC_CALL32 = 1,
- TEST_RELOC_PCREL32 = 2,
- TEST_RELOC_GOT_LOAD32 = 3,
- TEST_RELOC_GOT_USE32 = 4,
+ TEST_RELOC_CALL32 = 1,
+ TEST_RELOC_PCREL32 = 2,
+ TEST_RELOC_GOT_LOAD32 = 3,
+ TEST_RELOC_GOT_USE32 = 4,
TEST_RELOC_LEA32_WAS_GOT = 5,
};
-
+
virtual bool validateImpl(raw_ostream &diagnostics);
virtual void addPasses(PassManager &pm);
Modified: lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h Fri Dec 20 01:48:29 2013
@@ -39,8 +39,6 @@ public:
virtual void registerRelocationNames(Registry &) = 0;
};
-
-
class ELFLinkingContext : public LinkingContext {
public:
@@ -130,9 +128,7 @@ public:
return static_cast<lld::elf::TargetHandler<ELFT> &>(*_targetHandler.get());
}
- TargetHandlerBase *targetHandler() const {
- return _targetHandler.get();
- }
+ TargetHandlerBase *targetHandler() const { return _targetHandler.get(); }
virtual void addPasses(PassManager &pm);
void setTriple(llvm::Triple trip) { _triple = trip; }
Modified: lld/trunk/include/lld/ReaderWriter/Reader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/Reader.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/Reader.h (original)
+++ lld/trunk/include/lld/ReaderWriter/Reader.h Fri Dec 20 01:48:29 2013
@@ -28,7 +28,6 @@ class LinkingContext;
class PECOFFLinkingContext;
class TargetHandlerBase;
-
/// \brief An abstract class for reading object files, library files, and
/// executable files.
///
@@ -42,7 +41,7 @@ public:
/// The method is called with:
/// 1) the file_magic enumeration returned by identify_magic()
/// 2) the file extension (e.g. ".obj")
- /// 3) the whole file content buffer if the above is not enough.
+ /// 3) the whole file content buffer if the above is not enough.
virtual bool canParse(file_magic magic, StringRef fileExtension,
const MemoryBuffer &mb) const = 0;
@@ -52,36 +51,35 @@ public:
/// The resulting File object may take ownership of the MemoryBuffer.
virtual error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
- std::vector<std::unique_ptr<File> > &result) const = 0;
+ std::vector<std::unique_ptr<File>> &result) const = 0;
};
-
/// A registry to hold the list of currently registered Readers and
/// tables which map Reference kind values to strings.
/// The linker does not directly invoke Readers. Instead, it registers
/// Readers based on it configuration and command line options, then calls
-/// the Registry object to parse files.
+/// the Registry object to parse files.
class Registry {
public:
Registry();
-
+
/// Walk the list of registered Readers and find one that can parse the
/// supplied file and parse it.
error_code parseFile(std::unique_ptr<MemoryBuffer> &mb,
std::vector<std::unique_ptr<File>> &result) const;
-
+
/// Walk the list of registered kind tables to convert a Reference Kind
/// name to a value.
bool referenceKindFromString(StringRef inputStr, Reference::KindNamespace &ns,
- Reference::KindArch &a,
+ Reference::KindArch &a,
Reference::KindValue &value) const;
-
+
/// Walk the list of registered kind tables to convert a Reference Kind
/// value to a string.
- bool referenceKindToString(Reference::KindNamespace ns, Reference::KindArch a,
+ bool referenceKindToString(Reference::KindNamespace ns, Reference::KindArch a,
Reference::KindValue value, StringRef &) const;
-
- // These methods are called to dynamically add support for various file
+
+ // These methods are called to dynamically add support for various file
// formats. The methods are also implemented in the appropriate lib*.a
// library, so that the code for handling a format is only linked in, if this
// method is used. Any options that a Reader might need must be passed
@@ -98,26 +96,29 @@ public:
/// To convert between kind values and names, the registry walks the list
/// of registered kind tables. Each table is a zero terminated array of
- /// KindStrings elements.
- struct KindStrings { Reference::KindValue value; StringRef name; };
+ /// KindStrings elements.
+ struct KindStrings {
+ Reference::KindValue value;
+ StringRef name;
+ };
- /// A Reference Kind value is a tuple of <namespace, arch, value>. All
+ /// A Reference Kind value is a tuple of <namespace, arch, value>. All
/// entries in a conversion table have the same <namespace, arch>. The
/// array then contains the value/name pairs.
void addKindTable(Reference::KindNamespace ns, Reference::KindArch arch,
const KindStrings array[]);
private:
- struct KindEntry {
- Reference::KindNamespace ns;
- Reference::KindArch arch;
- const KindStrings *array;
+ struct KindEntry {
+ Reference::KindNamespace ns;
+ Reference::KindArch arch;
+ const KindStrings *array;
};
-
+
void add(std::unique_ptr<Reader>);
-
- std::vector<std::unique_ptr<Reader>> _readers;
- std::vector<KindEntry> _kindEntries;
+
+ std::vector<std::unique_ptr<Reader>> _readers;
+ std::vector<KindEntry> _kindEntries;
};
// Utilities for building a KindString table. For instance:
@@ -126,9 +127,10 @@ private:
// LLD_KIND_STRING_ENTRY(R_VAX_DATA16),
// LLD_KIND_STRING_END
// };
-#define LLD_KIND_STRING_ENTRY(name) { name, #name }
-#define LLD_KIND_STRING_END {0, ""}
-
+#define LLD_KIND_STRING_ENTRY(name) \
+ { name, #name }
+#define LLD_KIND_STRING_END \
+ { 0, "" }
} // end namespace lld
Modified: lld/trunk/include/lld/ReaderWriter/Simple.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/Simple.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/Simple.h (original)
+++ lld/trunk/include/lld/ReaderWriter/Simple.h Fri Dec 20 01:48:29 2013
@@ -23,8 +23,7 @@
namespace lld {
class SimpleFile : public MutableFile {
public:
- SimpleFile(StringRef path)
- : MutableFile(path) {}
+ SimpleFile(StringRef path) : MutableFile(path) {}
virtual void addAtom(const Atom &atom) {
if (const DefinedAtom *defAtom = dyn_cast<DefinedAtom>(&atom)) {
@@ -63,10 +62,10 @@ public:
}
protected:
- atom_collection_vector<DefinedAtom> _definedAtoms;
- atom_collection_vector<UndefinedAtom> _undefinedAtoms;
+ atom_collection_vector<DefinedAtom> _definedAtoms;
+ atom_collection_vector<UndefinedAtom> _undefinedAtoms;
atom_collection_vector<SharedLibraryAtom> _sharedLibraryAtoms;
- atom_collection_vector<AbsoluteAtom> _absoluteAtoms;
+ atom_collection_vector<AbsoluteAtom> _absoluteAtoms;
};
class FileToMutable : public SimpleFile {
@@ -86,7 +85,7 @@ public:
class SimpleReference : public Reference {
public:
- SimpleReference(Reference::KindNamespace ns, Reference::KindArch arch,
+ SimpleReference(Reference::KindNamespace ns, Reference::KindArch arch,
Reference::KindValue value, uint64_t off, const Atom *t,
Reference::Addend a)
: Reference(ns, arch, value), _target(t), _offsetInAtom(off), _addend(a) {
@@ -167,8 +166,8 @@ public:
it = reinterpret_cast<const void *>(index);
}
- void addReference(Reference::KindNamespace ns, Reference::KindArch arch,
- Reference::KindValue kindValue, uint64_t off,
+ void addReference(Reference::KindNamespace ns, Reference::KindArch arch,
+ Reference::KindValue kindValue, uint64_t off,
const Atom *target, Reference::Addend a) {
_references.push_back(SimpleReference(ns, arch, kindValue, off, target, a));
}
Modified: lld/trunk/include/lld/ReaderWriter/YamlContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/YamlContext.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/YamlContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/YamlContext.h Fri Dec 20 01:48:29 2013
@@ -17,14 +17,14 @@
#include <vector>
namespace lld {
- class File;
- class LinkingContext;
- namespace mach_o {
- namespace normalized {
- struct NormalizedFile;
- }
- }
-
+class File;
+class LinkingContext;
+namespace mach_o {
+namespace normalized {
+struct NormalizedFile;
+}
+}
+
using lld::mach_o::normalized::NormalizedFile;
/// When YAML I/O is used in lld, the yaml context always holds a YamlContext
@@ -32,17 +32,15 @@ using lld::mach_o::normalized::Normalize
/// different context info. This struct supports all clients.
struct YamlContext {
YamlContext()
- : _linkingContext(nullptr), _registry(nullptr), _file(nullptr),
- _normalizeMachOFile(nullptr){}
+ : _linkingContext(nullptr), _registry(nullptr), _file(nullptr),
+ _normalizeMachOFile(nullptr) {}
- const LinkingContext *_linkingContext;
- const Registry *_registry;
- File *_file;
- NormalizedFile *_normalizeMachOFile;
+ const LinkingContext *_linkingContext;
+ const Registry *_registry;
+ File *_file;
+ NormalizedFile *_normalizeMachOFile;
};
} // end namespace lld
#endif // LLD_READER_WRITER_YAML_CONTEXT_H
-
-
Modified: lld/trunk/lib/Driver/CoreDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CoreDriver.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/Driver/CoreDriver.cpp (original)
+++ lld/trunk/lib/Driver/CoreDriver.cpp Fri Dec 20 01:48:29 2013
@@ -67,28 +67,25 @@ public:
namespace lld {
static const Registry::KindStrings coreKindStrings[] = {
- { CoreLinkingContext::TEST_RELOC_CALL32, "call32" },
- { CoreLinkingContext::TEST_RELOC_PCREL32, "pcrel32" },
- { CoreLinkingContext::TEST_RELOC_GOT_LOAD32, "gotLoad32" },
- { CoreLinkingContext::TEST_RELOC_GOT_USE32, "gotUse32" },
+ { CoreLinkingContext::TEST_RELOC_CALL32, "call32" },
+ { CoreLinkingContext::TEST_RELOC_PCREL32, "pcrel32" },
+ { CoreLinkingContext::TEST_RELOC_GOT_LOAD32, "gotLoad32" },
+ { CoreLinkingContext::TEST_RELOC_GOT_USE32, "gotUse32" },
{ CoreLinkingContext::TEST_RELOC_LEA32_WAS_GOT, "lea32wasGot" },
LLD_KIND_STRING_END
};
-
bool CoreDriver::link(int argc, const char *argv[], raw_ostream &diagnostics) {
CoreLinkingContext ctx;
if (!parse(argc, argv, ctx))
return false;
-
+
// Register possible input file parsers.
ctx.registry().addSupportNativeObjects();
ctx.registry().addSupportYamlFiles();
-
- ctx.registry().addKindTable(Reference::KindNamespace::testing,
- Reference::KindArch::all,
- coreKindStrings);
+ ctx.registry().addKindTable(Reference::KindNamespace::testing,
+ Reference::KindArch::all, coreKindStrings);
return Driver::link(ctx);
}
Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Fri Dec 20 01:48:29 2013
@@ -77,7 +77,7 @@ bool DarwinLdDriver::linkMachO(int argc,
return false;
if (ctx.doNothing())
return true;
-
+
// Register possible input file parsers.
ctx.registry().addSupportMachOObjects(ctx.archName());
ctx.registry().addSupportArchives(ctx.logInputFiles());
Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdDriver.cpp Fri Dec 20 01:48:29 2013
@@ -111,14 +111,14 @@ bool GnuLdDriver::linkELF(int argc, cons
return true;
// Register possible input file parsers.
- options->registry().addSupportELFObjects(options->mergeCommonStrings(),
+ options->registry().addSupportELFObjects(options->mergeCommonStrings(),
options->targetHandler());
options->registry().addSupportArchives(options->logInputFiles());
options->registry().addSupportYamlFiles();
options->registry().addSupportNativeObjects();
if (options->allowLinkWithDynamicLibraries())
options->registry().addSupportELFDynamicSharedObjects(
- options->useShlibUndefines());
+ options->useShlibUndefines());
return link(*options, diagnostics);
}
Modified: lld/trunk/lib/Driver/GnuLdInputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdInputGraph.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdInputGraph.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdInputGraph.cpp Fri Dec 20 01:48:29 2013
@@ -32,14 +32,13 @@ error_code ELFFileNode::parse(const Link
return ec;
assert(parsedFiles.size() == 1);
std::unique_ptr<File> f(parsedFiles[0].release());
- if (auto archive = reinterpret_cast<const ArchiveLibraryFile*>(f.get())) {
+ if (auto archive = reinterpret_cast<const ArchiveLibraryFile *>(f.get())) {
// Have this node own the FileArchive object.
_archiveFile.reset(archive);
f.release();
// Add all members to _files vector
return archive->parseAllMembers(_files);
- }
- else {
+ } else {
// if --whole-archive is around non-archive, just use it as normal.
_files.push_back(std::move(f));
return error_code::success();
Modified: lld/trunk/lib/Passes/LayoutPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/LayoutPass.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/Passes/LayoutPass.cpp (original)
+++ lld/trunk/lib/Passes/LayoutPass.cpp Fri Dec 20 01:48:29 2013
@@ -70,7 +70,7 @@ static void showCycleDetectedError(AtomT
do {
llvm::dbgs() << " " << atomToDebugString(atom) << "\n";
for (const Reference *ref : *atom) {
- llvm::dbgs() << " " << atomToDebugString(ref->target()) << "\n";
+ llvm::dbgs() << " " << atomToDebugString(ref->target()) << "\n";
}
atom = followOnNexts[atom];
} while (atom != start);
Modified: lld/trunk/lib/Passes/RoundTripNativePass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/RoundTripNativePass.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/Passes/RoundTripNativePass.cpp (original)
+++ lld/trunk/lib/Passes/RoundTripNativePass.cpp Fri Dec 20 01:48:29 2013
@@ -43,7 +43,7 @@ void RoundTripNativePass::perform(std::u
error_code ec = _context.registry().parseFile(mb, _nativeFile);
if (ec) {
// Note: we need a way for Passes to report errors.
- llvm_unreachable("native reader not registered or read error");
+ llvm_unreachable("native reader not registered or read error");
}
File *objFile = _nativeFile[0].get();
mergedFile.reset(new FileToMutable(_context, *objFile));
Modified: lld/trunk/lib/Passes/RoundTripYAMLPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/RoundTripYAMLPass.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/Passes/RoundTripYAMLPass.cpp (original)
+++ lld/trunk/lib/Passes/RoundTripYAMLPass.cpp Fri Dec 20 01:48:29 2013
@@ -48,7 +48,7 @@ void RoundTripYAMLPass::perform(std::uni
error_code ec = _context.registry().parseFile(mb, _yamlFile);
if (ec) {
// Note: we need a way for Passes to report errors.
- llvm_unreachable("yaml reader not registered or read error");
+ llvm_unreachable("yaml reader not registered or read error");
}
File *objFile = _yamlFile[0].get();
mergedFile.reset(new FileToMutable(_context, *objFile));
Modified: lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp Fri Dec 20 01:48:29 2013
@@ -153,8 +153,7 @@ private:
class TestingPassFile : public SimpleFile {
public:
- TestingPassFile(const LinkingContext &ctx)
- : SimpleFile("Testing pass") {}
+ TestingPassFile(const LinkingContext &ctx) : SimpleFile("Testing pass") {}
virtual void addAtom(const Atom &atom) {
if (const DefinedAtom *defAtom = dyn_cast<DefinedAtom>(&atom))
@@ -238,10 +237,10 @@ public:
}
virtual void updateReferenceToGOT(const Reference *ref, bool targetIsNowGOT) {
- const_cast<Reference *>(ref)->setKindValue(targetIsNowGOT ?
- CoreLinkingContext::TEST_RELOC_PCREL32 :
- CoreLinkingContext::TEST_RELOC_LEA32_WAS_GOT);
- }
+ const_cast<Reference *>(ref)->setKindValue(
+ targetIsNowGOT ? CoreLinkingContext::TEST_RELOC_PCREL32
+ : CoreLinkingContext::TEST_RELOC_LEA32_WAS_GOT);
+ }
virtual const DefinedAtom *makeGOTEntry(const Atom &target) {
return new TestingGOTAtom(_file, target);
Modified: lld/trunk/lib/ReaderWriter/ELF/Atoms.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Atoms.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Atoms.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Atoms.h Fri Dec 20 01:48:29 2013
@@ -40,27 +40,22 @@ template <class ELFT> class ELFReference
typedef llvm::object::Elf_Rel_Impl<ELFT, false> Elf_Rel;
typedef llvm::object::Elf_Rel_Impl<ELFT, true> Elf_Rela;
public:
-
- ELFReference(const Elf_Rela *rela, uint64_t off, Reference::KindArch arch,
- uint16_t relocType, uint32_t idx)
- : Reference(Reference::KindNamespace::ELF, arch, relocType),
- _target(nullptr), _targetSymbolIndex(idx),
- _offsetInAtom(off), _addend(rela->r_addend) {
- }
-
- ELFReference(const Elf_Rel *rel, uint64_t off, Reference::KindArch arch,
- uint16_t relocType, uint32_t idx)
- : Reference(Reference::KindNamespace::ELF, arch, relocType),
- _target(nullptr), _targetSymbolIndex(idx),
- _offsetInAtom(off), _addend(0) {
- }
+ ELFReference(const Elf_Rela *rela, uint64_t off, Reference::KindArch arch,
+ uint16_t relocType, uint32_t idx)
+ : Reference(Reference::KindNamespace::ELF, arch, relocType),
+ _target(nullptr), _targetSymbolIndex(idx), _offsetInAtom(off),
+ _addend(rela->r_addend) {}
+
+ ELFReference(const Elf_Rel *rel, uint64_t off, Reference::KindArch arch,
+ uint16_t relocType, uint32_t idx)
+ : Reference(Reference::KindNamespace::ELF, arch, relocType),
+ _target(nullptr), _targetSymbolIndex(idx), _offsetInAtom(off),
+ _addend(0) {}
ELFReference(uint32_t edgeKind)
- : Reference(Reference::KindNamespace::all,
- Reference::KindArch::all, edgeKind),
- _target(nullptr), _targetSymbolIndex(0),
- _offsetInAtom(0), _addend(0) {
- }
+ : Reference(Reference::KindNamespace::all, Reference::KindArch::all,
+ edgeKind),
+ _target(nullptr), _targetSymbolIndex(0), _offsetInAtom(0), _addend(0) {}
virtual uint64_t offsetInAtom() const { return _offsetInAtom; }
@@ -169,33 +164,19 @@ class ELFDefinedAtom LLVM_FINAL : public
typedef llvm::object::Elf_Shdr_Impl<ELFT> Elf_Shdr;
public:
- ELFDefinedAtom(const ELFFile<ELFT> &file,
- StringRef symbolName,
- StringRef sectionName,
- const Elf_Sym *symbol,
- const Elf_Shdr *section,
- ArrayRef<uint8_t> contentData,
- unsigned int referenceStart,
- unsigned int referenceEnd,
- std::vector<ELFReference<ELFT>*> &referenceList)
-
- : _owningFile(file)
- , _symbolName(symbolName)
- , _sectionName(sectionName)
- , _symbol(symbol)
- , _section(section)
- , _contentData(contentData)
- , _referenceStartIndex(referenceStart)
- , _referenceEndIndex(referenceEnd)
- , _referenceList(referenceList)
- , _targetAtomHandler(nullptr)
- , _contentType(typeUnknown)
- , _permissions(permUnknown) {
- }
+ ELFDefinedAtom(const ELFFile<ELFT> &file, StringRef symbolName,
+ StringRef sectionName, const Elf_Sym *symbol,
+ const Elf_Shdr *section, ArrayRef<uint8_t> contentData,
+ unsigned int referenceStart, unsigned int referenceEnd,
+ std::vector<ELFReference<ELFT> *> &referenceList)
+ : _owningFile(file), _symbolName(symbolName), _sectionName(sectionName),
+ _symbol(symbol), _section(section), _contentData(contentData),
+ _referenceStartIndex(referenceStart), _referenceEndIndex(referenceEnd),
+ _referenceList(referenceList), _targetAtomHandler(nullptr),
+ _contentType(typeUnknown), _permissions(permUnknown) {}
+
+ ~ELFDefinedAtom() {}
- ~ELFDefinedAtom() {
- }
-
virtual const ELFFile<ELFT> &file() const {
return _owningFile;
}
@@ -219,7 +200,7 @@ public:
// Treat target defined common symbols
if ((_symbol->st_shndx > llvm::ELF::SHN_LOPROC &&
_symbol->st_shndx < llvm::ELF::SHN_HIPROC)) {
- if (!_targetAtomHandler)
+ if (!_targetAtomHandler)
_targetAtomHandler = &_owningFile.targetHandler()->targetAtomHandler();
if (_targetAtomHandler->getType(_symbol) == llvm::ELF::STT_COMMON)
return (uint64_t) _symbol->st_size;
@@ -255,7 +236,7 @@ public:
// mergeTentative
if ((_symbol->st_shndx > llvm::ELF::SHN_LOPROC &&
_symbol->st_shndx < llvm::ELF::SHN_HIPROC)) {
- if (!_targetAtomHandler)
+ if (!_targetAtomHandler)
_targetAtomHandler = &_owningFile.targetHandler()->targetAtomHandler();
if (_targetAtomHandler->getType(_symbol) == llvm::ELF::STT_COMMON)
return mergeAsTentative;
@@ -664,8 +645,8 @@ public:
virtual ContentType contentType() const {
if (_symbol->st_shndx >= llvm::ELF::SHN_LORESERVE &&
_symbol->st_shndx <= llvm::ELF::SHN_HIOS)
- return _owningFile.targetHandler()->targetAtomHandler().
- contentType(nullptr, _symbol);
+ return _owningFile.targetHandler()->targetAtomHandler().contentType(
+ nullptr, _symbol);
return typeZeroFill;
}
@@ -788,41 +769,38 @@ private:
const Elf_Sym *_symbol;
};
-
class SimpleELFDefinedAtom : public SimpleDefinedAtom {
public:
- SimpleELFDefinedAtom(const File &f) : SimpleDefinedAtom(f) { }
+ SimpleELFDefinedAtom(const File &f) : SimpleDefinedAtom(f) {}
- void addReferenceELF(Reference::KindArch arch,
- uint16_t kindValue, uint64_t off, const Atom *target,
- Reference::Addend addend) {
- this->addReference(Reference::KindNamespace::ELF, arch, kindValue,
- off, target, addend);
+ void addReferenceELF(Reference::KindArch arch, uint16_t kindValue,
+ uint64_t off, const Atom *target,
+ Reference::Addend addend) {
+ this->addReference(Reference::KindNamespace::ELF, arch, kindValue, off,
+ target, addend);
}
-
+
void addReferenceELF_Hexagon(uint16_t relocType, uint64_t off, const Atom *t,
- Reference::Addend a) {
+ Reference::Addend a) {
this->addReferenceELF(Reference::KindArch::Hexagon, relocType, off, t, a);
}
-
+
void addReferenceELF_x86_64(uint16_t relocType, uint64_t off, const Atom *t,
Reference::Addend a) {
this->addReferenceELF(Reference::KindArch::x86_64, relocType, off, t, a);
}
-
+
void addReferenceELF_PowerPC(uint16_t relocType, uint64_t off, const Atom *t,
Reference::Addend a) {
this->addReferenceELF(Reference::KindArch::PowerPC, relocType, off, t, a);
}
-
+
void addReferenceELF_Mips(uint16_t relocType, uint64_t off, const Atom *t,
- Reference::Addend a) {
+ Reference::Addend a) {
this->addReferenceELF(Reference::KindArch::Mips, relocType, off, t, a);
}
};
-
-
/// \brief Atom which represents an object for which a COPY relocation will be
/// generated.
class ObjectAtom : public SimpleELFDefinedAtom {
@@ -861,8 +839,7 @@ class GOTAtom : public SimpleELFDefinedA
public:
GOTAtom(const File &f, StringRef secName)
- : SimpleELFDefinedAtom(f), _section(secName) {
- }
+ : SimpleELFDefinedAtom(f), _section(secName) {}
virtual Scope scope() const { return scopeTranslationUnit; }
@@ -897,8 +874,7 @@ class PLTAtom : public SimpleELFDefinedA
public:
PLTAtom(const File &f, StringRef secName)
- : SimpleELFDefinedAtom(f), _section(secName) {
- }
+ : SimpleELFDefinedAtom(f), _section(secName) {}
virtual Scope scope() const { return scopeTranslationUnit; }
@@ -1020,8 +996,7 @@ class InitFiniAtom : public SimpleELFDef
public:
InitFiniAtom(const File &f, StringRef secName)
- : SimpleELFDefinedAtom(f), _section(secName) {
- }
+ : SimpleELFDefinedAtom(f), _section(secName) {}
virtual Scope scope() const { return scopeGlobal; }
Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Fri Dec 20 01:48:29 2013
@@ -332,12 +332,12 @@ Layout::SectionOrder DefaultLayout<ELFT>
case DefinedAtom::typeResolver:
case DefinedAtom::typeCode:
return llvm::StringSwitch<Layout::SectionOrder>(name)
- .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
- .StartsWith(".eh_frame", ORDER_EH_FRAME)
- .StartsWith(".init", ORDER_INIT)
- .StartsWith(".fini", ORDER_FINI)
- .StartsWith(".hash", ORDER_HASH)
- .Default(ORDER_TEXT);
+ .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
+ .StartsWith(".eh_frame", ORDER_EH_FRAME)
+ .StartsWith(".init", ORDER_INIT)
+ .StartsWith(".fini", ORDER_FINI)
+ .StartsWith(".hash", ORDER_HASH)
+ .Default(ORDER_TEXT);
case DefinedAtom::typeConstant:
return ORDER_RODATA;
@@ -355,8 +355,8 @@ Layout::SectionOrder DefaultLayout<ELFT>
case DefinedAtom::typeGOT:
return llvm::StringSwitch<Layout::SectionOrder>(name)
- .StartsWith(".got.plt", ORDER_GOT_PLT)
- .Default(ORDER_GOT);
+ .StartsWith(".got.plt", ORDER_GOT_PLT)
+ .Default(ORDER_GOT);
case DefinedAtom::typeStub:
return ORDER_PLT;
Modified: lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h Fri Dec 20 01:48:29 2013
@@ -24,7 +24,7 @@ namespace lld {
namespace elf {
template <class ELFT> class DynamicFile LLVM_FINAL : public SharedLibraryFile {
public:
- static ErrorOr<std::unique_ptr<DynamicFile> >
+ static ErrorOr<std::unique_ptr<DynamicFile>>
create(std::unique_ptr<llvm::MemoryBuffer> mb, bool useShlibUndefines) {
std::unique_ptr<DynamicFile> file(
new DynamicFile(mb->getBufferIdentifier()));
@@ -104,8 +104,7 @@ public:
}
private:
- DynamicFile(StringRef name)
- : SharedLibraryFile(name) {}
+ DynamicFile(StringRef name) : SharedLibraryFile(name) {}
mutable llvm::BumpPtrAllocator _alloc;
std::unique_ptr<llvm::object::ELFFile<ELFT>> _objFile;
Modified: lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp Fri Dec 20 01:48:29 2013
@@ -35,8 +35,8 @@ public:
}
};
-ELFLinkingContext::ELFLinkingContext(llvm::Triple triple,
- std::unique_ptr<TargetHandlerBase> targetHandler)
+ELFLinkingContext::ELFLinkingContext(
+ llvm::Triple triple, std::unique_ptr<TargetHandlerBase> targetHandler)
: _outputELFType(elf::ET_EXEC), _triple(triple),
_targetHandler(std::move(targetHandler)), _baseAddress(0),
_isStaticExecutable(false), _noInhibitExec(false),
Modified: lld/trunk/lib/ReaderWriter/ELF/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/File.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/File.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/File.h Fri Dec 20 01:48:29 2013
@@ -119,14 +119,14 @@ template <class ELFT> class ELFFile : pu
public:
ELFFile(StringRef name)
- : File(name, kindObject), _ordinal(0),
- _doStringsMerge(false), _targetHandler(nullptr) {}
+ : File(name, kindObject), _ordinal(0), _doStringsMerge(false),
+ _targetHandler(nullptr) {}
ELFFile(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings,
TargetHandlerBase *handler, error_code &ec)
- : File(mb->getBufferIdentifier(), kindObject),
- _ordinal(0), _doStringsMerge(atomizeStrings),
- _targetHandler(reinterpret_cast<TargetHandler<ELFT>*>(handler)) {
+ : File(mb->getBufferIdentifier(), kindObject), _ordinal(0),
+ _doStringsMerge(atomizeStrings),
+ _targetHandler(reinterpret_cast<TargetHandler<ELFT> *>(handler)) {
_objFile.reset(new llvm::object::ELFFile<ELFT>(mb.release(), ec));
if (ec)
@@ -162,23 +162,22 @@ public:
Reference::KindArch kindArch() {
switch (_objFile->getHeader()->e_machine) {
- case llvm::ELF::EM_X86_64:
- return Reference::KindArch::x86_64;
- case llvm::ELF::EM_386:
- return Reference::KindArch::x86;
- case llvm::ELF::EM_ARM:
- return Reference::KindArch::ARM;
- case llvm::ELF::EM_PPC:
- return Reference::KindArch::PowerPC;
- case llvm::ELF::EM_HEXAGON:
- return Reference::KindArch::Hexagon;
- case llvm::ELF::EM_MIPS:
- return Reference::KindArch::Mips;
+ case llvm::ELF::EM_X86_64:
+ return Reference::KindArch::x86_64;
+ case llvm::ELF::EM_386:
+ return Reference::KindArch::x86;
+ case llvm::ELF::EM_ARM:
+ return Reference::KindArch::ARM;
+ case llvm::ELF::EM_PPC:
+ return Reference::KindArch::PowerPC;
+ case llvm::ELF::EM_HEXAGON:
+ return Reference::KindArch::Hexagon;
+ case llvm::ELF::EM_MIPS:
+ return Reference::KindArch::Mips;
}
llvm_unreachable("unsupported e_machine value");
}
-
/// \brief Read input sections and populate necessary data structures
/// to read them later and create atoms
error_code createAtomizableSections() {
@@ -510,9 +509,7 @@ public:
return _absoluteAtoms;
}
- TargetHandler<ELFT> *targetHandler() const {
- return _targetHandler;
- }
+ TargetHandler<ELFT> *targetHandler() const { return _targetHandler; }
Atom *findAtom(const Elf_Sym *symbol) {
return _symbolToAtomMapping.lookup(symbol);
@@ -536,9 +533,9 @@ private:
continue;
bool isMips64EL = _objFile->isMips64EL();
uint32_t symbolIndex = rai.getSymbol(isMips64EL);
- auto *ERef = new (_readerStorage)
- ELFReference<ELFT>(&rai, rai.r_offset - symbol->st_value,
- kindArch(), rai.getType(isMips64EL), symbolIndex);
+ auto *ERef = new (_readerStorage) ELFReference<ELFT>(
+ &rai, rai.r_offset - symbol->st_value, kindArch(),
+ rai.getType(isMips64EL), symbolIndex);
_references.push_back(ERef);
}
}
@@ -552,9 +549,9 @@ private:
continue;
bool isMips64EL = _objFile->isMips64EL();
uint32_t symbolIndex = ri.getSymbol(isMips64EL);
- auto *ERef = new (_readerStorage)
- ELFReference<ELFT>(&ri, ri.r_offset - symbol->st_value,
- kindArch(), ri.getType(isMips64EL), symbolIndex);
+ auto *ERef = new (_readerStorage) ELFReference<ELFT>(
+ &ri, ri.r_offset - symbol->st_value, kindArch(),
+ ri.getType(isMips64EL), symbolIndex);
// Read the addend from the section contents
// TODO : We should move the way lld reads relocations totally from
// ELFFile
@@ -576,7 +573,7 @@ private:
/// cached value of target relocation handler
assert(_targetHandler);
const TargetRelocationHandler<ELFT> &targetRelocationHandler =
- _targetHandler->getRelocationHandler();
+ _targetHandler->getRelocationHandler();
for (auto &ri : _references) {
if (ri->kindNamespace() == lld::Reference::KindNamespace::ELF) {
@@ -689,7 +686,8 @@ private:
// not. Let the TargetHandler to make a decision if that's the case.
if (isTargetSpecificAtom(nullptr, symbol)) {
assert(_targetHandler);
- TargetAtomHandler<ELFT> &atomHandler = _targetHandler->targetAtomHandler();
+ TargetAtomHandler<ELFT> &atomHandler =
+ _targetHandler->targetAtomHandler();
return atomHandler.getType(symbol) == llvm::ELF::STT_COMMON;
}
return symbol->getType() == llvm::ELF::STT_COMMON ||
Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp Fri Dec 20 01:48:29 2013
@@ -77,7 +77,8 @@ public:
Atom *finiFunctionAtom = new (_allocator) SimpleUndefinedAtom(*this, name);
HexagonFiniAtom *finiAtom =
(new (_allocator) HexagonFiniAtom(*this, name));
- finiAtom->addReferenceELF_Hexagon(llvm::ELF::R_HEX_32, 0, finiFunctionAtom, 0);
+ finiAtom->addReferenceELF_Hexagon(llvm::ELF::R_HEX_32, 0, finiFunctionAtom,
+ 0);
finiAtom->setOrdinal(_ordinal++);
addAtom(*finiFunctionAtom);
addAtom(*finiAtom);
Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h Fri Dec 20 01:48:29 2013
@@ -31,8 +31,8 @@ public:
virtual error_code
applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &, const Reference &) const;
-
- private:
+
+private:
const HexagonTargetHandler &_targetHandler;
const HexagonTargetLayout<HexagonELFType> &_targetLayout;
};
Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp Fri Dec 20 01:48:29 2013
@@ -108,8 +108,7 @@ public:
class ELFPassFile : public SimpleFile {
public:
- ELFPassFile(const ELFLinkingContext &eti)
- : SimpleFile("ELFPassFile") {
+ ELFPassFile(const ELFLinkingContext &eti) : SimpleFile("ELFPassFile") {
setOrdinal(eti.getNextOrdinalAndIncrement());
}
@@ -291,8 +290,8 @@ public:
error_code handlePLT32(const Reference &ref) {
// Turn this into a PC32 to the PLT entry.
- assert(ref.kindNamespace() == Reference::KindNamespace::ELF);
- assert(ref.kindArch() == Reference::KindArch::Hexagon);
+ assert(ref.kindNamespace() == Reference::KindNamespace::ELF);
+ assert(ref.kindArch() == Reference::KindArch::Hexagon);
const_cast<Reference &>(ref).setKindValue(R_HEX_B22_PCREL);
const_cast<Reference &>(ref).setTarget(getPLTEntry(ref.target()));
return error_code::success();
@@ -307,9 +306,8 @@ void elf::HexagonLinkingContext::addPass
}
void HexagonTargetHandler::registerRelocationNames(Registry ®istry) {
- registry.addKindTable(Reference::KindNamespace::ELF,
- Reference::KindArch::Hexagon,
- kindStrings);
+ registry.addKindTable(Reference::KindNamespace::ELF,
+ Reference::KindArch::Hexagon, kindStrings);
}
const Registry::KindStrings HexagonTargetHandler::kindStrings[] = {
@@ -407,4 +405,3 @@ const Registry::KindStrings HexagonTarge
LLD_KIND_STRING_ENTRY(R_HEX_TPREL_11_X),
LLD_KIND_STRING_END
};
-
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp Fri Dec 20 01:48:29 2013
@@ -175,20 +175,13 @@ void MipsTargetHandler::finalizeSymbolVa
}
void MipsTargetHandler::registerRelocationNames(Registry ®istry) {
- registry.addKindTable(Reference::KindNamespace::ELF,
- Reference::KindArch::Mips,
- kindStrings);
+ registry.addKindTable(Reference::KindNamespace::ELF,
+ Reference::KindArch::Mips, kindStrings);
}
-
const Registry::KindStrings MipsTargetHandler::kindStrings[] = {
- LLD_KIND_STRING_ENTRY(R_MIPS_NONE),
- LLD_KIND_STRING_ENTRY(R_MIPS_32),
- LLD_KIND_STRING_ENTRY(R_MIPS_HI16),
- LLD_KIND_STRING_ENTRY(R_MIPS_LO16),
- LLD_KIND_STRING_ENTRY(R_MIPS_GOT16),
- LLD_KIND_STRING_ENTRY(R_MIPS_CALL16),
- LLD_KIND_STRING_ENTRY(R_MIPS_JALR),
- LLD_KIND_STRING_END
+ LLD_KIND_STRING_ENTRY(R_MIPS_NONE), LLD_KIND_STRING_ENTRY(R_MIPS_32),
+ LLD_KIND_STRING_ENTRY(R_MIPS_HI16), LLD_KIND_STRING_ENTRY(R_MIPS_LO16),
+ LLD_KIND_STRING_ENTRY(R_MIPS_GOT16), LLD_KIND_STRING_ENTRY(R_MIPS_CALL16),
+ LLD_KIND_STRING_ENTRY(R_MIPS_JALR), LLD_KIND_STRING_END
};
-
\ No newline at end of file
Modified: lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp Fri Dec 20 01:48:29 2013
@@ -67,11 +67,9 @@ PPCTargetHandler::PPCTargetHandler(PPCLi
: DefaultTargetHandler(targetInfo), _relocationHandler(targetInfo),
_targetLayout(targetInfo) {}
-
void PPCTargetHandler::registerRelocationNames(Registry ®istry) {
- registry.addKindTable(Reference::KindNamespace::ELF,
- Reference::KindArch::PowerPC,
- kindStrings);
+ registry.addKindTable(Reference::KindNamespace::ELF,
+ Reference::KindArch::PowerPC, kindStrings);
}
const Registry::KindStrings PPCTargetHandler::kindStrings[] = {
@@ -130,6 +128,3 @@ const Registry::KindStrings PPCTargetHan
LLD_KIND_STRING_ENTRY(R_PPC_REL16_HA),
LLD_KIND_STRING_END
};
-
-
-
Modified: lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h Fri Dec 20 01:48:29 2013
@@ -35,10 +35,8 @@ public:
PPCTargetHandler(PPCLinkingContext &targetInfo);
virtual void registerRelocationNames(Registry ®istry);
-
- virtual TargetLayout<PPCELFType> &targetLayout() {
- return _targetLayout;
- }
+
+ virtual TargetLayout<PPCELFType> &targetLayout() { return _targetLayout; }
virtual const PPCTargetRelocationHandler &getRelocationHandler() const {
return _relocationHandler;
Modified: lld/trunk/lib/ReaderWriter/ELF/Reader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Reader.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Reader.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Reader.cpp Fri Dec 20 01:48:29 2013
@@ -56,8 +56,8 @@ struct DynamicFileCreateELFTraits {
typedef llvm::ErrorOr<std::unique_ptr<lld::SharedLibraryFile>> result_type;
template <class ELFT>
- static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
- bool useUndefines) {
+ static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
+ bool useUndefines) {
return lld::elf::DynamicFile<ELFT>::create(std::move(mb), useUndefines);
}
};
@@ -67,81 +67,81 @@ struct ELFFileCreateELFTraits {
template <class ELFT>
static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
- bool atomizeStrings,
- TargetHandlerBase *handler,
+ bool atomizeStrings, TargetHandlerBase *handler,
lld::error_code &ec) {
- return std::unique_ptr<lld::File>(
- new lld::elf::ELFFile<ELFT>(std::move(mb), atomizeStrings, handler,ec));
+ return std::unique_ptr<lld::File>(new lld::elf::ELFFile<ELFT>(
+ std::move(mb), atomizeStrings, handler, ec));
}
};
class ELFObjectReader : public Reader {
public:
- ELFObjectReader(bool atomizeStrings, TargetHandlerBase* handler)
- : _atomizeStrings(atomizeStrings), _handler(handler) { }
+ ELFObjectReader(bool atomizeStrings, TargetHandlerBase *handler)
+ : _atomizeStrings(atomizeStrings), _handler(handler) {}
- virtual bool canParse(file_magic magic, StringRef,const MemoryBuffer&) const {
+ virtual bool canParse(file_magic magic, StringRef,
+ const MemoryBuffer &) const {
return (magic == llvm::sys::fs::file_magic::elf_relocatable);
}
-
+
virtual error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
std::vector<std::unique_ptr<File>> &result) const {
error_code ec;
std::size_t maxAlignment =
- 1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
+ 1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
std::unique_ptr<File> f(createELF<ELFFileCreateELFTraits>(
- getElfArchType(&*mb), maxAlignment, std::move(mb),
- _atomizeStrings, _handler, ec));
+ getElfArchType(&*mb), maxAlignment, std::move(mb), _atomizeStrings,
+ _handler, ec));
if (ec)
return ec;
result.push_back(std::move(f));
return error_code::success();
}
+
private:
- bool _atomizeStrings;
+ bool _atomizeStrings;
TargetHandlerBase *_handler;
};
-
class ELFDSOReader : public Reader {
public:
- ELFDSOReader(bool useUndefines) : _useUndefines(useUndefines) { }
+ ELFDSOReader(bool useUndefines) : _useUndefines(useUndefines) {}
- virtual bool canParse(file_magic magic, StringRef, const MemoryBuffer&) const{
+ virtual bool canParse(file_magic magic, StringRef,
+ const MemoryBuffer &) const {
return (magic == llvm::sys::fs::file_magic::elf_shared_object);
}
-
+
virtual error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
std::vector<std::unique_ptr<File>> &result) const {
std::size_t maxAlignment =
- 1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
- auto f = createELF<DynamicFileCreateELFTraits>(
- getElfArchType(&*mb), maxAlignment,
- std::move(mb), _useUndefines);
+ 1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
+ auto f = createELF<DynamicFileCreateELFTraits>(
+ getElfArchType(&*mb), maxAlignment, std::move(mb), _useUndefines);
if (!f)
- return f;
+ return f;
result.push_back(std::move(*f));
return error_code::success();
}
+
private:
bool _useUndefines;
};
} // anonymous
-
-// This dynamic registration of a handler causes support for all ELF
-// architectures to be pulled into the linker. If we want to support making a
+// This dynamic registration of a handler causes support for all ELF
+// architectures to be pulled into the linker. If we want to support making a
// linker that only supports one ELF architecture, we'd need to change this
// to have a different registration method for each architecture.
-void Registry::addSupportELFObjects(bool atomizeStrings,
- TargetHandlerBase *handler) {
+void Registry::addSupportELFObjects(bool atomizeStrings,
+ TargetHandlerBase *handler) {
// Tell registry about the ELF object file parser.
add(std::unique_ptr<Reader>(new ELFObjectReader(atomizeStrings, handler)));
-
+
// Tell registry about the relocation name to number mapping for this arch.
handler->registerRelocationNames(*this);
}
@@ -150,5 +150,4 @@ void Registry::addSupportELFDynamicShare
add(std::unique_ptr<Reader>(new ELFDSOReader(useShlibUndefines)));
}
-
} // end namespace lld
Modified: lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h Fri Dec 20 01:48:29 2013
@@ -42,7 +42,7 @@ template <class ELFT> class Section : pu
public:
Section(const ELFLinkingContext &context, StringRef name,
typename Chunk<ELFT>::Kind k = Chunk<ELFT>::Kind::ELFSection)
- : Chunk<ELFT>(name, k, context), _parent(nullptr), _flags(0), _entSize(0),
+ : Chunk<ELFT>(name, k, context), _parent(nullptr), _flags(0), _entSize(0),
_type(0), _link(0), _info(0), _segmentType(SHT_NULL) {}
/// \brief Modify the section contents before assigning virtual addresses
@@ -961,12 +961,12 @@ public:
r->r_addend =
writer->addressOfAtom(rel.second->target()) + rel.second->addend();
dest += sizeof(Elf_Rela);
- DEBUG_WITH_TYPE(
- "ELFRelocationTable",
- llvm::dbgs() << rel.second->kindValue() << " relocation at "
- << rel.first->name() << "@" << r->r_offset << " to "
- << rel.second->target()->name() << "@" << r->r_addend
- << "\n";);
+ DEBUG_WITH_TYPE("ELFRelocationTable",
+ llvm::dbgs() << rel.second->kindValue()
+ << " relocation at " << rel.first->name()
+ << "@" << r->r_offset << " to "
+ << rel.second->target()->name() << "@"
+ << r->r_addend << "\n";);
}
}
Modified: lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp Fri Dec 20 01:48:29 2013
@@ -31,8 +31,6 @@ static int relocPC32(uint8_t *location,
return 0;
}
-
-
const Registry::KindStrings X86TargetHandler::kindStrings[] = {
LLD_KIND_STRING_ENTRY(R_386_NONE),
LLD_KIND_STRING_ENTRY(R_386_32),
@@ -79,8 +77,7 @@ const Registry::KindStrings X86TargetHan
};
void X86TargetHandler::registerRelocationNames(Registry ®istry) {
- registry.addKindTable(Reference::KindNamespace::ELF,
- Reference::KindArch::x86,
+ registry.addKindTable(Reference::KindNamespace::ELF, Reference::KindArch::x86,
kindStrings);
}
Modified: lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h Fri Dec 20 01:48:29 2013
@@ -29,9 +29,8 @@ public:
virtual error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &,
const Reference &) const;
-
- static const Registry::KindStrings kindStrings[];
+ static const Registry::KindStrings kindStrings[];
};
class X86TargetHandler LLVM_FINAL
@@ -41,9 +40,7 @@ public:
virtual void registerRelocationNames(Registry ®istry);
- virtual TargetLayout<X86ELFType> &targetLayout() {
- return _targetLayout;
- }
+ virtual TargetLayout<X86ELFType> &targetLayout() { return _targetLayout; }
virtual const X86TargetRelocationHandler &getRelocationHandler() const {
return _relocationHandler;
Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp Fri Dec 20 01:48:29 2013
@@ -69,7 +69,7 @@ public:
Atom *initFunctionAtom = new (_allocator) SimpleUndefinedAtom(*this, name);
X86_64InitAtom *initAtom =
(new (_allocator) X86_64InitAtom(*this, name));
- initAtom->addReferenceELF_x86_64(llvm::ELF::R_X86_64_64, 0,
+ initAtom->addReferenceELF_x86_64(llvm::ELF::R_X86_64_64, 0,
initFunctionAtom, 0);
initAtom->setOrdinal(_ordinal++);
addAtom(*initFunctionAtom);
@@ -80,8 +80,8 @@ public:
Atom *finiFunctionAtom = new (_allocator) SimpleUndefinedAtom(*this, name);
X86_64FiniAtom *finiAtom =
(new (_allocator) X86_64FiniAtom(*this, name));
- finiAtom->addReferenceELF_x86_64(llvm::ELF::R_X86_64_64, 0,
- finiFunctionAtom, 0);
+ finiAtom->addReferenceELF_x86_64(llvm::ELF::R_X86_64_64, 0,
+ finiFunctionAtom, 0);
finiAtom->setOrdinal(_ordinal++);
addAtom(*finiFunctionAtom);
addAtom(*finiAtom);
Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp Fri Dec 20 01:48:29 2013
@@ -47,8 +47,6 @@ static void reloc32S(uint8_t *location,
// TODO: Make sure that the result sign extends to the 64bit value.
}
-
-
int64_t X86_64TargetRelocationHandler::relocAddend(const Reference &ref) const {
if (ref.kindNamespace() != Reference::KindNamespace::ELF)
return false;
@@ -94,7 +92,7 @@ error_code X86_64TargetRelocationHandler
case R_X86_64_TPOFF32: {
_tlsSize =
_context.getTargetHandler<X86_64ELFType>().targetLayout().getTLSSize();
- if (ref.kindValue() == R_X86_64_TPOFF32 ||
+ if (ref.kindValue() == R_X86_64_TPOFF32 ||
ref.kindValue() == R_X86_64_DTPOFF32) {
int32_t result = (int32_t)(targetVAddress - _tlsSize);
*reinterpret_cast<llvm::support::little32_t *>(location) = result;
Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp Fri Dec 20 01:48:29 2013
@@ -29,9 +29,8 @@ bool X86_64TargetHandler::createImplicit
}
void X86_64TargetHandler::registerRelocationNames(Registry ®istry) {
- registry.addKindTable(Reference::KindNamespace::ELF,
- Reference::KindArch::x86_64,
- kindStrings);
+ registry.addKindTable(Reference::KindNamespace::ELF,
+ Reference::KindArch::x86_64, kindStrings);
}
const Registry::KindStrings X86_64TargetHandler::kindStrings[] = {
@@ -76,4 +75,3 @@ const Registry::KindStrings X86_64Target
LLD_KIND_STRING_ENTRY(LLD_R_X86_64_GOTRELINDEX),
LLD_KIND_STRING_END
};
-
Modified: lld/trunk/lib/ReaderWriter/FileArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/FileArchive.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/FileArchive.cpp (original)
+++ lld/trunk/lib/ReaderWriter/FileArchive.cpp Fri Dec 20 01:48:29 2013
@@ -34,20 +34,19 @@ namespace {
/// \brief The FileArchive class represents an Archive Library file
class FileArchive : public lld::ArchiveLibraryFile {
public:
-
- virtual ~FileArchive() { }
+ virtual ~FileArchive() {}
/// \brief Check if any member of the archive contains an Atom with the
/// specified name and return the File object for that member, or nullptr.
virtual const File *find(StringRef name, bool dataSymbolOnly) const {
auto member = _symbolMemberMap.find(name);
- if (member == _symbolMemberMap.end())
+ if (member == _symbolMemberMap.end())
return nullptr;
Archive::child_iterator ci = member->second;
- // Don't return a member already returned
+ // Don't return a member already returned
const char *memberStart = ci->getBuffer().data();
- if (_membersInstantiated.count(memberStart))
+ if (_membersInstantiated.count(memberStart))
return nullptr;
if (dataSymbolOnly) {
@@ -72,10 +71,10 @@ public:
/// \brief parse each member
virtual error_code
- parseAllMembers(std::vector<std::unique_ptr<File>> &result) const {
- for (auto mf = _archive->begin_children(),
- me = _archive->end_children(); mf != me; ++mf) {
- if (error_code ec=instantiateMember(mf, result))
+ parseAllMembers(std::vector<std::unique_ptr<File>> &result) const {
+ for (auto mf = _archive->begin_children(), me = _archive->end_children();
+ mf != me; ++mf) {
+ if (error_code ec = instantiateMember(mf, result))
return ec;
}
return error_code::success();
@@ -98,10 +97,11 @@ public:
}
protected:
- error_code instantiateMember(Archive::child_iterator member,
- std::vector<std::unique_ptr<File>> &result) const {
+ error_code
+ instantiateMember(Archive::child_iterator member,
+ std::vector<std::unique_ptr<File>> &result) const {
OwningPtr<MemoryBuffer> buff;
- if (error_code ec=member->getMemoryBuffer(buff, true))
+ if (error_code ec = member->getMemoryBuffer(buff, true))
return ec;
if (_logLoading)
llvm::outs() << buff->getBufferIdentifier() << "\n";
@@ -112,10 +112,8 @@ protected:
return error_code::success();
}
-
error_code isDataSymbol(MemoryBuffer *mb, StringRef symbol) const {
- std::unique_ptr<ObjectFile>
- obj(ObjectFile::createObjectFile(mb));
+ std::unique_ptr<ObjectFile> obj(ObjectFile::createObjectFile(mb));
error_code ec;
SymbolRef::Type symtype;
uint32_t symflags;
@@ -124,22 +122,26 @@ protected:
StringRef symbolname;
for (symbol_iterator i = ibegin; i != iend; i.increment(ec)) {
- if (ec) return ec;
+ if (ec)
+ return ec;
// Get symbol name
- if ((ec = (i->getName(symbolname)))) return ec;
+ if ((ec = (i->getName(symbolname))))
+ return ec;
if (symbolname != symbol)
- continue;
+ continue;
// Get symbol flags
- if ((ec = (i->getFlags(symflags)))) return ec;
+ if ((ec = (i->getFlags(symflags))))
+ return ec;
if (symflags <= SymbolRef::SF_Undefined)
- continue;
+ continue;
// Get Symbol Type
- if ((ec = (i->getType(symtype)))) return ec;
+ if ((ec = (i->getType(symtype))))
+ return ec;
if (symtype == SymbolRef::ST_Data) {
return error_code::success();
@@ -149,40 +151,34 @@ protected:
}
private:
- typedef std::unordered_map<StringRef,Archive::child_iterator> MemberMap;
- typedef std::set<const char*> InstantiatedSet;
+ typedef std::unordered_map<StringRef, Archive::child_iterator> MemberMap;
+ typedef std::set<const char *> InstantiatedSet;
- const Registry &_registry;
- std::unique_ptr<Archive> _archive;
- mutable MemberMap _symbolMemberMap;
- mutable InstantiatedSet _membersInstantiated;
- atom_collection_vector<DefinedAtom> _definedAtoms;
- atom_collection_vector<UndefinedAtom> _undefinedAtoms;
+ const Registry &_registry;
+ std::unique_ptr<Archive> _archive;
+ mutable MemberMap _symbolMemberMap;
+ mutable InstantiatedSet _membersInstantiated;
+ atom_collection_vector<DefinedAtom> _definedAtoms;
+ atom_collection_vector<UndefinedAtom> _undefinedAtoms;
atom_collection_vector<SharedLibraryAtom> _sharedLibraryAtoms;
- atom_collection_vector<AbsoluteAtom> _absoluteAtoms;
- bool _isWholeArchive;
- bool _logLoading;
+ atom_collection_vector<AbsoluteAtom> _absoluteAtoms;
+ bool _isWholeArchive;
+ bool _logLoading;
public:
/// only subclasses of ArchiveLibraryFile can be instantiated
- FileArchive(const Registry ®istry,
- Archive* archive,
- StringRef path,
- bool isWholeArchive,
- bool logLoading)
- : ArchiveLibraryFile(path),
- _registry(registry),
- _archive(std::move(archive)),
- _isWholeArchive(isWholeArchive),
- _logLoading(logLoading) {
- }
+ FileArchive(const Registry ®istry, Archive *archive, StringRef path,
+ bool isWholeArchive, bool logLoading)
+ : ArchiveLibraryFile(path), _registry(registry),
+ _archive(std::move(archive)), _isWholeArchive(isWholeArchive),
+ _logLoading(logLoading) {}
error_code buildTableOfContents() {
- DEBUG_WITH_TYPE("FileArchive",
- llvm::dbgs() << "Table of contents for archive '"
- << _archive->getFileName() << "':\n");
+ DEBUG_WITH_TYPE("FileArchive", llvm::dbgs()
+ << "Table of contents for archive '"
+ << _archive->getFileName() << "':\n");
for (auto i = _archive->begin_symbols(), e = _archive->end_symbols();
- i != e; ++i) {
+ i != e; ++i) {
StringRef name;
error_code ec;
Archive::child_iterator member;
@@ -190,56 +186,55 @@ public:
return ec;
if ((ec = i->getMember(member)))
return ec;
- DEBUG_WITH_TYPE("FileArchive",
- llvm::dbgs() << llvm::format("0x%08llX ", member->getBuffer().data())
- << "'" << name << "'\n");
+ DEBUG_WITH_TYPE(
+ "FileArchive",
+ llvm::dbgs() << llvm::format("0x%08llX ", member->getBuffer().data())
+ << "'" << name << "'\n");
_symbolMemberMap[name] = member;
}
- return error_code::success();
+ return error_code::success();
}
}; // class FileArchive
-
-
class ArchiveReader : public Reader {
public:
- ArchiveReader(bool logLoading) : _logLoading(logLoading) { }
-
- virtual bool canParse(file_magic magic, StringRef, const MemoryBuffer&) const{
+ ArchiveReader(bool logLoading) : _logLoading(logLoading) {}
+
+ virtual bool canParse(file_magic magic, StringRef,
+ const MemoryBuffer &) const {
return (magic == llvm::sys::fs::file_magic::archive);
}
-
+
virtual error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const Registry ®,
std::vector<std::unique_ptr<File>> &result) const {
// Make Archive object which will be owned by FileArchive object.
error_code ec;
- Archive* archive = new Archive(mb.get(), ec);
+ Archive *archive = new Archive(mb.get(), ec);
if (ec)
return ec;
StringRef path = mb->getBufferIdentifier();
// Construct FileArchive object.
- std::unique_ptr<FileArchive> file(new FileArchive(reg, archive,
- path, false, _logLoading));
+ std::unique_ptr<FileArchive> file(
+ new FileArchive(reg, archive, path, false, _logLoading));
ec = file->buildTableOfContents();
if (ec)
return ec;
-
+
// Transfer ownership of memory buffer to Archive object.
mb.release();
-
+
result.push_back(std::move(file));
- return error_code::success();
+ return error_code::success();
}
+
private:
- bool _logLoading;
+ bool _logLoading;
};
-
} // anonymous namespace
-
void Registry::addSupportArchives(bool logLoading) {
add(std::unique_ptr<Reader>(new ArchiveReader(logLoading)));
}
Modified: lld/trunk/lib/ReaderWriter/MachO/ExecutableAtoms.hpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/ExecutableAtoms.hpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/ExecutableAtoms.hpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/ExecutableAtoms.hpp Fri Dec 20 01:48:29 2013
@@ -29,9 +29,8 @@ namespace mach_o {
//
class CRuntimeFile : public SimpleFile {
public:
- CRuntimeFile(const MachOLinkingContext &context)
- : SimpleFile("C runtime"),
- _undefMain(*this, context.entrySymbolName()) {
+ CRuntimeFile(const MachOLinkingContext &context)
+ : SimpleFile("C runtime"), _undefMain(*this, context.entrySymbolName()) {
// only main executables need _main
if (context.outputFileType() == llvm::MachO::MH_EXECUTE) {
this->addAtom(_undefMain);
Modified: lld/trunk/lib/ReaderWriter/MachO/GOTPass.hpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/GOTPass.hpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/GOTPass.hpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/GOTPass.hpp Fri Dec 20 01:48:29 2013
@@ -29,7 +29,7 @@ public:
return true;
}
- virtual bool isGOTAccess(const Reference&, bool& canBypassGOT) {
+ virtual bool isGOTAccess(const Reference &, bool &canBypassGOT) {
return false;
}
Modified: lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp Fri Dec 20 01:48:29 2013
@@ -100,7 +100,6 @@ StringRef MachOLinkingContext::nameFromA
return "<unknown>";
}
-
uint32_t MachOLinkingContext::cpuTypeFromArch(Arch arch) {
assert(arch != arch_unknown);
for (ArchInfo *info = _s_archInfos; !info->archName.empty(); ++info) {
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h Fri Dec 20 01:48:29 2013
@@ -259,7 +259,7 @@ writeYaml(const NormalizedFile &file, ra
/// Takes in-memory normalized dylib or object and parses it into lld::File
-ErrorOr<std::unique_ptr<lld::File>>
+ErrorOr<std::unique_ptr<lld::File>>
normalizedToAtoms(const NormalizedFile &normalizedFile, StringRef path);
/// Takes atoms and generates a normalized macho-o view.
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp Fri Dec 20 01:48:29 2013
@@ -312,20 +312,17 @@ void Registry::addSupportMachOObjects(St
MachOLinkingContext::Arch arch = MachOLinkingContext::archFromName(archName);
switch (arch) {
case MachOLinkingContext::arch_x86_64:
- addKindTable(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86_64,
+ addKindTable(Reference::KindNamespace::mach_o, Reference::KindArch::x86_64,
mach_o::KindHandler_x86_64::kindStrings);
break;
case MachOLinkingContext::arch_x86:
- addKindTable(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86,
+ addKindTable(Reference::KindNamespace::mach_o, Reference::KindArch::x86,
mach_o::KindHandler_x86::kindStrings);
break;
case MachOLinkingContext::arch_armv6:
case MachOLinkingContext::arch_armv7:
case MachOLinkingContext::arch_armv7s:
- addKindTable(Reference::KindNamespace::mach_o,
- Reference::KindArch::ARM,
+ addKindTable(Reference::KindNamespace::mach_o, Reference::KindArch::ARM,
mach_o::KindHandler_arm::kindStrings);
break;
default:
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp Fri Dec 20 01:48:29 2013
@@ -436,10 +436,9 @@ void Util::appendSection(SectionInfo *si
if ( ref->target() != nullptr )
targetAddress = _atomToAddress[ref->target()];
uint64_t fixupAddress = _atomToAddress[ai.atom] + offset;
- _context.kindHandler().applyFixup(ref->kindNamespace(), ref->kindArch(),
- ref->kindValue(), ref->addend(),
- &atomContent[offset], fixupAddress,
- targetAddress);
+ _context.kindHandler().applyFixup(
+ ref->kindNamespace(), ref->kindArch(), ref->kindValue(),
+ ref->addend(), &atomContent[offset], fixupAddress, targetAddress);
}
}
}
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp Fri Dec 20 01:48:29 2013
@@ -304,7 +304,7 @@ struct MappingTraits<Relocation> {
template <>
struct ScalarEnumerationTraits<RelocationInfoType> {
static void enumeration(IO &io, RelocationInfoType &value) {
- YamlContext *info = reinterpret_cast<YamlContext*>(io.getContext());
+ YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
assert(info != nullptr);
NormalizedFile *file = info->_normalizeMachOFile;
assert(file != nullptr);
Modified: lld/trunk/lib/ReaderWriter/MachO/ReferenceKinds.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/ReferenceKinds.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/ReferenceKinds.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/ReferenceKinds.cpp Fri Dec 20 01:48:29 2013
@@ -55,22 +55,21 @@ KindHandler::create(MachOLinkingContext:
KindHandler_x86_64::~KindHandler_x86_64() {
}
-
const Registry::KindStrings KindHandler_x86_64::kindStrings[] = {
- LLD_KIND_STRING_ENTRY(X86_64_RELOC_UNSIGNED),
- LLD_KIND_STRING_ENTRY(X86_64_RELOC_BRANCH),
- LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED),
- LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED_1),
- LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED_2),
- LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED_4),
- LLD_KIND_STRING_ENTRY(X86_64_RELOC_GOT_LOAD),
- LLD_KIND_STRING_ENTRY(X86_64_RELOC_GOT),
- LLD_KIND_STRING_ENTRY(X86_64_RELOC_TLV),
- LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_GOT_LOAD_NOW_LEA),
- LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_TLV_NOW_LEA),
- LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_LAZY_TARGET),
- LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_LAZY_IMMEDIATE),
- LLD_KIND_STRING_END
+ LLD_KIND_STRING_ENTRY(X86_64_RELOC_UNSIGNED),
+ LLD_KIND_STRING_ENTRY(X86_64_RELOC_BRANCH),
+ LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED),
+ LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED_1),
+ LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED_2),
+ LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED_4),
+ LLD_KIND_STRING_ENTRY(X86_64_RELOC_GOT_LOAD),
+ LLD_KIND_STRING_ENTRY(X86_64_RELOC_GOT),
+ LLD_KIND_STRING_ENTRY(X86_64_RELOC_TLV),
+ LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_GOT_LOAD_NOW_LEA),
+ LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_TLV_NOW_LEA),
+ LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_LAZY_TARGET),
+ LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_LAZY_IMMEDIATE),
+ LLD_KIND_STRING_END
};
bool KindHandler_x86_64::isCallSite(const Reference &ref) {
@@ -89,54 +88,53 @@ bool KindHandler_x86_64::isLazyTarget(co
return (ref.kindValue() == LLD_X86_64_RELOC_LAZY_TARGET);
}
-
-void KindHandler_x86_64::applyFixup(Reference::KindNamespace ns,
- Reference::KindArch arch,
- Reference::KindValue kindValue,
- uint64_t addend,
- uint8_t *location, uint64_t fixupAddress,
+void KindHandler_x86_64::applyFixup(Reference::KindNamespace ns,
+ Reference::KindArch arch,
+ Reference::KindValue kindValue,
+ uint64_t addend, uint8_t *location,
+ uint64_t fixupAddress,
uint64_t targetAddress) {
if (ns != Reference::KindNamespace::mach_o)
return;
assert(arch == Reference::KindArch::x86_64);
int32_t *loc32 = reinterpret_cast<int32_t*>(location);
uint64_t* loc64 = reinterpret_cast<uint64_t*>(location);
- switch ( kindValue ) {
- case X86_64_RELOC_BRANCH:
- case X86_64_RELOC_SIGNED:
- case X86_64_RELOC_GOT_LOAD:
- case X86_64_RELOC_GOT:
- case X86_64_RELOC_TLV:
+ switch (kindValue) {
+ case X86_64_RELOC_BRANCH:
+ case X86_64_RELOC_SIGNED:
+ case X86_64_RELOC_GOT_LOAD:
+ case X86_64_RELOC_GOT:
+ case X86_64_RELOC_TLV:
*loc32 = (targetAddress - (fixupAddress+4)) + addend;
break;
- case X86_64_RELOC_UNSIGNED:
+ case X86_64_RELOC_UNSIGNED:
*loc64 = targetAddress + addend;
break;
- case X86_64_RELOC_SIGNED_1:
+ case X86_64_RELOC_SIGNED_1:
*loc32 = (targetAddress - (fixupAddress+5)) + addend;
break;
- case X86_64_RELOC_SIGNED_2:
+ case X86_64_RELOC_SIGNED_2:
*loc32 = (targetAddress - (fixupAddress+6)) + addend;
break;
- case X86_64_RELOC_SIGNED_4:
+ case X86_64_RELOC_SIGNED_4:
*loc32 = (targetAddress - (fixupAddress+8)) + addend;
break;
- case LLD_X86_64_RELOC_SIGNED_32:
+ case LLD_X86_64_RELOC_SIGNED_32:
*loc32 = (targetAddress - fixupAddress) + addend;
break;
- case LLD_X86_64_RELOC_GOT_LOAD_NOW_LEA:
- case LLD_X86_64_RELOC_TLV_NOW_LEA:
+ case LLD_X86_64_RELOC_GOT_LOAD_NOW_LEA:
+ case LLD_X86_64_RELOC_TLV_NOW_LEA:
// Change MOVQ to LEA
assert(location[-2] == 0x8B);
location[-2] = 0x8D;
*loc32 = (targetAddress - (fixupAddress+4)) + addend;
break;
- case LLD_X86_64_RELOC_LAZY_TARGET:
- case LLD_X86_64_RELOC_LAZY_IMMEDIATE:
+ case LLD_X86_64_RELOC_LAZY_TARGET:
+ case LLD_X86_64_RELOC_LAZY_IMMEDIATE:
// do nothing
break;
- default:
- llvm_unreachable("invalid x86_64 Reference Kind");
+ default:
+ llvm_unreachable("invalid x86_64 Reference Kind");
break;
}
}
@@ -150,13 +148,13 @@ KindHandler_x86::~KindHandler_x86() {
}
const Registry::KindStrings KindHandler_x86::kindStrings[] = {
- LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_BRANCH32),
- LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_ABS32),
- LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_FUNC_REL32),
- LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_POINTER32),
- LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_LAZY_TARGET),
- LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_LAZY_IMMEDIATE),
- LLD_KIND_STRING_END
+ LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_BRANCH32),
+ LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_ABS32),
+ LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_FUNC_REL32),
+ LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_POINTER32),
+ LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_LAZY_TARGET),
+ LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_LAZY_IMMEDIATE),
+ LLD_KIND_STRING_END
};
bool KindHandler_x86::isCallSite(const Reference &ref) {
@@ -167,44 +165,41 @@ bool KindHandler_x86::isPointer(const Re
return (ref.kindValue() == LLD_X86_RELOC_POINTER32);
}
-
bool KindHandler_x86::isLazyImmediate(const Reference &ref) {
return (ref.kindValue() == LLD_X86_RELOC_LAZY_TARGET);
}
-
bool KindHandler_x86::isLazyTarget(const Reference &ref) {
return (ref.kindValue() == LLD_X86_RELOC_LAZY_TARGET);
}
-
-void KindHandler_x86::applyFixup(Reference::KindNamespace ns,
- Reference::KindArch arch,
- Reference::KindValue kindValue,
+void KindHandler_x86::applyFixup(Reference::KindNamespace ns,
+ Reference::KindArch arch,
+ Reference::KindValue kindValue,
uint64_t addend, uint8_t *location,
- uint64_t fixupAddress,
+ uint64_t fixupAddress,
uint64_t targetAddress) {
if (ns != Reference::KindNamespace::mach_o)
return;
assert(arch == Reference::KindArch::x86);
int32_t *loc32 = reinterpret_cast<int32_t*>(location);
switch (kindValue) {
- case LLD_X86_RELOC_BRANCH32:
+ case LLD_X86_RELOC_BRANCH32:
*loc32 = (targetAddress - (fixupAddress+4)) + addend;
break;
- case LLD_X86_RELOC_POINTER32:
- case LLD_X86_RELOC_ABS32:
+ case LLD_X86_RELOC_POINTER32:
+ case LLD_X86_RELOC_ABS32:
*loc32 = targetAddress + addend;
break;
- case LLD_X86_RELOC_FUNC_REL32:
+ case LLD_X86_RELOC_FUNC_REL32:
*loc32 = targetAddress + addend;
break;
- case LLD_X86_RELOC_LAZY_TARGET:
- case LLD_X86_RELOC_LAZY_IMMEDIATE:
+ case LLD_X86_RELOC_LAZY_TARGET:
+ case LLD_X86_RELOC_LAZY_IMMEDIATE:
// do nothing
break;
- default:
- llvm_unreachable("invalid x86 Reference Kind");
+ default:
+ llvm_unreachable("invalid x86 Reference Kind");
break;
}
}
@@ -218,21 +213,21 @@ KindHandler_arm::~KindHandler_arm() {
}
const Registry::KindStrings KindHandler_arm::kindStrings[] = {
- LLD_KIND_STRING_ENTRY(ARM_RELOC_BR24),
- LLD_KIND_STRING_ENTRY(ARM_THUMB_RELOC_BR22),
- LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_ABS_LO16),
- LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_ABS_HI16),
- LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_REL_LO16),
- LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_REL_HI16),
- LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_ABS32),
- LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_POINTER32),
- LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_LAZY_TARGET),
- LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_LAZY_IMMEDIATE),
- LLD_KIND_STRING_END
+ LLD_KIND_STRING_ENTRY(ARM_RELOC_BR24),
+ LLD_KIND_STRING_ENTRY(ARM_THUMB_RELOC_BR22),
+ LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_ABS_LO16),
+ LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_ABS_HI16),
+ LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_REL_LO16),
+ LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_REL_HI16),
+ LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_ABS32),
+ LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_POINTER32),
+ LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_LAZY_TARGET),
+ LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_LAZY_IMMEDIATE),
+ LLD_KIND_STRING_END
};
bool KindHandler_arm::isCallSite(const Reference &ref) {
- return (ref.kindValue() == ARM_THUMB_RELOC_BR22) ||
+ return (ref.kindValue() == ARM_THUMB_RELOC_BR22) ||
(ref.kindValue() == ARM_RELOC_BR24);
}
@@ -240,58 +235,55 @@ bool KindHandler_arm::isPointer(const Re
return (ref.kindValue() == LLD_ARM_RELOC_POINTER32);
}
-
bool KindHandler_arm::isLazyImmediate(const Reference &ref) {
return (ref.kindValue() == LLD_ARM_RELOC_LAZY_IMMEDIATE);
}
-
bool KindHandler_arm::isLazyTarget(const Reference &ref) {
return (ref.kindValue() == LLD_ARM_RELOC_LAZY_TARGET);
}
-
-void KindHandler_arm::applyFixup(Reference::KindNamespace ns,
- Reference::KindArch arch,
- Reference::KindValue kindValue,
+void KindHandler_arm::applyFixup(Reference::KindNamespace ns,
+ Reference::KindArch arch,
+ Reference::KindValue kindValue,
uint64_t addend, uint8_t *location,
- uint64_t fixupAddress,
+ uint64_t fixupAddress,
uint64_t targetAddress) {
if (ns != Reference::KindNamespace::mach_o)
return;
assert(arch == Reference::KindArch::ARM);
//int32_t *loc32 = reinterpret_cast<int32_t*>(location);
- switch ( kindValue ) {
- case ARM_THUMB_RELOC_BR22:
+ switch (kindValue) {
+ case ARM_THUMB_RELOC_BR22:
// FIXME
break;
- case ARM_RELOC_BR24:
+ case ARM_RELOC_BR24:
// FIXME
break;
- case LLD_ARM_RELOC_THUMB_ABS_LO16:
+ case LLD_ARM_RELOC_THUMB_ABS_LO16:
// FIXME
break;
- case LLD_ARM_RELOC_THUMB_ABS_HI16:
+ case LLD_ARM_RELOC_THUMB_ABS_HI16:
// FIXME
break;
- case LLD_ARM_RELOC_THUMB_REL_LO16:
+ case LLD_ARM_RELOC_THUMB_REL_LO16:
// FIXME
break;
- case LLD_ARM_RELOC_THUMB_REL_HI16:
+ case LLD_ARM_RELOC_THUMB_REL_HI16:
// FIXME
break;
- case LLD_ARM_RELOC_ABS32:
+ case LLD_ARM_RELOC_ABS32:
// FIXME
break;
- case LLD_ARM_RELOC_POINTER32:
+ case LLD_ARM_RELOC_POINTER32:
// FIXME
break;
- case LLD_ARM_RELOC_LAZY_TARGET:
- case LLD_ARM_RELOC_LAZY_IMMEDIATE:
+ case LLD_ARM_RELOC_LAZY_TARGET:
+ case LLD_ARM_RELOC_LAZY_IMMEDIATE:
// do nothing
break;
- default:
- llvm_unreachable("invalid ARM Reference Kind");
+ default:
+ llvm_unreachable("invalid ARM Reference Kind");
break;
}
}
Modified: lld/trunk/lib/ReaderWriter/MachO/ReferenceKinds.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/ReferenceKinds.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/ReferenceKinds.h (original)
+++ lld/trunk/lib/ReaderWriter/MachO/ReferenceKinds.h Fri Dec 20 01:48:29 2013
@@ -23,29 +23,29 @@ namespace mach_o {
// Additional Reference Kind values used internally.
enum {
LLD_X86_64_RELOC_GOT_LOAD_NOW_LEA = 100,
- LLD_X86_64_RELOC_TLV_NOW_LEA = 101,
- LLD_X86_64_RELOC_LAZY_TARGET = 102,
- LLD_X86_64_RELOC_LAZY_IMMEDIATE = 103,
- LLD_X86_64_RELOC_SIGNED_32 = 104,
+ LLD_X86_64_RELOC_TLV_NOW_LEA = 101,
+ LLD_X86_64_RELOC_LAZY_TARGET = 102,
+ LLD_X86_64_RELOC_LAZY_IMMEDIATE = 103,
+ LLD_X86_64_RELOC_SIGNED_32 = 104,
};
enum {
- LLD_X86_RELOC_BRANCH32 = 100, // CALL or JMP 32-bit pc-rel
- LLD_X86_RELOC_ABS32 = 101, // 32-bit absolute addr in instruction
- LLD_X86_RELOC_FUNC_REL32 = 102, // 32-bit target from start of func
- LLD_X86_RELOC_POINTER32 = 103, // 32-bit data pointer
- LLD_X86_RELOC_LAZY_TARGET = 104,
- LLD_X86_RELOC_LAZY_IMMEDIATE = 105
+ LLD_X86_RELOC_BRANCH32 = 100, // CALL or JMP 32-bit pc-rel
+ LLD_X86_RELOC_ABS32 = 101, // 32-bit absolute addr in instruction
+ LLD_X86_RELOC_FUNC_REL32 = 102, // 32-bit target from start of func
+ LLD_X86_RELOC_POINTER32 = 103, // 32-bit data pointer
+ LLD_X86_RELOC_LAZY_TARGET = 104,
+ LLD_X86_RELOC_LAZY_IMMEDIATE = 105
};
enum {
- LLD_ARM_RELOC_THUMB_ABS_LO16 = 100, // thumb movw of absolute address
- LLD_ARM_RELOC_THUMB_ABS_HI16 = 101, // thumb movt of absolute address
- LLD_ARM_RELOC_THUMB_REL_LO16 = 102, // thumb movw of (target - pc)
- LLD_ARM_RELOC_THUMB_REL_HI16 = 103, // thumb movt of (target - pc)
- LLD_ARM_RELOC_ABS32 = 104, // 32-bit constant pointer
- LLD_ARM_RELOC_POINTER32 = 105, // 32-bit data pointer
- LLD_ARM_RELOC_LAZY_TARGET = 106,
- LLD_ARM_RELOC_LAZY_IMMEDIATE = 107,
-};
+ LLD_ARM_RELOC_THUMB_ABS_LO16 = 100, // thumb movw of absolute address
+ LLD_ARM_RELOC_THUMB_ABS_HI16 = 101, // thumb movt of absolute address
+ LLD_ARM_RELOC_THUMB_REL_LO16 = 102, // thumb movw of (target - pc)
+ LLD_ARM_RELOC_THUMB_REL_HI16 = 103, // thumb movt of (target - pc)
+ LLD_ARM_RELOC_ABS32 = 104, // 32-bit constant pointer
+ LLD_ARM_RELOC_POINTER32 = 105, // 32-bit data pointer
+ LLD_ARM_RELOC_LAZY_TARGET = 106,
+ LLD_ARM_RELOC_LAZY_IMMEDIATE = 107,
+};
///
/// The KindHandler class is the abstract interface to Reference::Kind
@@ -58,16 +58,14 @@ public:
static std::unique_ptr<mach_o::KindHandler> create(MachOLinkingContext::Arch);
virtual ~KindHandler();
- virtual bool isCallSite(const Reference&) = 0;
- virtual bool isPointer(const Reference&) = 0;
- virtual bool isLazyImmediate(const Reference&) = 0;
- virtual bool isLazyTarget(const Reference&) = 0;
- virtual void applyFixup(Reference::KindNamespace ns,
- Reference::KindArch arch,
- Reference::KindValue kindValue,
- uint64_t addend, uint8_t *location,
- uint64_t fixupAddress,
- uint64_t targetAddress) = 0;
+ virtual bool isCallSite(const Reference &) = 0;
+ virtual bool isPointer(const Reference &) = 0;
+ virtual bool isLazyImmediate(const Reference &) = 0;
+ virtual bool isLazyTarget(const Reference &) = 0;
+ virtual void applyFixup(Reference::KindNamespace ns, Reference::KindArch arch,
+ Reference::KindValue kindValue, uint64_t addend,
+ uint8_t *location, uint64_t fixupAddress,
+ uint64_t targetAddress) = 0;
protected:
KindHandler();
@@ -77,56 +75,48 @@ protected:
class KindHandler_x86_64 : public KindHandler {
public:
-
static const Registry::KindStrings kindStrings[];
-
+
virtual ~KindHandler_x86_64();
- virtual bool isCallSite(const Reference&);
- virtual bool isPointer(const Reference&);
- virtual bool isLazyImmediate(const Reference&);
- virtual bool isLazyTarget(const Reference&);
- virtual void applyFixup(Reference::KindNamespace ns,
- Reference::KindArch arch,
- Reference::KindValue kindValue,
- uint64_t addend, uint8_t *location,
- uint64_t fixupAddress, uint64_t targetAddress);
+ virtual bool isCallSite(const Reference &);
+ virtual bool isPointer(const Reference &);
+ virtual bool isLazyImmediate(const Reference &);
+ virtual bool isLazyTarget(const Reference &);
+ virtual void applyFixup(Reference::KindNamespace ns, Reference::KindArch arch,
+ Reference::KindValue kindValue, uint64_t addend,
+ uint8_t *location, uint64_t fixupAddress,
+ uint64_t targetAddress);
};
class KindHandler_x86 : public KindHandler {
public:
-
static const Registry::KindStrings kindStrings[];
virtual ~KindHandler_x86();
- virtual bool isCallSite(const Reference&);
- virtual bool isPointer(const Reference&);
- virtual bool isLazyImmediate(const Reference&);
- virtual bool isLazyTarget(const Reference&);
- virtual void applyFixup(Reference::KindNamespace ns,
- Reference::KindArch arch,
- Reference::KindValue kindValue,
- uint64_t addend, uint8_t *location,
- uint64_t fixupAddress, uint64_t targetAddress);
-
+ virtual bool isCallSite(const Reference &);
+ virtual bool isPointer(const Reference &);
+ virtual bool isLazyImmediate(const Reference &);
+ virtual bool isLazyTarget(const Reference &);
+ virtual void applyFixup(Reference::KindNamespace ns, Reference::KindArch arch,
+ Reference::KindValue kindValue, uint64_t addend,
+ uint8_t *location, uint64_t fixupAddress,
+ uint64_t targetAddress);
};
class KindHandler_arm : public KindHandler {
public:
-
static const Registry::KindStrings kindStrings[];
virtual ~KindHandler_arm();
- virtual bool isCallSite(const Reference&);
- virtual bool isPointer(const Reference&);
- virtual bool isLazyImmediate(const Reference&);
- virtual bool isLazyTarget(const Reference&);
- virtual void applyFixup(Reference::KindNamespace ns,
- Reference::KindArch arch,
- Reference::KindValue kindValue,
- uint64_t addend, uint8_t *location,
- uint64_t fixupAddress, uint64_t targetAddress);
-
+ virtual bool isCallSite(const Reference &);
+ virtual bool isPointer(const Reference &);
+ virtual bool isLazyImmediate(const Reference &);
+ virtual bool isLazyTarget(const Reference &);
+ virtual void applyFixup(Reference::KindNamespace ns, Reference::KindArch arch,
+ Reference::KindValue kindValue, uint64_t addend,
+ uint8_t *location, uint64_t fixupAddress,
+ uint64_t targetAddress);
};
Modified: lld/trunk/lib/ReaderWriter/MachO/StubAtoms_x86.hpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/StubAtoms_x86.hpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/StubAtoms_x86.hpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/StubAtoms_x86.hpp Fri Dec 20 01:48:29 2013
@@ -31,9 +31,9 @@ class X86StubAtom : public SimpleDefined
public:
X86StubAtom(const File &file, const Atom &lazyPointer)
: SimpleDefinedAtom(file) {
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86,
- LLD_X86_RELOC_ABS32, 2, &lazyPointer, 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86, LLD_X86_RELOC_ABS32, 2,
+ &lazyPointer, 0);
}
virtual ContentType contentType() const {
@@ -65,12 +65,12 @@ public:
X86StubHelperCommonAtom(const File &file, const Atom &cache,
const Atom &binder)
: SimpleDefinedAtom(file) {
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86,
- LLD_X86_RELOC_ABS32, 1, &cache, 0);
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86,
- LLD_X86_RELOC_ABS32, 7, &binder, 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86, LLD_X86_RELOC_ABS32, 1, &cache,
+ 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86, LLD_X86_RELOC_ABS32, 7,
+ &binder, 0);
}
virtual ContentType contentType() const {
@@ -103,12 +103,12 @@ class X86StubHelperAtom : public SimpleD
public:
X86StubHelperAtom(const File &file, const Atom &helperCommon)
: SimpleDefinedAtom(file) {
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86,
- LLD_X86_RELOC_LAZY_IMMEDIATE, 1, this, 0);
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86,
- LLD_X86_RELOC_BRANCH32, 6, &helperCommon, 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86, LLD_X86_RELOC_LAZY_IMMEDIATE,
+ 1, this, 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86, LLD_X86_RELOC_BRANCH32, 6,
+ &helperCommon, 0);
}
virtual ContentType contentType() const {
@@ -140,12 +140,12 @@ class X86LazyPointerAtom : public Simple
public:
X86LazyPointerAtom(const File &file, const Atom &helper, const Atom &shlib)
: SimpleDefinedAtom(file) {
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86,
- LLD_X86_RELOC_POINTER32, 0, &helper, 0);
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86,
- LLD_X86_RELOC_LAZY_TARGET, 0, &shlib, 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86, LLD_X86_RELOC_POINTER32, 0,
+ &helper, 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86, LLD_X86_RELOC_LAZY_TARGET, 0,
+ &shlib, 0);
}
virtual ContentType contentType() const {
@@ -181,9 +181,9 @@ public:
X86NonLazyPointerAtom(const File &file, const Atom &shlib)
: SimpleDefinedAtom(file) {
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86,
- LLD_X86_RELOC_POINTER32, 0, &shlib, 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86, LLD_X86_RELOC_POINTER32, 0,
+ &shlib, 0);
}
virtual ContentType contentType() const {
Modified: lld/trunk/lib/ReaderWriter/MachO/StubAtoms_x86_64.hpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/StubAtoms_x86_64.hpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/StubAtoms_x86_64.hpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/StubAtoms_x86_64.hpp Fri Dec 20 01:48:29 2013
@@ -32,9 +32,9 @@ class X86_64StubAtom : public SimpleDefi
public:
X86_64StubAtom(const File &file, const Atom &lazyPointer)
: SimpleDefinedAtom(file) {
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86_64,
- X86_64_RELOC_SIGNED, 2, &lazyPointer, 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86_64, X86_64_RELOC_SIGNED, 2,
+ &lazyPointer, 0);
}
virtual ContentType contentType() const {
@@ -65,12 +65,12 @@ public:
X86_64StubHelperCommonAtom(const File &file, const Atom &cache,
const Atom &binder)
: SimpleDefinedAtom(file) {
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86_64,
- X86_64_RELOC_SIGNED, 3, &cache, 0);
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86_64,
- X86_64_RELOC_SIGNED, 11, &binder, 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86_64, X86_64_RELOC_SIGNED, 3,
+ &cache, 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86_64, X86_64_RELOC_SIGNED, 11,
+ &binder, 0);
}
virtual ContentType contentType() const {
@@ -103,12 +103,12 @@ class X86_64StubHelperAtom : public Simp
public:
X86_64StubHelperAtom(const File &file, const Atom &helperCommon)
: SimpleDefinedAtom(file) {
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86_64,
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86_64,
LLD_X86_64_RELOC_LAZY_IMMEDIATE, 1, this, 0);
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86_64,
- X86_64_RELOC_SIGNED, 6, &helperCommon, 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86_64, X86_64_RELOC_SIGNED, 6,
+ &helperCommon, 0);
}
virtual ContentType contentType() const {
@@ -140,11 +140,11 @@ public:
X86_64LazyPointerAtom(const File &file, const Atom &helper,
const Atom &shlib)
: SimpleDefinedAtom(file) {
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86_64,
- X86_64_RELOC_UNSIGNED, 0, &helper, 0);
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86_64,
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86_64, X86_64_RELOC_UNSIGNED, 0,
+ &helper, 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86_64,
LLD_X86_64_RELOC_LAZY_TARGET, 0, &shlib, 0);
}
@@ -181,9 +181,9 @@ public:
X86_64NonLazyPointerAtom(const File &file, const Atom &shlib)
: SimpleDefinedAtom(file) {
- this->addReference(Reference::KindNamespace::mach_o,
- Reference::KindArch::x86_64,
- X86_64_RELOC_UNSIGNED, 0, &shlib, 0);
+ this->addReference(Reference::KindNamespace::mach_o,
+ Reference::KindArch::x86_64, X86_64_RELOC_UNSIGNED, 0,
+ &shlib, 0);
}
virtual ContentType contentType() const {
Modified: lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp Fri Dec 20 01:48:29 2013
@@ -149,11 +149,10 @@ private:
class File : public SimpleFile {
public:
- File(const MachOLinkingContext &context)
- : SimpleFile("MachO Stubs pass") {}
+ File(const MachOLinkingContext &context) : SimpleFile("MachO Stubs pass") {}
};
- const MachOLinkingContext &_context;
+ const MachOLinkingContext &_context;
mach_o::KindHandler &_kindHandler;
File _file;
llvm::DenseMap<const Atom*, const DefinedAtom*> _targetToStub;
Modified: lld/trunk/lib/ReaderWriter/Native/NativeFileFormat.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Native/NativeFileFormat.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/Native/NativeFileFormat.h (original)
+++ lld/trunk/lib/ReaderWriter/Native/NativeFileFormat.h Fri Dec 20 01:48:29 2013
@@ -202,10 +202,10 @@ struct NativeReferenceIvarsV1 {
enum {
noTarget = UINT16_MAX
};
- uint32_t offsetInAtom;
- uint16_t kindValue;
- uint8_t kindNamespace;
- uint8_t kindArch;
+ uint32_t offsetInAtom;
+ uint16_t kindValue;
+ uint8_t kindNamespace;
+ uint8_t kindArch;
uint16_t targetIndex;
uint16_t addendIndex;
};
@@ -220,9 +220,9 @@ struct NativeReferenceIvarsV2 {
};
uint64_t offsetInAtom;
int64_t addend;
- uint16_t kindValue;
- uint8_t kindNamespace;
- uint8_t kindArch;
+ uint16_t kindValue;
+ uint8_t kindNamespace;
+ uint8_t kindArch;
uint32_t targetIndex;
};
Modified: lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp (original)
+++ lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp Fri Dec 20 01:48:29 2013
@@ -213,11 +213,10 @@ private:
//
class NativeReferenceV1 : public Reference {
public:
- NativeReferenceV1(const File& f, const NativeReferenceIvarsV1* ivarData)
- : Reference((KindNamespace)ivarData->kindNamespace,
- (KindArch)ivarData->kindArch, ivarData->kindValue),
- _file(&f), _ivarData(ivarData) {
- }
+ NativeReferenceV1(const File &f, const NativeReferenceIvarsV1 *ivarData)
+ : Reference((KindNamespace)ivarData->kindNamespace,
+ (KindArch)ivarData->kindArch, ivarData->kindValue),
+ _file(&f), _ivarData(ivarData) {}
virtual uint64_t offsetInAtom() const {
return _ivarData->offsetInAtom;
@@ -240,11 +239,10 @@ private:
//
class NativeReferenceV2 : public Reference {
public:
- NativeReferenceV2(const File& f, const NativeReferenceIvarsV2* ivarData)
- : Reference((KindNamespace)ivarData->kindNamespace,
- (KindArch)ivarData->kindArch, ivarData->kindValue),
- _file(&f), _ivarData(ivarData) {
- }
+ NativeReferenceV2(const File &f, const NativeReferenceIvarsV2 *ivarData)
+ : Reference((KindNamespace)ivarData->kindNamespace,
+ (KindArch)ivarData->kindArch, ivarData->kindValue),
+ _file(&f), _ivarData(ivarData) {}
virtual uint64_t offsetInAtom() const {
return _ivarData->offsetInAtom;
@@ -270,7 +268,7 @@ public:
/// Instantiates a File object from a native object file. Ownership
/// of the MemoryBuffer is transferred to the resulting File object.
static error_code make(std::unique_ptr<MemoryBuffer> mb,
- std::vector<std::unique_ptr<lld::File> > &result) {
+ std::vector<std::unique_ptr<lld::File>> &result) {
const uint8_t *const base =
reinterpret_cast<const uint8_t *>(mb->getBufferStart());
StringRef path(mb->getBufferIdentifier());
@@ -842,8 +840,7 @@ private:
uint32_t elementCount;
};
-
- std::unique_ptr<MemoryBuffer> _buffer;
+ std::unique_ptr<MemoryBuffer> _buffer;
const NativeFileHeader* _header;
AtomArray<DefinedAtom> _definedAtoms;
AtomArray<UndefinedAtom> _undefinedAtoms;
@@ -860,9 +857,9 @@ private:
const char* _strings;
uint32_t _stringsMaxOffset;
const Reference::Addend* _addends;
- uint32_t _addendsMaxIndex;
- const uint8_t *_contentStart;
- const uint8_t *_contentEnd;
+ uint32_t _addendsMaxIndex;
+ const uint8_t *_contentStart;
+ const uint8_t *_contentEnd;
};
inline const lld::File &NativeDefinedAtomV1::file() const {
@@ -1001,19 +998,18 @@ inline void NativeReferenceV2::setAddend
} // end namespace native
-
namespace {
class NativeReader : public Reader {
public:
- virtual bool canParse(file_magic magic, StringRef,
- const MemoryBuffer& mb) const {
+ virtual bool canParse(file_magic magic, StringRef,
+ const MemoryBuffer &mb) const {
const NativeFileHeader *const header =
- reinterpret_cast<const NativeFileHeader *>(mb.getBufferStart());
- return (memcmp(header->magic, NATIVE_FILE_HEADER_MAGIC,
- sizeof(header->magic)) == 0);
+ reinterpret_cast<const NativeFileHeader *>(mb.getBufferStart());
+ return (memcmp(header->magic, NATIVE_FILE_HEADER_MAGIC,
+ sizeof(header->magic)) == 0);
}
-
+
virtual error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
std::vector<std::unique_ptr<File>> &result) const {
@@ -1021,12 +1017,10 @@ public:
return error_code::success();
}
};
-
-
}
void Registry::addSupportNativeObjects() {
- add(std::unique_ptr<Reader>(new NativeReader()));
+ add(std::unique_ptr<Reader>(new NativeReader()));
}
} // end namespace lld
Modified: lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h Fri Dec 20 01:48:29 2013
@@ -28,11 +28,10 @@ class COFFDefinedAtom;
class COFFReference LLVM_FINAL : public Reference {
public:
COFFReference(const Atom *target, uint32_t offsetInAtom, uint16_t relocType,
- Reference::KindNamespace ns=Reference::KindNamespace::COFF,
- Reference::KindArch arch=Reference::KindArch::x86)
- : Reference(ns, arch, relocType),
- _target(target), _offsetInAtom(offsetInAtom) {
- }
+ Reference::KindNamespace ns = Reference::KindNamespace::COFF,
+ Reference::KindArch arch = Reference::KindArch::x86)
+ : Reference(ns, arch, relocType), _target(target),
+ _offsetInAtom(offsetInAtom) {}
virtual const Atom *target() const { return _target; }
virtual void setTarget(const Atom *newAtom) { _target = newAtom; }
@@ -343,7 +342,7 @@ private:
template <typename T, typename U>
void addLayoutEdge(T *a, U *b, uint32_t which) {
auto ref = new COFFReference(nullptr, 0, which, Reference::KindNamespace::all,
- Reference::KindArch::all);
+ Reference::KindArch::all);
ref->setTarget(b);
a->addReference(std::unique_ptr<COFFReference>(ref));
}
Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Fri Dec 20 01:48:29 2013
@@ -235,8 +235,7 @@ uint32_t PECOFFLinkingContext::getSectio
uint32_t clearMask = (ci == _sectionClearMask.end()) ? 0 : ci->second;
return (flags | setMask) & ~clearMask;
}
-
-
+
void PECOFFLinkingContext::addPasses(PassManager &pm) {
pm.add(std::unique_ptr<Pass>(new pecoff::SetSubsystemPass(*this)));
pm.add(std::unique_ptr<Pass>(new pecoff::EdataPass(*this)));
Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Fri Dec 20 01:48:29 2013
@@ -58,8 +58,8 @@ private:
typedef vector<const coff_symbol *> SymbolVectorT;
typedef std::map<const coff_section *, SymbolVectorT> SectionToSymbolsT;
typedef std::map<const StringRef, Atom *> SymbolNameToAtomT;
- typedef std::map<const coff_section *, vector<COFFDefinedFileAtom *> >
- SectionToAtomsT;
+ typedef std::map<const coff_section *, vector<COFFDefinedFileAtom *>>
+ SectionToAtomsT;
public:
typedef const std::map<std::string, std::string> StringMap;
@@ -86,7 +86,6 @@ public:
StringRef getLinkerDirectives() const { return _directives; }
private:
-
error_code readSymbolTable(vector<const coff_symbol *> &result);
void createAbsoluteAtoms(const SymbolVectorT &symbols,
@@ -102,10 +101,10 @@ private:
error_code cacheSectionAttributes();
error_code
- AtomizeDefinedSymbolsInSection(const coff_section *section,
- StringMap &altNames,
- vector<const coff_symbol *> &symbols,
- vector<COFFDefinedFileAtom *> &atoms);
+ AtomizeDefinedSymbolsInSection(const coff_section *section,
+ StringMap &altNames,
+ vector<const coff_symbol *> &symbols,
+ vector<COFFDefinedFileAtom *> &atoms);
error_code AtomizeDefinedSymbols(SectionToSymbolsT &definedSymbols,
StringMap &altNames,
@@ -156,8 +155,8 @@ private:
// A sorted map to find an atom from a section and an offset within
// the section.
std::map<const coff_section *,
- std::map<uint32_t, std::vector<COFFDefinedAtom *> > >
- _definedAtomLocations;
+ std::map<uint32_t, std::vector<COFFDefinedAtom *>>>
+ _definedAtomLocations;
mutable llvm::BumpPtrAllocator _alloc;
uint64_t _ordinal;
@@ -530,16 +529,15 @@ FileCOFF::AtomizeDefinedSymbolsInSection
StringMap &altNames,
vector<const coff_symbol *> &symbols,
vector<COFFDefinedFileAtom *> &atoms) {
- // Sort symbols by position.
+ // Sort symbols by position.
std::stable_sort(
symbols.begin(), symbols.end(),
// For some reason MSVC fails to allow the lambda in this context with a
// "illegal use of local type in type instantiation". MSVC is clearly
// wrong here. Force a conversion to function pointer to work around.
- static_cast<bool(*)(const coff_symbol *, const coff_symbol *)>(
- [](const coff_symbol * a, const coff_symbol * b)->bool {
- return a->Value < b->Value;
- }));
+ static_cast<bool (*)(const coff_symbol *, const coff_symbol *)>([](
+ const coff_symbol * a,
+ const coff_symbol * b)->bool { return a->Value < b->Value; }));
StringRef sectionName;
if (error_code ec = _obj->getSectionName(section, sectionName))
@@ -808,7 +806,7 @@ public:
virtual error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
- std::vector<std::unique_ptr<File> > &result) const {
+ std::vector<std::unique_ptr<File>> &result) const {
// Convert RC file to COFF
ErrorOr<std::string> coffPath = convertResourceFileToCOFF(std::move(mb));
if (!coffPath)
@@ -909,7 +907,7 @@ public:
virtual error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const Registry ®istry,
- std::vector<std::unique_ptr<File> > &result) const {
+ std::vector<std::unique_ptr<File>> &result) const {
// Parse the memory buffer as PECOFF file.
error_code ec;
std::unique_ptr<FileCOFF> file(
@@ -982,7 +980,8 @@ const Registry::KindStrings kindStringsI
LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SECREL),
LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_TOKEN),
LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SECREL7),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_REL32), LLD_KIND_STRING_END
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_REL32),
+ LLD_KIND_STRING_END
};
const Registry::KindStrings kindStringsAMD64[] = {
@@ -1002,7 +1001,8 @@ const Registry::KindStrings kindStringsA
LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_TOKEN),
LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SREL32),
LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_PAIR),
- LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SSPAN32), LLD_KIND_STRING_END
+ LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SSPAN32),
+ LLD_KIND_STRING_END
};
} // end namespace anonymous
@@ -1020,5 +1020,4 @@ void Registry::addSupportCOFFObjects(PEC
void Registry::addSupportWindowsResourceFiles() {
add(std::unique_ptr<Reader>(new ResourceFileReader()));
}
-
}
Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp Fri Dec 20 01:48:29 2013
@@ -181,7 +181,7 @@ public:
// The size of the string that follows the header.
uint32_t dataSize = *reinterpret_cast<const support::ulittle32_t *>(
- buf + offsetof(COFF::ImportHeader, SizeOfData));
+ buf + offsetof(COFF::ImportHeader, SizeOfData));
// Check if the total size is valid.
if (end - buf != sizeof(COFF::ImportHeader) + dataSize) {
@@ -190,14 +190,14 @@ public:
}
uint16_t hint = *reinterpret_cast<const support::ulittle16_t *>(
- buf + offsetof(COFF::ImportHeader, OrdinalHint));
+ buf + offsetof(COFF::ImportHeader, OrdinalHint));
StringRef symbolName(buf + sizeof(COFF::ImportHeader));
StringRef dllName(buf + sizeof(COFF::ImportHeader) + symbolName.size() + 1);
// TypeInfo is a bitfield. The least significant 2 bits are import
// type, followed by 3 bit import name type.
uint16_t typeInfo = *reinterpret_cast<const support::ulittle16_t *>(
- buf + offsetof(COFF::ImportHeader, TypeInfo));
+ buf + offsetof(COFF::ImportHeader, TypeInfo));
int type = typeInfo & 0x3;
int nameType = (typeInfo >> 2) & 0x7;
@@ -301,7 +301,7 @@ public:
virtual error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
- std::vector<std::unique_ptr<File> > &result) const {
+ std::vector<std::unique_ptr<File>> &result) const {
error_code ec;
auto file = std::unique_ptr<File>(new FileImportLibrary(std::move(mb), ec));
if (ec)
@@ -309,7 +309,6 @@ public:
result.push_back(std::move(file));
return error_code::success();
}
-
};
} // end anonymous namespace
Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Fri Dec 20 01:48:29 2013
@@ -106,7 +106,7 @@ public:
: HeaderChunk(), _context(ctx) {
// Minimum size of DOS stub is 64 bytes. The next block (PE header) needs to
// be aligned on 8 byte boundary.
- size_t size = std::max(_context.getDosStub().size(), (size_t) 64);
+ size_t size = std::max(_context.getDosStub().size(), (size_t)64);
_size = llvm::RoundUpToAlignment(size, 8);
}
@@ -303,8 +303,8 @@ private:
// Create the content of a relocation block.
std::vector<uint8_t>
- createBaseRelocBlock(uint64_t pageAddr,
- const std::vector<uint16_t> &offsets) const;
+ createBaseRelocBlock(uint64_t pageAddr,
+ const std::vector<uint16_t> &offsets) const;
std::vector<uint8_t> _contents;
};
@@ -752,7 +752,7 @@ private:
void setImageSizeOnDisk();
void setAddressOfEntryPoint(AtomChunk *text, PEHeaderChunk *peHeader);
uint64_t
- calcSectionSize(llvm::COFF::SectionCharacteristics sectionType) const;
+ calcSectionSize(llvm::COFF::SectionCharacteristics sectionType) const;
uint64_t calcSizeOfInitializedData() const {
return calcSectionSize(llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA);
Modified: lld/trunk/lib/ReaderWriter/Reader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Reader.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/Reader.cpp (original)
+++ lld/trunk/lib/ReaderWriter/Reader.cpp Fri Dec 20 01:48:29 2013
@@ -25,9 +25,9 @@ void Registry::add(std::unique_ptr<Reade
_readers.push_back(std::move(reader));
}
-error_code
+error_code
Registry::parseFile(std::unique_ptr<MemoryBuffer> &mb,
- std::vector<std::unique_ptr<File>> &result) const {
+ std::vector<std::unique_ptr<File>> &result) const {
// Get file type.
StringRef content(mb->getBufferStart(), mb->getBufferSize());
llvm::sys::fs::file_magic fileType = llvm::sys::fs::identify_magic(content);
@@ -39,36 +39,36 @@ Registry::parseFile(std::unique_ptr<Memo
if (reader->canParse(fileType, extension, *mb))
return reader->parseFile(mb, *this, result);
}
-
- // No Reader could parse this file.
+
+ // No Reader could parse this file.
return llvm::make_error_code(llvm::errc::executable_format_error);
}
static const Registry::KindStrings kindStrings[] = {
- { Reference::kindInGroup, "in-group" },
- { Reference::kindLayoutAfter, "layout-after" },
- { Reference::kindLayoutBefore, "layout-before" },
+ { Reference::kindInGroup, "in-group" },
+ { Reference::kindLayoutAfter, "layout-after" },
+ { Reference::kindLayoutBefore, "layout-before" },
LLD_KIND_STRING_END
};
Registry::Registry() {
- addKindTable(Reference::KindNamespace::all, Reference::KindArch::all,
- kindStrings);
+ addKindTable(Reference::KindNamespace::all, Reference::KindArch::all,
+ kindStrings);
}
-void Registry::addKindTable(Reference::KindNamespace ns,
+void Registry::addKindTable(Reference::KindNamespace ns,
Reference::KindArch arch,
const KindStrings array[]) {
- KindEntry entry = {ns, arch, array};
+ KindEntry entry = { ns, arch, array };
_kindEntries.push_back(entry);
}
-bool Registry::referenceKindFromString(StringRef inputStr,
+bool Registry::referenceKindFromString(StringRef inputStr,
Reference::KindNamespace &ns,
- Reference::KindArch &arch,
+ Reference::KindArch &arch,
Reference::KindValue &value) const {
for (const KindEntry &entry : _kindEntries) {
- for (const KindStrings *pair=entry.array; !pair->name.empty(); ++pair) {
+ for (const KindStrings *pair = entry.array; !pair->name.empty(); ++pair) {
if (!inputStr.equals(pair->name))
continue;
ns = entry.ns;
@@ -80,17 +80,16 @@ bool Registry::referenceKindFromString(S
return false;
}
-
-bool Registry::referenceKindToString(Reference::KindNamespace ns,
- Reference::KindArch arch,
- Reference::KindValue value,
+bool Registry::referenceKindToString(Reference::KindNamespace ns,
+ Reference::KindArch arch,
+ Reference::KindValue value,
StringRef &str) const {
for (const KindEntry &entry : _kindEntries) {
if (entry.ns != ns)
continue;
if (entry.arch != arch)
continue;
- for (const KindStrings *pair=entry.array; !pair->name.empty(); ++pair) {
+ for (const KindStrings *pair = entry.array; !pair->name.empty(); ++pair) {
if (pair->value != value)
continue;
str = pair->name;
@@ -100,5 +99,4 @@ bool Registry::referenceKindToString(Ref
return false;
}
-
} // end namespace lld
Modified: lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp (original)
+++ lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp Fri Dec 20 01:48:29 2013
@@ -253,8 +253,8 @@ LLVM_YAML_STRONG_TYPEDEF(bool, ShlibCanB
// For yaml, we just want one string that encapsulates the tuple.
struct RefKind {
Reference::KindNamespace ns;
- Reference::KindArch arch;
- uint16_t value;
+ Reference::KindArch arch;
+ uint16_t value;
};
} // namespace anon
@@ -274,8 +274,8 @@ template <> struct ScalarTraits<RefKind>
YamlContext *info = reinterpret_cast<YamlContext *>(ctxt);
assert(info->_registry);
StringRef str;
- if (info->_registry->referenceKindToString(kind.ns, kind.arch, kind.value,
- str))
+ if (info->_registry->referenceKindToString(kind.ns, kind.arch, kind.value,
+ str))
out << str;
else
out << (int)(kind.ns) << "-" << (int)(kind.arch) << "-" << kind.value;
@@ -285,8 +285,8 @@ template <> struct ScalarTraits<RefKind>
assert(ctxt != nullptr);
YamlContext *info = reinterpret_cast<YamlContext *>(ctxt);
assert(info->_registry);
- if (info->_registry->referenceKindFromString(scalar, kind.ns, kind.arch,
- kind.value))
+ if (info->_registry->referenceKindFromString(scalar, kind.ns, kind.arch,
+ kind.value))
return StringRef();
return StringRef("unknown reference kind");
}
@@ -564,8 +564,7 @@ template <> struct MappingTraits<const l
class NormArchiveFile : public lld::ArchiveLibraryFile {
public:
- NormArchiveFile(IO &io)
- : ArchiveLibraryFile(""), _path() {}
+ NormArchiveFile(IO &io) : ArchiveLibraryFile(""), _path() {}
NormArchiveFile(IO &io, const lld::File *file)
: ArchiveLibraryFile(file->path()), _path(file->path()) {
// If we want to support writing archives, this constructor would
@@ -606,11 +605,11 @@ template <> struct MappingTraits<const l
return nullptr;
}
- virtual error_code parseAllMembers(
- std::vector<std::unique_ptr<File>> &result) const {
+ virtual error_code
+ parseAllMembers(std::vector<std::unique_ptr<File>> &result) const {
return error_code::success();
}
-
+
StringRef _path;
std::vector<ArchMember> _members;
};
@@ -717,13 +716,13 @@ template <> struct MappingTraits<const l
class NormalizedReference : public lld::Reference {
public:
NormalizedReference(IO &io)
- : lld::Reference(lld::Reference::KindNamespace::all,
+ : lld::Reference(lld::Reference::KindNamespace::all,
lld::Reference::KindArch::all, 0),
- _target(nullptr), _targetName(), _offset(0), _addend(0) {}
+ _target(nullptr), _targetName(), _offset(0), _addend(0) {}
NormalizedReference(IO &io, const lld::Reference *ref)
- : lld::Reference(ref->kindNamespace(), ref->kindArch(),
- ref->kindValue()),
+ : lld::Reference(ref->kindNamespace(), ref->kindArch(),
+ ref->kindValue()),
_target(nullptr), _targetName(targetName(io, ref)),
_offset(ref->offsetInAtom()), _addend(ref->addend()) {
_mappedKind.ns = ref->kindNamespace();
@@ -735,8 +734,7 @@ template <> struct MappingTraits<const l
YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
assert(info != nullptr);
typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
- NormalizedFile *f =
- reinterpret_cast<NormalizedFile *>(info->_file);
+ NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
if (!_targetName.empty())
_targetName = f->copyString(_targetName);
DEBUG_WITH_TYPE("WriterYAML", llvm::dbgs()
@@ -809,8 +807,7 @@ template <> struct MappingTraits<const l
YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
assert(info != nullptr);
typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
- NormalizedFile *f =
- reinterpret_cast<NormalizedFile *>(info->_file);
+ NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
if (!_name.empty())
_name = f->copyString(_name);
if (!_refName.empty())
@@ -905,8 +902,7 @@ template <> struct MappingTraits<const l
typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
assert(info != nullptr);
- NormalizedFile *f =
- reinterpret_cast<NormalizedFile *>(info->_file);
+ NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
assert(f);
assert(f->_rnb);
if (f->_rnb->hasRefName(atom)) {
@@ -959,8 +955,7 @@ template <> struct MappingTraits<const l
YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
assert(info != nullptr);
typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
- NormalizedFile *f =
- reinterpret_cast<NormalizedFile *>(info->_file);
+ NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
if (!_name.empty())
_name = f->copyString(_name);
@@ -1019,8 +1014,7 @@ template <> struct MappingTraits<const l
YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
assert(info != nullptr);
typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
- NormalizedFile *f =
- reinterpret_cast<NormalizedFile *>(info->_file);
+ NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
if (!_name.empty())
_name = f->copyString(_name);
if (!_loadName.empty())
@@ -1083,8 +1077,7 @@ template <> struct MappingTraits<const l
YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
assert(info != nullptr);
typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
- NormalizedFile *f =
- reinterpret_cast<NormalizedFile *>(info->_file);
+ NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
if (!_name.empty())
_name = f->copyString(_name);
@@ -1122,8 +1115,7 @@ template <> struct MappingTraits<const l
typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
assert(info != nullptr);
- NormalizedFile *f =
- reinterpret_cast<NormalizedFile *>(info->_file);
+ NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
assert(f);
assert(f->_rnb);
if (f->_rnb->hasRefName(atom)) {
@@ -1249,12 +1241,12 @@ namespace {
class YAMLReader : public Reader {
public:
- YAMLReader(const Registry ®istry) : _registry(registry) { }
+ YAMLReader(const Registry ®istry) : _registry(registry) {}
- virtual bool canParse(file_magic, StringRef ext, const MemoryBuffer&) const {
+ virtual bool canParse(file_magic, StringRef ext, const MemoryBuffer &) const {
return (ext.equals(".objtxt") || ext.equals(".yaml"));
}
-
+
virtual error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
std::vector<std::unique_ptr<File>> &result) const {
@@ -1285,10 +1277,10 @@ public:
}
return make_error_code(lld::YamlReaderError::success);
}
+
private:
const Registry &_registry;
-};
-
+};
} // anonymous namespace
@@ -1296,7 +1288,6 @@ void Registry::addSupportYamlFiles() {
add(std::unique_ptr<Reader>(new YAMLReader(*this)));
}
-
std::unique_ptr<Writer> createWriterYAML(const LinkingContext &context) {
return std::unique_ptr<Writer>(new lld::yaml::Writer(context));
}
Modified: lld/trunk/unittests/DriverTests/InputGraphTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/InputGraphTest.cpp?rev=197788&r1=197787&r2=197788&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/InputGraphTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/InputGraphTest.cpp Fri Dec 20 01:48:29 2013
@@ -116,8 +116,7 @@ private:
class MyObjFile : public SimpleFile {
public:
- MyObjFile(LinkingContext &context, StringRef path)
- : SimpleFile(path) {}
+ MyObjFile(LinkingContext &context, StringRef path) : SimpleFile(path) {}
};
class InputGraphTest : public testing::Test {
More information about the llvm-commits
mailing list