[PATCH] D155294: [Driver][RISCV] Find baremetal multilibs using YAML for GNU toolchain

Joseph Faulls via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 14 07:36:29 PDT 2023


Joe created this revision.
Joe added reviewers: michaelplatings, kito-cheng.
Joe added a project: clang.
Herald added subscribers: jobnoorman, luke, shiva0217, VincentWu, vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, abidh, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, kristof.beyls, arichardson, emaste.
Herald added a project: All.
Joe requested review of this revision.
Herald added subscribers: cfe-commits, wangpc, eopXD, MaskRay.

This patch allows usage of multilib.yaml <https://discourse.llvm.org/t/rfc-multilib/67494> when using a riscv gnu toolchain

This could certainly land as three separate patches, but I wanted to put this up as one to gather feedback to make sure the direction makes sense.

These are the main discussion points I want to bring to attention:

1. For the RISCVMultilibFlags, the mabi flag is used in combination with all the march extension features (e.g +m). Notably, this doesn't align with the current arm/aarch64 multilib flags, which all flags corresponding to the command line flag. E.G `-march=`. Does this violate a particular design decision, or can any target decide on whatever multilib flags they want?

2. The location of multilib.yaml for a gnu toolchain is in the lib directory of the sysroot. E.G `riscv64-unknown-elf/lib/multilib.yaml`. This differs from the baremetal location of "lib/clang-runtimes".

3. Does it make more sense to implement finding multilibs using yaml for riscv in the baremetal toolchain first? I was planning on doing it after.

Theoretically, I think this matching of multilibs could be done without the need for multilib.yaml, but it is indeed much easier considering the logic is already there.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155294

Files:
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/BareMetal.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/Gnu.h
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/crtbegin.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/crtend.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv32i/ilp32/crtbegin.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv32i/ilp32/crtend.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv32iac/ilp32/crtbegin.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv32iac/ilp32/crtend.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv32im/ilp32/crtbegin.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv32im/ilp32/crtend.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imac/ilp32/crtbegin.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imac/ilp32/crtend.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imafc/ilp32f/crtbegin.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv32imafc/ilp32f/crtend.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv64imac/lp64/crtbegin.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv64imac/lp64/crtend.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv64imafdc/lp64d/crtbegin.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/lib/gcc/riscv64-unknown-elf/8.2.0/rv64imafdc/lp64d/crtend.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/riscv64-unknown-elf/bin/ld
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/riscv64-unknown-elf/lib/crt0.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/riscv64-unknown-elf/lib/multilib.yaml
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/riscv64-unknown-elf/lib/rv32i/ilp32/crt0.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/riscv64-unknown-elf/lib/rv32iac/ilp32/crt0.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/riscv64-unknown-elf/lib/rv32im/ilp32/crt0.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/riscv64-unknown-elf/lib/rv32imac/ilp32/crt0.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/riscv64-unknown-elf/lib/rv32imafc/ilp32f/crt0.o
  clang/test/Driver/Inputs/multilib_riscv_elf_sdk_yaml/riscv64-unknown-elf/lib/rv64imac/lp64/crt0.o
  clang/test/Driver/riscv-toolchain-multilib-yaml.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155294.540412.patch
Type: text/x-patch
Size: 20439 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230714/37463502/attachment-0001.bin>


More information about the cfe-commits mailing list