Correct missing procedures in other build modules which cause a linkage problem

This commit is contained in:
gingerBill
2023-01-12 16:59:16 +00:00
parent 34f9170189
commit 402a165b60
4 changed files with 21 additions and 16 deletions

View File

@@ -190,11 +190,6 @@ gb_internal lbProcedure *lb_create_procedure(lbModule *m, Entity *entity, bool i
lb_add_attribute_to_proc(m, p->value, "cold");
}
lbValue proc_value = {p->value, p->type};
lb_add_entity(m, entity, proc_value);
lb_add_member(m, p->name, proc_value);
lb_add_procedure_value(m, p);
if (p->is_export) {
LLVMSetLinkage(p->value, LLVMDLLExportLinkage);
LLVMSetDLLStorageClass(p->value, LLVMDLLExportStorageClass);
@@ -202,7 +197,9 @@ gb_internal lbProcedure *lb_create_procedure(lbModule *m, Entity *entity, bool i
lb_set_wasm_export_attributes(p->value, p->name);
} else if (!p->is_foreign) {
if (!USE_SEPARATE_MODULES) {
if (USE_SEPARATE_MODULES) {
LLVMSetLinkage(p->value, LLVMExternalLinkage);
} else {
LLVMSetLinkage(p->value, LLVMInternalLinkage);
// NOTE(bill): if a procedure is defined in package runtime and uses a custom link name,
@@ -316,6 +313,11 @@ gb_internal lbProcedure *lb_create_procedure(lbModule *m, Entity *entity, bool i
}
}
lbValue proc_value = {p->value, p->type};
lb_add_entity(m, entity, proc_value);
lb_add_member(m, p->name, proc_value);
lb_add_procedure_value(m, p);
return p;
}