__ssputws_r undefined while using nano.specs on fpv4-sp-d16 hard

Cui Alan <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <OS3P286MB221362830AAA2E94A3022614ADAE2@OS3P286MB2213.JPNP286.PROD.OUTLOOK.COM>
Hello,
I'm build STM32G474 system using newlib-nano.
While linking, it reported errors:
/usr/lib/gcc/arm-none-eabi/13.2.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/13.2.1/../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libg_nano.a(libc_a-svfwprintf.o): in function `_svfwprintf_r':
/build/reproducible-path/newlib-4.4.0.20231231/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/../../../../../../newlib/libc/stdio/vfwprintf.c:647:(.text+0x2ac): undefined reference to `__ssputws_r'
/usr/lib/gcc/arm-none-eabi/13.2.1/../../../arm-none-eabi/bin/ld: /build/reproducible-path/newlib-4.4.0.20231231/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/../../../../../../newlib/libc/stdio/vfwprintf.c:1445:(.text+0x2d6): undefined reference to `__ssputws_r'
/usr/lib/gcc/arm-none-eabi/13.2.1/../../../arm-none-eabi/bin/ld: /build/reproducible-path/newlib-4.4.0.20231231/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/../../../../../../newlib/libc/stdio/vfwprintf.c:1491:(.text+0x3cc): undefined reference to `__ssputws_r'
/usr/lib/gcc/arm-none-eabi/13.2.1/../../../arm-none-eabi/bin/ld: /build/reproducible-path/newlib-4.4.0.20231231/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/../../../../../../newlib/libc/stdio/vfwprintf.c:1492:(.text+0x416): undefined reference to `__ssputws_r'
/usr/lib/gcc/arm-none-eabi/13.2.1/../../../arm-none-eabi/bin/ld: /build/reproducible-path/newlib-4.4.0.20231231/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/../../../../../../newlib/libc/stdio/vfwprintf.c:1442:(.text+0x42c): undefined reference to `__ssputws_r'
/usr/lib/gcc/arm-none-eabi/13.2.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/13.2.1/../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libg_nano.a(libc_a-svfwprintf.o):/build/reproducible-path/newlib-4.4.0.20231231/build_nano/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/../../../../../../newlib/libc/stdio/vfwprintf.c:1436: more undefined references to `__ssputws_r' follow

Flags for g++:
-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard --specs=nosys.specs --specs=nano.specs -DSTM32G474xx -DSTM32G4xx -DUSE_HAL_DRIVER -Wall -Wextra -O0 -g3 -fdata-sections -ffunction-sections -g -std=gnu17 -MD -MT

Flags for linker(g++):
-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard --specs=nosys.specs --specs=nano.specs -DSTM32G474xx -DSTM32G4xx -DUSE_HAL_DRIVER -Wall -Wextra -O0 -g3 -fdata-sections -ffunction-sections -fno-rtti -fno-exceptions -fno-threadsafe-statics -g  -T "/home/alancui/ArisaFirmware/src/system.ld" -Wl,-Map=arisafw.map -Wl,--gc-sections -Wl,--start-group -Wl,--end-group -Wl,--print-memory-usage

gcc version 13.2.1 20231009 (15:13.2.rel1-2) (Debian)
Package: libstdc++-arm-none-eabi-newlib: 15:13.2.rel1-2+26(Debian)

After add a proxy forward __ssputws_r  to __ssputs_r as what Cygwin did (newlib/libc/stdio/ssputws_r.c), the system works fine.
extern int __ssputs_r(struct _reent *ptr, FILE *fp, const char *buf, size_t len); int __ssputws_r(struct _reent *ptr, FILE *fp, const wchar_t *buf, size_t len) {
    return __ssputs_r(ptr, fp, (const char *)buf, len * sizeof(wchar_t)); }

I'd like to know is that a configuration error or a bug of newlib.

Alan
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.