From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by sourceware.org (Postfix) with ESMTPS id 529FB385DDC2 for ; Wed, 17 Jul 2024 01:21:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 529FB385DDC2 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 529FB385DDC2 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1033 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721179311; cv=none; b=wTnWyKoQ8u4yKLyNPFPD7F/MnWyvSkEp/pdjzYCPWD6b/rLCtDPEt3XBUfSug+j6EhdyC0a4M5g6fFWrWgWMtbuF5WqEH/bCzKpDYzas3OPVv8z9eaC1FXtXjGhu7erKmA7tA8+6PCZNNavJObbOh4YqZrVh61DO5h72i0NbiAg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721179311; c=relaxed/simple; bh=cOaO1NH6y8+tBs71kqtmZhodwK4F/yYBPHaZ9B2Jy9M=; h=DKIM-Signature:From:Message-Id:Mime-Version:Subject:Date:To; b=vRmbvES/hYVVDMp9S6Je+IHPLhCnHn7AFOCJFJpqui2cap9n261inzasosFrzuTtHfTDMI/XaYCSkRQKTWbMzewFiYwB/yyD25YykM45DwA0upeFLybXoZ2qy/p0XA0+XcI0Awq0IokN7UJOOWj2SW3QCCJ/lA9oiBntBBbSfAE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2c967e21888so4613505a91.1 for ; Tue, 16 Jul 2024 18:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1721179307; x=1721784107; darn=sourceware.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=UxD2JEyvvBvRDZLU/FamqOICoOPIQWJ7Gfs96HdcoqA=; b=dABw+oSOenzrUmtJkMSEFO3LMKPDPo77zUTEBpeGHrD/yhTTW8BmHmo+UeAudu5GM2 h0ygaLBlbAv59mtOwKIFweaORR+OECV29tJ4ZPrQmMh7dcinF9p2FiMMn2XcgmTrBWb/ UN92ggiayGxuXGO6AlDUDmAk0nDxD/b8d0O7qeBHBpGYfSs6qnTy+JFBcBZLinB0OeQU 7g2Bkv0FU6d/P8xThzgtOE3cRR5ePi8B+O7Ja0hUwLPcCaMTjCuTW3V/0vxg7VqwAGgl eLtLWFfZ0+4n5bMUOlBowJs2Rihog7DnwveQJ0yOmH+YoG6s2gBybxzcQLSgMO0bWzPj RTVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721179307; x=1721784107; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UxD2JEyvvBvRDZLU/FamqOICoOPIQWJ7Gfs96HdcoqA=; b=MjbxRXbzfXgSAY01ZeTGXNM8+Gu5b7TfMV+03jnvyAqXqqWmCae50PxSTK+Ze0jHjl keA+FoScGzI2ogeUDQYohyzJRoBOOMLksCVrY9FWr3TWfEvRWE6xlqyKSrCKY1QU6mDT 8EbuXkU3XCTgPOLDzIZks/BxSNbhu+WVnMuK3eLvL2eUJpSXZEIYSZi6j1QEO/8Ycr7L V8u2mYT0sokRlTOJDAVxc0SZHOPbuuL5Ki2Mx4Vuw0yRULERk/ShHz6Wb88MPyFMRwVF OIYP7W339ttEM1nUDvv+ohwiEY3H0S7d4wO1C41JQJhnV19pBkBN3+SSDUslj5J5Hc6y nK6A== X-Gm-Message-State: AOJu0Yw3KNQGP7alEGQGxh1g8tdiijuyiaB2qZ7YFb21cqEMcP7snYOb B/ogd8ywXLawyAofUh6Z5RBbrvf+RjOdmufvCh2Fa6kXqatA64gEHR+VQo4iR7HvVdxbJVCHbDV bWH5mzUWtnxcWcYTAQgSzC3PVDjUNu35xAFXt3sWc1AyTbCvJ3t2qmSnVPa24G7pFceOfeLZzM0 4Cx7ut/VW6ybm6x4KO024L//lVf3QL/5siz9LK X-Google-Smtp-Source: AGHT+IFsGL5gfrf1pUGqjjTx6r7tXoirzWOQ2VatiqIr1BZUSXu/7Cgf795MDcmP/gpn9PpL0P/b4w== X-Received: by 2002:a17:90b:2309:b0:2c9:88af:300c with SMTP id 98e67ed59e1d1-2cb52791a74mr114771a91.18.1721179306456; Tue, 16 Jul 2024 18:21:46 -0700 (PDT) Received: from smtpclient.apple (1-169-253-193.dynamic-ip.hinet.net. [1.169.253.193]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2caedc92d02sm6911730a91.40.2024.07.16.18.21.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2024 18:21:46 -0700 (PDT) From: Hau Hsu Message-Id: <35D6E65A-2F4A-469E-80DE-F66431AEADA5@sifive.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_E867C75C-4643-4432-BC1D-72FDCBA7E850" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: [PATCH 0/2] fix undefined reference to `__ssputws_r' Date: Wed, 17 Jul 2024 09:21:30 +0800 In-Reply-To: Cc: Torbjorn SVENSSON , kito.cheng@gmail.com To: newlib@sourceware.org References: <20240708040157.3770926-1-hau.hsu@sifive.com> <0aa28bbc-407c-44e9-8ab3-2e34dbed8a8b@foss.st.com> X-Mailer: Apple Mail (2.3774.600.62) X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,KAM_LOTSOFHASH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,URIBL_SBL_A autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --Apple-Mail=_E867C75C-4643-4432-BC1D-72FDCBA7E850 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Oh I didn't receive the mail that reports the failures. I'll check whether we have the same issues in our RISC-V toolchain. Thanks, Hau Hsu > On Jul 16, 2024, at 17:34, Corinna Vinschen wrote: >=20 > Hi Hau Hsu, >=20 > are you looking into this? >=20 >=20 > Thanks, > Corinna >=20 >=20 > On Jul 15 10:53, Torbjorn SVENSSON wrote: >> Hi again, >>=20 >> I do not have time to dig into this right now, but these are the test ca= ses >> that start to fail after applying the 2 patches suggested by Hau Hsu: >>=20 >> FAIL: 27_io/objects/wchar_t/12048-1.cc -std=3Dgnu++17 execution test >> FAIL: 27_io/objects/wchar_t/12048-2.cc -std=3Dgnu++17 execution test >> FAIL: 27_io/objects/wchar_t/12048-3.cc -std=3Dgnu++17 execution test >> FAIL: 27_io/objects/wchar_t/12048-4.cc -std=3Dgnu++17 execution test >> FAIL: 27_io/objects/wchar_t/2.cc -std=3Dgnu++17 output pattern test >> FAIL: 27_io/objects/wchar_t/9662.cc -std=3Dgnu++17 execution test >> FAIL: ext/stdio_sync_filebuf/wchar_t/1.cc -std=3Dgnu++17 execution test >> FAIL: ext/stdio_sync_filebuf/wchar_t/12948-1.cc -std=3Dgnu++17 executio= n test >> FAIL: ext/stdio_sync_filebuf/wchar_t/12948-2.cc -std=3Dgnu++17 executio= n test >> FAIL: ext/stdio_sync_filebuf/wchar_t/12948-3.cc -std=3Dgnu++17 executio= n test >> FAIL: ext/stdio_sync_filebuf/wchar_t/12948-4.cc -std=3Dgnu++17 executio= n test >>=20 >> This was checked with basepoints/gcc-15-1852-g320c2ed4d2b and newlib >> 1339af44679aee0895fe311cfad89d38cfc2b919 built for arm-none-eabi. >>=20 >> Kind regards, >> Torbj=C3=B6rn >>=20 >>=20 >> On 2024-07-12 10:07, Torbjorn SVENSSON wrote: >>> Hi, >>>=20 >>> I've looked at the patch and I think it's fine. >>> I am currently building a toolchain with the patch series applied and >>> will run the tests on it. I'll get back with the result early next week. >>>=20 >>> The reason why I didn't go this route before was that I was afraid that >>> there would be more functions that would be missing. Hopefully, the >>> tests will show that this is not the case. >>>=20 >>> Kind regards, >>> Torbj=C3=B6rn >>>=20 >>> On 2024-07-09 12:48, Corinna Vinschen wrote: >>>> @Torbj=C3=B6rn, >>>>=20 >>>> would you mind to take a look? Any input on this? >>>>=20 >>>> FWIW< this looks right to me. >>>>=20 >>>>=20 >>>> Thanks, >>>> Corinna >>>>=20 >>>>=20 >>>> On Jul 8 12:01, Hau Hsu wrote: >>>>> *Issue* >>>>> When compile a simple C++ hello world, we got undefined reference to >>>>> `__ssputws_r' error with NEWLIB_NANO_FORMATTED_IO after upgrading to >>>>> newlib-4.4 in risc-v toolchain: >>>>>=20 >>>>> svfwprintf.c:(.text._svfwprintf_r+0x8e): undefined reference to >>>>> `__ssputws_r' >>>>>=20 >>>>> *Cause* >>>>> This is because commit >>>>> "v{fs}printf/v{fs}wprintf: create external output helpers" >>>>> >>>> cygwin.git;a=3Dcommit;h=3D61ccd3f94f92bcfc0940f0595ea5b3b72bce3c6d> >>>>> introduces a new file ssputws_r.c for a wide-char-oriented >>>>> helper function. >>>>> But this file will not be built when newlib_nano_formated_io is enabl= ed. >>>>>=20 >>>>> The problem is that the function __ssputws_r() is used by svfwprintf(= ), >>>>> which is compiled no matter whether newlib_nano_formated_io is enable= d. >>>>>=20 >>>>> *Fix* >>>>> This patch fix the issue by building ssputws_r.c regardless of whether >>>>> newlib_nano_formated_io is enabled. >>>>>=20 >>>>> *Problem of the previous fix* >>>>> Note that we also reverts a previouls patch that tries to fix the same >>>>> link error: >>>>> >>>> cygwin.git;a=3Dcommitdiff;h=3D3b97a5ec67a5a52c130158bb143949cd842de30= 5> >>>>> Because we got other errors after applying this patch: >>>>>=20 >>>>> undefined reference to `putwc' >>>>> ... >>>>> undefined reference to `getwc' >>>>> ... >>>>> undefined reference to `swprintf' >>>>>=20 >>>>> The previous patch removes wchar_t functions from >>>>> NEWLIB_NANO_FORMATTED_IO, but in the newlib/README says: >>>>>=20 >>>>>> --enable-newlib-nano-formatted-io >>>>>> This option does not affect wide-char formatted I/O functions >>>>>=20 >>>>> Thus I think we shouldn't remove wchar_t functions from >>>>> newlib_nano_formated_io. >>>>>=20 >>>>> Similar bug report: >>>>> * https://inbox.sourceware.org/newlib/ >>>>> ed0b48da6c6c4beaacd9fad63efaddc0@syntacore.com/t/ >>>>>=20 >>>>>=20 >>>>>=20 >>>>> Hau Hsu (2): >>>>> Revert "libc/stdio: Remove wchar_t functions from >>>>> NEWLIB_NANO_FORMATTED_IO" >>>>> libc/stdio: fix undefined reference to `__ssputws_r' >>>>>=20 >>>>> newlib/Makefile.in | 1004 ++++++++++++++++-------------= --- >>>>> newlib/libc/stdio/Makefile.inc | 54 +- >>>>> 2 files changed, 528 insertions(+), 530 deletions(-) >>>>>=20 >>>>> --=20 >>>>> 2.31.1 >>>>=20 >=20 --Apple-Mail=_E867C75C-4643-4432-BC1D-72FDCBA7E850--