@@ -230,6 +230,21 @@ __attribute__((constructor)) void jl_load_libjulia_internal(void) {
230
230
}
231
231
(* jl_codegen_exported_func_addrs [symbol_idx ]) = addr ;
232
232
}
233
+ // Next, if we're on Linux/FreeBSD, set up fast TLS.
234
+ #if !defined(_OS_WINDOWS_ ) && !defined(_OS_DARWIN_ )
235
+ void (* jl_pgcstack_setkey )(void * , void * (* )(void )) = lookup_symbol (libjulia_internal , "jl_pgcstack_setkey" );
236
+ if (jl_pgcstack_setkey == NULL ) {
237
+ jl_loader_print_stderr ("ERROR: Cannot find jl_pgcstack_setkey() function within libjulia-internal!\n" );
238
+ exit (1 );
239
+ }
240
+ void * fptr = lookup_symbol (RTLD_DEFAULT , "jl_get_pgcstack_static" );
241
+ void * (* key )(void ) = lookup_symbol (RTLD_DEFAULT , "jl_pgcstack_addr_static" );
242
+ if (fptr == NULL || key == NULL ) {
243
+ jl_loader_print_stderr ("ERROR: Cannot find jl_get_pgcstack_static(), must define this symbol within calling executable!\n" );
244
+ exit (1 );
245
+ }
246
+ jl_pgcstack_setkey (fptr , key );
247
+ #endif
233
248
234
249
// jl_options must be initialized very early, in case an embedder sets some
235
250
// values there before calling jl_init
@@ -247,22 +262,6 @@ JL_DLLEXPORT int jl_load_repl(int argc, char * argv[]) {
247
262
exit (1 );
248
263
}
249
264
}
250
- // Next, if we're on Linux/FreeBSD, set up fast TLS.
251
- #if !defined(_OS_WINDOWS_ ) && !defined(_OS_DARWIN_ )
252
- void (* jl_pgcstack_setkey )(void * , void * (* )(void )) = lookup_symbol (libjulia_internal , "jl_pgcstack_setkey" );
253
- if (jl_pgcstack_setkey == NULL ) {
254
- jl_loader_print_stderr ("ERROR: Cannot find jl_pgcstack_setkey() function within libjulia-internal!\n" );
255
- exit (1 );
256
- }
257
- void * fptr = lookup_symbol (RTLD_DEFAULT , "jl_get_pgcstack_static" );
258
- void * (* key )(void ) = lookup_symbol (RTLD_DEFAULT , "jl_pgcstack_addr_static" );
259
- if (fptr == NULL || key == NULL ) {
260
- jl_loader_print_stderr ("ERROR: Cannot find jl_get_pgcstack_static(), must define this symbol within calling executable!\n" );
261
- exit (1 );
262
- }
263
- jl_pgcstack_setkey (fptr , key );
264
- #endif
265
-
266
265
// Load the repl entrypoint symbol and jump into it!
267
266
int (* entrypoint )(int , char * * ) = (int (* )(int , char * * ))lookup_symbol (libjulia_internal , "jl_repl_entrypoint" );
268
267
if (entrypoint == NULL ) {
0 commit comments