diff options
author | Mike Pall <mike> | 2014-12-08 01:58:05 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2014-12-08 01:58:05 +0100 |
commit | e03df1e3395bc719d43bd9196d0290757f992b2f (patch) | |
tree | 98a2a827c4b83900e7b330d82c5d369caf642db4 /src/vm_x86.dasc | |
parent | f49c61a2776ae9abeb2297dbc3b53ea2962ad750 (diff) | |
download | luajit-e03df1e3395bc719d43bd9196d0290757f992b2f.tar.gz luajit-e03df1e3395bc719d43bd9196d0290757f992b2f.tar.bz2 luajit-e03df1e3395bc719d43bd9196d0290757f992b2f.zip |
x86/x64: Call external symbols directly from interpreter code.
Except for ELF/x86 PIC, where it's easier to use wrappers.
Diffstat (limited to '')
-rw-r--r-- | src/vm_x86.dasc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc index a0c7cc60..cd43afbd 100644 --- a/src/vm_x86.dasc +++ b/src/vm_x86.dasc | |||
@@ -2084,7 +2084,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2084 | | movsd FPARG1, xmm0 | 2084 | | movsd FPARG1, xmm0 |
2085 | |.endif | 2085 | |.endif |
2086 | | mov RB, BASE | 2086 | | mov RB, BASE |
2087 | | call extern lj_vm_ .. func | 2087 | | call extern func |
2088 | | mov BASE, RB | 2088 | | mov BASE, RB |
2089 | |.if X64 | 2089 | |.if X64 |
2090 | | jmp ->fff_resxmm0 | 2090 | | jmp ->fff_resxmm0 |
@@ -5962,15 +5962,21 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
5962 | "LEFDEY:\n\n", fcsize); | 5962 | "LEFDEY:\n\n", fcsize); |
5963 | } | 5963 | } |
5964 | #endif | 5964 | #endif |
5965 | #if LJ_64 | 5965 | #if !LJ_64 |
5966 | fprintf(ctx->fp, "\t.subsections_via_symbols\n"); | ||
5967 | #else | ||
5968 | fprintf(ctx->fp, | 5966 | fprintf(ctx->fp, |
5969 | "\t.non_lazy_symbol_pointer\n" | 5967 | "\t.non_lazy_symbol_pointer\n" |
5970 | "L_lj_err_unwind_dwarf$non_lazy_ptr:\n" | 5968 | "L_lj_err_unwind_dwarf$non_lazy_ptr:\n" |
5971 | ".indirect_symbol _lj_err_unwind_dwarf\n" | 5969 | ".indirect_symbol _lj_err_unwind_dwarf\n" |
5972 | ".long 0\n"); | 5970 | ".long 0\n\n"); |
5971 | fprintf(ctx->fp, "\t.section __IMPORT,__jump_table,symbol_stubs,pure_instructions+self_modifying_code,5\n"); | ||
5972 | { | ||
5973 | const char *const *xn; | ||
5974 | for (xn = ctx->extnames; *xn; xn++) | ||
5975 | if (strncmp(*xn, LABEL_PREFIX, sizeof(LABEL_PREFIX)-1)) | ||
5976 | fprintf(ctx->fp, "L_%s$stub:\n\t.indirect_symbol _%s\n\t.ascii \"\\364\\364\\364\\364\\364\"\n", *xn, *xn); | ||
5977 | } | ||
5973 | #endif | 5978 | #endif |
5979 | fprintf(ctx->fp, ".subsections_via_symbols\n"); | ||
5974 | } | 5980 | } |
5975 | break; | 5981 | break; |
5976 | default: /* Difficult for other modes. */ | 5982 | default: /* Difficult for other modes. */ |