[lld] r173966 - [ELF] Use the target's LayoutHandler.
Michael J. Spencer
bigcheesegs at gmail.com
Wed Jan 30 12:05:27 PST 2013
Author: mspencer
Date: Wed Jan 30 14:05:27 2013
New Revision: 173966
URL: http://llvm.org/viewvc/llvm-project?rev=173966&view=rev
Log:
[ELF] Use the target's LayoutHandler.
Modified:
lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h
lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h
lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp
lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h
lld/trunk/lib/ReaderWriter/ELF/Writer.cpp
lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp
lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h
Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h?rev=173966&r1=173965&r2=173966&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h Wed Jan 30 14:05:27 2013
@@ -34,11 +34,6 @@ public:
llvm_unreachable("Target should provide implementation for function ");
}
- /// TargetLayout
- TargetLayout<ELFT> &targetLayout() {
- llvm_unreachable("Target should provide implementation for function ");
- }
-
/// TargetAtomHandler
TargetAtomHandler<ELFT> &targetAtomHandler() {
llvm_unreachable("Target should provide implementation for function ");
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=173966&r1=173965&r2=173966&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp Wed Jan 30 14:05:27 2013
@@ -107,5 +107,6 @@ ErrorOr<void> HexagonTargetRelocationHan
}
HexagonTargetHandler::HexagonTargetHandler(HexagonTargetInfo &targetInfo)
- : DefaultTargetHandler(targetInfo), _relocationHandler(targetInfo){
+ : DefaultTargetHandler(targetInfo), _relocationHandler(targetInfo),
+ _targetLayout(targetInfo) {
}
Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h?rev=173966&r1=173965&r2=173966&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h Wed Jan 30 14:05:27 2013
@@ -11,6 +11,7 @@
#define LLD_READER_WRITER_ELF_HEXAGON_TARGET_HANDLER_H
#include "DefaultTargetHandler.h"
+#include "TargetLayout.h"
namespace lld {
namespace elf {
@@ -35,12 +36,17 @@ class HexagonTargetHandler LLVM_FINAL
public:
HexagonTargetHandler(HexagonTargetInfo &targetInfo);
+ virtual TargetLayout<HexagonELFType> &targetLayout() {
+ return _targetLayout;
+ }
+
virtual const HexagonTargetRelocationHandler &getRelocationHandler() const {
return _relocationHandler;
}
private:
HexagonTargetRelocationHandler _relocationHandler;
+ TargetLayout<HexagonELFType> _targetLayout;
};
} // end namespace elf
} // end namespace lld
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=173966&r1=173965&r2=173966&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp Wed Jan 30 14:05:27 2013
@@ -62,5 +62,6 @@ ErrorOr<void> PPCTargetRelocationHandler
}
PPCTargetHandler::PPCTargetHandler(PPCTargetInfo &targetInfo)
- : DefaultTargetHandler(targetInfo), _relocationHandler(targetInfo) {
+ : DefaultTargetHandler(targetInfo), _relocationHandler(targetInfo),
+ _targetLayout(targetInfo) {
}
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=173966&r1=173965&r2=173966&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h Wed Jan 30 14:05:27 2013
@@ -11,6 +11,7 @@
#define LLD_READER_WRITER_ELF_PPC_TARGET_HANDLER_H
#include "DefaultTargetHandler.h"
+#include "TargetLayout.h"
namespace lld {
namespace elf {
@@ -35,12 +36,17 @@ class PPCTargetHandler LLVM_FINAL
public:
PPCTargetHandler(PPCTargetInfo &targetInfo);
+ virtual TargetLayout<PPCELFType> &targetLayout() {
+ return _targetLayout;
+ }
+
virtual const PPCTargetRelocationHandler &getRelocationHandler() const {
return _relocationHandler;
}
private:
PPCTargetRelocationHandler _relocationHandler;
+ TargetLayout<PPCELFType> _targetLayout;
};
} // end namespace elf
} // end namespace lld
Modified: lld/trunk/lib/ReaderWriter/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Writer.cpp?rev=173966&r1=173965&r2=173966&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Writer.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Writer.cpp Wed Jan 30 14:05:27 2013
@@ -75,7 +75,7 @@ template <class ELFT>
ExecutableWriter<ELFT>::ExecutableWriter(const ELFTargetInfo &ti)
: _targetInfo(ti), _targetHandler(ti.getTargetHandler<ELFT>()),
_runtimeFile(ti) {
- _layout = new TargetLayout<ELFT>(_targetInfo);
+ _layout = &_targetHandler.targetLayout();
}
template <class ELFT>
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=173966&r1=173965&r2=173966&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp Wed Jan 30 14:05:27 2013
@@ -63,5 +63,6 @@ ErrorOr<void> X86TargetRelocationHandler
}
X86TargetHandler::X86TargetHandler(X86TargetInfo &targetInfo)
- : DefaultTargetHandler(targetInfo), _relocationHandler(targetInfo) {
+ : DefaultTargetHandler(targetInfo), _relocationHandler(targetInfo),
+ _targetLayout(targetInfo) {
}
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=173966&r1=173965&r2=173966&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h Wed Jan 30 14:05:27 2013
@@ -11,6 +11,7 @@
#define LLD_READER_WRITER_ELF_X86_TARGET_HANDLER_H
#include "DefaultTargetHandler.h"
+#include "TargetLayout.h"
namespace lld {
namespace elf {
@@ -35,12 +36,17 @@ class X86TargetHandler LLVM_FINAL
public:
X86TargetHandler(X86TargetInfo &targetInfo);
+ virtual TargetLayout<X86ELFType> &targetLayout() {
+ return _targetLayout;
+ }
+
virtual const X86TargetRelocationHandler &getRelocationHandler() const {
return _relocationHandler;
}
private:
X86TargetRelocationHandler _relocationHandler;
+ TargetLayout<X86ELFType> _targetLayout;
};
} // end namespace elf
} // end namespace lld
More information about the llvm-commits
mailing list