aboutsummaryrefslogtreecommitdiff
path: root/deps/lld/ELF/Target.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-01-17 17:29:21 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-01-17 17:29:21 -0500
commit4aed7ea6f89a091aede10ccf0fb45b3ce12c710d (patch)
tree1e29f13ad17bfc841c33f6ac3d0ccb092404f409 /deps/lld/ELF/Target.cpp
parent48cd808185f54e935714539d101585a9a0a41673 (diff)
downloadzig-4aed7ea6f89a091aede10ccf0fb45b3ce12c710d.tar.gz
zig-4aed7ea6f89a091aede10ccf0fb45b3ce12c710d.zip
update embedded LLD to 6.0.0rc1
Diffstat (limited to 'deps/lld/ELF/Target.cpp')
-rw-r--r--deps/lld/ELF/Target.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/deps/lld/ELF/Target.cpp b/deps/lld/ELF/Target.cpp
index 11986efc74..b528fd583c 100644
--- a/deps/lld/ELF/Target.cpp
+++ b/deps/lld/ELF/Target.cpp
@@ -25,11 +25,11 @@
//===----------------------------------------------------------------------===//
#include "Target.h"
-#include "Error.h"
#include "InputFiles.h"
#include "OutputSections.h"
#include "SymbolTable.h"
#include "Symbols.h"
+#include "lld/Common/ErrorHandler.h"
#include "llvm/Object/ELF.h"
using namespace llvm;
@@ -40,7 +40,7 @@ using namespace lld::elf;
TargetInfo *elf::Target;
-std::string lld::toString(uint32_t Type) {
+std::string lld::toString(RelType Type) {
StringRef S = getELFRelocationTypeName(elf::Config->EMachine, Type);
if (S == "Unknown")
return ("Unknown (" + Twine(Type) + ")").str();
@@ -89,7 +89,7 @@ TargetInfo *elf::getTarget() {
template <class ELFT> static std::string getErrorLoc(const uint8_t *Loc) {
for (InputSectionBase *D : InputSections) {
- auto *IS = dyn_cast_or_null<InputSection>(D);
+ auto *IS = dyn_cast<InputSection>(D);
if (!IS || !IS->getParent())
continue;
@@ -117,27 +117,26 @@ std::string elf::getErrorLocation(const uint8_t *Loc) {
TargetInfo::~TargetInfo() {}
-int64_t TargetInfo::getImplicitAddend(const uint8_t *Buf, uint32_t Type) const {
+int64_t TargetInfo::getImplicitAddend(const uint8_t *Buf, RelType Type) const {
return 0;
}
-bool TargetInfo::usesOnlyLowPageBits(uint32_t Type) const { return false; }
+bool TargetInfo::usesOnlyLowPageBits(RelType Type) const { return false; }
-bool TargetInfo::needsThunk(RelExpr Expr, uint32_t RelocType,
- const InputFile *File, const SymbolBody &S) const {
+bool TargetInfo::needsThunk(RelExpr Expr, RelType Type, const InputFile *File,
+ uint64_t BranchAddr, const Symbol &S) const {
return false;
}
-bool TargetInfo::inBranchRange(uint32_t RelocType, uint64_t Src,
- uint64_t Dst) const {
+bool TargetInfo::inBranchRange(RelType Type, uint64_t Src, uint64_t Dst) const {
return true;
}
-void TargetInfo::writeIgotPlt(uint8_t *Buf, const SymbolBody &S) const {
+void TargetInfo::writeIgotPlt(uint8_t *Buf, const Symbol &S) const {
writeGotPlt(Buf, S);
}
-RelExpr TargetInfo::adjustRelaxExpr(uint32_t Type, const uint8_t *Data,
+RelExpr TargetInfo::adjustRelaxExpr(RelType Type, const uint8_t *Data,
RelExpr Expr) const {
return Expr;
}
@@ -146,22 +145,29 @@ void TargetInfo::relaxGot(uint8_t *Loc, uint64_t Val) const {
llvm_unreachable("Should not have claimed to be relaxable");
}
-void TargetInfo::relaxTlsGdToLe(uint8_t *Loc, uint32_t Type,
+void TargetInfo::relaxTlsGdToLe(uint8_t *Loc, RelType Type,
uint64_t Val) const {
llvm_unreachable("Should not have claimed to be relaxable");
}
-void TargetInfo::relaxTlsGdToIe(uint8_t *Loc, uint32_t Type,
+void TargetInfo::relaxTlsGdToIe(uint8_t *Loc, RelType Type,
uint64_t Val) const {
llvm_unreachable("Should not have claimed to be relaxable");
}
-void TargetInfo::relaxTlsIeToLe(uint8_t *Loc, uint32_t Type,
+void TargetInfo::relaxTlsIeToLe(uint8_t *Loc, RelType Type,
uint64_t Val) const {
llvm_unreachable("Should not have claimed to be relaxable");
}
-void TargetInfo::relaxTlsLdToLe(uint8_t *Loc, uint32_t Type,
+void TargetInfo::relaxTlsLdToLe(uint8_t *Loc, RelType Type,
uint64_t Val) const {
llvm_unreachable("Should not have claimed to be relaxable");
}
+
+uint64_t TargetInfo::getImageBase() {
+ // Use -image-base if set. Fall back to the target default if not.
+ if (Config->ImageBase)
+ return *Config->ImageBase;
+ return Config->Pic ? 0 : DefaultImageBase;
+}