@@ -182,6 +182,21 @@ __attribute__((constructor)) void jl_load_libjulia_internal(void) {
182
182
}
183
183
(* jl_exported_func_addrs [symbol_idx ]) = addr ;
184
184
}
185
+ // Next, if we're on Linux/FreeBSD, set up fast TLS.
186
+ #if !defined(_OS_WINDOWS_ ) && !defined(_OS_DARWIN_ )
187
+ void (* jl_pgcstack_setkey )(void * , void * (* )(void )) = lookup_symbol (libjulia_internal , "jl_pgcstack_setkey" );
188
+ if (jl_pgcstack_setkey == NULL ) {
189
+ jl_loader_print_stderr ("ERROR: Cannot find jl_pgcstack_setkey() function within libjulia-internal!\n" );
190
+ exit (1 );
191
+ }
192
+ void * fptr = lookup_symbol (RTLD_DEFAULT , "jl_get_pgcstack_static" );
193
+ void * (* key )(void ) = lookup_symbol (RTLD_DEFAULT , "jl_pgcstack_addr_static" );
194
+ if (fptr == NULL || key == NULL ) {
195
+ jl_loader_print_stderr ("ERROR: Cannot find jl_get_pgcstack_static(), must define this symbol within calling executable!\n" );
196
+ exit (1 );
197
+ }
198
+ jl_pgcstack_setkey (fptr , key );
199
+ #endif
185
200
186
201
// jl_options must be initialized very early, in case an embedder sets some
187
202
// values there before calling jl_init
@@ -199,22 +214,6 @@ JL_DLLEXPORT int jl_load_repl(int argc, char * argv[]) {
199
214
exit (1 );
200
215
}
201
216
}
202
- // Next, if we're on Linux/FreeBSD, set up fast TLS.
203
- #if !defined(_OS_WINDOWS_ ) && !defined(_OS_DARWIN_ )
204
- void (* jl_pgcstack_setkey )(void * , void * (* )(void )) = lookup_symbol (libjulia_internal , "jl_pgcstack_setkey" );
205
- if (jl_pgcstack_setkey == NULL ) {
206
- jl_loader_print_stderr ("ERROR: Cannot find jl_pgcstack_setkey() function within libjulia-internal!\n" );
207
- exit (1 );
208
- }
209
- void * fptr = lookup_symbol (RTLD_DEFAULT , "jl_get_pgcstack_static" );
210
- void * (* key )(void ) = lookup_symbol (RTLD_DEFAULT , "jl_pgcstack_addr_static" );
211
- if (fptr == NULL || key == NULL ) {
212
- jl_loader_print_stderr ("ERROR: Cannot find jl_get_pgcstack_static(), must define this symbol within calling executable!\n" );
213
- exit (1 );
214
- }
215
- jl_pgcstack_setkey (fptr , key );
216
- #endif
217
-
218
217
// Load the repl entrypoint symbol and jump into it!
219
218
int (* entrypoint )(int , char * * ) = (int (* )(int , char * * ))lookup_symbol (libjulia_internal , "jl_repl_entrypoint" );
220
219
if (entrypoint == NULL ) {
0 commit comments