summaryrefslogtreecommitdiff
path: root/lld/ELF/Target.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/Target.cpp')
-rw-r--r--lld/ELF/Target.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index 024e0cfec27b..70a68fd8db9e 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -28,6 +28,7 @@
#include "OutputSections.h"
#include "SymbolTable.h"
#include "Symbols.h"
+#include "SyntheticSections.h"
#include "lld/Common/ErrorHandler.h"
#include "llvm/Object/ELF.h"
@@ -91,15 +92,20 @@ TargetInfo *getTarget() {
}
template <class ELFT> static ErrorPlace getErrPlace(const uint8_t *loc) {
- if (!Out::bufferStart)
- return {};
-
+ assert(loc != nullptr);
for (InputSectionBase *d : inputSections) {
auto *isec = cast<InputSection>(d);
if (!isec->getParent())
continue;
- uint8_t *isecLoc = Out::bufferStart + isec->getParent()->offset + isec->outSecOff;
+ const uint8_t *isecLoc =
+ Out::bufferStart
+ ? (Out::bufferStart + isec->getParent()->offset + isec->outSecOff)
+ : isec->data().data();
+ if (isecLoc == nullptr) {
+ assert(isa<SyntheticSection>(isec) && "No data but not synthetic?");
+ continue;
+ }
if (isecLoc <= loc && loc < isecLoc + isec->getSize())
return {isec, isec->template getLocation<ELFT>(loc - isecLoc) + ": "};
}
@@ -130,7 +136,8 @@ int64_t TargetInfo::getImplicitAddend(const uint8_t *buf, RelType type) const {
bool TargetInfo::usesOnlyLowPageBits(RelType type) const { return false; }
bool TargetInfo::needsThunk(RelExpr expr, RelType type, const InputFile *file,
- uint64_t branchAddr, const Symbol &s) const {
+ uint64_t branchAddr, const Symbol &s,
+ int64_t a) const {
return false;
}
@@ -143,10 +150,6 @@ bool TargetInfo::inBranchRange(RelType type, uint64_t src, uint64_t dst) const {
return true;
}
-void TargetInfo::writeIgotPlt(uint8_t *buf, const Symbol &s) const {
- writeGotPlt(buf, s);
-}
-
RelExpr TargetInfo::adjustRelaxExpr(RelType type, const uint8_t *data,
RelExpr expr) const {
return expr;