Thread (7 messages) 7 messages, 1 author, 2024-10-24
STALE583d

[kvm-unit-tests PATCH v3 5/5] README: Add cross and clang recipes

From: Andrew Jones <hidden>
Date: 2024-09-11 09:15:09
Also in: kvm, kvm-riscv, kvmarm, linux-s390
Subsystem: the rest · Maintainer: Linus Torvalds

Add configure command line examples for cross-compiling, for
compiling with clang, and for cross-compiling with clang.

Signed-off-by: Andrew Jones <redacted>
---
 README.md | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff --git a/README.md b/README.md
index 2d6f7db5605c..be07dc28a094 100644
--- a/README.md
+++ b/README.md
@@ -17,6 +17,28 @@ in this directory.  Test images are created in ./ARCH/\*.flat
 
 NOTE: GCC cross-compiler is required for [build on macOS](README.macOS.md).
 
+## Cross-compiling
+
+A cross compiler may be configured by specifying a cross prefix. For example,
+for arm64
+
+    ./configure --arch=arm64 --cross-prefix=aarch64-linux-gnu-
+    make
+
+## clang
+
+clang may be used as an alternative to gcc.
+
+    ./configure --cc=clang
+    make
+
+clang may also be used with cross binutils when cross-compiling. For example,
+for riscv64
+
+    ./configure --arch=riscv64 --cc=clang --cflags='--target=riscv64' \
+                --cross-prefix=riscv64-linux-gnu-
+    make
+
 ## Standalone tests
 
 The tests can be built as standalone.  To create and use standalone tests do:
-- 
2.46.0

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help