[PATCH] D68407: [WIP][RISCV] Use compiler-rt if no GCC installation detected

Edward Jones via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 4 09:31:51 PST 2019


edward-jones updated this revision to Diff 227722.
edward-jones retitled this revision from "[RISCV] Use compiler-rt if no GCC installation detected" to "[WIP][RISCV] Use compiler-rt if no GCC installation detected".
edward-jones edited the summary of this revision.
edward-jones added a comment.
Herald added a subscriber: sameer.abuasal.

I've rebased, and also refactored this to use `AddRunTimeLibs` and `GetDefaultRuntimeLibType`. The tests have been updated to reflect the changes. Notable changes compared to the last version of the patch:

- `AddRunTimeLibs` causes `-lgcc_s` to also be added to the linker command alongside `-lgcc`. It seems that this is added as part of `AddUnwindLibrary` in `clang/lib/Driver/ToolChains/CommonArgs.cpp`. Based on the comments for that function, I would expect to get either `-lgcc_s -lgcc` or `-lgcc -lgcc_eh` on the linker command depending on the type of unwinding supported, but this doesn't match the existing behaviour of the RISC-V driver (hence this patch breaks tests), nor does it match the behaviour of RISC-V gcc.
- The search for compiler-rt no longer looks in `<prefix>/<triple>/lib` for the runtime libraries. It instead looks in the resource directory `<prefix>/lib/clang/<version>/lib`. This seems to be more correct; out-of-tree compiler-rt builds just need to make sure to set the install prefix to the result of `clang -print-resource-dir`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68407/new/

https://reviews.llvm.org/D68407

Files:
  clang/lib/Driver/ToolChains/RISCVToolchain.cpp
  clang/lib/Driver/ToolChains/RISCVToolchain.h
  clang/test/Driver/Inputs/basic_riscv32_nogcc_tree/riscv32-unknown-elf/lib/crtbegin.o
  clang/test/Driver/Inputs/basic_riscv32_nogcc_tree/riscv32-unknown-elf/lib/crtend.o
  clang/test/Driver/Inputs/basic_riscv64_nogcc_tree/riscv64-unknown-elf/lib/crtbegin.o
  clang/test/Driver/Inputs/basic_riscv64_nogcc_tree/riscv64-unknown-elf/lib/crtend.o
  clang/test/Driver/riscv32-toolchain-extra.c
  clang/test/Driver/riscv64-toolchain-extra.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68407.227722.patch
Type: text/x-patch
Size: 7133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191104/f5fe4bfb/attachment.bin>


More information about the cfe-commits mailing list