[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240118191727.5547-1-palmer@rivosinc.com>
Date: Thu, 18 Jan 2024 11:17:27 -0800
From: Palmer Dabbelt <palmer@...osinc.com>
To: masahiroy@...nel.org, nicolas@...sle.eu
Cc: nathan@...nel.org, linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
Palmer Dabbelt <palmer@...osinc.com>
Subject: [PATCH] Makefile: Add HOST_GCC_SUFFIX and CROSS_GCC_SUFFIX
From: Palmer Dabbelt <palmer@...osinc.com>
I was just trying to track down a build bug with an old toolchain.
Turns out Ubuntu installs old GCCs as something like
riscv64-linux-gnu-gcc-10, which is a bit clunky to point the build at
without a way to append a suffix to CC.
There's already LLVM_SUFFIX, but nothing similar for GCC. I've split
out the host and target suffixes as users probably don't have the same
version of for both (unlike LLVM, where the cross compiler is likely to
support the host target).
Signed-off-by: Palmer Dabbelt <palmer@...osinc.com>
---
I've only given this some very minimal testing, but it at least works
for my simple use case.
---
Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index f1b2fd977275..36ce336cda3b 100644
--- a/Makefile
+++ b/Makefile
@@ -433,8 +433,8 @@ endif
HOSTCC = $(LLVM_PREFIX)clang$(LLVM_SUFFIX)
HOSTCXX = $(LLVM_PREFIX)clang++$(LLVM_SUFFIX)
else
-HOSTCC = gcc
-HOSTCXX = g++
+HOSTCC = gcc$(HOST_GCC_SUFFIX)
+HOSTCXX = g++$(HOST_GCC_SUFFIX)
endif
HOSTRUSTC = rustc
HOSTPKG_CONFIG = pkg-config
@@ -480,7 +480,7 @@ OBJDUMP = $(LLVM_PREFIX)llvm-objdump$(LLVM_SUFFIX)
READELF = $(LLVM_PREFIX)llvm-readelf$(LLVM_SUFFIX)
STRIP = $(LLVM_PREFIX)llvm-strip$(LLVM_SUFFIX)
else
-CC = $(CROSS_COMPILE)gcc
+CC = $(CROSS_COMPILE)gcc$(CROSS_GCC_SUFFIX)
LD = $(CROSS_COMPILE)ld
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
--
2.43.0
Powered by blists - more mailing lists