Skip to content

Commit

Permalink
fixup! use separate names for internal and exported functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Sep 16, 2021
1 parent 3a02a12 commit 9daf97d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 18 deletions.
4 changes: 3 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ endif

# headers are used for dependency tracking, while public headers will be part of the dist
UV_HEADERS :=
HEADERS := $(BUILDDIR)/julia_version.h $(wildcard $(SRCDIR)/support/*.h) $(addprefix $(SRCDIR)/,julia.h julia_assert.h julia_threads.h julia_fasttls.h julia_locks.h julia_atomics.h julia_internal.h options.h timing.h) $(addprefix $(BUILDDIR)/, $(DTRACE_HEADERS) jl_internal_funcs.inc)
ifeq ($(USE_SYSTEM_LIBUV),0)
UV_HEADERS += uv.h
UV_HEADERS += uv/*.h
endif
PUBLIC_HEADERS := $(BUILDDIR)/julia_version.h $(wildcard $(SRCDIR)/support/*.h) $(addprefix $(SRCDIR)/,julia.h julia_assert.h julia_threads.h julia_fasttls.h julia_locks.h julia_atomics.h)
HEADERS := $(PUBLIC_HEADERS) $(addprefix $(SRCDIR)/,julia_internal.h options.h timing.h) $(addprefix $(BUILDDIR)/,$(DTRACE_HEADERS) jl_internal_funcs.inc)
PUBLIC_HEADERS += $(addprefix $(SRCDIR)/,julia_gcext.h)
PUBLIC_HEADER_TARGETS := $(addprefix $(build_includedir)/julia/,$(notdir $(PUBLIC_HEADERS)) $(UV_HEADERS))

LLVM_LDFLAGS := $(shell $(LLVM_CONFIG_HOST) --ldflags)
Expand Down
13 changes: 13 additions & 0 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 **//
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/support/END.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ CNAME endp


#undef CNAME
#undef HIDENAME
#undef STR
#undef XSTR
#undef _START_ENTRY
Expand Down
2 changes: 0 additions & 2 deletions src/support/ENTRY.amd64.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#define EXT_(csym) csym
#define EXT(csym) EXT_(csym)
#endif
#define HIDENAME(asmsym) .asmsym
.text
_START_ENTRY
.globl EXT(CNAME)
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/support/ENTRY.i387.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#define EXT_(csym) csym
#define EXT(csym) EXT_(csym)
#endif
#define HIDENAME(asmsym) .asmsym
.text
_START_ENTRY
.globl EXT(CNAME)
Expand All @@ -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
Expand Down
20 changes: 14 additions & 6 deletions src/support/_setjmp.win32.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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]
Expand Down
20 changes: 14 additions & 6 deletions src/support/_setjmp.win64.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand All @@ -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)
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 9daf97d

Please sign in to comment.