[PATCH] D71387: pass -mabi to LTO linker only in RISC-V targets, enable RISC-V LTO

Jessica Clarke via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 6 16:23:26 PDT 2021


jrtc27 added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:633
 
+  // pass more options in specific target
+  switch (ToolChain.getArch()) {
----------------



================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:634-638
+  switch (ToolChain.getArch()) {
+  default:
+    break;
+  case llvm::Triple::riscv32:
+  case llvm::Triple::riscv64: {
----------------
ToolChain.getArch().isRISCV()? No need for a switch until there are other architectures that need code here too.


================
Comment at: clang/test/Driver/lto.c:126
+// RUN: %clang -target riscv32-unknown-linux-gnu %s -fuse-ld=gold -flto \
+// RUN:   -mabi=ilp32f -### 2>&1 | FileCheck %s --check-prefix=RISCV-SPEC-ABI-1
+// RUN: %clang -target riscv32-unknown-linux-gnu %s -fuse-ld=gold -flto \
----------------
Give these meaningful names


================
Comment at: clang/test/Driver/lto.c:134-137
+// RISCV-SPEC-ABI-1: "-plugin-opt=-target-abi=ilp32f"
+// RISCV-SPEC-ABI-2: "-plugin-opt=-target-abi=ilp32d"
+// RISCV-SPEC-ABI-3: "-plugin-opt=-target-abi=lp64"
+// RISCV-SPEC-ABI-4: "-plugin-opt=-target-abi=lp64f"
----------------
Why this set without ilp32 and lp64d, two of the four most common ABIs?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71387



More information about the cfe-commits mailing list