Commit e169ba2b83c780058fe626856cfdb5903a85cb97

Kylie McClain 2016-04-29T21:04:07

Fix usage on musl libc A gcc compiled on musl does not define __gnu_linux__, it defines __linux__. Only on glibc does __gnu_linux__ get defined, but both define __linux__, so we should check for that instead. With this patch, libffi works perfectly, and passes its testsuite entirely on musl libc systems.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/closures.c b/src/closures.c
index 3dec0e3..05849e0 100644
--- a/src/closures.c
+++ b/src/closures.c
@@ -35,7 +35,7 @@
 #include <ffi_common.h>
 
 #if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE
-# if __gnu_linux__ && !defined(__ANDROID__)
+# if __linux__ && !defined(__ANDROID__)
 /* This macro indicates it may be forbidden to map anonymous memory
    with both write and execute permission.  Code compiled when this
    option is defined will attempt to map such pages once, but if it