aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend.hpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2025-04-08 11:36:53 +0100
committergingerBill <bill@gingerbill.org>2025-04-08 11:36:53 +0100
commitfe040d1bbd22c78081ffc1d45b3462f40f8eb17a (patch)
tree005c8d5bca1c0e5508442fa0d7180036565b0b20 /src/llvm_backend.hpp
parent77b5eebf8ce090839713fc59fe0f60045524043f (diff)
Propagate `@(link_section=<string>)` to nested declarations
Diffstat (limited to 'src/llvm_backend.hpp')
-rw-r--r--src/llvm_backend.hpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/llvm_backend.hpp b/src/llvm_backend.hpp
index 3e01ada5f..6177fcf6e 100644
--- a/src/llvm_backend.hpp
+++ b/src/llvm_backend.hpp
@@ -415,9 +415,19 @@ gb_internal LLVMTypeRef llvm_get_element_type(LLVMTypeRef type);
gb_internal lbBlock *lb_create_block(lbProcedure *p, char const *name, bool append=false);
+struct lbConstContext {
+ bool allow_local;
+ bool is_rodata;
+ String link_section;
+};
+
+static lbConstContext const LB_CONST_CONTEXT_DEFAULT = {true, false, {}};
+static lbConstContext const LB_CONST_CONTEXT_DEFAULT_ALLOW_LOCAL = {true, false, {}};
+static lbConstContext const LB_CONST_CONTEXT_DEFAULT_NO_LOCAL = {false, false, {}};
+
gb_internal lbValue lb_const_nil(lbModule *m, Type *type);
gb_internal lbValue lb_const_undef(lbModule *m, Type *type);
-gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bool allow_local=true, bool is_rodata=false);
+gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, lbConstContext cc = LB_CONST_CONTEXT_DEFAULT);
gb_internal lbValue lb_const_bool(lbModule *m, Type *type, bool value);
gb_internal lbValue lb_const_int(lbModule *m, Type *type, u64 value);
@@ -514,7 +524,7 @@ gb_internal void lb_fill_slice(lbProcedure *p, lbAddr const &slice, lbValue base
gb_internal lbValue lb_type_info(lbProcedure *p, Type *type);
-gb_internal lbValue lb_find_or_add_entity_string(lbModule *m, String const &str);
+gb_internal lbValue lb_find_or_add_entity_string(lbModule *m, String const &str, bool custom_link_section);
gb_internal lbValue lb_generate_anonymous_proc_lit(lbModule *m, String const &prefix_name, Ast *expr, lbProcedure *parent = nullptr);
gb_internal bool lb_is_const(lbValue value);