Skip to content

Commit 8a48813

Browse files
committed
l2s: deal with linkage
1 parent f44692f commit 8a48813

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/frontends/llvm/l2s.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,15 @@ const Node* convert_function(Parser* p, LLVMValueRef fn) {
118118
assert(fn_type->tag == FnType_TAG);
119119
assert(fn_type->payload.fn_type.param_types.count == params.count);
120120
Nodes annotations = empty(a);
121-
annotations = append_nodes(a, annotations, annotation(a, (Annotation) { .name = "Exported" }));
121+
switch (LLVMGetLinkage(fn)) {
122+
case LLVMExternalLinkage:
123+
case LLVMExternalWeakLinkage: {
124+
annotations = append_nodes(a, annotations, annotation(a, (Annotation) {.name = "Exported"}));
125+
break;
126+
}
127+
default:
128+
break;
129+
}
122130
Node* f = function(p->dst, params, LLVMGetValueName(fn), annotations, fn_type->payload.fn_type.return_types);
123131
const Node* r = fn_addr_helper(a, f);
124132
insert_dict(LLVMValueRef, const Node*, p->map, fn, r);

0 commit comments

Comments
 (0)