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

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
@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.