mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 4/4] Makefile: clang: fail non-sandbox LLVM builds early
Date: Mon, 17 Feb 2025 11:46:11 +0100	[thread overview]
Message-ID: <20250217104611.1836442-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250217104611.1836442-1-a.fatoum@pengutronix.de>

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@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 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




  parent reply	other threads:[~2025-02-17 10:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17 10:46 [PATCH 1/4] sandbox: make CC_HAS_LINUX_I386_SUPPORT depend on GCC Ahmad Fatoum
2025-02-17 10:46 ` [PATCH 2/4] Makefile: clang: fix typo in -Wno-typdef-redefinition flag Ahmad Fatoum
2025-02-17 10:46 ` [PATCH 3/4] kbuild: actually include Makefile.clang for clang builds Ahmad Fatoum
2025-02-17 10:46 ` Ahmad Fatoum [this message]
2025-02-17 11:19 ` [PATCH 1/4] sandbox: make CC_HAS_LINUX_I386_SUPPORT depend on GCC Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250217104611.1836442-4-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.trumtrar@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox