mirror of
https://github.com/intel/llvm.git
synced 2026-01-17 14:48:27 +08:00
[ELF] Implement getImplicitAddend and enable checkDynamicRelocsDefault for PPC32
This commit is contained in:
@@ -278,9 +278,16 @@ RelType PPC::getDynRel(RelType type) const {
|
||||
int64_t PPC::getImplicitAddend(const uint8_t *buf, RelType type) const {
|
||||
switch (type) {
|
||||
case R_PPC_NONE:
|
||||
case R_PPC_GLOB_DAT:
|
||||
case R_PPC_JMP_SLOT:
|
||||
return 0;
|
||||
case R_PPC_ADDR32:
|
||||
case R_PPC_REL32:
|
||||
case R_PPC_RELATIVE:
|
||||
case R_PPC_IRELATIVE:
|
||||
case R_PPC_DTPMOD32:
|
||||
case R_PPC_DTPREL32:
|
||||
case R_PPC_TPREL32:
|
||||
return SignExtend64<32>(read32(buf));
|
||||
default:
|
||||
internalLinkerError(getErrorLocation(buf),
|
||||
|
||||
@@ -1714,7 +1714,7 @@ static void setConfigs(opt::InputArgList &args) {
|
||||
// have support for reading Elf_Rel addends, so we only enable for a subset.
|
||||
#ifndef NDEBUG
|
||||
bool checkDynamicRelocsDefault =
|
||||
!llvm::is_contained({EM_AMDGPU, EM_HEXAGON, EM_PPC}, m);
|
||||
!llvm::is_contained({EM_AMDGPU, EM_HEXAGON}, m);
|
||||
#else
|
||||
bool checkDynamicRelocsDefault = false;
|
||||
#endif
|
||||
|
||||
@@ -746,7 +746,7 @@ void OutputSection::checkDynRelAddends(const uint8_t *bufStart) {
|
||||
assert(relOsec != nullptr && "missing output section for relocation");
|
||||
// Some targets have NOBITS synthetic sections with dynamic relocations
|
||||
// with non-zero addends. Skip such sections.
|
||||
if (config->emachine == EM_PPC64 &&
|
||||
if (is_contained({EM_PPC, EM_PPC64}, config->emachine) &&
|
||||
(rel.inputSec == in.ppc64LongBranchTarget.get() ||
|
||||
rel.inputSec == in.igotPlt.get()))
|
||||
continue;
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
# RUN: llvm-readelf -x .got2 %t | FileCheck --check-prefix=HEX %s
|
||||
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
|
||||
|
||||
# RUN: ld.lld -pie %t.o -o %t --apply-dynamic-relocs
|
||||
# RUN: llvm-readelf -x .got2 %t | FileCheck --check-prefix=HEX2 %s
|
||||
|
||||
# RELOC: .rela.dyn {
|
||||
# RELOC-NEXT: 0x3024C R_PPC_RELATIVE - 0x101A0
|
||||
# RELOC-NEXT: 0x30250 R_PPC_IRELATIVE - 0x10188
|
||||
@@ -15,6 +18,9 @@
|
||||
# HEX: Hex dump of section '.got2':
|
||||
# HEX-NEXT: 0x0003024c 00000000 ....
|
||||
|
||||
# HEX2: Hex dump of section '.got2':
|
||||
# HEX2-NEXT: 0x0003024c 000101a0 ....
|
||||
|
||||
.section .got2,"aw"
|
||||
.long func
|
||||
|
||||
|
||||
Reference in New Issue
Block a user