Re: [PATCH 0/2] fix undefined reference to `__ssputws_r'

Hau Hsu <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
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 <[email protected]> wrote:
> 
> Hi Hau Hsu,
> 
> are you looking into this?
> 
> 
> Thanks,
> Corinna
> 
> 
> On Jul 15 10:53, Torbjorn SVENSSON wrote:
>> Hi again,
>> 
>> I do not have time to dig into this right now, but these are the test cases
>> that start to fail after applying the 2 patches suggested by Hau Hsu:
>> 
>> FAIL: 27_io/objects/wchar_t/12048-1.cc  -std=gnu++17 execution test
>> FAIL: 27_io/objects/wchar_t/12048-2.cc  -std=gnu++17 execution test
>> FAIL: 27_io/objects/wchar_t/12048-3.cc  -std=gnu++17 execution test
>> FAIL: 27_io/objects/wchar_t/12048-4.cc  -std=gnu++17 execution test
>> FAIL: 27_io/objects/wchar_t/2.cc  -std=gnu++17 output pattern test
>> FAIL: 27_io/objects/wchar_t/9662.cc  -std=gnu++17 execution test
>> FAIL: ext/stdio_sync_filebuf/wchar_t/1.cc  -std=gnu++17 execution test
>> FAIL: ext/stdio_sync_filebuf/wchar_t/12948-1.cc  -std=gnu++17 execution test
>> FAIL: ext/stdio_sync_filebuf/wchar_t/12948-2.cc  -std=gnu++17 execution test
>> FAIL: ext/stdio_sync_filebuf/wchar_t/12948-3.cc  -std=gnu++17 execution test
>> FAIL: ext/stdio_sync_filebuf/wchar_t/12948-4.cc  -std=gnu++17 execution test
>> 
>> This was checked with basepoints/gcc-15-1852-g320c2ed4d2b and newlib
>> 1339af44679aee0895fe311cfad89d38cfc2b919 built for arm-none-eabi.
>> 
>> Kind regards,
>> Torbjörn
>> 
>> 
>> On 2024-07-12 10:07, Torbjorn SVENSSON wrote:
>>> Hi,
>>> 
>>> 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.
>>> 
>>> 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.
>>> 
>>> Kind regards,
>>> Torbjörn
>>> 
>>> On 2024-07-09 12:48, Corinna Vinschen wrote:
>>>> @Torbjörn,
>>>> 
>>>> would you mind to take a look?  Any input on this?
>>>> 
>>>> FWIW< this looks right to me.
>>>> 
>>>> 
>>>> Thanks,
>>>> Corinna
>>>> 
>>>> 
>>>> 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:
>>>>> 
>>>>> svfwprintf.c:(.text._svfwprintf_r+0x8e): undefined reference to
>>>>> `__ssputws_r'
>>>>> 
>>>>> *Cause*
>>>>> This is because commit
>>>>> "v{fs}printf/v{fs}wprintf: create external output helpers"
>>>>> <https://cygwin.com/git/?p=newlib-
>>>>> cygwin.git;a=commit;h=61ccd3f94f92bcfc0940f0595ea5b3b72bce3c6d>
>>>>> 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 enabled.
>>>>> 
>>>>> The problem is that the function __ssputws_r() is used by svfwprintf(),
>>>>> which is compiled no matter whether newlib_nano_formated_io is enabled.
>>>>> 
>>>>> *Fix*
>>>>> This patch fix the issue by building ssputws_r.c regardless of whether
>>>>> newlib_nano_formated_io is enabled.
>>>>> 
>>>>> *Problem of the previous fix*
>>>>> Note that we also reverts a previouls patch that tries to fix the same
>>>>> link error:
>>>>> <https://cygwin.com/git/?p=newlib-
>>>>> cygwin.git;a=commitdiff;h=3b97a5ec67a5a52c130158bb143949cd842de305>
>>>>> Because we got other errors after applying this patch:
>>>>> 
>>>>> undefined reference to `putwc'
>>>>> ...
>>>>> undefined reference to `getwc'
>>>>> ...
>>>>> undefined reference to `swprintf'
>>>>> 
>>>>> The previous patch removes wchar_t functions from
>>>>> NEWLIB_NANO_FORMATTED_IO, but in the newlib/README says:
>>>>> 
>>>>>> --enable-newlib-nano-formatted-io
>>>>>>    This option does not affect wide-char formatted I/O functions
>>>>> 
>>>>> Thus I think we shouldn't remove wchar_t functions from
>>>>> newlib_nano_formated_io.
>>>>> 
>>>>> Similar bug report:
>>>>> * https://inbox.sourceware.org/newlib/
>>>>> [email protected]/t/
>>>>> 
>>>>> 
>>>>> 
>>>>> Hau Hsu (2):
>>>>>    Revert "libc/stdio: Remove wchar_t functions from
>>>>>      NEWLIB_NANO_FORMATTED_IO"
>>>>>    libc/stdio: fix undefined reference to `__ssputws_r'
>>>>> 
>>>>>   newlib/Makefile.in             | 1004 ++++++++++++++++----------------
>>>>>   newlib/libc/stdio/Makefile.inc |   54 +-
>>>>>   2 files changed, 528 insertions(+), 530 deletions(-)
>>>>> 
>>>>> -- 
>>>>> 2.31.1
>>>> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.