Skip to content

Commit

Permalink
Support R_PPC64_TPREL16_LO_DS
Browse files Browse the repository at this point in the history
Fixes #1262
  • Loading branch information
rui314 committed May 21, 2024
1 parent a25226e commit a8cd2e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions elf/arch-ppc64v1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ void InputSection<E>::apply_reloc_alloc(Context<E> &ctx, u8 *base) {
case R_PPC64_TPREL16_LO:
*(ub16 *)loc = lo(S + A - ctx.tp_addr);
break;
case R_PPC64_TPREL16_LO_DS:
*(ub16 *)loc |= (S + A - ctx.tp_addr) & 0xfffc;
break;
case R_PPC64_GOT_TPREL16_LO_DS:
*(ub16 *)loc |= (sym.get_gottp_addr(ctx) - TOC) & 0xfffc;
break;
Expand Down Expand Up @@ -381,6 +384,7 @@ void InputSection<E>::scan_relocations(Context<E> &ctx) {
break;
case R_PPC64_TPREL16_HA:
case R_PPC64_TPREL16_LO:
case R_PPC64_TPREL16_LO_DS:
check_tlsle(ctx, sym, rel);
break;
case R_PPC64_REL32:
Expand Down
4 changes: 4 additions & 0 deletions elf/arch-ppc64v2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ void InputSection<E>::apply_reloc_alloc(Context<E> &ctx, u8 *base) {
case R_PPC64_TPREL16_LO:
*(ul16 *)loc = lo(S + A - ctx.tp_addr);
break;
case R_PPC64_TPREL16_LO_DS:
*(ul16 *)loc |= (S + A - ctx.tp_addr) & 0xfffc;
break;
case R_PPC64_TPREL34:
write34(loc, S + A - ctx.tp_addr);
break;
Expand Down Expand Up @@ -451,6 +454,7 @@ void InputSection<E>::scan_relocations(Context<E> &ctx) {
break;
case R_PPC64_TPREL16_HA:
case R_PPC64_TPREL16_LO:
case R_PPC64_TPREL16_LO_DS:
case R_PPC64_TPREL34:
check_tlsle(ctx, sym, rel);
break;
Expand Down

0 comments on commit a8cd2e8

Please sign in to comment.