This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add fenv_t and signal macros in riscv
ClosedPublic

Authored by mikhail.ramalho on Mar 8 2023, 9:31 AM.

Details

Summary

This patch now enables full build.

Diff Detail

Event Timeline

mikhail.ramalho created this revision.Mar 8 2023, 9:31 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 8 2023, 9:31 AM
mikhail.ramalho requested review of this revision.Mar 8 2023, 9:31 AM
sivachandra added inline comments.Mar 8 2023, 9:48 AM
libc/config/linux/app.h
40 ↗(On Diff #503412)

Do we need this change for full build?

abrachet added inline comments.
libc/include/llvm-libc-types/fenv_t.h
29

I think the __riscv check should be above this

libc/config/linux/app.h
40 ↗(On Diff #503412)

I'll double-check

  • Removed unnecessary define from app.h (for full build)
  • Fix riscv define in the wrong place in fenv_t.h
mikhail.ramalho marked an inline comment as done.Mar 8 2023, 10:09 AM
sivachandra accepted this revision.Mar 8 2023, 11:49 AM
This revision is now accepted and ready to land.Mar 8 2023, 11:49 AM
mcgrathr added inline comments.
libc/include/llvm-libc-types/fenv_t.h
27

I would *highly* recommend never using a typedef to a base type (or other existing type) like this. It's much better to define a struct with a single member, as you can see done for the ARM case above. This ensures that the API contract enforces that fenv_t and fenv_t* values are passed, rather than unsigned int or unsigned int*. On x86-64, ARM, and RISC-V, the calling convention for a struct like this is the same as for the bare integer type.