From patchwork Sat May 20 20:55:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Edwards X-Patchwork-Id: 1784184 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 (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=l+6UGOGK; 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 4QPKmd5fpNz20PV for ; Sun, 21 May 2023 22:35:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0A112857CF; Sun, 21 May 2023 14:33:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="l+6UGOGK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2417084780; Sat, 20 May 2023 22:56:12 +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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) (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 58AB9847BD for ; Sat, 20 May 2023 22:56:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=cfsworks@gmail.com Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-64d2da69fdfso2709676b3a.0 for ; Sat, 20 May 2023 13:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684616167; x=1687208167; 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=Zx9z5QFGwPVQBv1lsXC/s7kELhiNp8EKSQebZkMIJc4=; b=l+6UGOGK46A/v3qWoGaAfeUczmfaZ8hFeul4uycnWuBpAiQux94QeYLqXvIM9Z+Iqf 1tQVIol1pDl7u/QgjicQTOvCMqKk/NkNmJw8Mu29MJXvcfaur9oIOoIx7GTrwDm0BI20 D37+0bzoGwhmrcr2RgEfIJZVTMtAbTubCxwjA+FZ/KiWqnSO+gXjmhvLK2gdPsyva9EI Oqu0ad3gDBaDFIamkMOfYk4HUX5rojibndDbyibLp2yQ5Le7pIUZQCEeuoKAtJFs9j5e 4Mkxz5iK2XJ4B4yNCadgoFTXNWb5mCQGsdZneFyJRygUJ61/kkOo3r0zreZE6EahNHRj rR0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684616167; x=1687208167; 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=Zx9z5QFGwPVQBv1lsXC/s7kELhiNp8EKSQebZkMIJc4=; b=boUFeroEKFt4IbEsuzmQdp85J1c2wAi9qWwRi8C/SJntBo2frSCJoKV5j/4M1qkUBN MKgl2Umo7tG0POgvrzzSXkLpT9iudRjH1iDua+jeZB6eDIr9oc/zaCR4hAeiCgigDD5K p6FUnegN1D1otQcyjCIEb+8DHr9b3jnhcbNtWpByTNDMpGUfeKywMhND08JbzmRYhFsQ VUHsvn29VLflqhNwNeLM/OEDw0AYUoBaThxlY9RuskTB3+aXN/XWEQMAl7oZ5pQac7zs Q6PZlRwPzGawNYjXinHYAUiMf6LS5zw7UPxhKeWnML/MPSst4YfJA2Kcr+I7xp37+b73 A6zg== X-Gm-Message-State: AC+VfDyY1B8GMYU9Eg9iv1xfx9byN2CA3rcTnkRTS2BXVLActRemWCzT HYbThIh5buMm7fRaWjcrPRgUb12D3vLS8lbX X-Google-Smtp-Source: ACHHUZ6OrRXpSXAUggCvuD8vbaL3cZPvbp+PDnu6HfAMU/ZBGfH6Du1LpBoBNncLUxAEdGuVJkknMQ== X-Received: by 2002:a05:6a00:1803:b0:63a:ea82:b7b7 with SMTP id y3-20020a056a00180300b0063aea82b7b7mr7964771pfa.28.1684616167476; Sat, 20 May 2023 13:56:07 -0700 (PDT) Received: from celestia.nettie.lan (static-198-54-134-172.cust.tzulo.com. [198.54.134.172]) by smtp.gmail.com with ESMTPSA id j17-20020a62e911000000b0064d413caea6sm1651045pfh.179.2023.05.20.13.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 May 2023 13:56:07 -0700 (PDT) From: Sam Edwards X-Google-Original-From: Sam Edwards To: u-boot@lists.denx.de Cc: Sam Edwards , Andrew Scull , Simon Glass , Tom Rini Subject: [RFC PATCH 09/10] arm: discard all .dyn* sections Date: Sat, 20 May 2023 14:55:46 -0600 Message-Id: <20230520205547.1009254-10-CFSworks@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230520205547.1009254-1-CFSworks@gmail.com> References: <20230520205547.1009254-1-CFSworks@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 21 May 2023 14:33:27 +0200 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 This makes the output ELF friendlier to llvm-objcopy, which otherwise complains about discarding .dynsym when it's (potentially) referenced by .rel.dyn. Since u-boot doesn't actually make use of a dynamic linker, and these sections are only here because we're building --pie, it's best to discard what we don't need. Signed-off-by: Sam Edwards --- arch/arm/cpu/u-boot.lds | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds index 8cdf08a730..bd4650bd86 100644 --- a/arch/arm/cpu/u-boot.lds +++ b/arch/arm/cpu/u-boot.lds @@ -235,10 +235,13 @@ SECTIONS */ /DISCARD/ : { *(.gnu.version*) } - .dynsym _image_binary_end : { *(.dynsym) } - .dynbss : { *(.dynbss) } - .dynstr : { *(.dynstr*) } - .dynamic : { *(.dynamic*) } + /* + * Not needed at runtime: relocations are done directly on .rel.dyn, + * and we're self-relocating so we don't need compatibility with an + * external dynamic linker. + */ + /DISCARD/ : { *(.dyn*) } + .plt : { *(.plt*) } .interp : { *(.interp*) } .gnu.hash : { *(.gnu.hash) }