[ELF] Support R_PPC_ADDR24 (ba foo; bla foo)

This commit is contained in:
Fangrui Song 2021-01-17 00:02:13 -08:00
parent 3cbd476c54
commit 3809f4ebab
2 changed files with 8 additions and 1 deletions

View File

@ -222,6 +222,7 @@ RelExpr PPC::getRelExpr(RelType type, const Symbol &s,
case R_PPC_ADDR16_HA:
case R_PPC_ADDR16_HI:
case R_PPC_ADDR16_LO:
case R_PPC_ADDR24:
case R_PPC_ADDR32:
return R_ABS;
case R_PPC_DTPREL16:
@ -345,6 +346,7 @@ void PPC::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
write32(loc, (read32(loc) & ~mask) | (val & mask));
break;
}
case R_PPC_ADDR24:
case R_PPC_REL24:
case R_PPC_LOCAL24PC:
case R_PPC_PLTREL24: {

View File

@ -19,8 +19,13 @@
# CHECK-LABEL: section .R_PPC_ADDR16_LO:
# CHECK: addi 4, 4, 4660
.section .R_PPC_ADDR24,"ax",@progbits
ba a
# CHECK-LABEL: section .R_PPC_ADDR24:
# CHECK: ba 4660
.section .R_PPC_ADDR32,"a",@progbits
.long a
.long b
# HEX-LABEL: section .R_PPC_ADDR32:
# HEX-NEXT: 100000b4 00001234 000bcdef
# HEX-NEXT: {{.*}} 00001234 000bcdef