File tree Expand file tree Collapse file tree 4 files changed +14
-2
lines changed
Expand file tree Collapse file tree 4 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1219,6 +1219,7 @@ struct CodegenParams
12191219 debug_info_kind:: Cint
12201220 safepoint_on_entry:: Cint
12211221 gcstack_arg:: Cint
1222+ use_jlplt:: Cint
12221223
12231224 lookup:: Ptr{Cvoid}
12241225
@@ -1228,15 +1229,15 @@ struct CodegenParams
12281229 prefer_specsig:: Bool = false ,
12291230 gnu_pubnames= true , debug_info_kind:: Cint = default_debug_info_kind (),
12301231 safepoint_on_entry:: Bool = true ,
1231- gcstack_arg:: Bool = true ,
1232+ gcstack_arg:: Bool = true , use_jlplt :: Bool = true ,
12321233 lookup:: Ptr{Cvoid} = unsafe_load (cglobal (:jl_rettype_inferred_addr , Ptr{Cvoid})),
12331234 generic_context = nothing )
12341235 return new (
12351236 Cint (track_allocations), Cint (code_coverage),
12361237 Cint (prefer_specsig),
12371238 Cint (gnu_pubnames), debug_info_kind,
12381239 Cint (safepoint_on_entry),
1239- Cint (gcstack_arg),
1240+ Cint (gcstack_arg), Cint (use_jlplt),
12401241 lookup, generic_context)
12411242 end
12421243end
Original file line number Diff line number Diff line change @@ -2077,6 +2077,14 @@ jl_cgval_t function_sig_t::emit_a_ccall(
20772077 if (ctx.emission_context .imaging_mode )
20782078 jl_printf (JL_STDERR," WARNING: literal address used in ccall for %s; code cannot be statically compiled\n " , symarg.f_name );
20792079 }
2080+ else if (!ctx.params ->use_jlplt ) {
2081+ if ((symarg.f_lib && !((symarg.f_lib == JL_EXE_LIBNAME) ||
2082+ (symarg.f_lib == JL_LIBJULIA_INTERNAL_DL_LIBNAME) ||
2083+ (symarg.f_lib == JL_LIBJULIA_DL_LIBNAME))) || symarg.lib_expr ) {
2084+ emit_error (ctx, " ccall: Had library expression, but symbol lookup was disabled" );
2085+ }
2086+ llvmf = jl_Module->getOrInsertFunction (symarg.f_name , functype).getCallee ();
2087+ }
20802088 else {
20812089 assert (symarg.f_name != NULL );
20822090 PointerType *funcptype = PointerType::get (functype, 0 );
Original file line number Diff line number Diff line change @@ -1365,6 +1365,7 @@ extern "C" {
13651365 /* debug_info_kind */ (int ) DICompileUnit::DebugEmissionKind::FullDebug,
13661366 /* safepoint_on_entry */ 1 ,
13671367 /* gcstack_arg */ 1 ,
1368+ /* use_jlplt*/ 1 ,
13681369 /* lookup */ jl_rettype_inferred_addr,
13691370 /* generic_context */ NULL };
13701371}
Original file line number Diff line number Diff line change @@ -2354,6 +2354,8 @@ typedef struct {
23542354 int safepoint_on_entry ; // Emit a safepoint on entry to each function
23552355 int gcstack_arg ; // Pass the ptls value as an argument with swiftself
23562356
2357+ int use_jlplt ; // Whether to use the Julia PLT mechanism or emit symbols directly
2358+
23572359 // Cache access. Default: jl_rettype_inferred.
23582360 jl_codeinstance_lookup_t lookup ;
23592361
You can’t perform that action at this time.
0 commit comments