summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2013-06-03 17:30:35 +0200
committerMike Pall <mike>2013-06-03 17:30:35 +0200
commit338e9863c220462201fde0e725aba4002310c849 (patch)
tree44541896aeb35881e66d3a913fda2b0fe4fca922
parent3eeb7d3aa02259e93db6e4816909e80acb57f8f8 (diff)
downloadluajit2-338e9863c220462201fde0e725aba4002310c849.tar.gz
PPC: Add plt suffix for external calls from assembler code.
-rw-r--r--src/host/buildvm.c6
-rw-r--r--src/vm_ppc.dasc4
-rw-r--r--src/vm_ppcspe.dasc14
3 files changed, 15 insertions, 9 deletions
diff --git a/src/host/buildvm.c b/src/host/buildvm.c
index ba8fbcba..2ce3b638 100644
--- a/src/host/buildvm.c
+++ b/src/host/buildvm.c
@@ -108,10 +108,16 @@ static const char *sym_decorate(BuildCtx *ctx,
sprintf(name, "%s%s%s", symprefix, prefix, suffix);
p = strchr(name, '@');
if (p) {
+#if LJ_TARGET_X86ORX64
if (!LJ_64 && (ctx->mode == BUILD_coffasm || ctx->mode == BUILD_peobj))
name[0] = '@';
else
*p = '\0';
+#elif (LJ_TARGET_PPC || LJ_TARGET_PPCSPE) && !LJ_TARGET_CONSOLE
+ /* Keep @plt. */
+#else
+ *p = '\0';
+#endif
}
p = (char *)malloc(strlen(name)+1); /* MSVC doesn't like strdup. */
strcpy(p, name);
diff --git a/src/vm_ppc.dasc b/src/vm_ppc.dasc
index 685ea518..f2530811 100644
--- a/src/vm_ppc.dasc
+++ b/src/vm_ppc.dasc
@@ -49,7 +49,7 @@
|// Convenience macros for TOC handling.
|.if TOC
|// Linker needs a TOC patch area for every external call relocation.
-|.macro blex, target; bl extern target; nop; .endmacro
+|.macro blex, target; bl extern target@plt; nop; .endmacro
|.macro .toc, a, b; a, b; .endmacro
|.if P64
|.define TOC_OFS, 8
@@ -59,7 +59,7 @@
|.define ENV_OFS, 8
|.endif
|.else // No TOC.
-|.macro blex, target; bl extern target; .endmacro
+|.macro blex, target; bl extern target@plt; .endmacro
|.macro .toc, a, b; .endmacro
|.endif
|.macro .tocenv, a, b; .if TOCENV; a, b; .endif; .endmacro
diff --git a/src/vm_ppcspe.dasc b/src/vm_ppcspe.dasc
index 4fabc02f..293e3919 100644
--- a/src/vm_ppcspe.dasc
+++ b/src/vm_ppcspe.dasc
@@ -1390,7 +1390,7 @@ static void build_subroutines(BuildCtx *ctx)
| checknum CARG2
| evmergehi CARG1, CARG2, CARG2
| checkfail ->fff_fallback
- | bl extern func
+ | bl extern func@plt
| evmergelo CRET1, CRET1, CRET2
| b ->fff_restv
|.endmacro
@@ -1405,7 +1405,7 @@ static void build_subroutines(BuildCtx *ctx)
| checknum CARG1
| evmergehi CARG3, CARG4, CARG4
| checkanyfail ->fff_fallback
- | bl extern func
+ | bl extern func@plt
| evmergelo CRET1, CRET1, CRET2
| b ->fff_restv
|.endmacro
@@ -1437,7 +1437,7 @@ static void build_subroutines(BuildCtx *ctx)
| checknum CARG2
| evmergehi CARG1, CARG2, CARG2
| checkfail ->fff_fallback
- | bl extern log
+ | bl extern log@plt
| evmergelo CRET1, CRET1, CRET2
| b ->fff_restv
|
@@ -1471,7 +1471,7 @@ static void build_subroutines(BuildCtx *ctx)
| checknum CARG1
| checkanyfail ->fff_fallback
| efdctsi CARG3, CARG4
- | bl extern ldexp
+ | bl extern ldexp@plt
| evmergelo CRET1, CRET1, CRET2
| b ->fff_restv
|
@@ -1484,7 +1484,7 @@ static void build_subroutines(BuildCtx *ctx)
| checkfail ->fff_fallback
| la CARG3, DISPATCH_GL(tmptv)(DISPATCH)
| lwz PC, FRAME_PC(BASE)
- | bl extern frexp
+ | bl extern frexp@plt
| lwz TMP1, DISPATCH_GL(tmptv)(DISPATCH)
| evmergelo CRET1, CRET1, CRET2
| efdcfsi CRET2, TMP1
@@ -1503,7 +1503,7 @@ static void build_subroutines(BuildCtx *ctx)
| checkfail ->fff_fallback
| la CARG3, -8(BASE)
| lwz PC, FRAME_PC(BASE)
- | bl extern modf
+ | bl extern modf@plt
| evmergelo CRET1, CRET1, CRET2
| la RA, -8(BASE)
| evstdd CRET1, 0(BASE)
@@ -2399,7 +2399,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| checknum CARG1
| evmergehi CARG3, CARG4, CARG4
| checkanyfail ->vmeta_arith_vv
- | bl extern pow
+ | bl extern pow@plt
| evmergelo CRET2, CRET1, CRET2
| evstddx CRET2, BASE, RA
| ins_next