mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Fix for nolibc (eg wasm). Add multi global declarations. Simplicity wasm export / import. Prevent "extern" functions to have a function body.
This commit is contained in:
@@ -1021,17 +1021,17 @@ void llvm_append_function_attributes(GenContext *c, Decl *decl)
|
||||
{
|
||||
llvm_attribute_add(c, function, attribute_id.noreturn, -1);
|
||||
}
|
||||
if (decl->is_wasm_interface && arch_is_wasm(platform_target.arch))
|
||||
if (decl->is_export && arch_is_wasm(platform_target.arch))
|
||||
{
|
||||
if (decl->visibility == VISIBLE_EXTERN)
|
||||
{
|
||||
llvm_attribute_add_string(c, function, "wasm-import-name", decl_get_extname(decl), -1);
|
||||
}
|
||||
else if (c->code_module == decl->unit->module)
|
||||
if (c->code_module == decl->unit->module)
|
||||
{
|
||||
llvm_attribute_add_string(c, function, "wasm-export-name", decl_get_extname(decl), -1);
|
||||
}
|
||||
}
|
||||
if (decl->visibility == VISIBLE_EXTERN && arch_is_wasm(platform_target.arch))
|
||||
{
|
||||
llvm_attribute_add_string(c, function, "wasm-import-name", decl_get_extname(decl), -1);
|
||||
}
|
||||
if (decl->alignment != type_abi_alignment(decl->type))
|
||||
{
|
||||
llvm_set_alignment(function, decl->alignment);
|
||||
@@ -1104,6 +1104,7 @@ LLVMValueRef llvm_get_ref(GenContext *c, Decl *decl)
|
||||
case DECL_BODYPARAM:
|
||||
case DECL_CT_ECHO:
|
||||
case DECL_CT_INCLUDE:
|
||||
case DECL_GLOBALS:
|
||||
UNREACHABLE;
|
||||
}
|
||||
UNREACHABLE
|
||||
|
||||
Reference in New Issue
Block a user