diff mbox series

efi: Drop preprocessor directives from zboot.lds

Message ID 20250606154112.311565-1-vkuznets@redhat.com
State New
Headers show
Series efi: Drop preprocessor directives from zboot.lds | expand

Commit Message

Vitaly Kuznetsov June 6, 2025, 3:41 p.m. UTC
Older versions of `ld` don't seem to support preprocessor directives in
linker scripts, e.g. on RHEL9's ld-2.35.2-63.el9 the build fails with:

 ld:./drivers/firmware/efi/libstub/zboot.lds:32: ignoring invalid character `#' in expression
 ld:./drivers/firmware/efi/libstub/zboot.lds:33: syntax error

We don't seem to need these '#ifdef', no empty .sbat section is created
when CONFIG_EFI_SBAT_FILE="":

 # objdump -h arch/arm64/boot/vmlinuz.efi

 arch/arm64/boot/vmlinuz.efi:     file format pei-aarch64-little

 Sections:
 Idx Name          Size      VMA               LMA               File off  Algn
   0 .text         00b94000  0000000000001000  0000000000001000  00001000  2**2
                   CONTENTS, ALLOC, LOAD, READONLY, CODE
   1 .data         00000200  0000000000b95000  0000000000b95000  00b95000  2**2
                   CONTENTS, ALLOC, LOAD, DATA

Fixes: 0f9a1739dd0e ("efi: zboot specific mechanism for embedding SBAT section")
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
Note: not-yet-merged x86 version of 0f9a1739dd0e does not seem to be affected
as vmlinux.lds script is a pre-processed version of vmlinux.lds.S.
---
 drivers/firmware/efi/libstub/zboot.lds | 2 --
 1 file changed, 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/firmware/efi/libstub/zboot.lds b/drivers/firmware/efi/libstub/zboot.lds
index c3a166675450..4b8d5cd3dfa2 100644
--- a/drivers/firmware/efi/libstub/zboot.lds
+++ b/drivers/firmware/efi/libstub/zboot.lds
@@ -29,14 +29,12 @@  SECTIONS
 		. = _etext;
 	}
 
-#ifdef CONFIG_EFI_SBAT
         .sbat : ALIGN(4096) {
 		_sbat = .;
 		*(.sbat)
 		_esbat = ALIGN(4096);
 		. = _esbat;
 	}
-#endif
 
 	.data : ALIGN(4096) {
 		_data = .;