From patchwork Wed Oct 29 06:58:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 122911 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 65B9D3858D20 for ; Wed, 29 Oct 2025 07:05:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 65B9D3858D20 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=cwSfv6le X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from sea.source.kernel.org (sea.source.kernel.org [IPv6:2600:3c0a:e001:78e:0:1991:8:25]) by sourceware.org (Postfix) with ESMTPS id 086C03858C83 for ; Wed, 29 Oct 2025 06:58:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 086C03858C83 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 086C03858C83 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2600:3c0a:e001:78e:0:1991:8:25 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761721139; cv=none; b=q9ZfPun9COPukWFr30P708GaspUyDaELBsWWxDojpFdofTsG8Jt3Yv82CgMZBJSdVedgbPprcxW1oJkPWau4WrcWEJVzDnaYPwWWj+WIOrsmp+68VHJxeD3cZKCS0s4wCeLo0w/XNyxHtQ1HiJwPmZaRZTFtdp6FbwGTW7j2BMQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761721139; c=relaxed/simple; bh=D/yvME0C/lUB0n4uO/wiGotLvGx4e5gqHnE2H1bZQLk=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=kf4n/E5rY2cEKvtduu+1KeAV5U6lZeAxgxJ812MOVQDjfBGalFKaz6TbmvvAr3o3jcMvxBl233zkU51pSvLmTiJHWv83liVmLI0zz3feeRTsaPucQYOBkfff7de0/fOYJrddpOqbJKGkEbEi6aVZZFM3lpGH+XFYUBN4ccl92Yo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 086C03858C83 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 5AA2A45802 for ; Wed, 29 Oct 2025 06:58:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EDBFC4CEFB; Wed, 29 Oct 2025 06:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761721138; bh=D/yvME0C/lUB0n4uO/wiGotLvGx4e5gqHnE2H1bZQLk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=cwSfv6levgjL57LvrplISPK4W2ygsHGaW91ia+tkFdD5N3n9EPBmnQ/Ym/koX4Xc0 ARfdL24+pLLPpvu7gZiWjCbF7VkwAkwLRK/hr2rS15Rx5VkYP20Byl0NK14iLhvCIk 97WavvAqp/C+SgFQEB2nQReQC9Ve/o9BDFZzakz757opXzQ5+9qj31sf9UDV5h1g4e ltEyg+yzFFlTMud+HER1/PAxZENi8Yie5fesdfu8VTBdrM0I9EVQA+EV2GLRDT/cpf I0U/GpKEUdjgdmNDKHQohZJJPkYQR3Yzri8qnlONLkIkItKEQ4JCxMaFsz3aYsg4+9 2rWZ/i8klZPiA== From: Vincent Mailhol Date: Wed, 29 Oct 2025 07:58:29 +0100 Subject: [PATCH 4/6] libgloss: i386: move profil_write() from cygmon-salib.c to cygmon-gmon.c MIME-Version: 1.0 Message-Id: <20251029-fix-libgloss-i386-compile-issues-v1-4-26edcb02f69c@kernel.org> References: <20251029-fix-libgloss-i386-compile-issues-v1-0-26edcb02f69c@kernel.org> In-Reply-To: <20251029-fix-libgloss-i386-compile-issues-v1-0-26edcb02f69c@kernel.org> To: newlib@sourceware.org Cc: Vincent Mailhol X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2396; i=mailhol@kernel.org; h=from:subject:message-id; bh=D/yvME0C/lUB0n4uO/wiGotLvGx4e5gqHnE2H1bZQLk=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDJmMu1X4hPSstRg8D8Xdc2WdJL9c58qDMP0L2Sy5F+Wi4 t6nlx/vKGVhEONikBVTZFlWzsmt0FHoHXboryXMHFYmkCEMXJwCMJF2FYa/Ur16Gf+ad2UeVnm0 N3U76xuB6TNKLq+7Wdqe7fftpYDbb4a/Mhc14nIdzdbH6rO5rlJulvFJ+Xz1w/HqyU8LUk5eXPC TFQA= X-Developer-Key: i=mailhol@kernel.org; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: newlib-bounces~patchwork=sourceware.org@sourceware.org _mcleanup() uses profil_write(). However, there is no prior declaration of profil_write() in cygmon-gmon.c leading to below GCC error: cygmon-gmon.c: In function '_mcleanup': cygmon-gmon.c:203:3: error: implicit declaration of function 'profil_write' [-Wimplicit-function-declaration] 203 | profil_write (1, sbuf, ssiz); | ^~~~~~~~~~~~ As a matter of facts, profil_write() is never used elsewhere than cygmon-gmon.c. Move profil_write() from cygmon-salib.c to cygmon-gmon.c. Add the required fcntl.h include. Also, change the type of profil_write()'s buffer parameter from char * to void * to prevent an incompatible pointer type warning. Finally, mark profil_write() as being a static function to make it clear that it is not used outside of the translation unit. Signed-off-by: Vincent Mailhol --- libgloss/i386/cygmon-gmon.c | 20 ++++++++++++++++++++ libgloss/i386/cygmon-salib.c | 19 ------------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/libgloss/i386/cygmon-gmon.c b/libgloss/i386/cygmon-gmon.c index 88bdf251c..778dbd76d 100644 --- a/libgloss/i386/cygmon-gmon.c +++ b/libgloss/i386/cygmon-gmon.c @@ -62,6 +62,7 @@ static char sccsid[] = "@(#)gmon.c 5.3 (Berkeley) 5/22/91"; #include #endif +#include #include #include #include @@ -193,6 +194,25 @@ monstartup(lowpc, highpc) moncontrol (1); } +static void +profil_write (int type, void *buffer, int len) +{ + static int des = -1; + + if (des < 0) + { + des = open ("gmon.out", O_WRONLY | O_CREAT | O_TRUNC, 0644); + } + if (len == 0) + { + close (des); + } + else + { + write (des, buffer, len); + } +} + void _mcleanup() { diff --git a/libgloss/i386/cygmon-salib.c b/libgloss/i386/cygmon-salib.c index b4a4d34b3..734afe9d6 100644 --- a/libgloss/i386/cygmon-salib.c +++ b/libgloss/i386/cygmon-salib.c @@ -161,22 +161,3 @@ __do_global_dtors () } } #endif - -void -profil_write (int type, char *buffer, int len) -{ - static int des = -1; - - if (des < 0) - { - des = open ("gmon.out", O_WRONLY | O_CREAT | O_TRUNC, 0644); - } - if (len == 0) - { - close (des); - } - else - { - write (des, buffer, len); - } -}