forked from OSchip/llvm-project
Fix implicit plt creation on aarch64.
We were not handling page relative relocations. llvm-svn: 271798
This commit is contained in:
parent
1fcdc23a6e
commit
12dc446939
|
@ -263,6 +263,7 @@ getSymVA(uint32_t Type, typename ELFT::uint A, typename ELFT::uint P,
|
|||
case R_PC:
|
||||
case R_RELAX_GOT_PC:
|
||||
return Body.getVA<ELFT>(A) - P;
|
||||
case R_PLT_PAGE_PC:
|
||||
case R_PAGE_PC:
|
||||
return getAArch64Page(Body.getVA<ELFT>(A)) - getAArch64Page(P);
|
||||
}
|
||||
|
|
|
@ -251,7 +251,8 @@ template <class ELFT> static bool isAbsolute(const SymbolBody &Body) {
|
|||
}
|
||||
|
||||
static bool needsPlt(RelExpr Expr) {
|
||||
return Expr == R_PLT_PC || Expr == R_PPC_PLT_OPD || Expr == R_PLT;
|
||||
return Expr == R_PLT_PC || Expr == R_PPC_PLT_OPD || Expr == R_PLT ||
|
||||
Expr == R_PLT_PAGE_PC;
|
||||
}
|
||||
|
||||
// True if this expression is of the form Sym - X, where X is a position in the
|
||||
|
@ -311,6 +312,8 @@ static RelExpr toPlt(RelExpr Expr) {
|
|||
return R_PPC_PLT_OPD;
|
||||
if (Expr == R_PC)
|
||||
return R_PLT_PC;
|
||||
if (Expr == R_PAGE_PC)
|
||||
return R_PLT_PAGE_PC;
|
||||
if (Expr == R_ABS)
|
||||
return R_PLT;
|
||||
return Expr;
|
||||
|
|
|
@ -35,6 +35,7 @@ enum RelExpr {
|
|||
R_PC,
|
||||
R_PLT,
|
||||
R_PLT_PC,
|
||||
R_PLT_PAGE_PC,
|
||||
R_PPC_OPD,
|
||||
R_PPC_PLT_OPD,
|
||||
R_PPC_TOC,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
.global foo
|
||||
.type foo, @function
|
||||
foo:
|
||||
.global bar
|
||||
bar:
|
|
@ -0,0 +1,26 @@
|
|||
// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=aarch64-pc-linux
|
||||
// RUN: llvm-mc %p/Inputs/aarch64-copy2.s -o %t2.o -filetype=obj -triple=aarch64-pc-linux
|
||||
// RUN: ld.lld %t2.o -o %t2.so -shared
|
||||
// RUN: ld.lld %t.o %t2.so -o %t
|
||||
// RUN: llvm-readobj -t %t | FileCheck %s
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
adrp x8, foo
|
||||
bl bar
|
||||
|
||||
// CHECK: Name: bar
|
||||
// CHECK-NEXT: Value: 0x0
|
||||
// CHECK-NEXT: Size: 0
|
||||
// CHECK-NEXT: Binding: Global
|
||||
// CHECK-NEXT: Type: None
|
||||
// CHECK-NEXT: Other: 0
|
||||
// CHECK-NEXT: Section: Undefined
|
||||
|
||||
// CHECK: Name: foo
|
||||
// CHECK-NEXT: Value: 0x11030
|
||||
// CHECK-NEXT: Size: 0
|
||||
// CHECK-NEXT: Binding: Global
|
||||
// CHECK-NEXT: Type: Function
|
||||
// CHECK-NEXT: Other: 0
|
||||
// CHECK-NEXT: Section: Undefined
|
Loading…
Reference in New Issue