summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/zen.yml7
-rw-r--r--src/codegen/codegen.c10
2 files changed, 13 insertions, 4 deletions
diff --git a/.github/workflows/zen.yml b/.github/workflows/zen.yml
index c292613..f2cc47a 100644
--- a/.github/workflows/zen.yml
+++ b/.github/workflows/zen.yml
@@ -8,9 +8,10 @@ on:
jobs:
build:
-
- runs-on: ubuntu-latest
-
+ strategy:
+ matrix:
+ os: [macos-15-intel, ubuntu-24.04]
+ runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: make
diff --git a/src/codegen/codegen.c b/src/codegen/codegen.c
index 91f5bb5..86295e4 100644
--- a/src/codegen/codegen.c
+++ b/src/codegen/codegen.c
@@ -10,6 +10,14 @@
#include "ast.h"
#include "zprep_plugin.h"
+#ifdef __APPLE__
+#define SEGMENT_NAME_PREFIX "__TEXT,"
+#define SEGMENT_NAME_SUFFIX ",regular,pure_instructions"
+#else
+#define SEGMENT_NAME_PREFIX ""
+#define SEGMENT_NAME_SUFFIX ""
+#endif
+
// static function for internal use.
static char *g_current_func_ret_type = NULL;
static void codegen_match_internal(ParserContext *ctx, ASTNode *node, FILE *out, int use_result)
@@ -1367,7 +1375,7 @@ void codegen_node_single(ParserContext *ctx, ASTNode *node, FILE *out)
{
fprintf(out, ", ");
}
- fprintf(out, "section(\"%s\")", node->func.section);
+ fprintf(out, "section(\"%s%s%s\")", SEGMENT_NAME_PREFIX, node->func.section, SEGMENT_NAME_SUFFIX);
}
#undef EMIT_ATTR
fprintf(out, ")) ");