[ELF] Support R_PPC_NONE/R_PPC64_NONE in getImplicitAddend
Similar to f457863ae3
This commit is contained in:
parent
c161b30f5c
commit
53fc5d9b9a
|
@ -30,6 +30,7 @@ public:
|
||||||
RelExpr getRelExpr(RelType type, const Symbol &s,
|
RelExpr getRelExpr(RelType type, const Symbol &s,
|
||||||
const uint8_t *loc) const override;
|
const uint8_t *loc) const override;
|
||||||
RelType getDynRel(RelType type) const override;
|
RelType getDynRel(RelType type) const override;
|
||||||
|
int64_t getImplicitAddend(const uint8_t *buf, RelType type) const override;
|
||||||
void writeGotHeader(uint8_t *buf) const override;
|
void writeGotHeader(uint8_t *buf) const override;
|
||||||
void writePltHeader(uint8_t *buf) const override {
|
void writePltHeader(uint8_t *buf) const override {
|
||||||
llvm_unreachable("should call writePPC32GlinkSection() instead");
|
llvm_unreachable("should call writePPC32GlinkSection() instead");
|
||||||
|
@ -275,6 +276,17 @@ RelType PPC::getDynRel(RelType type) const {
|
||||||
return R_PPC_NONE;
|
return R_PPC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t PPC::getImplicitAddend(const uint8_t *buf, RelType type) const {
|
||||||
|
switch (type) {
|
||||||
|
case R_PPC_NONE:
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
internalLinkerError(getErrorLocation(buf),
|
||||||
|
"cannot read addend for relocation " + toString(type));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static std::pair<RelType, uint64_t> fromDTPREL(RelType type, uint64_t val) {
|
static std::pair<RelType, uint64_t> fromDTPREL(RelType type, uint64_t val) {
|
||||||
uint64_t dtpBiasedVal = val - 0x8000;
|
uint64_t dtpBiasedVal = val - 0x8000;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
|
@ -363,6 +363,7 @@ public:
|
||||||
RelExpr getRelExpr(RelType type, const Symbol &s,
|
RelExpr getRelExpr(RelType type, const Symbol &s,
|
||||||
const uint8_t *loc) const override;
|
const uint8_t *loc) const override;
|
||||||
RelType getDynRel(RelType type) const override;
|
RelType getDynRel(RelType type) const override;
|
||||||
|
int64_t getImplicitAddend(const uint8_t *buf, RelType type) const override;
|
||||||
void writePltHeader(uint8_t *buf) const override;
|
void writePltHeader(uint8_t *buf) const override;
|
||||||
void writePlt(uint8_t *buf, const Symbol &sym,
|
void writePlt(uint8_t *buf, const Symbol &sym,
|
||||||
uint64_t pltEntryAddr) const override;
|
uint64_t pltEntryAddr) const override;
|
||||||
|
@ -1059,6 +1060,17 @@ RelType PPC64::getDynRel(RelType type) const {
|
||||||
return R_PPC64_NONE;
|
return R_PPC64_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t PPC64::getImplicitAddend(const uint8_t *buf, RelType type) const {
|
||||||
|
switch (type) {
|
||||||
|
case R_PPC64_NONE:
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
internalLinkerError(getErrorLocation(buf),
|
||||||
|
"cannot read addend for relocation " + toString(type));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PPC64::writeGotHeader(uint8_t *buf) const {
|
void PPC64::writeGotHeader(uint8_t *buf) const {
|
||||||
write64(buf, getPPC64TocBase());
|
write64(buf, getPPC64TocBase());
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,14 @@
|
||||||
# RUN: ld.lld -r %t.o -o %t
|
# RUN: ld.lld -r %t.o -o %t
|
||||||
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
|
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
|
||||||
|
|
||||||
|
# RUN: yaml2obj -DBITS=32 -DMACHINE=PPC %s -o %t.o
|
||||||
|
# RUN: ld.lld -r %t.o -o %t
|
||||||
|
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
|
||||||
|
|
||||||
|
# RUN: yaml2obj -DMACHINE=PPC64 %s -o %t.o
|
||||||
|
# RUN: ld.lld -r %t.o -o %t
|
||||||
|
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
|
||||||
|
|
||||||
# RUN: yaml2obj -DMACHINE=RISCV %s -o %t.o
|
# RUN: yaml2obj -DMACHINE=RISCV %s -o %t.o
|
||||||
# RUN: ld.lld -r %t.o -o %t
|
# RUN: ld.lld -r %t.o -o %t
|
||||||
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
|
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
|
||||||
|
|
Loading…
Reference in New Issue