All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Edwards <cfsworks@gmail.com>
To: u-boot@lists.denx.de
Cc: Sam Edwards <CFSworks@gmail.com>,
	Andrew Scull <ascull@google.com>, Simon Glass <sjg@chromium.org>,
	Tom Rini <trini@konsulko.com>
Subject: [RFC PATCH 09/10] arm: discard all .dyn* sections
Date: Sat, 20 May 2023 14:55:46 -0600	[thread overview]
Message-ID: <20230520205547.1009254-10-CFSworks@gmail.com> (raw)
In-Reply-To: <20230520205547.1009254-1-CFSworks@gmail.com>

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 <CFSworks@gmail.com>
---

 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) }
-- 
2.39.2


  parent reply	other threads:[~2023-05-21 12:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-20 20:55 [RFC PATCH 00/10] Improve ARM target's support for LLVM toolchain Sam Edwards
2023-05-20 20:55 ` [RFC PATCH 01/10] makefile: Fix symbol typo in binary_size_check Sam Edwards
2023-05-20 20:55 ` [RFC PATCH 02/10] arm: set alignment properly for asm funcs Sam Edwards
2023-05-20 20:55 ` [RFC PATCH 03/10] arm: exclude eabi_compat from LTO Sam Edwards
2023-05-20 20:55 ` [RFC PATCH 04/10] arm: add __aeabi_memclr in eabi_compat Sam Edwards
2023-05-20 20:55 ` [RFC PATCH 05/10] arm: add aligned-memory aliases to eabi_compat Sam Edwards
2023-05-20 20:55 ` [RFC PATCH 06/10] arm: discard .gnu.version* sections Sam Edwards
2023-05-20 20:55 ` [RFC PATCH 07/10] arm: efi_loader: discard hash, unwind information Sam Edwards
2023-05-22  7:00   ` Ilias Apalodimas
2023-05-22 19:25     ` Sam Edwards
2023-05-22 20:28       ` Ilias Apalodimas
2023-05-23  5:08       ` Heinrich Schuchardt
2023-05-20 20:55 ` [RFC PATCH 08/10] arm: efi_loader: move .dynamic out of .text in EFI Sam Edwards
2023-05-22  7:30   ` Ilias Apalodimas
2023-05-22  8:10   ` Heinrich Schuchardt
2023-05-22 17:13     ` Sam Edwards
2023-05-20 20:55 ` Sam Edwards [this message]
2023-05-20 20:55 ` [RFC PATCH 10/10] arm: migrate away from sections.c Sam Edwards
2023-05-23  6:56   ` Ilias Apalodimas
2023-05-21  4:26 ` [RFC PATCH 00/10] Improve ARM target's support for LLVM toolchain Heinrich Schuchardt
2023-05-21  4:59   ` Sam Edwards
2023-05-22  6:52     ` Ilias Apalodimas
2023-05-22 19:37       ` Sam Edwards
2023-05-22 20:15         ` Heinrich Schuchardt
2023-05-23  6:54         ` Ilias Apalodimas
2023-05-22 10:39     ` Michal Simek
2023-05-22 15:30       ` Tom Rini
2023-05-22 19:59         ` Sam Edwards
2023-05-22 21:13           ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230520205547.1009254-10-CFSworks@gmail.com \
    --to=cfsworks@gmail.com \
    --cc=ascull@google.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.