From patchwork Sun Apr 30 01:29:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775321 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=AzwfWPR2; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q887m704bz1ydW for ; Sun, 30 Apr 2023 11:36:20 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B8F60863B0; Sun, 30 Apr 2023 03:31:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="AzwfWPR2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 07A8A85C9B; Sun, 30 Apr 2023 03:30:36 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 430E2861AC for ; Sun, 30 Apr 2023 03:30:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-760f5070ccfso107205039f.2 for ; Sat, 29 Apr 2023 18:30:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682818232; x=1685410232; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1DZd4Uptictzjqx0qkhpzeo//xbWdS31aMkPGuNQHDs=; b=AzwfWPR2SybA3AGgIYoczW7eaQZ0hQt9XgGZ+WhK9l7VdDZHfbHYfur0qeEMj45uLj gvCL35LPp5YyOpRYNmFEI6vZFVereo4/DvuBDJ3WzkY/tgvFfdtJoribFOERHP8SLkhC BvfqYG21rRgp6I8gPSU3DXRt9vdEQwzhpTH0A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682818232; x=1685410232; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1DZd4Uptictzjqx0qkhpzeo//xbWdS31aMkPGuNQHDs=; b=ZNFgk3YOiWWoMoKZtJ1lU2oKwy7cgmXj9S0mK3isaNBYBYGnQy0Ijz764IKHbgGqNS 7JxAQL9h1G3KGSkw9YFj4oeof0owAC8qUt0iV0UaFvDiA14S3G/3MnW+lXYl5/EuoCYS d3JcdEkCTYRDmHteMlALDb0+BK3ssbZ+RQQKOfX8UOrz+Ijd7OF7NVYdYKzKpQFMJcMA 6F1RGQfuH73DOBazjvi8spjIVDq23Es3SbhmwOSizEbICGsYNxBZavYuGriQYjNWZtj/ TBMJVXtIPqtOPi/WDl5vPnsKuoPjzenFQLyFsvr8TqrjJ/rgBLc+E594tXiKoicDlmez oyTQ== X-Gm-Message-State: AC+VfDylEEKEvT3T9T2mYI08Mg7dGljnuX3cafePtPdOGGgOIcSXmea2 7ti9KFVRgfYkMmyrsB6t8U9pYMpMeYoHDuO/J5Q= X-Google-Smtp-Source: ACHHUZ58QKdKCM/VY5I/BktxRR7BDNm/Q12KEuv90NXO8l1un6jT88bzHoqoqt79Eh2osLDjx9WktA== X-Received: by 2002:a5d:9955:0:b0:750:c68e:f028 with SMTP id v21-20020a5d9955000000b00750c68ef028mr7275721ios.9.1682818231764; Sat, 29 Apr 2023 18:30:31 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id w4-20020a02cf84000000b0040f8ed3ab81sm7259429jar.129.2023.04.29.18.30.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Apr 2023 18:30:31 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , =?utf-8?q?Pali_Roh=C3=A1r?= , Heinrich Schuchardt , Tom Rini , Simon Glass Subject: [PATCH v2 24/30] sandbox: Provide an EFI link script for PE Date: Sat, 29 Apr 2023 19:29:57 -0600 Message-ID: <20230430013003.1047454-25-sjg@chromium.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog In-Reply-To: <20230430013003.1047454-1-sjg@chromium.org> References: <20230430013003.1047454-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add another case for sandbox, when it is built on Windows. Signed-off-by: Simon Glass --- (no changes since v1) arch/sandbox/config.mk | 4 +- arch/x86/lib/crt0_x86_64_efi.S | 2 + arch/x86/lib/pe_x86_64_efi.lds | 83 ++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 arch/x86/lib/pe_x86_64_efi.lds diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk index c97c39d4301b..d397ae3fe29b 100644 --- a/arch/sandbox/config.mk +++ b/arch/sandbox/config.mk @@ -44,7 +44,9 @@ cmd_u-boot-spl = (cd $(obj) && $(CC) -o $(SPL_BIN) -Wl,-T u-boot-spl.lds \ -Wl,--no-whole-archive \ $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot-spl.map -Wl,--gc-sections) -ifeq ($(HOST_ARCH),$(HOST_ARCH_X86_64)) +ifneq ($(MSYS_VERSION),0) +EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/pe_x86_64_efi.lds +else ifeq ($(HOST_ARCH),$(HOST_ARCH_X86_64)) EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_x86_64_efi.lds EFI_TARGET := --target=efi-app-x86_64 else ifeq ($(HOST_ARCH),$(HOST_ARCH_X86)) diff --git a/arch/x86/lib/crt0_x86_64_efi.S b/arch/x86/lib/crt0_x86_64_efi.S index 47ed5af97228..cd61b4bdd82f 100644 --- a/arch/x86/lib/crt0_x86_64_efi.S +++ b/arch/x86/lib/crt0_x86_64_efi.S @@ -15,6 +15,7 @@ _start: subq $8, %rsp +#ifndef __CYGWIN__ pushq %rcx pushq %rdx @@ -28,6 +29,7 @@ _start: testq %rax, %rax jnz .exit +#endif call efi_main .exit: diff --git a/arch/x86/lib/pe_x86_64_efi.lds b/arch/x86/lib/pe_x86_64_efi.lds new file mode 100644 index 000000000000..1ee08f6e662e --- /dev/null +++ b/arch/x86/lib/pe_x86_64_efi.lds @@ -0,0 +1,83 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * U-Boot EFI linker script + * + * Modified from usr/lib32/elf_x86_64_efi.lds in gnu-efi + */ + +OUTPUT_FORMAT("pe-x86-64", "pe-x86-64", "pe-x86-64") +OUTPUT_ARCH(i386:x86-64) +ENTRY(_start) +SECTIONS +{ + image_base = .; + .hash : { *(.hash) } /* this MUST come first, EFI expects it */ + . = ALIGN(4096); + .eh_frame : { + *(.eh_frame) + } + + . = ALIGN(4096); + + .text : { + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + } + + . = ALIGN(4096); + + .reloc : { + *(.reloc) + } + + . = ALIGN(4096); + + .data : { + *(.rodata*) + *(.got.plt) + *(.got) + *(.data*) + *(.sdata) + /* the EFI loader doesn't seem to like a .bss section, so we stick + * it all into .data: */ + *(.sbss) + *(.scommon) + *(.dynbss) + *(.bss*) + *(COMMON) + *(.rel.local) + + /* U-Boot lists and device tree */ + . = ALIGN(8); + *(SORT(__u_boot_list*)); + . = ALIGN(8); + *(.dtb*); + } + + . = ALIGN(4096); + .dynamic : { *(.dynamic) } + . = ALIGN(4096); + + .rela : { + *(.rela.data*) + *(.rela.got) + *(.rela.stab) + *(.rela__u_boot_list*) + } + + . = ALIGN(4096); + .dynsym : { *(.dynsym) } + . = ALIGN(4096); + .dynstr : { *(.dynstr) } + . = ALIGN(4096); + + /DISCARD/ : { *(.eh_frame) } + + .ignored.reloc : { + *(.rela.reloc) + *(.note.GNU-stack) + } + + .comment 0 : { *(.comment) } +}