build: fix build on darwin

Signed-off-by: Weijia Wang <contact@weijia.wang>
This commit is contained in:
Weijia Wang 2022-07-31 13:41:07 +02:00
parent dc2be77f63
commit f9aa9b4a07
7 changed files with 49 additions and 9 deletions

View file

@ -37,11 +37,17 @@ struct test {
int must_fail;
} __attribute__ ((aligned (16)));
#ifdef __APPLE__
#define TEST_SECTION "__RODATA,test_section"
#else
#define TEST_SECTION "test_section"
#endif
#define TEST(name) \
static void name(void); \
\
const struct test test##name \
__attribute__ ((used, section ("test_section"))) = { \
__attribute__ ((used, section (TEST_SECTION))) = { \
#name, name, 0 \
}; \
\
@ -51,7 +57,7 @@ struct test {
static void name(void); \
\
const struct test test##name \
__attribute__ ((used, section ("test_section"))) = { \
__attribute__ ((used, section (TEST_SECTION))) = { \
#name, name, 1 \
}; \
\