mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Standard library is now correctly weakly linked, fixing the use of C3 .so together with executable. #1549, #1107.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
- Cannot use void as a generic parameter #1546
|
||||
- Interfaces not correctly copied with generics #1545
|
||||
- Memory leak in keys.new_list fixed.
|
||||
- Standard library is now correctly weakly linked, fixing the use of C3 .so together with executable. #1549, #1107.
|
||||
|
||||
### Stdlib changes
|
||||
- Remove unintended print of `char[]` as String
|
||||
|
||||
@@ -53,6 +53,12 @@ static void gencontext_init(GenContext *context, Module *module, LLVMContextRef
|
||||
{
|
||||
assert(LLVMIsMultithreaded());
|
||||
memset(context, 0, sizeof(GenContext));
|
||||
if ((module->name->len == 3 && str_eq("std", module->name->module))
|
||||
|| (module->name->len > 5 && memcmp("std::", module->name->module, 5) == 0))
|
||||
{
|
||||
context->weaken = true;
|
||||
}
|
||||
|
||||
if (shared_context)
|
||||
{
|
||||
context->shared_context = true;
|
||||
@@ -586,6 +592,7 @@ void llvm_emit_global_variable_init(GenContext *c, Decl *decl)
|
||||
{
|
||||
LLVMSetVisibility(global_ref, LLVMDefaultVisibility);
|
||||
if (optional_ref) LLVMSetVisibility(optional_ref, LLVMDefaultVisibility);
|
||||
if (c->weaken) llvm_set_linkonce(c, global_ref);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -665,6 +665,7 @@ void llvm_emit_function_decl(GenContext *c, Decl *decl)
|
||||
LLVMSetVisibility(function, LLVMDefaultVisibility);
|
||||
return;
|
||||
}
|
||||
if (c->weaken) llvm_set_linkonce(c, function);
|
||||
if (decl->is_weak) llvm_set_weak(c, function);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ typedef struct GenContext_
|
||||
{
|
||||
bool shared_context;
|
||||
bool in_init_ref;
|
||||
bool weaken;
|
||||
LLVMModuleRef module;
|
||||
LLVMBuilderRef global_builder;
|
||||
LLVMTargetMachineRef machine;
|
||||
|
||||
Reference in New Issue
Block a user