[PATCH 4/4] Makefile: clang: fail non-sandbox LLVM builds early

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The sandbox architecture is the only architecture so far that has been
validated to build to completion with clang and function correctly
afterwards.

Until other architectures follow suit, fail the build gracefully for them.

Note that in Linux, CLANG_TARGET_FLAGS_sandbox expands to
$(CLANG_TARGET_FLAGS_$(SRCARCH)). This requires that we have support for
non-sandbox architectures in the first place. Until we do, just make it
a no-op by setting CLANG_TARGET_FLAGS to the same target triple that's used
by default anyway.

Reported-by: Steffen Trumtrar <s.trumtrar@xxxxxxxxxxxxxx>
Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 scripts/Makefile.clang | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang
index 874110ea83ad..7e4dfb8622d3 100644
--- a/scripts/Makefile.clang
+++ b/scripts/Makefile.clang
@@ -1,4 +1,14 @@
 # SPDX-License-Identifier: GPL-2.0-only
+
+CLANG_TARGET_FLAGS_sandbox	:= $(shell $(CC) -print-target-triple)
+CLANG_TARGET_FLAGS		:= $(CLANG_TARGET_FLAGS_$(SRCARCH))
+
+ifeq ($(CLANG_TARGET_FLAGS),)
+$(error add '--target=' option to scripts/Makefile.clang)
+else
+CLANG_FLAGS	+= --target=$(CLANG_TARGET_FLAGS)
+endif
+
 CLANG_FLAGS	+= -Wno-typedef-redefinition
 CLANG_FLAGS	+= -Werror=unknown-warning-option
 CLANG_FLAGS	+= -Werror=ignored-optimization-argument
-- 
2.39.5





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux