This is an archive of the discontinued LLVM Phabricator instance.

[libc] Minimal support for riscv32
ClosedPublic

Authored by phosek on Jun 9 2023, 10:26 AM.

Details

Summary

This change adds support for baremetal riscv32 configuration.

Diff Detail

Event Timeline

phosek created this revision.Jun 9 2023, 10:26 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 9 2023, 10:26 AM
phosek requested review of this revision.Jun 9 2023, 10:26 AM
sivachandra accepted this revision.Jun 9 2023, 11:44 PM

LGTM. I think some duplicates can be removed but it already being done in https://reviews.llvm.org/D148797.

libc/config/baremetal/riscv32/entrypoints.txt
86

Why not include fenv.h entrypoints?

This revision is now accepted and ready to land.Jun 9 2023, 11:44 PM
asb added a comment.Jun 12 2023, 7:58 AM

I'm not familiar enough with LLVM's libc to have a strong opinion here, but my suspicion is that a single riscv/ directory (with ifdefs in files as needed) is going to be a better solution than having directories for both riscv32 and riscv64. But if the plan is to leave refactoring this to D148797, that seems fine to me.

phosek updated this revision to Diff 530550.Jun 12 2023, 9:36 AM

I agree with Alex, we can leave https://reviews.llvm.org/D148797 as a refactor patch for later.

One of the open queries for D148797 was on buildbot support - is that a blocker for baremetal targets too?

sivachandra added a comment.EditedJun 12 2023, 11:46 AM

One of the open queries for D148797 was on buildbot support - is that a blocker for baremetal targets too?

That's a good question :) - the answer is "no" because in general it is very hard to manage bare metal boards on a CI platform. That said, we do want build only bots. We have not blocked the arm32 bare metal config that way, so I think we should not block riscv32 also. But, I plan to set up cross-builders for baremetal configs soon. Once we have examples, we will start blocking bare metal configs also on build-only bots.

phosek marked an inline comment as done.Jun 12 2023, 3:49 PM

I wasn't aware of D148797, thanks for the pointer. I'm fine with either landing this one first and refactoring it later, or going directly D148797 if you think it's going to land soon.

libc/config/baremetal/riscv32/entrypoints.txt
86

I omitted those initially because those were failing to build due to a missing malloc, but this was addressed by D152607.

I wasn't aware of D148797, thanks for the pointer. I'm fine with either landing this one first and refactoring it later, or going directly D148797 if you think it's going to land soon.

Go ahead and submit this. I think D148797 will take time. It has been delayed for a few reasons and I am also guilty of the delay. Since the bar for baremetal configs at this time is "if it builds, it is good", you can land it and we will refactor later to eliminate duplicates between rv32 and rv64.

This revision was automatically updated to reflect the committed changes.
phosek marked an inline comment as done.