From eee1b8846b0788c866dabf04e85742a48662455f Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 24 Oct 2022 08:57:12 +0200 Subject: asm-generic: memory_layout: define __keep_symbolref() When multiple PBL entry points are built as part of a multi-image build, the link process will be conducted multiple times, each with a different entry point and then linker garbage collection will take care to remove any unreferenced sections. Sometimes, we want to keep sections around, even if they are unreferenced in code, because the linker will place them at a location, where they can fulfill their purpose without being referenced explicitly. Examples are the barebox IMD entries, which attach image meta-data to barebox or the stack setup prologue which is inserted at the start of the image to work around lack of __attribute__((naked)) support on ARM64. So far, these sections were kept around by either a call to an external function, which worked because we don't employ LTO or via barrier_data(ptr), which in its implementation generates a load from the supplied ptr. Improve readability, by defining a new __keep_symbolref() that describes what it is supposed to do and does just that: Keep a symbol reference alive as long as the code surrounding it is not eliminated as dead code. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20221024065716.1215046-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- arch/arm/include/asm/barebox-arm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/arm/include/asm/barebox-arm.h') diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h index 47d20b6b04..68a9610398 100644 --- a/arch/arm/include/asm/barebox-arm.h +++ b/arch/arm/include/asm/barebox-arm.h @@ -141,7 +141,7 @@ static inline unsigned long arm_mem_barebox_image(unsigned long membase, #define ____emit_entry_prologue(name, instr, ...) do { \ static __attribute__ ((unused,section(".text_head_prologue_" __stringify(name)))) \ const u32 __entry_prologue[] = {(instr), ##__VA_ARGS__}; \ - barrier_data(__entry_prologue); \ + __keep_symbolref(__entry_prologue); \ } while(0) #define __emit_entry_prologue(name, instr1, instr2, instr3, instr4, instr5) \ -- cgit v1.2.3