Page MenuHomePhabricator

Add initial support for multilibs in Baremetal toolchain.
ClosedPublic

Authored by abidh on Dec 11 2020, 11:45 AM.

Details

Summary

This patch add support of riscv multilibs in the Baremetal toolchain. It is
a bit different to what is done in GNU.cpp as we are not iterating a
GNU sysroot to find the multilibs. This is intended for an llvm only
toolchain. We are not checking for the presence of any runtime bits to
enable a specific multilib.

I have structured the patch so that other targets for which
there is no multilibs support yet in Baremetal.cpp (e.g. arm-none-eabi)
will not be affected. Patch also allows some multilibs reuse.

Long term, I would like to go in the direction of data-driven specification of
multilib directories and flags.

Diff Detail

Event Timeline

abidh created this revision.Dec 11 2020, 11:45 AM
abidh requested review of this revision.Dec 11 2020, 11:45 AM
jroelofs added inline comments.Dec 14 2020, 9:21 AM
clang/lib/Driver/ToolChains/BareMetal.cpp
58

no else after return

169

I think the suffix ought to go after lib/baremetal, rather than before to match what is specified by Multilib::gccSuffix() (yeah, bad name... sorry). That will group all of them under a top-level folder like has been done for other platforms (i.e. darwin, linux, etc). Then it becomes a per-platform decision whether the contents are organized into folders like in a gcc toolchain, or if the lib names themselves get the discriminator (i.e. libclang_rt.${kind}.a)

jroelofs added inline comments.Dec 14 2020, 9:27 AM
clang/lib/Driver/ToolChains/BareMetal.cpp
169

minor nit: the RuntimesDir should be suffixed by the gccSuffix, not the osSuffix (even though they're the same in this case).

abidh updated this revision to Diff 311650.Dec 14 2020, 10:41 AM

Handle review comments.

This revision is now accepted and ready to land.Dec 14 2020, 10:43 AM
This revision was automatically updated to reflect the committed changes.
abidh marked 3 inline comments as done.
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2020, 1:00 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript