mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
prepend underscore to non exported functions
to prevent symbol collisions
This commit is contained in:
parent
77ffb5075b
commit
0e92b44043
@ -945,9 +945,14 @@ static void resolve_function_proto(CodeGen *g, AstNode *node, FnTableEntry *fn_t
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Buf *symbol_name;
|
||||||
fn_table_entry->fn_value = LLVMAddFunction(g->module, buf_ptr(&fn_table_entry->symbol_name),
|
if (is_c_compat) {
|
||||||
fn_type->data.fn.raw_type_ref);
|
symbol_name = &fn_table_entry->symbol_name;
|
||||||
|
} else {
|
||||||
|
symbol_name = buf_sprintf("_%s", buf_ptr(&fn_table_entry->symbol_name));
|
||||||
|
}
|
||||||
|
fn_table_entry->fn_value = LLVMAddFunction(g->module, buf_ptr(symbol_name),
|
||||||
|
fn_type->data.fn.raw_type_ref);
|
||||||
|
|
||||||
if (fn_table_entry->is_inline) {
|
if (fn_table_entry->is_inline) {
|
||||||
LLVMAddFunctionAttr(fn_table_entry->fn_value, LLVMAlwaysInlineAttribute);
|
LLVMAddFunctionAttr(fn_table_entry->fn_value, LLVMAlwaysInlineAttribute);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user