PPC: Add plt suffix for external calls from assembler code.

This commit is contained in:
Mike Pall 2013-06-03 17:30:35 +02:00
parent 3eeb7d3aa0
commit 338e9863c2
3 changed files with 15 additions and 9 deletions

View File

@ -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);

View File

@ -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

View File

@ -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