Skip to content

Commit 9816e72

Browse files
committed
[Driver][RISCV] Add RedHat Linux RISC-V triple
Summary: Adds the RedHat Linux triple to the list of 64-bit RISC-V triples. Without this the gcc libraries wouldn't be found by clang on a redhat/fedora system, as the search list included `/usr/lib/gcc/riscv64-redhat-linux-gnu` but the correct path didn't include the `-gnu` suffix. Reviewers: lenary, asb, dlj Reviewed By: lenary Tags: #clang Differential Revision: https://reviews.llvm.org/D74399
1 parent a55dec7 commit 9816e72

File tree

7 files changed

+16
-0
lines changed

7 files changed

+16
-0
lines changed

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,6 +2090,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
20902090
static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
20912091
"riscv64-linux-gnu",
20922092
"riscv64-unknown-elf",
2093+
"riscv64-redhat-linux",
20932094
"riscv64-suse-linux"};
20942095

20952096
static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};

clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtbegin.o

Whitespace-only changes.

clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtend.o

Whitespace-only changes.

clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crti.o

Whitespace-only changes.

clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtn.o

Whitespace-only changes.

clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib64/crt1.o

Whitespace-only changes.

clang/test/Driver/linux-ld.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,21 @@
769769
// CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|\\\\}}crtend.o"
770770
// CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|\\\\}}crtn.o"
771771
//
772+
// Check Fedora 31 on riscv64.
773+
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
774+
// RUN: --target=riscv64-redhat-linux -rtlib=platform \
775+
// RUN: --gcc-toolchain="" \
776+
// RUN: --sysroot=%S/Inputs/fedora_31_riscv64_tree \
777+
// RUN: | FileCheck --check-prefix=CHECK-FEDORA-31-RISCV64 %s
778+
// CHECK-FEDORA-31-RISCV64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
779+
// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|\\\\}}crt1.o"
780+
// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crti.o"
781+
// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtbegin.o"
782+
// CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9"
783+
// CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64"
784+
// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtend.o"
785+
// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtn.o"
786+
//
772787
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
773788
// RUN: --target=arm-unknown-linux-gnueabi -rtlib=platform \
774789
// RUN: --gcc-toolchain="" \

0 commit comments

Comments
 (0)