From 2a96af743eb5f83f78e736994e3a22f25fba978b Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 24 Aug 2025 20:09:17 +0000 Subject: [PATCH] fix build warnings for Haiku. especially linker warning about php binary having an executable stack. cloe GH-19575 --- NEWS | 1 + configure.ac | 5 +++++ ext/sockets/sockets.c | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 8350e4dfa2e6..04c041e50a34 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ PHP NEWS . Using null as an array offset or when calling array_key_exists() is now deprecated. (alexandre-daubois) . Fixed bug GH-19681 (PHP_EXPAND_PATH broken with bash 5.3.0). (Remi) + . Marks the stack as non-executable on Haiku. (David Carlier) - CLI: . Fixed bug GH-19461 (Improve error message on listening error with IPv6 diff --git a/configure.ac b/configure.ac index 633244962d8d..5059f55127b0 100644 --- a/configure.ac +++ b/configure.ac @@ -217,7 +217,12 @@ dnl supports it. This can help reduce the binary size and startup time. AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [CFLAGS="$CFLAGS -fvisibility=hidden"]) +dnl to disable executable stack on haiku due +dnl to missing elf .note.GNU-stack part case $host_alias in + *haiku*) + LDFLAGS="$LDFLAGS -Wl,-z,noexecstack" + ;; *solaris*) CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS" ;; diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 3cae726838a6..6fb75e2db1db 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -109,7 +109,9 @@ ZEND_DECLARE_MODULE_GLOBALS(sockets) } \ } while (0) #else -#define PHP_ETH_PROTO_CHECK(protocol, family) (0) +#define PHP_ETH_PROTO_CHECK(protocol, family) \ + (void)protocol; \ + (void)family #endif static PHP_GINIT_FUNCTION(sockets);