From 9e128bc3a59b762d6a4392a2e2ecce4d3d861fd2 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Thu, 16 Sep 2021 11:35:38 -0400 Subject: [PATCH] fixup! use separate names for internal and exported functions --- src/julia.h | 13 +++++++++++++ src/support/END.h | 1 - src/support/ENTRY.amd64.h | 2 -- src/support/ENTRY.i387.h | 2 -- src/support/_setjmp.win32.S | 20 ++++++++++++++------ src/support/_setjmp.win64.S | 20 ++++++++++++++------ 6 files changed, 41 insertions(+), 17 deletions(-) diff --git a/src/julia.h b/src/julia.h index 1680f51bebb227..626f78063de125 100644 --- a/src/julia.h +++ b/src/julia.h @@ -5,6 +5,8 @@ #ifdef LIBRARY_EXPORTS #include "jl_internal_funcs.inc" +#undef jl_setjmp +#undef jl_longjmp #endif //** Configuration options that affect the Julia ABI **// @@ -1885,14 +1887,25 @@ JL_DLLEXPORT void jl_restore_excstack(size_t state) JL_NOTSAFEPOINT; #if defined(_COMPILER_GCC_) JL_DLLEXPORT int __attribute__ ((__nothrow__,__returns_twice__)) (jl_setjmp)(jmp_buf _Buf); __declspec(noreturn) __attribute__ ((__nothrow__)) void (jl_longjmp)(jmp_buf _Buf, int _Value); +JL_DLLEXPORT int __attribute__ ((__nothrow__,__returns_twice__)) (ijl_setjmp)(jmp_buf _Buf); +__declspec(noreturn) __attribute__ ((__nothrow__)) void (ijl_longjmp)(jmp_buf _Buf, int _Value); #else JL_DLLEXPORT int (jl_setjmp)(jmp_buf _Buf); void (jl_longjmp)(jmp_buf _Buf, int _Value); +JL_DLLEXPORT int (ijl_setjmp)(jmp_buf _Buf); +void (ijl_longjmp)(jmp_buf _Buf, int _Value); #endif +#ifdef LIBRARY_EXPORTS +#define jl_setjmp_f ijl_setjmp +#define jl_setjmp_name "ijl_setjmp" +#define jl_setjmp(a,b) ijl_setjmp(a) +#define jl_longjmp(a,b) ijl_longjmp(a,b) +#else #define jl_setjmp_f jl_setjmp #define jl_setjmp_name "jl_setjmp" #define jl_setjmp(a,b) jl_setjmp(a) #define jl_longjmp(a,b) jl_longjmp(a,b) +#endif #elif defined(_OS_EMSCRIPTEN_) #define jl_setjmp(a,b) setjmp(a) #define jl_longjmp(a,b) longjmp(a,b) diff --git a/src/support/END.h b/src/support/END.h index 090bbc02eeb1c7..ec7b75d397b88f 100644 --- a/src/support/END.h +++ b/src/support/END.h @@ -47,7 +47,6 @@ CNAME endp #undef CNAME -#undef HIDENAME #undef STR #undef XSTR #undef _START_ENTRY diff --git a/src/support/ENTRY.amd64.h b/src/support/ENTRY.amd64.h index b8049f0711f89e..f18caa502ac5c5 100644 --- a/src/support/ENTRY.amd64.h +++ b/src/support/ENTRY.amd64.h @@ -41,7 +41,6 @@ #define EXT_(csym) csym #define EXT(csym) EXT_(csym) #endif -#define HIDENAME(asmsym) .asmsym .text _START_ENTRY .globl EXT(CNAME) @@ -51,7 +50,6 @@ EXT(CNAME): #elif defined(_WIN32) #define EXT_(csym) csym #define EXT(csym) EXT_(csym) -#define HIDENAME(asmsym) .asmsym #ifndef _MSC_VER .intel_syntax noprefix diff --git a/src/support/ENTRY.i387.h b/src/support/ENTRY.i387.h index d80038671247ae..cb7b93466cc3ef 100644 --- a/src/support/ENTRY.i387.h +++ b/src/support/ENTRY.i387.h @@ -41,7 +41,6 @@ #define EXT_(csym) csym #define EXT(csym) EXT_(csym) #endif -#define HIDENAME(asmsym) .asmsym .text _START_ENTRY .globl EXT(CNAME) @@ -51,7 +50,6 @@ EXT(CNAME): #elif defined(_WIN32) #define EXT_(csym) _##csym #define EXT(csym) EXT_(csym) -#define HIDENAME(asmsym) .asmsym #ifndef _MSC_VER .intel_syntax diff --git a/src/support/_setjmp.win32.S b/src/support/_setjmp.win32.S index 441872dd4261a6..33ed50ed3deab1 100644 --- a/src/support/_setjmp.win32.S +++ b/src/support/_setjmp.win32.S @@ -56,8 +56,10 @@ * and update fs:[0xEOC] to contain the address of the stack */ -#define CNAME jl_setjmp +#define CNAME ijl_setjmp #include "ENTRY.i387.h" +.globl _jl_setjmp +_jl_setjmp: mov eax,DWORD PTR [esp+4] // arg 1 mov edx,DWORD PTR [esp+0] // rta mov DWORD PTR [eax+0],ebp @@ -73,8 +75,10 @@ #include "END.h" -#define CNAME jl_longjmp +#define CNAME ijl_longjmp #include "ENTRY.i387.h" +.globl _jl_longjmp +_jl_longjmp: mov edx,DWORD PTR [esp+4] // arg 1 mov eax,DWORD PTR [esp+8] // arg 2 mov ebp,DWORD PTR [edx+24] // seh registration @@ -87,14 +91,16 @@ mov ebp,DWORD PTR [edx+0] mov DWORD PTR [esp],ecx test eax,eax - jne a + jne 1f inc eax -a: ret // jmp ecx +1: ret // jmp ecx #include "END.h" -#define CNAME jl_swapcontext +#define CNAME ijl_swapcontext #include "ENTRY.i387.h" +.globl _jl_swapcontext +_jl_swapcontext: mov eax,DWORD PTR [esp+4] // save stack registers mov edx,DWORD PTR fs:[8] // stack top (low) @@ -118,8 +124,10 @@ a: ret // jmp ecx #include "END.h" -#define CNAME jl_setcontext +#define CNAME ijl_setcontext #include "ENTRY.i387.h" +.globl _jl_setcontext +_jl_setcontext: mov eax,DWORD PTR [esp+4] // restore stack registers mov edx,DWORD PTR [eax+0] diff --git a/src/support/_setjmp.win64.S b/src/support/_setjmp.win64.S index cb512cfe4ab3e2..f5e5c69c7cff38 100644 --- a/src/support/_setjmp.win64.S +++ b/src/support/_setjmp.win64.S @@ -6,8 +6,10 @@ * and update gs:[0x1478] to contain the address of the stack */ -#define CNAME jl_setjmp +#define CNAME ijl_setjmp #include "ENTRY.amd64.h" +.globl jl_setjmp +jl_setjmp: mov rdx,QWORD PTR [rsp] // rta mov rax,QWORD PTR gs:[0] // SEH mov QWORD PTR [rcx+0],rax @@ -37,8 +39,10 @@ #include "END.h" -#define CNAME jl_longjmp +#define CNAME ijl_longjmp #include "ENTRY.amd64.h" +.globl jl_longjmp +jl_longjmp: mov rax,QWORD PTR [rcx+0] mov rbx,QWORD PTR [rcx+8] mov rsp,QWORD PTR [rcx+16] @@ -63,15 +67,17 @@ mov QWORD PTR gs:[0],rax mov eax,edx // move arg2 to return test eax,eax - jne a + jne 1f inc eax -a: mov QWORD PTR [rsp],r8 +1: mov QWORD PTR [rsp],r8 ret #include "END.h" -#define CNAME jl_swapcontext +#define CNAME ijl_swapcontext #include "ENTRY.amd64.h" +.globl jl_swapcontext +jl_swapcontext: // save stack registers mov r8,QWORD PTR gs:[16] // stack top (low) mov rax,QWORD PTR gs:[8] // stack bottom (high) @@ -109,8 +115,10 @@ a: mov QWORD PTR [rsp],r8 #include "END.h" -#define CNAME jl_setcontext +#define CNAME ijl_setcontext #include "ENTRY.amd64.h" +.globl jl_setcontext +jl_setcontext: // restore stack registers mov r8,QWORD PTR [rcx+0] mov rax,QWORD PTR [rcx+8]