From patchwork Fri Feb 20 00:19:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1908 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546810; bh=2rQoYjDVimXA0vVz93wb2RLcEGpBqIJ5y7EIjX3xQM8=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=RqtumOD8eGmBRqbqALAwNzNhJF8X/WdYjLhdGuZPqoiPhW3Bt7yPM14WsXpAYq9b3 TqATHv6rJ/r2Eiacxy12/7ODDC+SkNnWqrp5tXEs2HFt+cP976H+6lSBxZ7pXYBDRb sRrpUwrqamywF3I5FcXti/9BDdyNV8IOfiGdHo4sW4rHckyAY6zeaAXyijxR7898vK WHp0b2vl+trNcjp1PwakHSty/v6oYS6z+aMBWo8YhzMxYqTtpo4wf46m0PCJJqoAkw jvpB9Zp8gRpdVcvyxzKwYliYG2DXc/hmSMSsqouBxDooIwDYOZARtAY1D1nuHFJBgg NG5G41Za7uBMw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5D39169C8C for ; Thu, 19 Feb 2026 17:20:10 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 6aSSPGKtQ_4Q for ; Thu, 19 Feb 2026 17:20:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546810; bh=2rQoYjDVimXA0vVz93wb2RLcEGpBqIJ5y7EIjX3xQM8=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=RqtumOD8eGmBRqbqALAwNzNhJF8X/WdYjLhdGuZPqoiPhW3Bt7yPM14WsXpAYq9b3 TqATHv6rJ/r2Eiacxy12/7ODDC+SkNnWqrp5tXEs2HFt+cP976H+6lSBxZ7pXYBDRb sRrpUwrqamywF3I5FcXti/9BDdyNV8IOfiGdHo4sW4rHckyAY6zeaAXyijxR7898vK WHp0b2vl+trNcjp1PwakHSty/v6oYS6z+aMBWo8YhzMxYqTtpo4wf46m0PCJJqoAkw jvpB9Zp8gRpdVcvyxzKwYliYG2DXc/hmSMSsqouBxDooIwDYOZARtAY1D1nuHFJBgg NG5G41Za7uBMw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4B76B69C89 for ; Thu, 19 Feb 2026 17:20:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546809; bh=EccnzlSk7m5BCM5FElYc2q5R3WL7ev0dSeXDVKzW/MQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wbntylq4raCcCGGDYZbnadJkj/Cf8BiymxyBxhBzSiLchgfs16EAV+rpCLaHlUZER J1jyYQfQAFQQopxtJhd0E5ILn7LIGU+SbLbJ4896CSq2Qk6pyQoShlfp69bxd5TrYW R87fC72OnOvso8kF+87+k/CrJ/uJ3w2vyH5K0FMoctp2DR4bRHA7Ai4Pv5qFNS/pWe pbdbUDqosTfvCCL5cuSvAApKsNEcrjZQMFePSD+nMQQATpr2lK3iUHBQrvjTHUZ0ak 5wys7UG+tuIVIeJ7h7/ljTDrLNLwnb98Rr+E7kW7zUUIU9RnzIiEMFKtKSj4aZexL4 d83PRySLV/uMg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8E92969C0B; Thu, 19 Feb 2026 17:20:09 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id xm4pc6u8CFAu; Thu, 19 Feb 2026 17:20:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546805; bh=NiJDvs+0tVC5UHVe+8LWF4gJSP8Lt22eIxnalRnnQv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g/Ol2V4wQ3za8zJr/Rbo48srbs2URnY3xQLczDnTV4ewCASYNy7UQR2+QENssz2ty ZZpSr3Ny8UDe1MZUWiQdX0NxyJfsuLH/P+92j9z9ohe31BDSfIDOwzIFJvkeAnvLYZ 5Oema04FT08p2TzErP0Jwg52Wzr3O5KhC2YkwWKqgC0QtxrAra+wy5qTa12FJQud+A ebiv14yZXHoxGo7u4Im5b4Fh/spH824SJ4SqXzDMyTK+pxEj02TT8+yYVcYZbPRrr+ F1q7VlHaze0ft7BByGGbLeL4C5+rEi92VGGx60cdUJftjeXoDEH36GZqJKU2xba8Ro 3QsgOg0eh7i1w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 07C7169C7C; Thu, 19 Feb 2026 17:20:04 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:14 -0700 Message-ID: <20260220001926.2366140-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260220001926.2366140-1-sjg@u-boot.org> References: <20260220001926.2366140-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: Y6NM6KXJCTI6JSSVRZZQBIGVTBAI72XM X-Message-ID-Hash: Y6NM6KXJCTI6JSSVRZZQBIGVTBAI72XM X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/13] ulib: x86: Add 32-bit Rust target support List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass There is no built-in i686-unknown-none Rust target, so use i686-unknown-linux-gnu with flags to disable unwinding and force static relocations, which produces a clean freestanding ELF 32-bit object suitable for linking into U-Boot. Select the Rust target and flags based on CONFIG_X86_64 so that the 64-bit build continues to use x86_64-unknown-none with its built-in defaults (PIE-compatible code, no unwinding). Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- scripts/Makefile.ulib-example | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.ulib-example b/scripts/Makefile.ulib-example index 4d8af88b898..a398f3e9621 100644 --- a/scripts/Makefile.ulib-example +++ b/scripts/Makefile.ulib-example @@ -21,8 +21,18 @@ ULIB_EXAMPLES := demo # --- Rust examples --- RUSTC := rustc -RUST_TARGET_x86 := x86_64-unknown-none +RUST_TARGET_x86 := i686-unknown-linux-gnu +RUST_TARGET_x86_64 := x86_64-unknown-none +RUST_FLAGS_x86 := -C panic=abort -C relocation-model=static +RUST_FLAGS_x86_64 := + +ifdef CONFIG_X86_64 +RUST_TARGET := $(RUST_TARGET_$(EXAMPLE_ARCH)_64) +RUST_FLAGS := $(RUST_FLAGS_$(EXAMPLE_ARCH)_64) +else RUST_TARGET := $(RUST_TARGET_$(EXAMPLE_ARCH)) +RUST_FLAGS := $(RUST_FLAGS_$(EXAMPLE_ARCH)) +endif ifeq ($(CONFIG_RUST_EXAMPLES),y) ULIB_EXAMPLES += rust-demo @@ -34,7 +44,8 @@ quiet_cmd_u-boot-example = LD $@ quiet_cmd_rustc_obj = RUSTC $@ cmd_rustc_obj = \ mkdir -p $(dir $@) && \ - MAKEFLAGS= $(RUSTC) --edition 2021 --emit=obj -o $@ --target=$(RUST_TARGET) $< + MAKEFLAGS= $(RUSTC) --edition 2021 --emit=obj -o $@ \ + --target=$(RUST_TARGET) $(RUST_FLAGS) $< examples/ulib/rust_demo.o: examples/ulib/rust_demo.rs FORCE $(call if_changed,rustc_obj)