forked from OSchip/llvm-project
[ELF] Write R_AARCH64_IRELATIVE addends with -z rel
This commit is contained in:
parent
65053fbc0d
commit
c4c68b676e
|
@ -35,6 +35,7 @@ public:
|
|||
RelType getDynRel(RelType type) const override;
|
||||
int64_t getImplicitAddend(const uint8_t *buf, RelType type) const override;
|
||||
void writeGotPlt(uint8_t *buf, const Symbol &s) const override;
|
||||
void writeIgotPlt(uint8_t *buf, const Symbol &s) const override;
|
||||
void writePltHeader(uint8_t *buf) const override;
|
||||
void writePlt(uint8_t *buf, const Symbol &sym,
|
||||
uint64_t pltEntryAddr) const override;
|
||||
|
@ -214,6 +215,11 @@ void AArch64::writeGotPlt(uint8_t *buf, const Symbol &) const {
|
|||
write64(buf, in.plt->getVA());
|
||||
}
|
||||
|
||||
void AArch64::writeIgotPlt(uint8_t *buf, const Symbol &s) const {
|
||||
if (config->writeAddends)
|
||||
write64(buf, s.getVA());
|
||||
}
|
||||
|
||||
void AArch64::writePltHeader(uint8_t *buf) const {
|
||||
const uint8_t pltData[] = {
|
||||
0xf0, 0x7b, 0xbf, 0xa9, // stp x16, x30, [sp,#-16]!
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=PDE-RELOC
|
||||
|
||||
# RUN: ld.lld -pie --no-relax %t.o -o %t
|
||||
# RUN: ld.lld -pie --no-relax --apply-dynamic-relocs %t.o -o %t.apply
|
||||
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s --check-prefix=PIE
|
||||
# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=PIE-RELOC
|
||||
# RUN: llvm-readobj -r -x .got.plt %t | FileCheck %s --check-prefixes=PIE-RELOC,NO-APPLY
|
||||
# RUN: llvm-readobj -r -x .got.plt %t.apply | FileCheck %s --check-prefixes=PIE-RELOC,APPLY
|
||||
|
||||
## When compiling with -fno-PIE or -fPIE, if the ifunc is in the same
|
||||
## translation unit as the address taker, the compiler knows that ifunc is not
|
||||
|
@ -70,3 +72,7 @@ main:
|
|||
# PIE-RELOC: .rela.dyn {
|
||||
# PIE-RELOC-NEXT: 0x30380 R_AARCH64_IRELATIVE - 0x10260
|
||||
# PIE-RELOC-NEXT: }
|
||||
# PIE-RELOC: Hex dump of section '.got.plt':
|
||||
# NO-APPLY: 0x00030380 00000000 00000000
|
||||
# APPLY: 0x00030380 60020100 00000000
|
||||
# PIE-RELOC-EMPTY:
|
||||
|
|
Loading…
Reference in New Issue