From patchwork Wed Dec 3 20:04:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 125852 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B77041439C7 for ; Wed, 3 Dec 2025 20:05:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B77041439C7 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=bell.net header.i=@bell.net header.a=rsa-sha256 header.s=selector1 header.b=MzfeOB/9 X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from cmx-torrgo001.bell.net (mta-tor-007.bell.net [209.71.212.44]) by sourceware.org (Postfix) with ESMTP id 1A7B94143B1E for ; Wed, 3 Dec 2025 20:04:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1A7B94143B1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=bell.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bell.net ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1A7B94143B1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.71.212.44 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764792283; cv=none; b=LMusaNpFt+IDwK+qiPB1w1xBpj1t6F77lGE4nLo5+4MoMfmhwokIRS7h4lbdv128IZ6Nem/ZLbJUwRVPefSj1SjO78DZBrCUdkd2ENn5Iop+PBjf3t29IE8sL5fjb4ni0Ik4kqTozyQ+Nl47Th/tAnOgOu/3itnUinblNHHiua4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764792283; c=relaxed/simple; bh=2sEC6UicnfVnPwmh4Am65zjZK5wYBXbfRouEF066hvo=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=RuyloJZlZhihHp1+Bu2JNAgyN4VNKFRCQMNoyWPTp8MU56lByGLeqmKbgu+DgLQ4nSwUXPSILaCcNTL2WoxnzbgWDtcgPB3Rt4uGzUHP/PIqnUOIBYug23exBCnCLk1natLM5Xlhem3fk+bY9hkdne4imXoS8rlwv2CetNIdMw0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A7B94143B1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell.net; s=selector1; t=1764792283; bh=Ip4VWtOyC0X68WQhtKWGLgug8m5mxq9B1uMO/O3gSyE=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type; b=MzfeOB/95G0gw1ZMF1MKPoHsQeCzWNQyR99neeJvbRnPQbYpYpqjgHR41dzEXhaTjMDoJJpVmjjYpqLPtB1hXxKT84SF/MKWgItKrQ1TZL0VHX3zWcDhXRlSKiYaTvrWxLxKLH6ew8nrZ9Kdhn7e36OO605gb5pyGGCwvO5PqjerQl2Pa2CMUuaYJ2fy6j6Hnwp6HRhdyM+twzhlL3/dUEWxD99zA3Kp39H66iQabiUVrMn43AS+3MvRWoLgWE3rpXuGRg5zFGwP7m98Z/JP4IDvu+4hFZsflCArRcqxgEY51gSRNYKW/8RoUiyVnRxNl6JhAoW6Y39zfUYrFIiSkw== X-RG-SOPHOS: Clean X-RG-VADE-SC: 0 X-RG-VADE: Clean X-Originating-IP: [142.126.189.246] X-RG-Env-Sender: dave.anglin@bell.net X-RG-Rigid: 6905EC3B03B2B383 X-RazorGate-Vade: dmFkZTGBqnVK8vNi1oESdR/Ad1qniznAAY/7HwIJl79TmJHTyM4YYfE++5rVgvdr7E+Wx8grKkctwmFNR77Cy/xmhaKNiTnodNoWMjfUPeS5yAKOQzhObuutD7f7WCsncMiCbPub1A2gyq+LgRzvarh+b+2979MTjRos9onHoKCogdakV1xjFTx9bBWJJ055Spmz4+8xFONq10SJ8tBWu3WQSUVfT5bMSSmExqNtUSU4mCkfN0jpNMA6kLdQva6CbkdPEY13cixv4X9amRlBqlbXi1SREm9YVUv5H7dnfA18a6h5I3qbPbqhivjg7y7RJodO84EfFPOGhJV0yuD9Tc3Sk8HxXRD2QgnUL6YpB06aaMeAk70LGygas3OqcPgkW5xvAfbJJLqe5xM/Hc2V9/3M6YW2ADVHJnga2AOibGX2Z/1HlOPlVULdy0ohKe3MM2C1e5wccmdakaFXRcckO4amZ/MzTlNWO0oJAdpLrkxKmgu8PT4TjWNM7eSqpXq4ENI63lITGoqyfLhjTAc22UBhEeA/ICM3CrrGk/BwaxoR3q6SJ+GrOJuR1Q86knA9SXQcNdmkXDlT8OSM7+ccx/rWiZ03CMqmcwz8Nv0Je/LovuRr09pt8+DhM462/K86LOF4nil+aLpc+ATCfm0Fi9Lf9uQY3RZv+qox7kzre8bQ3uC8HA X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from mx3210.local (142.126.189.246) by cmx-torrgo001.bell.net (authenticated as dave.anglin@bell.net) id 6905EC3B03B2B383; Wed, 3 Dec 2025 15:04:42 -0500 Date: Wed, 3 Dec 2025 15:04:41 -0500 From: John David Anglin To: Binutils Subject: [PATCH] Fix binutils build on hppa64-hpux with gcc-16 (v2) Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_HOSTKARMA_W, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org This version implements some suggestions from Jan Beulich. We only include strings.h when it's available. It's a POSIX header and not defined in C99. A declaration for strtoull() is added to the sysdep.h headers to avoid having to check for the long long type. I fixed some typos in the changelog. Okay? Dave --- Fix binutils build on hppa64-hpux with gcc-16 (v2) With recent gcc versions, implicit function declarations are errors. We need to ensure that ffs() and strtoull() are declared and correctly checked for by configure. On hpux11, ffs() is declared in strings.h. So, we need to ensure strings.h is included when it's available. strtoull() is not defined but it's provided by libiberty. An unnecessary include of strings.h in elf32-xtensa.c is removed. 2025-12-03 John David Anglin bfd/ChangeLog: * configure.ac: Check for strings.h header. Check for strtoull declaration. * elf32-xtensa.c: Remove strings.h include. * configure: Regenerate. * config.in: Regenerate. * sysdep.h: Include strings.h and declare strtoull() if a declaration for it isn't found by configure. ld/ChangeLog: * configure.ac: Check for strtoull declaration. * configure: Regenerate. * config.in: Regenerate. * sysdep.h: Declare strtoull() if a declaration for it isn't found by configure. diff --git a/bfd/configure.ac b/bfd/configure.ac index 4fb3bf41f34..af4728eac20 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac @@ -217,12 +217,12 @@ fi BFD_CC_FOR_BUILD AC_CHECK_HEADERS(fcntl.h sys/file.h sys/resource.h sys/stat.h sys/types.h \ - unistd.h) + strings.h unistd.h) AC_CHECK_FUNCS(fcntl fdopen fileno fls getgid getpagesize getrlimit getuid \ sysconf) -AC_CHECK_DECLS([basename, ffs, stpcpy, asprintf, vasprintf, strnlen]) +AC_CHECK_DECLS([basename, ffs, stpcpy, asprintf, vasprintf, strnlen, strtoull]) AC_CHECK_DECLS([___lc_codepage_func], [], [], [[#include ]]) BFD_BINARY_FOPEN diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 20b6292c14e..168e7491c20 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -22,7 +22,6 @@ #include "bfd.h" #include -#include #include "bfdlink.h" #include "libbfd.h" diff --git a/bfd/sysdep.h b/bfd/sysdep.h index 1f54a9d897d..e6c8b8a787a 100644 --- a/bfd/sysdep.h +++ b/bfd/sysdep.h @@ -37,6 +37,10 @@ #include #include +#ifdef HAVE_STRINGS_H +#include +#endif + #ifdef HAVE_UNISTD_H #include #endif @@ -112,6 +116,10 @@ extern int ffs (int); extern char *stpcpy (char *__dest, const char *__src); #endif +#if !HAVE_DECL_STRTOULL +extern unsigned long long strtoull(const char *, char **, int); +#endif + #ifdef HAVE_FTELLO #if !HAVE_DECL_FTELLO extern off_t ftello (FILE *stream); diff --git a/ld/configure.ac b/ld/configure.ac index 3e44e3361ef..2c4cc47de01 100644 --- a/ld/configure.ac +++ b/ld/configure.ac @@ -451,7 +451,7 @@ AC_CHECK_FUNCS(close getrusage glob lseek mkstemp open realpath waitpid) BFD_BINARY_FOPEN -AC_CHECK_DECLS([environ, stpcpy]) +AC_CHECK_DECLS([environ, stpcpy, strtoull]) GCC_AC_FUNC_MMAP diff --git a/ld/sysdep.h b/ld/sysdep.h index 1d5cc3ce424..70de112a513 100644 --- a/ld/sysdep.h +++ b/ld/sysdep.h @@ -96,6 +96,10 @@ extern char **environ; extern char *stpcpy (char *__dest, const char *__src); #endif +#if !HAVE_DECL_STRTOULL +extern unsigned long long strtoull(const char *, char **, int); +#endif + #define POISON_BFD_BOOLEAN 1 #endif /* ! defined (LD_SYSDEP_H) */