mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-19 13:16:46 +00:00
[ELF] Implement getImplicitAddend and enable checkDynamicRelocsDefault for AMDGPU
This commit is contained in:
parent
0cbe49eade
commit
df979228ef
@ -34,6 +34,7 @@ public:
|
||||
RelExpr getRelExpr(RelType type, const Symbol &s,
|
||||
const uint8_t *loc) const override;
|
||||
RelType getDynRel(RelType type) const override;
|
||||
int64_t getImplicitAddend(const uint8_t *buf, RelType type) const override;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@ -183,6 +184,20 @@ RelType AMDGPU::getDynRel(RelType type) const {
|
||||
return R_AMDGPU_NONE;
|
||||
}
|
||||
|
||||
int64_t AMDGPU::getImplicitAddend(const uint8_t *buf, RelType type) const {
|
||||
switch (type) {
|
||||
case R_AMDGPU_NONE:
|
||||
return 0;
|
||||
case R_AMDGPU_ABS64:
|
||||
case R_AMDGPU_RELATIVE64:
|
||||
return read64(buf);
|
||||
default:
|
||||
internalLinkerError(getErrorLocation(buf),
|
||||
"cannot read addend for relocation " + toString(type));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
TargetInfo *elf::getAMDGPUTargetInfo() {
|
||||
static AMDGPU target;
|
||||
return ⌖
|
||||
|
@ -1713,8 +1713,7 @@ static void setConfigs(opt::InputArgList &args) {
|
||||
// enable the debug checks for all targets, but currently not all targets
|
||||
// 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}, m);
|
||||
bool checkDynamicRelocsDefault = m != EM_HEXAGON;
|
||||
#else
|
||||
bool checkDynamicRelocsDefault = false;
|
||||
#endif
|
||||
|
@ -5,6 +5,9 @@
|
||||
# RUN: llvm-nm %t.so | FileCheck %s --check-prefix=NM
|
||||
# RUN: llvm-readelf -x .rodata -x nonalloc %t.so | FileCheck %s --check-prefix=HEX
|
||||
|
||||
## ABS64 and RELATIVE64 relocs do not cause --check-dynamic-relocations errors.
|
||||
# RUN: ld.lld --hash-style=sysv -shared %t.o -o /dev/null --apply-dynamic-relocs
|
||||
|
||||
.text
|
||||
|
||||
kernel0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user