From patchwork Wed Feb 11 14:32:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1817 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=1770820464; bh=IXrt1Nd+z/60qUqUMA5bKr5fs9E9jcOyLijIx+B43dw=; 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=SM3n+qgb62NP+3Wi4RZnPbUsQtni7Ylt+sJMVVEo8gaTVwMapniWztTBqtKM+FAH3 MKvKb52JHpk5PvxOzuiCh4VH6izkxNDYP45fJbreB+vexom7HurB0BTgWRYAPmAYBa PCBEUmZqiU4dycz1GGrGrfsyA6XOAFwfQvumFAsRBj+b2w+kEV28g8QaF+i6+OlVtZ TWv2xlpCqU3kBQDKOcSWePc27we+aJbwIn/rapkBLJT6fwbKPD3ub1QH4nsBJwvGrG Dir9wJQXdX4nzJFn5VfVcO5A2rbEnNdc3NxYfHzccRHoLI/J2/szXfhRlGxsisTc8h wxXGNcpQYCRjQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DA62B69A90 for ; Wed, 11 Feb 2026 07:34:24 -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 lQZPe7Cr8FlP for ; Wed, 11 Feb 2026 07:34:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770820464; bh=IXrt1Nd+z/60qUqUMA5bKr5fs9E9jcOyLijIx+B43dw=; 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=SM3n+qgb62NP+3Wi4RZnPbUsQtni7Ylt+sJMVVEo8gaTVwMapniWztTBqtKM+FAH3 MKvKb52JHpk5PvxOzuiCh4VH6izkxNDYP45fJbreB+vexom7HurB0BTgWRYAPmAYBa PCBEUmZqiU4dycz1GGrGrfsyA6XOAFwfQvumFAsRBj+b2w+kEV28g8QaF+i6+OlVtZ TWv2xlpCqU3kBQDKOcSWePc27we+aJbwIn/rapkBLJT6fwbKPD3ub1QH4nsBJwvGrG Dir9wJQXdX4nzJFn5VfVcO5A2rbEnNdc3NxYfHzccRHoLI/J2/szXfhRlGxsisTc8h wxXGNcpQYCRjQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C880169A89 for ; Wed, 11 Feb 2026 07:34:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770820463; bh=CGMiT/UrQauaMMwnVadJRf8dAEPIQJ4lXxzsuyMAGd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i85iXtP1//IgV+To1/an1NMu5L9onsdOOFtX+U1XuyZ8MXUKFzMafpoZDtCP8boxf znFSJ2m41+rrktIxp55vBsfLHvgm/+1gE42ndmI1zmdefQHTeVqhnPcn8DMtfMHrbE mw79LcDQmlbdVQaoVMtwlHWbMpIaB/dvoHTdKhQpyv1caLNUz/aMxBlXAf/WMA7A2P J3GqV8VTiKeQMj0L5NQrJBLueQc0BONtF62Mb81ZRH3xBNOuRTIh7qfBrb1x3uPh2R 0CBf4mccFRmpuhVuLQTAWu7s3y0UBBz7pxnq36WZTPa7yObiFBej7/jv3rEMVQKFUb LL0BDntwbHT9Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D738A699BF; Wed, 11 Feb 2026 07:34:23 -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 ICeCGBgDDN4R; Wed, 11 Feb 2026 07:34:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770820459; bh=rthz9fMy47/0Iwx5INuOfVRuH3p5qI6WfXFfUv8KWG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VRVuHBF7SyiVAePjcQQbac2ygpeuN4l5oNKXG+VmcKBJqZYOqX5+GuuxdAYSud3XI SblzJMK6MOUvdxYGv9zFgY8XllFeU6I9YTJEms6D0hh/PqlmtL7vksP8Z3mZGm99vA nKuW7v/told85Www+K0r0Za+J+lfRGvNql/+csDt83cH2oE+ZDRy7bE/aXLv6NogE2 3eB7kF3W7/Sg59CrbU7imVBnKIIuTZ9b7kYQ0FZu9wbjWonRDAMLy+TS+mOqFUr/AO xKWGUSBQO8w/PAu3+YrJjUeo0Nzy30lkBxVZZwf2pX+NSWjVw/CGTQCOyzBJHlKXEr d56QmGT/olEEA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8D436699D6; Wed, 11 Feb 2026 07:34:19 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 07:32:54 -0700 Message-ID: <20260211143309.1183113-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260211143309.1183113-1-sjg@u-boot.org> References: <20260211143309.1183113-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: PEFTPO3D7WS3DR7KJOO33I4B3SJRDCA2 X-Message-ID-Hash: PEFTPO3D7WS3DR7KJOO33I4B3SJRDCA2 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/12] x86: Build 16-bit startup objects as 32-bit for x86_64 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 The 64-bit PIE linker cannot handle 16-bit relocations, so start16.o and resetvec.o cannot be linked into the 64-bit u-boot binary. Override the assembler flags to build these objects as 32-bit (elf_i386) when targeting x86_64, and exclude them from head-y since they are handled separately by binman. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/x86/Makefile | 2 ++ arch/x86/cpu/Makefile | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 07e8df15afb..8abedd6e5e9 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -20,8 +20,10 @@ endif endif endif # EFI +ifndef CONFIG_$(PHASE_)X86_64 head-$(CONFIG_$(PHASE_)X86_16BIT_INIT) += arch/x86/cpu/start16.o head-$(CONFIG_$(PHASE_)X86_16BIT_INIT) += arch/x86/cpu/resetvec.o +endif libs-y += arch/x86/cpu/ libs-y += arch/x86/lib/ diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile index 82ae65f141a..71feca3bf29 100644 --- a/arch/x86/cpu/Makefile +++ b/arch/x86/cpu/Makefile @@ -26,6 +26,17 @@ endif extra-$(CONFIG_$(PHASE_)X86_16BIT_INIT) += resetvec.o start16.o +ifdef CONFIG_$(PHASE_)X86_64 +# The 16-bit startup code must be assembled as 32-bit since the 64-bit +# linker cannot handle 16-bit relocations in a PIE binary. These +# objects are not linked into the 64-bit u-boot; instead their sections +# are extracted to binary files for binman to place. +AFLAGS_REMOVE_start16.o := -march=core2 -m64 +AFLAGS_start16.o := -march=i386 -m32 +AFLAGS_REMOVE_resetvec.o := -march=core2 -m64 +AFLAGS_resetvec.o := -march=i386 -m32 +endif + obj-y += cpu.o ifndef CONFIG_TPL_BUILD obj-y += cpu_x86.o