[lld] r250168 - ELF2: Move createTarget to Target.cpp.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 13 09:08:15 PDT 2015
Author: ruiu
Date: Tue Oct 13 11:08:15 2015
New Revision: 250168
URL: http://llvm.org/viewvc/llvm-project?rev=250168&view=rev
Log:
ELF2: Move createTarget to Target.cpp.
Now all Target<Arch> classes are used only in Target.cpp.
We can put them in an anonymous namespace. In order to avoid
merge conflict with other people's patches, I'll do that later.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/Target.cpp
lld/trunk/ELF/Target.h
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=250168&r1=250167&r2=250168&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Tue Oct 13 11:08:15 2015
@@ -54,24 +54,6 @@ static std::pair<ELFKind, uint16_t> pars
error("Unknown emulation: " + S);
}
-static TargetInfo *createTarget() {
- switch (Config->EMachine) {
- case EM_386:
- return new X86TargetInfo();
- case EM_AARCH64:
- return new AArch64TargetInfo();
- case EM_MIPS:
- return new MipsTargetInfo();
- case EM_PPC:
- return new PPCTargetInfo();
- case EM_PPC64:
- return new PPC64TargetInfo();
- case EM_X86_64:
- return new X86_64TargetInfo();
- }
- error("Unknown target machine");
-}
-
// Opens and parses a file. Path has to be resolved already.
// Newly created memory buffers are owned by this driver.
void LinkerDriver::addFile(StringRef Path) {
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=250168&r1=250167&r2=250168&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Tue Oct 13 11:08:15 2015
@@ -27,6 +27,24 @@ namespace elf2 {
std::unique_ptr<TargetInfo> Target;
+TargetInfo *createTarget() {
+ switch (Config->EMachine) {
+ case EM_386:
+ return new X86TargetInfo();
+ case EM_AARCH64:
+ return new AArch64TargetInfo();
+ case EM_MIPS:
+ return new MipsTargetInfo();
+ case EM_PPC:
+ return new PPCTargetInfo();
+ case EM_PPC64:
+ return new PPC64TargetInfo();
+ case EM_X86_64:
+ return new X86_64TargetInfo();
+ }
+ error("Unknown target machine");
+}
+
TargetInfo::~TargetInfo() {}
bool TargetInfo::relocPointsToGot(uint32_t Type) const { return false; }
Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=250168&r1=250167&r2=250168&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Tue Oct 13 11:08:15 2015
@@ -125,6 +125,7 @@ public:
};
extern std::unique_ptr<TargetInfo> Target;
+TargetInfo *createTarget();
}
}
More information about the llvm-commits
mailing list