New @export() handling

Use a struct as second parameter to be future proof (and also allows to
specify default values for the parameters)

Closes #2679 as it was just a matter of a few lines of code.
This commit is contained in:
LemonBoy
2020-01-09 10:36:51 +01:00
committed by Andrew Kelley
parent 4613e4d15f
commit 5ab5de89c0
13 changed files with 314 additions and 277 deletions

View File

@@ -7538,8 +7538,8 @@ static void do_code_gen(CodeGen *g) {
LLVMSetLinkage(global_value, to_llvm_linkage(linkage));
maybe_export_dll(g, global_value, GlobalLinkageIdStrong);
}
if (tld_var->section_name) {
LLVMSetSection(global_value, buf_ptr(tld_var->section_name));
if (var->section_name) {
LLVMSetSection(global_value, buf_ptr(var->section_name));
}
LLVMSetAlignment(global_value, var->align_bytes);
@@ -8264,7 +8264,7 @@ static void define_builtin_fns(CodeGen *g) {
create_builtin_fn(g, BuiltinFnIdOpaqueType, "OpaqueType", 0);
create_builtin_fn(g, BuiltinFnIdSetAlignStack, "setAlignStack", 1);
create_builtin_fn(g, BuiltinFnIdArgType, "ArgType", 2);
create_builtin_fn(g, BuiltinFnIdExport, "export", 3);
create_builtin_fn(g, BuiltinFnIdExport, "export", 2);
create_builtin_fn(g, BuiltinFnIdErrorReturnTrace, "errorReturnTrace", 0);
create_builtin_fn(g, BuiltinFnIdAtomicRmw, "atomicRmw", 5);
create_builtin_fn(g, BuiltinFnIdAtomicLoad, "atomicLoad", 3);