[RFC PATCH 06/10] arm: discard .gnu.version* sections

Sam Edwards cfsworks at gmail.com
Sat May 20 22:55:43 CEST 2023


These are often a consequence of --pie, but they aren't actually
used in the runtime relocation code. It is better to discard them
than to aggregate them, because they tend to be of different types,
and this upsets some linkers (e.g. LLD).

Signed-off-by: Sam Edwards <CFSworks at gmail.com>
---

 arch/arm/cpu/u-boot.lds | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
index fc4f63d834..8cdf08a730 100644
--- a/arch/arm/cpu/u-boot.lds
+++ b/arch/arm/cpu/u-boot.lds
@@ -229,6 +229,12 @@ SECTIONS
 		KEEP(*(.__bss_end));
 	}
 
+	/*
+	 * LLD's --pie may synthesize these sections, even if they are empty;
+	 * discard them, for we do not need version symbols
+	 */
+	/DISCARD/ : { *(.gnu.version*) }
+
 	.dynsym _image_binary_end : { *(.dynsym) }
 	.dynbss : { *(.dynbss) }
 	.dynstr : { *(.dynstr*) }
-- 
2.39.2



More information about the U-Boot mailing list