File tree Expand file tree Collapse file tree 4 files changed +26
-9
lines changed Expand file tree Collapse file tree 4 files changed +26
-9
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 @@ -1351,17 +1351,23 @@ static const auto jl_new_opaque_closure_jlcall_func = new JuliaFunction<>{XSTR(j
13511351static _Atomic (uint64_t ) globalUniqueGeneratedNames{1 };
13521352
13531353// --- code generation ---
1354+
13541355extern " C" {
1355- jl_cgparams_t jl_default_cgparams = {1 , 1 , 0 ,
1356+ jl_cgparams_t jl_default_cgparams = {
1357+ /* track_allocations */ 1 ,
1358+ /* code_coverage */ 1 ,
1359+ /* prefer_specsig */ 0 ,
13561360#ifdef _OS_WINDOWS_
1357- 0 ,
1361+ /* gnu_pubnames */ 0 ,
13581362#else
1359- 1 ,
1363+ /* gnu_pubnames */ 1 ,
13601364#endif
1361- (int ) DICompileUnit::DebugEmissionKind::FullDebug,
1362- 1 ,
1363- 1 ,
1364- jl_rettype_inferred_addr, NULL };
1365+ /* debug_info_kind */ (int ) DICompileUnit::DebugEmissionKind::FullDebug,
1366+ /* safepoint_on_entry */ 1 ,
1367+ /* gcstack_arg */ 1 ,
1368+ /* use_jlplt*/ 1 ,
1369+ /* lookup */ jl_rettype_inferred_addr,
1370+ /* generic_context */ NULL };
13651371}
13661372
13671373
Original file line number Diff line number Diff line change @@ -2367,6 +2367,8 @@ typedef struct {
23672367 int safepoint_on_entry ; // Emit a safepoint on entry to each function
23682368 int gcstack_arg ; // Pass the ptls value as an argument with swiftself
23692369
2370+ int use_jlplt ; // Whether to use the Julia PLT mechanism or emit symbols directly
2371+
23702372 // Cache access. Default: jl_rettype_inferred.
23712373 jl_codeinstance_lookup_t lookup ;
23722374
You can’t perform that action at this time.
0 commit comments