summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2017-11-20 11:01:28 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2017-11-20 11:14:35 +0100
commit46c063c6f939b410ece1edcf63c312d8283de4eb (patch)
tree26008f812f9a8bf3cb5a608ebe5ec23045679bef
parent9f1ad299c93112fd9744311aad04d16f46ab2442 (diff)
downloadouroboros-46c063c6f939b410ece1edcf63c312d8283de4eb.tar.gz
ouroboros-46c063c6f939b410ece1edcf63c312d8283de4eb.zip
lib: Fix init and fini ELF sections for OS X
OS X uses a different syntax for specifying ELF sections. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
-rw-r--r--src/lib/dev.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 35a2328c..3c81d1db 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -468,8 +468,16 @@ static void fini(void)
pthread_rwlock_destroy(&ai.lock);
}
-__attribute__((section(".init_array"))) __typeof__(init) * __init = init;
-__attribute__((section(".fini_array"))) __typeof__(fini) * __fini = fini;
+#if defined(__MACH__) && defined(__APPLE__)
+#define INIT_SECTION "__DATA, __mod_init_func"
+#define FINI_SECTION "__DATA, __mod_term_func"
+#else
+#define INIT_SECTION ".init_array"
+#define FINI_SECTION ".fini_array"
+#endif
+
+__attribute__((section(INIT_SECTION))) __typeof__(init) * __init = init;
+__attribute__((section(FINI_SECTION))) __typeof__(fini) * __fini = fini;
int flow_accept(qosspec_t * qs,
const struct timespec * timeo)