[PATCH] libsframe: testsuite: Fix testsuite build on Solaris [PR33168]

Indu Bhagat indu.bhagat@oracle.com
Fri Aug 29 22:09:17 GMT 2025
On 8/15/25 1:08 AM, Rainer Orth wrote:
> As reported in PR libsframe/33168, the libsframe tests don't build on
> Solaris.  The failure is
> 
> In file included from libsframe/testsuite/libsframe.decode/be-flipping.c:28:
> /usr/include/dejagnu.h:48:1: error: conflicting types for ‘wait’; have ‘void(void)’
>     48 | wait (void)
>        | ^~~~
> In file included from /usr/include/stdlib.h:16,
>                   from libsframe/testsuite/libsframe.decode/be-flipping.c:21:
> /usr/include/sys/wait.h:85:14: note: previous declaration of ‘wait’ with type ‘pid_t(int *)’ {aka ‘long int(int *)’}
>     85 | extern pid_t wait(int *);
>        |              ^~~~
> 
> We have a combination of two factors here:
> 
> * Solaris <stdlib.h> has
> 
> #if defined(__EXTENSIONS__) || defined(_XPG4)
> #include <sys/wait.h>
> #endif
> 
>    and configure.ac predefines __EXTENSIONS__ due to the use of
>    AC_USE_SYSTEM_EXTENSIONS.
> 
> * This conflicts with <dejagnu.h>'s definition
> 
> void
> wait (void)
> {
> ...
> }
> 
> While this version of wait was removed in upstream DejaGnu, the removal
> only happened after the latest release, 1.6.3.
> 
> To avoid this, this patch just removes AC_USE_SYSTEM_EXTENSIONS which is
> responsible for the __EXTENSIONS__ definition.
> 
> AC_USE_SYSTEM_EXTENSIONS was initially introduced due to PR
> binutils/6526 for the benefit of Interix 3.5 and carried forward from
> there to all configure.ac'.s.  However, AFAICS Interix isn't supported
> by libsframe at all, so removing it seems to be safe.
> 
> Tested on {i386,amd64}-pc-solaris2.11, {sparc,sparcv9}-sun-solaris2.11,
> {x86_64,i686}-pc-linux-gnu, and amd64-pc-freebsd14.0.
> 
> Ok for trunk?
> 

Apologies for the delay. Somehow lost track of this one.

The attached patch (2-sol2-libsframe-testsuite-dg.patch which removes 
AC_USE_SYSTEM_EXTENSIONS) is missing the libsframe/config.h.in 
regenerated file though.

I get this diff with --enable-maintainer-mode

diff --git a/libsframe/config.h.in b/libsframe/config.h.in
index 74810fd30df..b58b81b0a9c 100644
--- a/libsframe/config.h.in
+++ b/libsframe/config.h.in
@@ -85,28 +85,6 @@
  /* Define to 1 if you have the ANSI C header files. */
  #undef STDC_HEADERS

-/* Enable extensions on AIX 3, Interix.  */
-#ifndef _ALL_SOURCE
-# undef _ALL_SOURCE
-#endif
-/* Enable GNU extensions on systems that have them.  */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif
-/* Enable threading extensions on Solaris.  */
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-/* Enable extensions on HP NonStop.  */
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
-/* Enable general extensions on Solaris.  */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-
-
  /* Version number of package */
  #undef VERSION

@@ -120,13 +98,3 @@

  /* Define for large files, on AIX-style hosts. */
  #undef _LARGE_FILES
-
-/* Define to 1 if on MINIX. */
-#undef _MINIX
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
-   this defined. */
-#undef _POSIX_1_SOURCE
-
-/* Define to 1 if you need to in order for `stat' and other things to 
work. */
-#undef _POSIX_SOURCE

> The PR also contains a less intrusive patch which only disables the
> __EXTENSIONS__ definition on Solaris.  It was meant for inclusion in
> binutils 2.45, but this ship has already sailed:
> 
> diff --git a/libsframe/configure.ac b/libsframe/configure.ac
> --- a/libsframe/configure.ac
> +++ b/libsframe/configure.ac
> @@ -23,6 +23,13 @@ AC_CONFIG_SRCDIR(sframe.c)
>   
>   AC_CANONICAL_TARGET
>   
> +case "${host}" in
> +  # __EXTENSIONS__ includes <sys/wait.h> on Solaris, conflicting with
> +  # dejagnu.h's wait definition up to DejaGnu 1.6.3.
> +  *-*-solaris*)
> +    ac_cv_safe_to_define___extensions__=no
> +    ;;
> +esac
>   AC_USE_SYSTEM_EXTENSIONS
>   AM_INIT_AUTOMAKE
>   AM_SILENT_RULES([yes])
> 
> 	Rainer
> 

In general, I was inclining rather towards this "safer but uglier" stub 
instead of the patch removing AC_USE_SYSTEM_EXTENSIONS because:
   - most components in Binutils still do use AC_USE_SYSTEM_EXTENSIONS 
in their configure.ac,
   - I cannot evaluate whether removing AC_USE_SYSTEM_EXTENSIONS from 
one subsystem will later cause issues.

With both the reasons being in the I-am-not-sure category, I would 
appreciate any input from others on this.

Thanks



More information about the Binutils mailing list