Skip to content

compiler_rt: undefined symbol _fltused on uefi targets with hardware floats #24148

Closed
@Khitiara

Description

@Khitiara

Zig Version

0.15.0-dev.767+201c0f54a

Steps to Reproduce and Observed Behavior

When compiling a uefi application with hardware floats in the target (generally not ideal practice but still shouldnt error), the following error is returned: error: lld-link: undefined symbol: _fltused. This is intended llvm behavior, and arises due to the use of floats in compiler_rt: https://discourse.llvm.org/t/lld-link-fails-to-link-uefi-binary-because-of-undefined-symbol-fltused/52454

The underlying issue is that uefi is fundamentally a windows-like target, and uefi uses the value of the _fltused symbol to trigger enabling hardware floats and the floating point environment in general, similar to how it is used on windows (for which a conditional export in compiler_rt already exists).

(With softfloats in use, no reference is made to the symbol as hardware float initialization is not required, and ideally no export should be made when softfloats are on.)

Expected Behavior

Compilation to succeed

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorcompiler-rtos-uefi

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions