Skip to content

Missing long double Function Implementations in Newlib (2025.02) #43

@bigmagic123

Description

@bigmagic123

In 2025.02, some long double math functions in Newlib are missing implementations, causing link errors when compiling for RISC-V targets. This occurs because a prior Newlib update enabled long double support for RISC-V but did not fully implement all necessary functions.

Fixed Version:

Upgrading to Newlib 4.5.0 resolves the issue, as it includes the required implementations.
The problem is already fixed in 2025.10.
Detailed Description:
Issue Cause:

Newlib partially enabled non-LDBL_EQ_DBL (long double = 128-bit) support for RISC-V but lacked complete implementations for certain long double math functions (e.g., sinl, cosl, expl). This leads to "undefined reference" errors during linking.

Affected Code:

Any RISC-V project using long double math functions (e.g., printf, trigonometric functions) may fail to link with errors like:

undefined reference to `__trunctfdf2' undefined reference to `sinl' Fix & Workaround:

Upgrade Newlib to 4.5.0, which includes the missing implementations (see patch).
Alternatively, use 2025.10, where the fix is already applied.
Impact:

Affects RISC-V projects relying on long double precision.
Temporary workarounds (e.g., avoiding long double or manually implementing functions) are possible but not scalable.
Affected Versions: Newlib in 2025.02

Fixed Versions: Newlib 4.5.0+ / 2025.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    P:1Medium impact/importance bugbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions