@@ -971,18 +971,26 @@ static GlobalVariable *emit_shard_table(Module &M, Type *T_size, Type *T_psize,
971
971
return tables_gv;
972
972
}
973
973
974
+ static Function *emit_pgcstack_default_func (Module &M, Type *T_ptr) {
975
+ auto FT = FunctionType::get (T_ptr, false );
976
+ auto F = Function::Create (FT, GlobalValue::InternalLinkage, " pgcstack_default_func" , &M);
977
+ llvm::IRBuilder<> builder (BasicBlock::Create (M.getContext (), " top" , F));
978
+ builder.CreateRet (Constant::getNullValue (T_ptr));
979
+ return F;
980
+ }
981
+
974
982
// See src/processor.h for documentation about this table. Corresponds to jl_image_ptls_t.
975
- static GlobalVariable *emit_ptls_table (Module &M, Type *T_size, Type *T_psize ) {
983
+ static GlobalVariable *emit_ptls_table (Module &M, Type *T_size, Type *T_ptr ) {
976
984
std::array<Constant *, 3 > ptls_table{
977
- new GlobalVariable (M, T_size , false , GlobalValue::ExternalLinkage, Constant::getNullValue (T_size ), " jl_pgcstack_func_slot" ),
985
+ new GlobalVariable (M, T_ptr , false , GlobalValue::ExternalLinkage, emit_pgcstack_default_func (M, T_ptr ), " jl_pgcstack_func_slot" ),
978
986
new GlobalVariable (M, T_size, false , GlobalValue::ExternalLinkage, Constant::getNullValue (T_size), " jl_pgcstack_key_slot" ),
979
987
new GlobalVariable (M, T_size, false , GlobalValue::ExternalLinkage, Constant::getNullValue (T_size), " jl_tls_offset" ),
980
988
};
981
989
for (auto &gv : ptls_table) {
982
990
cast<GlobalVariable>(gv)->setVisibility (GlobalValue::HiddenVisibility);
983
991
cast<GlobalVariable>(gv)->setDSOLocal (true );
984
992
}
985
- auto ptls_table_arr = ConstantArray::get (ArrayType::get (T_psize , ptls_table.size ()), ptls_table);
993
+ auto ptls_table_arr = ConstantArray::get (ArrayType::get (T_ptr , ptls_table.size ()), ptls_table);
986
994
auto ptls_table_gv = new GlobalVariable (M, ptls_table_arr->getType (), false ,
987
995
GlobalValue::ExternalLinkage, ptls_table_arr, " jl_ptls_table" );
988
996
ptls_table_gv->setVisibility (GlobalValue::HiddenVisibility);
@@ -2181,6 +2189,7 @@ void jl_dump_native_impl(void *native_code,
2181
2189
2182
2190
Type *T_size = DL.getIntPtrType (Context);
2183
2191
Type *T_psize = T_size->getPointerTo ();
2192
+ Type *T_ptr = PointerType::get (Context, 0 );
2184
2193
2185
2194
auto FT = FunctionType::get (Type::getInt8Ty (Context)->getPointerTo ()->getPointerTo (), {}, false );
2186
2195
auto F = Function::Create (FT, Function::ExternalLinkage, " get_jl_RTLD_DEFAULT_handle_addr" , metadataM);
@@ -2204,7 +2213,7 @@ void jl_dump_native_impl(void *native_code,
2204
2213
builder.CreateRet (ConstantInt::get (T_int32, 1 ));
2205
2214
}
2206
2215
if (imaging_mode) {
2207
- auto specs = jl_get_llvm_clone_targets ();
2216
+ auto specs = jl_get_llvm_clone_targets (jl_options. cpu_target );
2208
2217
const uint32_t base_flags = has_veccall ? JL_TARGET_VEC_CALL : 0 ;
2209
2218
SmallVector<uint8_t , 0 > data;
2210
2219
auto push_i32 = [&] (uint32_t v) {
@@ -2223,7 +2232,7 @@ void jl_dump_native_impl(void *native_code,
2223
2232
GlobalVariable::InternalLinkage,
2224
2233
value, " jl_dispatch_target_ids" );
2225
2234
auto shards = emit_shard_table (metadataM, T_size, T_psize, threads);
2226
- auto ptls = emit_ptls_table (metadataM, T_size, T_psize );
2235
+ auto ptls = emit_ptls_table (metadataM, T_size, T_ptr );
2227
2236
auto header = emit_image_header (metadataM, threads, nfvars, ngvars);
2228
2237
auto AT = ArrayType::get (T_size, sizeof (jl_small_typeof) / sizeof (void *));
2229
2238
auto jl_small_typeof_copy = new GlobalVariable (metadataM, AT, false ,
0 commit comments