case R_PLT:
return Sym.getPltVA() + A;
case R_PLT_PC:
- case R_PPC_CALL_PLT:
+ case R_PPC64_CALL_PLT:
return Sym.getPltVA() + A - P;
- case R_PPC_CALL: {
+ case R_PPC64_CALL: {
uint64_t SymVA = Sym.getVA(A);
// If we have an undefined weak symbol, we might get here with a symbol
// address of zero. That could overflow, but the code must be unreachable,
// branching to the local entry point.
return SymVA - P + getPPC64GlobalEntryToLocalEntryOffset(Sym.StOther);
}
- case R_PPC_TOC:
+ case R_PPC64_TOCBASE:
return getPPC64TocBase() + A;
case R_RELAX_GOT_PC:
return Sym.getVA(A) - P;
case R_RELAX_TLS_GD_TO_IE_GOTPLT:
Target->relaxTlsGdToIe(BufLoc, Type, TargetVA);
break;
- case R_PPC_CALL:
+ case R_PPC64_CALL:
// If this is a call to __tls_get_addr, it may be part of a TLS
// sequence that has been relaxed and turned into a nop. In this
// case, we don't want to handle it as a call.
// Returns true if Expr refers a PLT entry.
static bool needsPlt(RelExpr Expr) {
- return oneof<R_PLT_PC, R_PPC_CALL_PLT, R_PLT>(Expr);
+ return oneof<R_PLT_PC, R_PPC64_CALL_PLT, R_PLT>(Expr);
}
// Returns true if Expr refers a GOT entry. Note that this function
// True if this expression is of the form Sym - X, where X is a position in the
// file (PC, or GOT for example).
static bool isRelExpr(RelExpr Expr) {
- return oneof<R_PC, R_GOTREL, R_GOTPLTREL, R_MIPS_GOTREL, R_PPC_CALL,
- R_PPC64_RELAX_TOC, R_PPC_CALL_PLT, R_AARCH64_PAGE_PC, R_RELAX_GOT_PC>(Expr);
+ return oneof<R_PC, R_GOTREL, R_GOTPLTREL, R_MIPS_GOTREL, R_PPC64_CALL,
+ R_PPC64_CALL_PLT, R_PPC64_RELAX_TOC, R_AARCH64_PAGE_PC,
+ R_RELAX_GOT_PC>(Expr);
}
// Returns true if a given relocation can be computed at link-time.
R_MIPS_GOT_LOCAL_PAGE, R_MIPS_GOTREL, R_MIPS_GOT_OFF,
R_MIPS_GOT_OFF32, R_MIPS_GOT_GP_PC, R_MIPS_TLSGD,
R_AARCH64_GOT_PAGE_PC, R_GOT_PC, R_GOTONLY_PC, R_GOTPLTONLY_PC,
- R_PLT_PC, R_TLSGD_GOT, R_TLSGD_GOTPLT, R_TLSGD_PC, R_PPC_CALL_PLT,
+ R_PLT_PC, R_TLSGD_GOT, R_TLSGD_GOTPLT, R_TLSGD_PC, R_PPC64_CALL_PLT,
R_PPC64_RELAX_TOC, R_TLSDESC_CALL, R_TLSDESC_PC,
R_AARCH64_TLSDESC_PAGE, R_HINT, R_TLSLD_HINT, R_TLSIE_HINT>(E))
return true;
static RelExpr toPlt(RelExpr Expr) {
switch (Expr) {
- case R_PPC_CALL:
- return R_PPC_CALL_PLT;
+ case R_PPC64_CALL:
+ return R_PPC64_CALL_PLT;
case R_PC:
return R_PLT_PC;
case R_ABS:
switch (Expr) {
case R_PLT_PC:
return R_PC;
- case R_PPC_CALL_PLT:
- return R_PPC_CALL;
+ case R_PPC64_CALL_PLT:
+ return R_PPC64_CALL;
case R_PLT:
return R_ABS;
default:
// The 4 types that relative GOTPLT are all x86 and x86-64 specific.
if (oneof<R_GOTPLTONLY_PC, R_GOTPLTREL, R_GOTPLT, R_TLSGD_GOTPLT>(Expr)) {
In.GotPlt->HasGotPltOffRel = true;
- } else if (oneof<R_GOTONLY_PC, R_GOTREL, R_PPC_TOC, R_PPC64_RELAX_TOC>(Expr)) {
+ } else if (oneof<R_GOTONLY_PC, R_GOTREL, R_PPC64_TOCBASE, R_PPC64_RELAX_TOC>(
+ Expr)) {
In.Got->HasGotOffRel = true;
}
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
# RUN: ld.lld --no-toc-optimize %t.o -o %t
-# RUN: llvm-readelf -x .rodata -x .eh_frame %t | FileCheck %s --check-prefix=DATALE
+# RUN: llvm-readelf -x .rodata -x .R_PPC64_TOC -x .eh_frame %t | FileCheck %s --check-prefix=DATALE
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
# RUN: ld.lld --no-toc-optimize %t.o -o %t
-# RUN: llvm-readelf -x .rodata -x .eh_frame %t | FileCheck %s --check-prefix=DATABE
+# RUN: llvm-readelf -x .rodata -x .R_PPC64_TOC -x .eh_frame %t | FileCheck %s --check-prefix=DATABE
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
.text
__foo:
li 3,0
+.section .R_PPC64_TOC,"a",@progbits
+ .quad .TOC.@tocbase
+
+# SEC: .got PROGBITS 0000000010020000
+
+## tocbase = .got+0x8000 = 0x10028000
+# DATALE-LABEL: section '.R_PPC64_TOC':
+# DATALE: 00800210 00000000
+
+# DATABE-LABEL: section '.R_PPC64_TOC':
+# DATABE: 00000000 10028000
+
# Check that the personality (relocated by R_PPC64_REL64) in the .eh_frame
# equals the address of __foo.
-# 0x100001e2 + 0x76fe = 0x10010058
+# 0x100001ea + 0xfe6e = 0x10010058
# DATALE: section '.eh_frame':
-# DATALE: 0x100001e0 {{....}}76fe
+# DATALE: 0x100001e8 {{....}}6efe
# DATABE: section '.eh_frame':
-# DATABE: 0x100001e0 {{[0-9a-f]+ [0-9a-f]+}} fe76{{....}}
+# DATABE: 0x100001e8 {{[0-9a-f]+ [0-9a-f]+}} fe6e{{....}}
# CHECK: __foo
# CHECK-NEXT: 10010058: li 3, 0