Revert "[lld][AMDGPU] Support R_AMDGPU_ABS32_(LO|HI) relocations" (#191591)

Reverts llvm/llvm-project#191550

Merged without understanding getImplicitAddend and test convention, and
less than 4 hours after a colleague rubber stamping with "I am not ELF
or linker expert but to me looks good."
This commit is contained in:
Fangrui Song
2026-04-10 21:21:47 -07:00
committed by GitHub
parent 8378b6d51e
commit a3ae5b5080
2 changed files with 0 additions and 36 deletions

View File

@@ -151,7 +151,6 @@ uint32_t AMDGPU::calcEFlags() const {
void AMDGPU::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
switch (rel.type) {
case R_AMDGPU_ABS32:
case R_AMDGPU_ABS32_LO:
case R_AMDGPU_GOTPCREL:
case R_AMDGPU_GOTPCREL32_LO:
case R_AMDGPU_REL32:
@@ -162,7 +161,6 @@ void AMDGPU::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
case R_AMDGPU_REL64:
write64le(loc, val);
break;
case R_AMDGPU_ABS32_HI:
case R_AMDGPU_GOTPCREL32_HI:
case R_AMDGPU_REL32_HI:
write32le(loc, val >> 32);
@@ -182,8 +180,6 @@ RelExpr AMDGPU::getRelExpr(RelType type, const Symbol &s,
const uint8_t *loc) const {
switch (type) {
case R_AMDGPU_ABS32:
case R_AMDGPU_ABS32_LO:
case R_AMDGPU_ABS32_HI:
case R_AMDGPU_ABS64:
return R_ABS;
case R_AMDGPU_REL32:
@@ -213,16 +209,6 @@ int64_t AMDGPU::getImplicitAddend(const uint8_t *buf, RelType type) const {
switch (type) {
case R_AMDGPU_NONE:
return 0;
case R_AMDGPU_ABS32:
case R_AMDGPU_ABS32_LO:
case R_AMDGPU_ABS32_HI:
case R_AMDGPU_REL32:
case R_AMDGPU_REL32_LO:
case R_AMDGPU_REL32_HI:
case R_AMDGPU_GOTPCREL:
case R_AMDGPU_GOTPCREL32_LO:
case R_AMDGPU_GOTPCREL32_HI:
return SignExtend64<32>(read32(ctx, buf));
case R_AMDGPU_ABS64:
case R_AMDGPU_RELATIVE64:
return read64(ctx, buf);

View File

@@ -1,22 +0,0 @@
# REQUIRES: amdgpu
# RUN: llvm-mc -filetype=obj -triple=amdgcn-- -mcpu=fiji %s -o %t.o
# RUN: ld.lld %t.o -o %t
# RUN: llvm-objdump -d %t | FileCheck %s
# RUN: llvm-readelf -s -d %t | FileCheck %s --check-prefix=SYMBOL
# CHECK: <_start>:
# CHECK-NEXT: s_mov_b32 s0, 0xfeedface
# CHECK-NEXT: s_mov_b32 s1, 0xdeadbeef
# CHECK-NEXT: s_endpgm
# SYMBOL: deadbeeffeedface 0 NOTYPE GLOBAL DEFAULT ABS sym
.globl sym
sym = 0xdeadbeeffeedface
.globl _start
_start:
s_mov_b32 s0, sym@abs32@lo
s_mov_b32 s1, sym@abs32@hi
s_endpgm