From patchwork Tue Mar 12 14:08:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 1911093 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; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=FOkFceJz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TvFqn5cZNz1yWt for ; Wed, 13 Mar 2024 01:08:53 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 88B1D87F6E; Tue, 12 Mar 2024 15:08:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="FOkFceJz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 574A987F5E; Tue, 12 Mar 2024 15:08:44 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (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 5B03B87F56 for ; Tue, 12 Mar 2024 15:08:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-563cb3ba9daso6546950a12.3 for ; Tue, 12 Mar 2024 07:08:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710252522; x=1710857322; darn=lists.denx.de; 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=axqi5l4Ztq3WiIi5s/5Po9WAHf/Ep2gUDdwyUWhnccw=; b=FOkFceJzjYwo6ibVUSURL4TdGsNySKCdX+xNhMZMNLnyK0gOPSAc1T3EIFJrTKUn7S /Yku3Klc+qBhbU/U31pktx8b5X2Uwfu2CUPhMLKzgd3jcTHucZRVm8cj0JqXm1oZAu3p QYwjK830N+1la2M+fWXoFbFBMTRwQmGu3Hm7kmru/l0M+E/pqg7fzWyTl9/YARhIJp98 msVNwNtU+Hrhcde9Gc7XekrkQf2JWihDK2zk747pDi9ZLaQOetwvC+lLy0k3tf31SbMI Y4xWnnNPEAhs3BJK4mtoC+m8AqJFH8aVEBPi6xSbMhjlXmhDogSdSkgSLXZtVbKlrLDf ExiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710252522; x=1710857322; 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=axqi5l4Ztq3WiIi5s/5Po9WAHf/Ep2gUDdwyUWhnccw=; b=mjYjM7XFF/O9XETK9NWUlrnBExwfzTkksSx6rdtQ/z7aYhO6DdaTl+L32XiBVW5bkB uwOF3zNDcevS9iRElnhvQ8S0HuZyJ1wjlsRl7hMYF+jcw67/zvVDuMsE17C2GSAjLBCT xEaKRiSlLqlY8oh3Y9Mtt+XavtydUJazJqYN7WERqv3lW9042slFfQiMaS+EeAJqJrlc +q5KLE0c7E1zATfiKtN4gl/Zg8UqamLK5Ym+1eWi3XZVMDXNOCua/49IvA8xJKDk1w4j 7czo2wT2Iy+CY0VngiXsVGQmNVGXv4t+WNGsl5Ji2H249x+d4smr5IdujCZmmUZorrYY zzZA== X-Gm-Message-State: AOJu0Yxxpu+1FkWwtl98mwsIeUxdfkeVA4gX+jS8HVXYn1kO/zrFPdLq oRQXexqxjMY3Db7K+2Dco+Mhce0fStWNewh6gPK4MvkwgRcRpEsLuwW9zmeSwf2DIV4qvY29BCf 2I9I= X-Google-Smtp-Source: AGHT+IE54YP0QBPmQg5Jb8ocQ5Z8Dpoa03OiUd9Nwa54ih0almygQP2WPixS0XsQz2iYikTmmai+7g== X-Received: by 2002:a50:8ad7:0:b0:567:15a6:848e with SMTP id k23-20020a508ad7000000b0056715a6848emr6847525edk.18.1710252521706; Tue, 12 Mar 2024 07:08:41 -0700 (PDT) Received: from hades.. (ppp046103107123.access.hol.gr. [46.103.107.123]) by smtp.gmail.com with ESMTPSA id d23-20020a056402001700b0056857701bf5sm2246086edu.81.2024.03.12.07.08.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 07:08:40 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de, trini@konsulko.com, cfsworks@gmail.com Cc: caleb.connolly@linaro.org, sumit.garg@linaro.org, richard.henderson@linaro.org, Ilias Apalodimas , Ryan Chen , Chia-Wei Wang , Aspeed BMC SW team , Joel Stanley , Simon Glass , Philipp Tomsich , Kever Yang , Michal Simek , Yegor Yefremov , Heinrich Schuchardt , Sam Edwards , Shiji Yang , Bin Meng Subject: [PATCH 1/7 v2] arm: baltos: remove custom linker script Date: Tue, 12 Mar 2024 16:08:23 +0200 Message-Id: <20240312140832.1968215-2-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20240312140832.1968215-1-ilias.apalodimas@linaro.org> References: <20240312140832.1968215-1-ilias.apalodimas@linaro.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 commit 3d74a0977f514 ("ti: am335x: Remove unused linker script") removed the linker script for the TI variant. This linker script doesn't seem to do anything special and on top of that, has no definitions for the EFI runtime sections. So let's get rid of it and use the generic linker script which defines those correctly Signed-off-by: Ilias Apalodimas Reviewed-by: Tom Rini --- board/vscom/baltos/u-boot.lds | 128 ---------------------------------- 1 file changed, 128 deletions(-) delete mode 100644 board/vscom/baltos/u-boot.lds -- 2.37.2 diff --git a/board/vscom/baltos/u-boot.lds b/board/vscom/baltos/u-boot.lds deleted file mode 100644 index cb2ee6769753..000000000000 --- a/board/vscom/baltos/u-boot.lds +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2004-2008 Texas Instruments - * - * (C) Copyright 2002 - * Gary Jennejohn, DENX Software Engineering, - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") -OUTPUT_ARCH(arm) -ENTRY(_start) -SECTIONS -{ - . = 0x00000000; - - . = ALIGN(4); - .text : - { - *(.__image_copy_start) - *(.vectors) - CPUDIR/start.o (.text*) - board/vscom/baltos/built-in.o (.text*) - *(.text*) - } - - . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } - - . = ALIGN(4); - .data : { - *(.data*) - } - - . = ALIGN(4); - - . = .; - - . = ALIGN(4); - __u_boot_list : { - KEEP(*(SORT(__u_boot_list*))); - } - - . = ALIGN(4); - - .image_copy_end : - { - *(.__image_copy_end) - } - - .rel_dyn_start : - { - *(.__rel_dyn_start) - } - - .rel.dyn : { - *(.rel*) - } - - .rel_dyn_end : - { - *(.__rel_dyn_end) - } - - .hash : { *(.hash*) } - - .end : - { - *(.__end) - } - - _image_binary_end = .; - - /* - * Deprecated: this MMU section is used by pxa at present but - * should not be used by new boards/CPUs. - */ - . = ALIGN(4096); - .mmutable : { - *(.mmutable) - } - -/* - * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c - * __bss_base and __bss_limit are for linker only (overlay ordering) - */ - - .bss_start __rel_dyn_start (OVERLAY) : { - KEEP(*(.__bss_start)); - __bss_base = .; - } - - .bss __bss_base (OVERLAY) : { - *(.bss*) - . = ALIGN(4); - __bss_limit = .; - } - - .bss_end __bss_limit (OVERLAY) : { - KEEP(*(.__bss_end)); - } - - .dynsym _image_binary_end : { *(.dynsym) } - .dynbss : { *(.dynbss) } - .dynstr : { *(.dynstr*) } - .dynamic : { *(.dynamic*) } - .gnu.hash : { *(.gnu.hash) } - .plt : { *(.plt*) } - .interp : { *(.interp*) } - .gnu : { *(.gnu*) } - .ARM.exidx : { *(.ARM.exidx*) } -} From patchwork Tue Mar 12 14:08:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 1911094 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; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=gBcIsTB6; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TvFr02FJrz1yWt for ; Wed, 13 Mar 2024 01:09:04 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EFC6C87F56; Tue, 12 Mar 2024 15:08:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gBcIsTB6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 19C1987F3F; Tue, 12 Mar 2024 15:08:51 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (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 3086687F80 for ; Tue, 12 Mar 2024 15:08:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5684073ab38so24038a12.0 for ; Tue, 12 Mar 2024 07:08:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710252526; x=1710857326; darn=lists.denx.de; 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=FjSMhR61rU2pWAjQF3ZKkg2Bp7YMbHLjGk3M7dJ2SI8=; b=gBcIsTB6072JGuHQmUl9bmv24GFXO7whtqT+D5Mahhc6+VgCU5a2YlhDPECoRO2j+E Ur55z2yaDv2rddnUE8yb1x07FA19FaGK/nzvcsU7M9tHfuUa9rquODWbS0cvQzKpr+// 85Hxbv18SWNDQPR8scqL1LTVDa6cH8uSPBmtflJ2IB6PrY3h19xY71Dy5DA7Vw7ykF63 eJUKp5IdJtfrOj5Cu2Bh6zaZ8eRdcHkdV1Wg7NkIdVm0bJmlM8TPFBynkSDyRo/akMGj kzrWn9HTuMnrpIrxcutqXr4bUpxzJ53BKCqqNTE2tEg4RWEa53U9t4eBGdGoRwTkWLKF yGSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710252526; x=1710857326; 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=FjSMhR61rU2pWAjQF3ZKkg2Bp7YMbHLjGk3M7dJ2SI8=; b=eyVbul6zB3CzWiQGiXRQtCqyNXK/g9dDyi/epFtadObrmzHAL+lb/xGPQIE6kFLBfb 1cAN9QYuqz6KsHkS670GuMHARhly3sHsUF/TdCSMBKcnwaU2/Ew+DMXfWoiuLmn/BnJI YgAyMI79N5AQaWwNe8mcjVrviRBrRix4y9V3RLbewnpx67gWMQNJhHA0xQqBxNg39giW ckhvyFjEUz+86ZChEi/wT8LWf6erYEq5CLj5z45f3ehWzOC789ZBEDoOhlNanYidIUfs U6aELBqBqyEA5DEaus6fT3y07/sucpkcFEY0QAeEma8TnM6nsT4ePq1Vd4WDsWOrivhc QaXA== X-Gm-Message-State: AOJu0YwHo0uGsJACdE89LaGKtk7LRFe5jRU+7m8dqE82eltCCxwXHTXN DBN2/43qs2J5RTiplaeDLY6DTuefWPvqK31Xkrgs402Jw1OYY+EAHNdScBRw96hFeEsVPsPnbpU 4Sr4= X-Google-Smtp-Source: AGHT+IH5bABDA9belQ8RPBu3NVg53ntpykfCS5HzyEJScSvMVQ9vSf60/LcLtafvN3kooHwbITmIng== X-Received: by 2002:a50:d595:0:b0:568:335d:1192 with SMTP id v21-20020a50d595000000b00568335d1192mr10171004edi.13.1710252526732; Tue, 12 Mar 2024 07:08:46 -0700 (PDT) Received: from hades.. (ppp046103107123.access.hol.gr. [46.103.107.123]) by smtp.gmail.com with ESMTPSA id d23-20020a056402001700b0056857701bf5sm2246086edu.81.2024.03.12.07.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 07:08:46 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de, trini@konsulko.com, cfsworks@gmail.com Cc: caleb.connolly@linaro.org, sumit.garg@linaro.org, richard.henderson@linaro.org, Ilias Apalodimas , Ryan Chen , Chia-Wei Wang , Aspeed BMC SW team , Joel Stanley , Simon Glass , Philipp Tomsich , Kever Yang , Michal Simek , Yegor Yefremov , Heinrich Schuchardt , Sam Edwards , Shiji Yang , Bin Meng Subject: [PATCH 2/7 v2] arm: clean up v7 and v8 linker scripts for bss_start/end Date: Tue, 12 Mar 2024 16:08:24 +0200 Message-Id: <20240312140832.1968215-3-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20240312140832.1968215-1-ilias.apalodimas@linaro.org> References: <20240312140832.1968215-1-ilias.apalodimas@linaro.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 commit 3ebd1cbc49f0 ("arm: make __bss_start and __bss_end__ compiler-generated") and commit f84a7b8f54db ("ARM: Fix __bss_start and __bss_end in linker scripts") were moving the bss_start/end on c generated variables that were injected in their own sections. The reason was that we needed relative relocations for position independent code and linker bugs back then prevented us from doing so [0]. However, the linker documentation pages states that symbols that are defined within a section definition will create a relocatable type with the value being a fixed offset from the base of a section [1]. So let's start cleaning this up starting with the bss_start and bss_end variables. Convert them into symbols within the .bss section definition. [0] binutils commit 6b3b0ab89663 ("Make linker assigned symbol dynamic only for shared object") [1] https://sourceware.org/binutils/docs/ld/Expression-Section.html Signed-off-by: Ilias Apalodimas Tested-by: Caleb Connolly # Qualcomm sdm845 --- arch/arm/cpu/armv8/u-boot-spl.lds | 14 +++----------- arch/arm/cpu/armv8/u-boot.lds | 15 +++------------ arch/arm/cpu/u-boot.lds | 21 ++++++--------------- arch/arm/lib/sections.c | 2 -- arch/arm/mach-rockchip/u-boot-tpl-v8.lds | 14 +++----------- arch/arm/mach-zynq/u-boot.lds | 21 ++++++--------------- 6 files changed, 21 insertions(+), 66 deletions(-) -- 2.37.2 diff --git a/arch/arm/cpu/armv8/u-boot-spl.lds b/arch/arm/cpu/armv8/u-boot-spl.lds index 7cb9d731246d..16fddb46e9cb 100644 --- a/arch/arm/cpu/armv8/u-boot-spl.lds +++ b/arch/arm/cpu/armv8/u-boot-spl.lds @@ -63,18 +63,10 @@ SECTIONS _image_binary_end = .; - .bss_start (NOLOAD) : { - . = ALIGN(8); - KEEP(*(.__bss_start)); - } >.sdram - - .bss (NOLOAD) : { + .bss : { + __bss_start = .; *(.bss*) - . = ALIGN(8); - } >.sdram - - .bss_end (NOLOAD) : { - KEEP(*(.__bss_end)); + __bss_end = .; } >.sdram /DISCARD/ : { *(.rela*) } diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds index fb6a30c922f7..c4ee10ebc3ff 100644 --- a/arch/arm/cpu/armv8/u-boot.lds +++ b/arch/arm/cpu/armv8/u-boot.lds @@ -149,19 +149,10 @@ SECTIONS _end = .; - . = ALIGN(8); - - .bss_start : { - KEEP(*(.__bss_start)); - } - - .bss : { + .bss ALIGN(8): { + __bss_start = .; *(.bss*) - . = ALIGN(8); - } - - .bss_end : { - KEEP(*(.__bss_end)); + __bss_end = .; } /DISCARD/ : { *(.dynsym) } diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds index 7724c9332c3b..01accb109fad 100644 --- a/arch/arm/cpu/u-boot.lds +++ b/arch/arm/cpu/u-boot.lds @@ -207,23 +207,14 @@ SECTIONS } /* - * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c - * __bss_base and __bss_limit are for linker only (overlay ordering) + * These sections occupy the same memory, but their lifetimes do + * not overlap: U-Boot initializes .bss only after applying dynamic + * relocations and therefore after it doesn't need .rel.dyn any more. */ - - .bss_start __rel_dyn_start (OVERLAY) : { - KEEP(*(.__bss_start)); - __bss_base = .; - } - - .bss __bss_base (OVERLAY) : { + .bss ADDR(.rel.dyn) (OVERLAY): { + __bss_start = .; *(.bss*) - . = ALIGN(4); - __bss_limit = .; - } - - .bss_end __bss_limit (OVERLAY) : { - KEEP(*(.__bss_end)); + __bss_end = .; } .dynsym _image_binary_end : { *(.dynsym) } diff --git a/arch/arm/lib/sections.c b/arch/arm/lib/sections.c index 857879711c6a..8e8bd5797e16 100644 --- a/arch/arm/lib/sections.c +++ b/arch/arm/lib/sections.c @@ -19,8 +19,6 @@ * aliasing warnings. */ -char __bss_start[0] __section(".__bss_start"); -char __bss_end[0] __section(".__bss_end"); char __image_copy_start[0] __section(".__image_copy_start"); char __image_copy_end[0] __section(".__image_copy_end"); char __rel_dyn_start[0] __section(".__rel_dyn_start"); diff --git a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds index 74618eba591b..b7887194026e 100644 --- a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds +++ b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds @@ -56,18 +56,10 @@ SECTIONS _image_binary_end = .; - .bss_start (NOLOAD) : { - . = ALIGN(8); - KEEP(*(.__bss_start)); - } - - .bss (NOLOAD) : { + .bss ALIGN(8) : { + __bss_start = .; *(.bss*) - . = ALIGN(8); - } - - .bss_end (NOLOAD) : { - KEEP(*(.__bss_end)); + __bss_end = .; } /DISCARD/ : { *(.dynsym) } diff --git a/arch/arm/mach-zynq/u-boot.lds b/arch/arm/mach-zynq/u-boot.lds index 3b7c9d515f8b..25c81b21018b 100644 --- a/arch/arm/mach-zynq/u-boot.lds +++ b/arch/arm/mach-zynq/u-boot.lds @@ -103,23 +103,14 @@ SECTIONS _image_binary_end = .; /* - * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c - * __bss_base and __bss_limit are for linker only (overlay ordering) + * These sections occupy the same memory, but their lifetimes do + * not overlap: U-Boot initializes .bss only after applying dynamic + * relocations and therefore after it doesn't need .rel.dyn any more. */ - - .bss_start __rel_dyn_start (OVERLAY) : { - KEEP(*(.__bss_start)); - __bss_base = .; - } - - .bss __bss_base (OVERLAY) : { + .bss ADDR(.rel.dyn) (OVERLAY): { + __bss_start = .; *(.bss*) - . = ALIGN(8); - __bss_limit = .; - } - - .bss_end __bss_limit (OVERLAY) : { - KEEP(*(.__bss_end)); + __bss_end = .; } /* From patchwork Tue Mar 12 14:08:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 1911095 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; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=A/oaeD9l; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TvFrC71n9z1yWt for ; Wed, 13 Mar 2024 01:09:15 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5D76487F80; Tue, 12 Mar 2024 15:08:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="A/oaeD9l"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5AD6B87F80; Tue, 12 Mar 2024 15:08:54 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (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 5370487F69 for ; Tue, 12 Mar 2024 15:08:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5683089d4bbso5442713a12.2 for ; Tue, 12 Mar 2024 07:08:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710252532; x=1710857332; darn=lists.denx.de; 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=J6pvg5Oa7u0dLpTLS16+tVIbHYHC3s3NEBv9Yf4lmgo=; b=A/oaeD9l5ZdFHsCwaP0iigaKq/7trpyiSoBFB/5RMYsGyxTjOXfUlhDWA8S5GGXWJ/ blmw5lW2RCyL/BPfFUYMbXEBlvAYpF9d17LtwwbdtB+UsFRfCySgnLH1gMqSWvJVhxGy tP1atVK33ht8p5eg8UrMh1XPDCGpmLb4rvxHh8x0/Tzi8dnnQ2fCCH8D9D4pq/pXjiFr HYenqsXZj9eRwkptvjmPZdtd9Q2/3yWp4jtET8I5QKz6Vvql4YVOxAEiTx3ncParzfCj pQVMldMAvSDqsLAXZ7fSn0J8MUPnNixq2fFYWbFLZ8KONHp9HMrcjgGEiuPnPWlS71So Gg8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710252532; x=1710857332; 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=J6pvg5Oa7u0dLpTLS16+tVIbHYHC3s3NEBv9Yf4lmgo=; b=HI/UV/62HFWmBbv0JAKH4T3gzN01ln7nwVlHLvU93F8cvthLXNyxu0+h5cqaecSRL/ 3wF7/wzTXrUuj1IJZ/65snCun5eTT5EXZPm221NgzGP4ZcYu7hi5WHg923GavNcG9ufJ evuDjS0YQyUnfbFYrKhSKIBYJxqeVSZLIMxTfgY2t9XtQI1rWYw7NaiRMVPchnGIV+tN EKg+xAj/fdhHs/FkVIobs5OPawNJZ7oNsuC6IQIdkNiBaYEKJibXRNCwTBVeapsPhXsl jx3IyXHYZgHOpY/OEHsoZUs8PJYAkI76Hpt4OGhtr2IBg8j57aRamGZZ3zrJMR8n0fA8 ePsw== X-Gm-Message-State: AOJu0YzTC0SlIqpPTHqoVw81/c1IZxQCb342dp8KzPpE1cS/Qu0ePCYa 4xKIM9VJCQY3Zg7XMJliN7zP1QAlRDAaMBzUvVM4bPJhrg+LbrfRJltHoljC/hBmyRh9XVTewXD tTTs= X-Google-Smtp-Source: AGHT+IEtdpmXJL7Chht9lGl3NCxrb0yB75mXrak5HbOw6mFnYCgJn1Nrf0GaQKJiVAjrm5Sg0OE+Bg== X-Received: by 2002:a50:8e17:0:b0:565:6c72:40a9 with SMTP id 23-20020a508e17000000b005656c7240a9mr6050407edw.28.1710252531701; Tue, 12 Mar 2024 07:08:51 -0700 (PDT) Received: from hades.. (ppp046103107123.access.hol.gr. [46.103.107.123]) by smtp.gmail.com with ESMTPSA id d23-20020a056402001700b0056857701bf5sm2246086edu.81.2024.03.12.07.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 07:08:51 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de, trini@konsulko.com, cfsworks@gmail.com Cc: caleb.connolly@linaro.org, sumit.garg@linaro.org, richard.henderson@linaro.org, Ilias Apalodimas , Sam Edwards , Ryan Chen , Chia-Wei Wang , Aspeed BMC SW team , Joel Stanley , Simon Glass , Philipp Tomsich , Kever Yang , Michal Simek , Yegor Yefremov , Heinrich Schuchardt , Shiji Yang , Bin Meng Subject: [PATCH 3/7 v2] arm: fix __efi_runtime_rel_start/end definitions Date: Tue, 12 Mar 2024 16:08:25 +0200 Message-Id: <20240312140832.1968215-4-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20240312140832.1968215-1-ilias.apalodimas@linaro.org> References: <20240312140832.1968215-1-ilias.apalodimas@linaro.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 __efi_runtime_rel_start/end are defined as c variables for arm7 only in order to force the compiler emit relative references. However, defining those within a section definition will do the same thing since [0]. On top of that the v8 linker scripts define it as a symbol. So let's remove the special sections from the linker scripts, the variable definitions from sections.c and define them as a symbols within the correct section. [0] binutils commit 6b3b0ab89663 ("Make linker assigned symbol dynamic only for shared object") Suggested-by: Sam Edwards Signed-off-by: Ilias Apalodimas Reviewed-by: Sam Edwards Tested-by: Sam Edwards # Binary output identical Reviewed-by: Richard Henderson --- arch/arm/cpu/armv8/u-boot.lds | 4 +--- arch/arm/cpu/u-boot.lds | 16 +++------------- arch/arm/lib/sections.c | 2 -- arch/arm/mach-zynq/u-boot.lds | 16 +++------------- include/asm-generic/sections.h | 2 ++ lib/efi_loader/efi_runtime.c | 1 + 6 files changed, 10 insertions(+), 31 deletions(-) -- 2.37.2 diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds index c4ee10ebc3ff..eccb116d3cfa 100644 --- a/arch/arm/cpu/armv8/u-boot.lds +++ b/arch/arm/cpu/armv8/u-boot.lds @@ -115,9 +115,7 @@ SECTIONS KEEP(*(SORT(__u_boot_list*))); } - . = ALIGN(8); - - .efi_runtime_rel : { + .efi_runtime_rel ALIGN(8) : { __efi_runtime_rel_start = .; *(.rel*.efi_runtime) *(.rel*.efi_runtime.*) diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds index 01accb109fad..37f4cd27d79a 100644 --- a/arch/arm/cpu/u-boot.lds +++ b/arch/arm/cpu/u-boot.lds @@ -152,21 +152,11 @@ SECTIONS KEEP(*(SORT(__u_boot_list*))); } - . = ALIGN(4); - - .efi_runtime_rel_start : - { - *(.__efi_runtime_rel_start) - } - - .efi_runtime_rel : { + .efi_runtime_rel ALIGN(4) : { + __efi_runtime_rel_start = .; *(.rel*.efi_runtime) *(.rel*.efi_runtime.*) - } - - .efi_runtime_rel_stop : - { - *(.__efi_runtime_rel_stop) + __efi_runtime_rel_stop = .; } . = ALIGN(4); diff --git a/arch/arm/lib/sections.c b/arch/arm/lib/sections.c index 8e8bd5797e16..ddfde52163fc 100644 --- a/arch/arm/lib/sections.c +++ b/arch/arm/lib/sections.c @@ -29,6 +29,4 @@ char __secure_stack_start[0] __section(".__secure_stack_start"); char __secure_stack_end[0] __section(".__secure_stack_end"); char __efi_runtime_start[0] __section(".__efi_runtime_start"); char __efi_runtime_stop[0] __section(".__efi_runtime_stop"); -char __efi_runtime_rel_start[0] __section(".__efi_runtime_rel_start"); -char __efi_runtime_rel_stop[0] __section(".__efi_runtime_rel_stop"); char _end[0] __section(".__end"); diff --git a/arch/arm/mach-zynq/u-boot.lds b/arch/arm/mach-zynq/u-boot.lds index 25c81b21018b..11b6e7278a9c 100644 --- a/arch/arm/mach-zynq/u-boot.lds +++ b/arch/arm/mach-zynq/u-boot.lds @@ -58,21 +58,11 @@ SECTIONS KEEP(*(SORT(__u_boot_list*))); } - . = ALIGN(4); - - .efi_runtime_rel_start : - { - *(.__efi_runtime_rel_start) - } - - .efi_runtime_rel : { + .efi_runtime_rel ALIGN(4) : { + __efi_runtime_rel_start = .; *(.rel*.efi_runtime) *(.rel*.efi_runtime.*) - } - - .efi_runtime_rel_stop : - { - *(.__efi_runtime_rel_stop) + __efi_runtime_rel_stop = .; } . = ALIGN(8); diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 1e1657a01673..60949200dd93 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -34,6 +34,8 @@ extern char __priv_data_start[], __priv_data_end[]; /* Start and end of .ctors section - used for constructor calls. */ extern char __ctors_start[], __ctors_end[]; +extern char __efi_runtime_rel_start[], __efi_runtime_rel_stop[]; + /* function descriptor handling (if any). Override * in asm/sections.h */ #ifndef dereference_function_descriptor diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 18da6892e796..9185f1894c47 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -15,6 +15,7 @@ #include #include #include +#include /* For manual relocation support */ DECLARE_GLOBAL_DATA_PTR; From patchwork Tue Mar 12 14:08:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 1911096 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; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=J+U+usi1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TvFrQ5yhCz1yWt for ; Wed, 13 Mar 2024 01:09:26 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B03DC87F71; Tue, 12 Mar 2024 15:09:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="J+U+usi1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C0DD187F8E; Tue, 12 Mar 2024 15:08:59 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) (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 7065D87F71 for ; Tue, 12 Mar 2024 15:08:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5684f95cc9bso4243931a12.1 for ; Tue, 12 Mar 2024 07:08:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710252537; x=1710857337; darn=lists.denx.de; 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=iMOxHHM+Unoaq3XyIs2oq1LjRVh47AY5Cd39Hcukh3E=; b=J+U+usi1nUPEF3LGPJmDy9IZJS4HkjH0ZGu5hwlwU+m1MPh5up3QDlmyNCnPWRI21s +Lm71YxmP2ESqWfsenbHaK54BKKE1OnGf8VizSuqIyWWdIxxW3DuVVOe/awmGH3rAXLf TgamCjBkadZdxEfXDlPlCQIwGX7yOoGM4njnMBa+6tiN3bEruLDeRz9gi3jtfLLg/Y9w xCM9jdHnWPIkFmFtcmkUyzYM3m0OdfbF+ND5WLj/JvAeh3OZVUAvX6DZ9E1SZluB4pOP JOak60sUHn261akyoCPCc4DypnZY4xpFI/fj/ztY+k/jH6MzFAcyHF4NMhKZp4Y5lkcg rdeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710252537; x=1710857337; 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=iMOxHHM+Unoaq3XyIs2oq1LjRVh47AY5Cd39Hcukh3E=; b=GU6drGqG2Dhix+xG0zPJljk1Q122+W+8HO8Ob3wO9C6DfHE/Bbnp56eIv+h9wSiURF KBLTWm7vO4Lw94enq/gUAeBuK0OVAZH76+Vfp8SbRQv5V8j0Q3jgwd/te1GSxsw1aTgE y9pxms2FXXhrblNCGrSUi4RUUqUm/ZtUl6hHw/3dVwQT7DpYUgchoGuxVSHJ6ixFz3S8 hLGhQTUJynOXW8e4LXLA8Y7wOsEXWCoyOsW7DPJIBfk98sFXr3ErPRXvkAv7I2yB7m2i 0p6WuJZwYhBVplXSlC7FXq/JrCUlfAmrVUIDtUjgYEYaaKvlstbO2WFC180u+8MaDrGo DR0A== X-Gm-Message-State: AOJu0Yw0lbIKU3xyrnIh/V6zabrCT5L9KHrOcohL3Gy7y0Ad9vpXZvPT pRKIWU0R0isPKvCNWxTNKZsHA7rqbmopomJFz/PF8l+Wuu9MimWK6vbu220QFBB3Oq13fB851tR rQQg= X-Google-Smtp-Source: AGHT+IECegzFFndq5BpTGNLtjNaNTglGEI4NIcB6k0CQ/MXkHQtNt/11drU3NQ9+rhcQ9YRf95RADw== X-Received: by 2002:a50:d782:0:b0:567:f475:6c6b with SMTP id w2-20020a50d782000000b00567f4756c6bmr10048088edi.8.1710252536840; Tue, 12 Mar 2024 07:08:56 -0700 (PDT) Received: from hades.. (ppp046103107123.access.hol.gr. [46.103.107.123]) by smtp.gmail.com with ESMTPSA id d23-20020a056402001700b0056857701bf5sm2246086edu.81.2024.03.12.07.08.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 07:08:56 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de, trini@konsulko.com, cfsworks@gmail.com Cc: caleb.connolly@linaro.org, sumit.garg@linaro.org, richard.henderson@linaro.org, Ilias Apalodimas , Sam Edwards , Ryan Chen , Chia-Wei Wang , Aspeed BMC SW team , Joel Stanley , Simon Glass , Philipp Tomsich , Kever Yang , Michal Simek , Yegor Yefremov , Heinrich Schuchardt , Shiji Yang , Bin Meng Subject: [PATCH 4/7 v2] arm: clean up v7 and v8 linker scripts for __rel_dyn_start/end Date: Tue, 12 Mar 2024 16:08:26 +0200 Message-Id: <20240312140832.1968215-5-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20240312140832.1968215-1-ilias.apalodimas@linaro.org> References: <20240312140832.1968215-1-ilias.apalodimas@linaro.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 commit 47bd65ef057f ("arm: make __rel_dyn_{start, end} compiler-generated") were moving the __rel_dyn_start/end on c generated variables that were injected in their own sections. The reason was that we needed relative relocations for position independent code and linker bugs back then prevented us from doing so [0]. However, the linker documentation pages states that symbols that are defined within a section definition will create a relocatable type with the value being a fixed offset from the base of a section [1]. [0] binutils commit 6b3b0ab89663 ("Make linker assigned symbol dynamic only for shared object") [1] https://sourceware.org/binutils/docs/ld/Expression-Section.html Suggested-by: Sam Edwards Signed-off-by: Ilias Apalodimas Reviewed-by: Sam Edwards Tested-by: Sam Edwards # Binary output identical Reviewed-by: Richard Henderson --- arch/arm/cpu/armv8/u-boot.lds | 16 +++------------- arch/arm/cpu/u-boot.lds | 14 +++----------- arch/arm/lib/sections.c | 2 -- arch/arm/mach-zynq/u-boot.lds | 14 +++----------- 4 files changed, 9 insertions(+), 37 deletions(-) -- 2.37.2 diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds index eccb116d3cfa..e737de761a9d 100644 --- a/arch/arm/cpu/armv8/u-boot.lds +++ b/arch/arm/cpu/armv8/u-boot.lds @@ -129,20 +129,10 @@ SECTIONS *(.__image_copy_end) } - . = ALIGN(8); - - .rel_dyn_start : - { - *(.__rel_dyn_start) - } - - .rela.dyn : { + .rela.dyn ALIGN(8) : { + __rel_dyn_start = .; *(.rela*) - } - - .rel_dyn_end : - { - *(.__rel_dyn_end) + __rel_dyn_end = .; } _end = .; diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds index 37f4cd27d79a..b1065ec8063d 100644 --- a/arch/arm/cpu/u-boot.lds +++ b/arch/arm/cpu/u-boot.lds @@ -166,18 +166,10 @@ SECTIONS *(.__image_copy_end) } - .rel_dyn_start : - { - *(.__rel_dyn_start) - } - - .rel.dyn : { + .rel.dyn ALIGN(4) : { + __rel_dyn_start = .; *(.rel*) - } - - .rel_dyn_end : - { - *(.__rel_dyn_end) + __rel_dyn_end = .; } .end : diff --git a/arch/arm/lib/sections.c b/arch/arm/lib/sections.c index ddfde52163fc..1ee3dd3667ba 100644 --- a/arch/arm/lib/sections.c +++ b/arch/arm/lib/sections.c @@ -21,8 +21,6 @@ char __image_copy_start[0] __section(".__image_copy_start"); char __image_copy_end[0] __section(".__image_copy_end"); -char __rel_dyn_start[0] __section(".__rel_dyn_start"); -char __rel_dyn_end[0] __section(".__rel_dyn_end"); char __secure_start[0] __section(".__secure_start"); char __secure_end[0] __section(".__secure_end"); char __secure_stack_start[0] __section(".__secure_stack_start"); diff --git a/arch/arm/mach-zynq/u-boot.lds b/arch/arm/mach-zynq/u-boot.lds index 11b6e7278a9c..16245fd4ac2f 100644 --- a/arch/arm/mach-zynq/u-boot.lds +++ b/arch/arm/mach-zynq/u-boot.lds @@ -71,18 +71,10 @@ SECTIONS *(.__image_copy_end) } - .rel_dyn_start : - { - *(.__rel_dyn_start) - } - - .rel.dyn : { + .rel.dyn ALIGN(8) : { + __rel_dyn_start = .; *(.rel*) - } - - .rel_dyn_end : - { - *(.__rel_dyn_end) + __rel_dyn_end = .; } .end : From patchwork Tue Mar 12 14:08:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 1911098 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; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=iBp5ThKK; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TvFrd5pKPz1yWt for ; Wed, 13 Mar 2024 01:09:37 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8A71C87FAD; Tue, 12 Mar 2024 15:09:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="iBp5ThKK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B0EB387F78; Tue, 12 Mar 2024 15:09:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (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 A789387F69 for ; Tue, 12 Mar 2024 15:09:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-568107a9ff2so6257127a12.3 for ; Tue, 12 Mar 2024 07:09:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710252542; x=1710857342; darn=lists.denx.de; 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=EyTGDcjnbgrI/Feob4SwLA7ZO6R4QQDrl/SKUTNkZvw=; b=iBp5ThKKi69dIKMAVr1mcufMFdeNwsQK1BCYmqqBGl0qkyH2FE/zzM3JQ/j2RXNsAl EuQ0ANlgK583TIDgydwJhzjFdZ10NXe8LgZZsxLuDi+fx2+sAtyBmPH5eFjIrzW3Csr7 Ffz8g523a9xksvql92CiYOiHziJAZqw91FSarafYW5N7zU0cP0TUAXrn8gM8/IzD0W7l dFCYOMdDVjim7C0Xvy+VGxUUmOZKOvmedsjTwhnRLoW7YllXIbbmAw7Uacm0kjEVF5L7 wjOQ62SD6Dkl1Rc/LaLn64kVlNxEfKBjD8JAAlGUQgEG96YlMaJyajy7MwGuu80189AQ 4/qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710252542; x=1710857342; 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=EyTGDcjnbgrI/Feob4SwLA7ZO6R4QQDrl/SKUTNkZvw=; b=WZVU1YP7IUSn5OgIN0vDcx44lDNSek3YtEb71TTIbeG7AaPSC9t/KtrmRtGbr0dHY+ BEKnFP8DjRDvgpLvBTqV5Tbb3HoG7fZ+LqjBWLFInCq5XPzxvag7BDt2qr28LlHPTT33 /bpKxkdqHE1sSGbpobJEDYB5AtjYN/oAup8dcY7pHZ/nFZmy/Woqnz5guQKGqFXnPbEN jPzZK/RePf0kIsRy7/xssefoExHMegiQpiFl6OpwcCWMFx5Emv5hGg92HYt9szFZ5WkE LbDfTBQJDdOc9IbU6Eog+43PDMnIpX29vNo2wBRaDHvNFwXEwvSQtI4aum0wml39nZz4 VaJg== X-Gm-Message-State: AOJu0Ywl0HDx+wvn9PsakEkbceuVKIPP4ijz0gilzUIk29qyPiUOOTvr RzEnRA0Uq76oOnKTucPkJ0Mko0sYNEWOHa3vBPKYbYpFgbyDMOsa690kXdkcKGIFbIFL6oprQR+ 8B00= X-Google-Smtp-Source: AGHT+IFeHq7dMtYZ/Fq3sykOppM9UyyKnwbF/FcEfdC5chseddugxzDYlCY1mtVLhFHNrig0ON2AXg== X-Received: by 2002:a50:d618:0:b0:568:2ad2:5d96 with SMTP id x24-20020a50d618000000b005682ad25d96mr355184edi.40.1710252541919; Tue, 12 Mar 2024 07:09:01 -0700 (PDT) Received: from hades.. (ppp046103107123.access.hol.gr. [46.103.107.123]) by smtp.gmail.com with ESMTPSA id d23-20020a056402001700b0056857701bf5sm2246086edu.81.2024.03.12.07.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 07:09:01 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de, trini@konsulko.com, cfsworks@gmail.com Cc: caleb.connolly@linaro.org, sumit.garg@linaro.org, richard.henderson@linaro.org, Ilias Apalodimas , Sam Edwards , Ryan Chen , Chia-Wei Wang , Aspeed BMC SW team , Joel Stanley , Simon Glass , Philipp Tomsich , Kever Yang , Michal Simek , Yegor Yefremov , Heinrich Schuchardt , Shiji Yang , Bin Meng Subject: [PATCH 5/7 v2] arm: fix __efi_runtime_start/end definitions Date: Tue, 12 Mar 2024 16:08:27 +0200 Message-Id: <20240312140832.1968215-6-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20240312140832.1968215-1-ilias.apalodimas@linaro.org> References: <20240312140832.1968215-1-ilias.apalodimas@linaro.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 __efi_runtime_start/end are defined as c variables for arm7 only in order to force the compiler emit relative references. However, defining those within a section definition will do the same thing since [0]. On top of that the v8 linker scripts define it as a symbol. So let's remove the special sections from the linker scripts, the variable definitions from sections.c and define them as a symbols within the correct section. [0] binutils commit 6b3b0ab89663 ("Make linker assigned symbol dynamic only for shared object") Suggested-by: Sam Edwards Signed-off-by: Ilias Apalodimas Reviewed-by: Sam Edwards Tested-by: Sam Edwards # Binary output identical Reviewed-by: Richard Henderson --- arch/arm/cpu/u-boot.lds | 12 +++--------- arch/arm/lib/sections.c | 2 -- arch/arm/mach-zynq/u-boot.lds | 12 +++--------- include/asm-generic/sections.h | 1 + 4 files changed, 7 insertions(+), 20 deletions(-) -- 2.37.2 diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds index b1065ec8063d..df979986a5ef 100644 --- a/arch/arm/cpu/u-boot.lds +++ b/arch/arm/cpu/u-boot.lds @@ -43,18 +43,12 @@ SECTIONS } /* This needs to come before *(.text*) */ - .__efi_runtime_start : { - *(.__efi_runtime_start) - } - - .efi_runtime : { + .efi_runtime ALIGN(4) : { + __efi_runtime_start = .; *(.text.efi_runtime*) *(.rodata.efi_runtime*) *(.data.efi_runtime*) - } - - .__efi_runtime_stop : { - *(.__efi_runtime_stop) + __efi_runtime_stop = .; } .text_rest : diff --git a/arch/arm/lib/sections.c b/arch/arm/lib/sections.c index 1ee3dd3667ba..a4d4202e99f5 100644 --- a/arch/arm/lib/sections.c +++ b/arch/arm/lib/sections.c @@ -25,6 +25,4 @@ char __secure_start[0] __section(".__secure_start"); char __secure_end[0] __section(".__secure_end"); char __secure_stack_start[0] __section(".__secure_stack_start"); char __secure_stack_end[0] __section(".__secure_stack_end"); -char __efi_runtime_start[0] __section(".__efi_runtime_start"); -char __efi_runtime_stop[0] __section(".__efi_runtime_stop"); char _end[0] __section(".__end"); diff --git a/arch/arm/mach-zynq/u-boot.lds b/arch/arm/mach-zynq/u-boot.lds index 16245fd4ac2f..fc0ba0ed9a84 100644 --- a/arch/arm/mach-zynq/u-boot.lds +++ b/arch/arm/mach-zynq/u-boot.lds @@ -22,18 +22,12 @@ SECTIONS } /* This needs to come before *(.text*) */ - .__efi_runtime_start : { - *(.__efi_runtime_start) - } - - .efi_runtime : { + .efi_runtime ALIGN(4) : { + __efi_runtime_start = .; *(.text.efi_runtime*) *(.rodata.efi_runtime*) *(.data.efi_runtime*) - } - - .__efi_runtime_stop : { - *(.__efi_runtime_stop) + __efi_runtime_stop = .; } .text_rest : diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 60949200dd93..b6bca53db10d 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -35,6 +35,7 @@ extern char __priv_data_start[], __priv_data_end[]; extern char __ctors_start[], __ctors_end[]; extern char __efi_runtime_rel_start[], __efi_runtime_rel_stop[]; +extern char __efi_runtime_start[], __efi_runtime_stop[]; /* function descriptor handling (if any). Override * in asm/sections.h */ From patchwork Tue Mar 12 14:08:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 1911099 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; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=YQYoSpHg; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TvFrr25l4z1yWt for ; Wed, 13 Mar 2024 01:09:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 549A887FA0; Tue, 12 Mar 2024 15:09:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="YQYoSpHg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C3EED87F8C; Tue, 12 Mar 2024 15:09:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) (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 B4F9B87FA0 for ; Tue, 12 Mar 2024 15:09:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5684c3313cdso3224407a12.3 for ; Tue, 12 Mar 2024 07:09:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710252547; x=1710857347; darn=lists.denx.de; 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=ZaScewqBQfQe1ZYJSJupnjWvoj3IezG3YAWy8EhJX64=; b=YQYoSpHgIXuFHcDWlNkpgafJZnAp/ofW3toU05xiAHfhwiRO78J3iYnW9/huRAJ/63 H9xhHNZ9fN9+SFLTrQGmo4Kp4e2fXoojRsWOeKLtiEO+bQMW32bKJ6CcDipzCXNZHx/i SOQnfpWPShN5px8kTufo4hCB95HXUfEmIV2hDRghqopBZe98f2rQgmF+TQkqJ48uJL5f srxJUf6RnTykjTE/B34T3oJQkTIXj6B2xm3MZzAeEUlDRTEjFbdsNVuYqSVxoXrflfBZ xmMuZCMIOmOWncyqXhe1FdyX2HTGeOSOJe29fHTCYGwmncGT1bfd7n9otyphgX6ZAS7X 1tdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710252547; x=1710857347; 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=ZaScewqBQfQe1ZYJSJupnjWvoj3IezG3YAWy8EhJX64=; b=DLQ+agHjy4WCyVUnjfiGrVOYlSkHlqHOT74TxAVdePJiFpQmERK4yB5K7ZDL5STR8E 8yqPGEmSs/2z8Z0Lnmt1ULCAus8D+61N8pkDaeQmmRqgc8UMZgKjiehEONenzeTnRFBB C9Xo89OHj1kmE4qpIe/CU6V5iENYwjuPWcjCsfNMFxT/KIcxOz4b1u20HFWzjOCOwBcn WHs2wtL2ww8iG/libTlEyo47kq1/NJlLhnwxk+BlMYsH5XQizQZ8oEqgJ3JDjfs2FqCh zEbudxbUIWZqjJ5vAmO7092ZausSHE7+kfCb9RLsvSaXt8mvP1XSpI8eJ+8blxayvvTB fHDw== X-Gm-Message-State: AOJu0Yxs6eFHIrgiWP1asexKxK4q2qSyksx5NCIChiPokJOc0gsfgNiG 9MeL+GIc+wS8n3ibcftAkF8JMa9hRDywTbRuArXu3fjo1KRU0N8IPPUtxVi+Vr2SELQRY42qYUk seD8= X-Google-Smtp-Source: AGHT+IE1Rjogc2md/TeplFuUrfeTQiBSDTYPkTEmoi1u9/73u2LTKveWqXpZpEmslxfJmnh5dE9nrA== X-Received: by 2002:a50:8717:0:b0:567:9ddd:65c3 with SMTP id i23-20020a508717000000b005679ddd65c3mr6884379edb.29.1710252546958; Tue, 12 Mar 2024 07:09:06 -0700 (PDT) Received: from hades.. (ppp046103107123.access.hol.gr. [46.103.107.123]) by smtp.gmail.com with ESMTPSA id d23-20020a056402001700b0056857701bf5sm2246086edu.81.2024.03.12.07.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 07:09:06 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de, trini@konsulko.com, cfsworks@gmail.com Cc: caleb.connolly@linaro.org, sumit.garg@linaro.org, richard.henderson@linaro.org, Ilias Apalodimas , Sam Edwards , Ryan Chen , Chia-Wei Wang , Aspeed BMC SW team , Joel Stanley , Simon Glass , Philipp Tomsich , Kever Yang , Michal Simek , Yegor Yefremov , Heinrich Schuchardt , Shiji Yang , Bin Meng Subject: [PATCH 6/7 v2] arm: move image_copy_start/end to linker symbols Date: Tue, 12 Mar 2024 16:08:28 +0200 Message-Id: <20240312140832.1968215-7-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20240312140832.1968215-1-ilias.apalodimas@linaro.org> References: <20240312140832.1968215-1-ilias.apalodimas@linaro.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 image_copy_start/end are defined as c variables in order to force the compiler emit relative references. However, defining those within a section definition will do the same thing since [0]. So let's remove the special sections from the linker scripts, the variable definitions from sections.c and define them as a symbols within a section. [0] binutils commit 6b3b0ab89663 ("Make linker assigned symbol dynamic only for shared object") Suggested-by: Sam Edwards Signed-off-by: Ilias Apalodimas Tested-by: Sam Edwards # Binary output identical Reviewed-by: Richard Henderson --- arch/arm/cpu/armv8/u-boot-spl.lds | 7 ++----- arch/arm/cpu/armv8/u-boot.lds | 9 ++------- arch/arm/cpu/u-boot-spl.lds | 2 +- arch/arm/cpu/u-boot.lds | 9 ++------- arch/arm/lib/sections.c | 2 -- arch/arm/mach-aspeed/ast2600/u-boot-spl.lds | 2 +- arch/arm/mach-rockchip/u-boot-tpl-v8.lds | 7 ++----- arch/arm/mach-zynq/u-boot-spl.lds | 2 +- arch/arm/mach-zynq/u-boot.lds | 8 ++------ 9 files changed, 13 insertions(+), 35 deletions(-) -- 2.37.2 diff --git a/arch/arm/cpu/armv8/u-boot-spl.lds b/arch/arm/cpu/armv8/u-boot-spl.lds index 16fddb46e9cb..6417cbd08e2c 100644 --- a/arch/arm/cpu/armv8/u-boot-spl.lds +++ b/arch/arm/cpu/armv8/u-boot-spl.lds @@ -21,9 +21,9 @@ OUTPUT_ARCH(aarch64) ENTRY(_start) SECTIONS { + __image_copy_start = ADDR(.text); .text : { . = ALIGN(8); - __image_copy_start = .; CPUDIR/start.o (.text*) *(.text*) } >.sram @@ -51,10 +51,7 @@ SECTIONS KEEP(*(SORT(__u_boot_list*))); } >.sram - .image_copy_end : { - . = ALIGN(8); - *(.__image_copy_end) - } >.sram + __image_copy_end = .; .end : { . = ALIGN(8); diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds index e737de761a9d..33f4624b561d 100644 --- a/arch/arm/cpu/armv8/u-boot.lds +++ b/arch/arm/cpu/armv8/u-boot.lds @@ -21,9 +21,9 @@ SECTIONS . = 0x00000000; . = ALIGN(8); + __image_copy_start = ADDR(.text); .text : { - *(.__image_copy_start) CPUDIR/start.o (.text*) } @@ -122,12 +122,7 @@ SECTIONS __efi_runtime_rel_stop = .; } - . = ALIGN(8); - - .image_copy_end : - { - *(.__image_copy_end) - } + __image_copy_end = .; .rela.dyn ALIGN(8) : { __rel_dyn_start = .; diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds index fb2189d50dea..9ed62395a9c5 100644 --- a/arch/arm/cpu/u-boot-spl.lds +++ b/arch/arm/cpu/u-boot-spl.lds @@ -14,9 +14,9 @@ SECTIONS . = 0x00000000; . = ALIGN(4); + __image_copy_start = ADDR(.text); .text : { - __image_copy_start = .; *(.vectors) CPUDIR/start.o (.text*) *(.text*) diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds index df979986a5ef..b6b19a4174fe 100644 --- a/arch/arm/cpu/u-boot.lds +++ b/arch/arm/cpu/u-boot.lds @@ -35,9 +35,9 @@ SECTIONS . = 0x00000000; . = ALIGN(4); + __image_copy_start = ADDR(.text); .text : { - *(.__image_copy_start) *(.vectors) CPUDIR/start.o (.text*) } @@ -153,12 +153,7 @@ SECTIONS __efi_runtime_rel_stop = .; } - . = ALIGN(4); - - .image_copy_end : - { - *(.__image_copy_end) - } + __image_copy_end = .; .rel.dyn ALIGN(4) : { __rel_dyn_start = .; diff --git a/arch/arm/lib/sections.c b/arch/arm/lib/sections.c index a4d4202e99f5..db5463b2bbbc 100644 --- a/arch/arm/lib/sections.c +++ b/arch/arm/lib/sections.c @@ -19,8 +19,6 @@ * aliasing warnings. */ -char __image_copy_start[0] __section(".__image_copy_start"); -char __image_copy_end[0] __section(".__image_copy_end"); char __secure_start[0] __section(".__secure_start"); char __secure_end[0] __section(".__secure_end"); char __secure_stack_start[0] __section(".__secure_stack_start"); diff --git a/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds b/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds index 37f0ccd92201..ada6570d9712 100644 --- a/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds +++ b/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds @@ -22,9 +22,9 @@ SECTIONS . = 0x00000000; . = ALIGN(4); + __image_copy_start = ADDR(.text); .text : { - __image_copy_start = .; *(.vectors) CPUDIR/start.o (.text*) *(.text*) diff --git a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds index b7887194026e..8ff35b5c17cf 100644 --- a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds +++ b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds @@ -22,9 +22,9 @@ SECTIONS { . = 0x00000000; + __image_copy_start = ADDR(.text); .text : { . = ALIGN(8); - *(.__image_copy_start) CPUDIR/start.o (.text*) *(.text*) } @@ -44,10 +44,7 @@ SECTIONS KEEP(*(SORT(__u_boot_list*))); } - .image_copy_end : { - . = ALIGN(8); - *(.__image_copy_end) - } + __image_copy_end = .; .end : { . = ALIGN(8); diff --git a/arch/arm/mach-zynq/u-boot-spl.lds b/arch/arm/mach-zynq/u-boot-spl.lds index 8c18d3f91f4b..d96a57702886 100644 --- a/arch/arm/mach-zynq/u-boot-spl.lds +++ b/arch/arm/mach-zynq/u-boot-spl.lds @@ -18,9 +18,9 @@ ENTRY(_start) SECTIONS { . = ALIGN(4); + __image_copy_start = ADDR(.text); .text : { - __image_copy_start = .; *(.vectors) CPUDIR/start.o (.text*) *(.text*) diff --git a/arch/arm/mach-zynq/u-boot.lds b/arch/arm/mach-zynq/u-boot.lds index fc0ba0ed9a84..f739d1cfce85 100644 --- a/arch/arm/mach-zynq/u-boot.lds +++ b/arch/arm/mach-zynq/u-boot.lds @@ -14,9 +14,9 @@ SECTIONS . = 0x00000000; . = ALIGN(4); + __image_copy_start = ADDR(.text); .text : { - *(.__image_copy_start) *(.vectors) CPUDIR/start.o (.text*) } @@ -59,11 +59,7 @@ SECTIONS __efi_runtime_rel_stop = .; } - . = ALIGN(8); - .image_copy_end : - { - *(.__image_copy_end) - } + __image_copy_end = .; .rel.dyn ALIGN(8) : { __rel_dyn_start = .; From patchwork Tue Mar 12 14:08:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 1911100 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; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=BvlxnZzR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TvFs25qLYz1yWt for ; Wed, 13 Mar 2024 01:09:58 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7991987F8C; Tue, 12 Mar 2024 15:09:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="BvlxnZzR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C19BE87F4B; Tue, 12 Mar 2024 15:09:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) (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 CB9DE87F75 for ; Tue, 12 Mar 2024 15:09:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-56877761303so742476a12.3 for ; Tue, 12 Mar 2024 07:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710252552; x=1710857352; darn=lists.denx.de; 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=EJRs1vrJJ4CKMJShK+cbz2zWdTiiQf+L3+YxItkCyZY=; b=BvlxnZzReujRXFLr5ylhePJzTrJYB/Wp4wRgPIHXLB4NXq1kApFEdEQgGnTdnCjWkf GpHYvdE1SPyrnDibiKDiu7VKurcr6Jgl0iixa0/7hkkp9JgPCh56eYnwTzMVDoy6pO+V Y3PlmrVX2HcN1QFM6GiKOagrR1lBkg7UyigG1Cc8fzKRVQlNThDvAN7zqYanXVxSQMEF SKYfs/1P1jgk5naYd4vgjYLhCGpOa+t92RLHtg3gbC4fNhZzuOaJzCQeoQVy/d6PXmJy MTE95Bt5de6PmQPMg+2ujotMWX3P3Y55zMdfcQ+gEifJJ9UdFjrtZVAlAGgJQacaj0Tr BX3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710252552; x=1710857352; 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=EJRs1vrJJ4CKMJShK+cbz2zWdTiiQf+L3+YxItkCyZY=; b=IhiO+tYbdUOU01aOZxMiAnHT9jvGeb0mvDxc7wVKVO/WV8+tPcxTBOVTyWUw5/avko i3uacgcULtNq6cdPsxFxxjNnPoioQzIAfjjBbx81DEQXbYn6pr5Un4owcZpdDwlQ9sCU SvGTRGnBeH1Qb3zcFhpB8Pq65j03LCY/7Lo3UbslggpQ7pZWpYJy/3tDt8AxLDrodn24 xlfOn17iAhFpZoGOuZypeqa+obGaYJwWXqlUrkIg3LzBcF9Dmhrcw2No0ht8jloddi+T 2V1GuCCD6qPzgUjrL8x+54/cZpc5QvwHNKtWzECzESNJfOIm0G0ZptR0LHul99JVBiO4 WAmQ== X-Gm-Message-State: AOJu0YwoYaR4Ih8bMGbKGQqVEXVTj5G5dAROcPirdspQq9BFDlAdCQxx 8AI+LnPQgkWP35dD9YMNhl1L5QJlm0SirWR5ahxcUy/r2J2U0hBip9EkIVQzRYDTs+imJaVp+YA /p88= X-Google-Smtp-Source: AGHT+IEEG3xOpDF16Na675uxOjkfchkLhYvpwiDZ5ICR0qhrBJuDFbKDQnFHRCtE1Gi/41bYkXlS1w== X-Received: by 2002:a50:9ee9:0:b0:564:5150:76a2 with SMTP id a96-20020a509ee9000000b00564515076a2mr1478384edf.4.1710252552063; Tue, 12 Mar 2024 07:09:12 -0700 (PDT) Received: from hades.. (ppp046103107123.access.hol.gr. [46.103.107.123]) by smtp.gmail.com with ESMTPSA id d23-20020a056402001700b0056857701bf5sm2246086edu.81.2024.03.12.07.09.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 07:09:11 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de, trini@konsulko.com, cfsworks@gmail.com Cc: caleb.connolly@linaro.org, sumit.garg@linaro.org, richard.henderson@linaro.org, Ilias Apalodimas , Ryan Chen , Chia-Wei Wang , Aspeed BMC SW team , Joel Stanley , Simon Glass , Philipp Tomsich , Kever Yang , Michal Simek , Yegor Yefremov , Heinrich Schuchardt , Sam Edwards , Shiji Yang , Bin Meng Subject: [PATCH 7/7 v2] arm: remove redundant section alignments Date: Tue, 12 Mar 2024 16:08:29 +0200 Message-Id: <20240312140832.1968215-8-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20240312140832.1968215-1-ilias.apalodimas@linaro.org> References: <20240312140832.1968215-1-ilias.apalodimas@linaro.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 Previous patches cleaning up linker symbols, also merged any explicit . = ALIGN(x); into section definitions -- e.g '.bss ALIGN(x) :' instead of '. - ALIGN(x); bss : {...}' However, if the output address is not specified then one will be chosen for the section. This address will be adjusted to fit the alignment requirement of the output section following the strictest alignment of any input section contained within the output section. So let's get rid of the redundant ALIGN directives. It's worth noting that the only platform the alignment is preserved on .rel.dyn is mach-zynq, which was explicitly aligning that section on an 8b boundary instead of the automatically chosen 4b alignment. Signed-off-by: Ilias Apalodimas --- arch/arm/cpu/armv8/u-boot.lds | 6 +++--- arch/arm/cpu/u-boot.lds | 6 +++--- arch/arm/mach-rockchip/u-boot-tpl-v8.lds | 2 +- arch/arm/mach-zynq/u-boot.lds | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) -- 2.37.2 diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds index 33f4624b561d..ccdd1966cfbc 100644 --- a/arch/arm/cpu/armv8/u-boot.lds +++ b/arch/arm/cpu/armv8/u-boot.lds @@ -115,7 +115,7 @@ SECTIONS KEEP(*(SORT(__u_boot_list*))); } - .efi_runtime_rel ALIGN(8) : { + .efi_runtime_rel : { __efi_runtime_rel_start = .; *(.rel*.efi_runtime) *(.rel*.efi_runtime.*) @@ -124,7 +124,7 @@ SECTIONS __image_copy_end = .; - .rela.dyn ALIGN(8) : { + .rela.dyn : { __rel_dyn_start = .; *(.rela*) __rel_dyn_end = .; @@ -132,7 +132,7 @@ SECTIONS _end = .; - .bss ALIGN(8): { + .bss : { __bss_start = .; *(.bss*) __bss_end = .; diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds index b6b19a4174fe..a9fcbbf22e96 100644 --- a/arch/arm/cpu/u-boot.lds +++ b/arch/arm/cpu/u-boot.lds @@ -43,7 +43,7 @@ SECTIONS } /* This needs to come before *(.text*) */ - .efi_runtime ALIGN(4) : { + .efi_runtime : { __efi_runtime_start = .; *(.text.efi_runtime*) *(.rodata.efi_runtime*) @@ -146,7 +146,7 @@ SECTIONS KEEP(*(SORT(__u_boot_list*))); } - .efi_runtime_rel ALIGN(4) : { + .efi_runtime_rel : { __efi_runtime_rel_start = .; *(.rel*.efi_runtime) *(.rel*.efi_runtime.*) @@ -155,7 +155,7 @@ SECTIONS __image_copy_end = .; - .rel.dyn ALIGN(4) : { + .rel.dyn : { __rel_dyn_start = .; *(.rel*) __rel_dyn_end = .; diff --git a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds index 8ff35b5c17cf..e67416c09c1c 100644 --- a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds +++ b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds @@ -53,7 +53,7 @@ SECTIONS _image_binary_end = .; - .bss ALIGN(8) : { + .bss : { __bss_start = .; *(.bss*) __bss_end = .; diff --git a/arch/arm/mach-zynq/u-boot.lds b/arch/arm/mach-zynq/u-boot.lds index f739d1cfce85..111410215072 100644 --- a/arch/arm/mach-zynq/u-boot.lds +++ b/arch/arm/mach-zynq/u-boot.lds @@ -22,7 +22,7 @@ SECTIONS } /* This needs to come before *(.text*) */ - .efi_runtime ALIGN(4) : { + .efi_runtime : { __efi_runtime_start = .; *(.text.efi_runtime*) *(.rodata.efi_runtime*) @@ -52,7 +52,7 @@ SECTIONS KEEP(*(SORT(__u_boot_list*))); } - .efi_runtime_rel ALIGN(4) : { + .efi_runtime_rel : { __efi_runtime_rel_start = .; *(.rel*.efi_runtime) *(.rel*.efi_runtime.*)