* Re: disable-newlib-io-long-double?
@ 2020-03-17 1:34 chengzhiwei (C)
2020-03-17 18:10 ` disable-newlib-io-long-double? Jim Wilson
0 siblings, 1 reply; 4+ messages in thread
From: chengzhiwei (C) @ 2020-03-17 1:34 UTC (permalink / raw)
To: Jim Wilson, newlib
Thanks!
Check the file of vfprintf.c, I guess I found the reason:
# ifdef _NO_LONGDBL
if (flags & LONGDBL) {
_fpvalue = (double)GET_ARG (N, ap, _LONG_DOUBLE);
} else {
_fpvalue = GET_ARG (N, ap, double);
}
There is an accuracy conversion step, but in my project, all of the long double symbols have been stripped away in libgcc.a, maybe I should patch the file of vfprintf.c.
zhiwei
-----邮件原件-----
发件人: Jim Wilson [mailto:jimw@sifive.com]
发送时间: 2020年3月17日 4:51
收件人: chengzhiwei (C) <chengzhiwei6@huawei.com>; newlib@sourceware.org
主题: Re: disable-newlib-io-long-double?
On 3/16/20 4:37 AM, chengzhiwei (C) wrote:
> In my project, all of the quadrature symbols have been stripped away in libgcc.a, so when I built newlib toolchain based on riscv32 target, we used the option "--disable-newlib-io-long-double" to turn off the feature of long double. But when performing a floating-point calculation, the symbol "trunctfdf2" is not defined correctly:
> libc.a(lib_a-vfprintf.o): in function `.L60':vfprintf.c:(.text+0x3fe): undefined reference to `__trunctfdf2'
--disable-newlib-io-long-double is the default. That configure option shouldn't do anything.
__trunctfdf2 comes from libgcc. Are you linking with libgcc?
Of course, if you have long double disabled, it is odd that you get a call to trunctfdf2. You should check how the vfprintf.c file was compiled. There is a _NO_LONGDBL that should be defined by default, and should prevent any long double code from being enabled in that file.
Jim
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: disable-newlib-io-long-double?
2020-03-17 1:34 disable-newlib-io-long-double? chengzhiwei (C)
@ 2020-03-17 18:10 ` Jim Wilson
0 siblings, 0 replies; 4+ messages in thread
From: Jim Wilson @ 2020-03-17 18:10 UTC (permalink / raw)
To: chengzhiwei (C); +Cc: newlib
On Mon, Mar 16, 2020 at 6:34 PM chengzhiwei (C) <chengzhiwei6@huawei.com> wrote:
> Check the file of vfprintf.c, I guess I found the reason:
> # ifdef _NO_LONGDBL
> if (flags & LONGDBL) {
> _fpvalue = (double)GET_ARG (N, ap, _LONG_DOUBLE);
> } else {
> _fpvalue = GET_ARG (N, ap, double);
> }
> There is an accuracy conversion step, but in my project, all of the long double symbols have been stripped away in libgcc.a, maybe I should patch the file of vfprintf.c.
Another option is --enable-newlib-nano-formatted-io which uses the
nano-vfprintf.c file instead of vprintf.c. This drops more features
from vprintf, including the long double support.
You might want to look at github.com/riscv/riscv-gnu-toolchain for
comparison. It builds a regular newlib and a newlib nano, where the
newlib nano uses --enable-newlib-nano-formatted-io,
Jim
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: disable-newlib-io-long-double?
2020-03-16 11:37 disable-newlib-io-long-double? chengzhiwei (C)
@ 2020-03-16 20:50 ` Jim Wilson
0 siblings, 0 replies; 4+ messages in thread
From: Jim Wilson @ 2020-03-16 20:50 UTC (permalink / raw)
To: chengzhiwei (C), newlib
On 3/16/20 4:37 AM, chengzhiwei (C) wrote:
> In my project, all of the quadrature symbols have been stripped away in libgcc.a, so when I built newlib toolchain based on riscv32 target, we used the option "--disable-newlib-io-long-double" to turn off the feature of long double. But when performing a floating-point calculation, the symbol "trunctfdf2" is not defined correctly:
> libc.a(lib_a-vfprintf.o): in function `.L60':vfprintf.c:(.text+0x3fe): undefined reference to `__trunctfdf2'
--disable-newlib-io-long-double is the default. That configure option
shouldn't do anything.
__trunctfdf2 comes from libgcc. Are you linking with libgcc?
Of course, if you have long double disabled, it is odd that you get a
call to trunctfdf2. You should check how the vfprintf.c file was
compiled. There is a _NO_LONGDBL that should be defined by default, and
should prevent any long double code from being enabled in that file.
Jim
^ permalink raw reply [flat|nested] 4+ messages in thread
* disable-newlib-io-long-double?
@ 2020-03-16 11:37 chengzhiwei (C)
2020-03-16 20:50 ` disable-newlib-io-long-double? Jim Wilson
0 siblings, 1 reply; 4+ messages in thread
From: chengzhiwei (C) @ 2020-03-16 11:37 UTC (permalink / raw)
To: newlib
Hi, all:
In my project, all of the quadrature symbols have been stripped away in libgcc.a, so when I built newlib toolchain based on riscv32 target, we used the option "--disable-newlib-io-long-double" to turn off the feature of long double. But when performing a floating-point calculation, the symbol "trunctfdf2" is not defined correctly:
libc.a(lib_a-vfprintf.o): in function `.L60':vfprintf.c:(.text+0x3fe): undefined reference to `__trunctfdf2'
What puzzles me is why is this one symbol undefined? Is there any way to solve this problem?
Regards,
--zhiwei
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-17 18:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 1:34 disable-newlib-io-long-double? chengzhiwei (C)
2020-03-17 18:10 ` disable-newlib-io-long-double? Jim Wilson
-- strict thread matches above, loose matches on Subject: below --
2020-03-16 11:37 disable-newlib-io-long-double? chengzhiwei (C)
2020-03-16 20:50 ` disable-newlib-io-long-double? Jim Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).