mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-19 22:33:13 +01:00
Implement new ModuleInfo discovery/druntime startup scheme on Linux.
This is the same implementation that is used for DMD and supports shared libraries (not yet tested).
This commit is contained in:
committed by
Kai Nacke
parent
82c202bb60
commit
d9b137bb45
@@ -191,6 +191,7 @@ static void LLVM_D_BuildRuntimeModule()
|
||||
LLType* classInfoTy = DtoType(Type::typeinfoclass->type);
|
||||
LLType* typeInfoTy = DtoType(Type::dtypeinfo->type);
|
||||
LLType* aaTypeInfoTy = DtoType(Type::typeinfoassociativearray->type);
|
||||
LLType* moduleInfoPtrTy = getPtrToType(DtoType(Module::moduleinfo->type));
|
||||
|
||||
LLType* aaTy = rt_ptr(LLStructType::get(gIR->context()));
|
||||
|
||||
@@ -306,7 +307,7 @@ static void LLVM_D_BuildRuntimeModule()
|
||||
llvm::StringRef fname("_d_array_bounds");
|
||||
llvm::StringRef fname2("_d_switch_error");
|
||||
LLType *types[] = {
|
||||
getPtrToType(DtoType(Module::moduleinfo->type)),
|
||||
moduleInfoPtrTy,
|
||||
intTy
|
||||
};
|
||||
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
|
||||
@@ -777,7 +778,7 @@ static void LLVM_D_BuildRuntimeModule()
|
||||
->setAttributes(Attr_1_NoCapture);
|
||||
}
|
||||
|
||||
// int _aaEqual(TypeInfo_AssociativeArray ti, AA e1, AA e2)
|
||||
// int _aaEqual(in TypeInfo tiRaw, in AA e1, in AA e2)
|
||||
{
|
||||
llvm::StringRef fname("_aaEqual");
|
||||
LLType *types[] = { typeInfoTy, aaTy, aaTy };
|
||||
@@ -941,4 +942,23 @@ static void LLVM_D_BuildRuntimeModule()
|
||||
LLFunctionType* fty = llvm::FunctionType::get(voidTy, false);
|
||||
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
|
||||
}
|
||||
|
||||
// void _d_dso_registry(CompilerDSOData* data)
|
||||
if (global.params.isLinux) {
|
||||
llvm::StringRef fname("_d_dso_registry");
|
||||
|
||||
llvm::StructType* dsoDataTy = llvm::StructType::get(
|
||||
sizeTy, // version
|
||||
getPtrToType(voidPtrTy), // slot
|
||||
getPtrToType(moduleInfoPtrTy), // _minfo_beg
|
||||
getPtrToType(moduleInfoPtrTy), // _minfo_end
|
||||
NULL
|
||||
);
|
||||
|
||||
llvm::Type* params[] = {
|
||||
getPtrToType(dsoDataTy)
|
||||
};
|
||||
llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, params, false);
|
||||
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user