efi: Drop preprocessor directives from zboot.lds
PATCH 1/1 efi: Drop preprocessor directives from zboot.lds
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
---
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(-)
drivers/firmware/efi/libstub/zboot.lds +0 -2
@@ -29,14 +29,12 @@ SECTIONS . = _etext; } -#ifdef CONFIG_EFI_SBAT .sbat : ALIGN(4096) { _sbat = .; *(.sbat) _esbat = ALIGN(4096); . = _esbat; } -#endif .data : ALIGN(4096) { _data = .;
Signature · 1 line
2.49.0
Quoted 15 lines · Vitaly Kuznetsov
Older versions of
lddon'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-littleSections:
Quoted 8 lines
Idx Name Size VMA LMA File off Algn 0 .text 00b94000 0000000000001000 0000000000001000 00001000 2**2CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 000002000000000000b950000000000000b9500000b950002**2
CONTENTS, ALLOC, LOAD, DATAFixes 0f9a1739dd0e ("efi: zboot specific mechanism for embedding SBAT section")Signed-off-by Vitaly Kuznetsov <[email protected]>
Ah yes, I failed to realize that zboot.lds is never preprocessed - I did notice that the #ifdef is unnecessary here as LD ignores empty sections.
So the fix is
I'll queue this as a fix.
Quoted 30 lines
---
Note: not-yet-merged x86 version of0f9a1739dd0edoes not seem to be affected asvmlinux.ldsscript is a pre-processed version ofvmlinux.lds.S.--- drivers/firmware/efi/libstub/zboot.lds | 2 -- 1 file changed, 2 deletions(-)drivers/firmware/efi/libstub/zboot.lds +0
-3@@ -29,14 +29,12 @@ SECTIONS . = _etext; } -#ifdef CONFIG_EFI_SBAT .sbat : ALIGN(4096) { _sbat = .; *(.sbat) _esbat = ALIGN(4096); . = _esbat; } -#endif .data : ALIGN(4096) { _data = .; --2.49.0
Quoted 14 lines · Vitaly Kuznetsov
Older versions of
lddon'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-littleSections:
Quoted 8 lines
Idx Name Size VMA LMA File off Algn 0 .text 00b94000 0000000000001000 0000000000001000 00001000 2**2CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 000002000000000000b950000000000000b9500000b950002**2
CONTENTS, ALLOC, LOAD, DATAFixes 0f9a1739dd0e ("efi: zboot specific mechanism for embedding SBAT section")Signed-off-by Vitaly Kuznetsov <[email protected]>
Thanks for fixing Vitaly:
(this is for the build test, not SBAT testing).
Quoted 26 lines
---
Note: not-yet-merged x86 version of0f9a1739dd0edoes not seem to be affected asvmlinux.ldsscript is a pre-processed version ofvmlinux.lds.S.--- drivers/firmware/efi/libstub/zboot.lds | 2 -- 1 file changed, 2 deletions(-)drivers/firmware/efi/libstub/zboot.lds +0
-2@@ -29,14 +29,12 @@ SECTIONS . = _etext; } -#ifdef CONFIG_EFI_SBAT .sbat : ALIGN(4096) { _sbat = .; *(.sbat) _esbat = ALIGN(4096); . = _esbat; } -#endif .data : ALIGN(4096) { _data = .;
Quoted 21 lines · Luiz Capitulino
Quoted 20 lines · Vitaly Kuznetsov
Older versions of
lddon'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.efiarch/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
Quoted 8 lines
Quoted 2 lines
Fixes 0f9a1739dd0e ("efi: zboot specific mechanism for embedding SBAT section")Signed-off-by Vitaly Kuznetsov <[email protected]>Thanks for fixing Vitaly:
Tested-by Luiz Capitulino <[email protected]>(this is for the build test, not SBAT testing).
Vitaly, Ard,
Are we planning to include this fix for 6.16? I'm afraid we'll introduce a regression if we don't include it.
Quoted 26 lines
Quoted 25 lines
---
Note: not-yet-merged x86 version of0f9a1739dd0edoes not seem to be affected asvmlinux.ldsscript is a pre-processed version ofvmlinux.lds.S.
---
drivers/firmware/efi/libstub/zboot.lds| 2 --1 file changed, 2 deletions(-)drivers/firmware/efi/libstub/zboot.lds +0
-2@@ -29,14 +29,12 @@ SECTIONS . = _etext; } -#ifdef CONFIG_EFI_SBAT .sbat : ALIGN(4096) { _sbat = .; *(.sbat) _esbat = ALIGN(4096); . = _esbat; } -#endif .data : ALIGN(4096) { _data = .;
Ard Biesheuvel
maintainerQuoted 28 lines · Luiz Capitulino
Quoted 26 lines · Luiz Capitulino
Quoted 14 lines · Vitaly Kuznetsov
Older versions of
lddon'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-littleSections:
Quoted 8 lines
Idx Name Size VMA LMA File off Algn 0 .text 00b94000 0000000000001000 0000000000001000 00001000 2**2CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 000002000000000000b950000000000000b9500000b950002**2
CONTENTS, ALLOC, LOAD, DATAFixes 0f9a1739dd0e ("efi: zboot specific mechanism for embedding SBAT section")Signed-off-by Vitaly Kuznetsov <[email protected]>Thanks for fixing Vitaly:
Quoted 9 lines
Quoted 3 lines
Tested-by Luiz Capitulino <[email protected]>(this is for the build test, not SBAT testing).
Vitaly, Ard,
Are we planning to include this fix for 6.16? I'm afraid we'll introduce a regression if we don't include it.
Apologies, I let this sit for a bit longer than I intended. I'll send out the PR today.
Quoted 33 lines · Ard Biesheuvel
Quoted 32 lines · Luiz Capitulino
Quoted 29 lines · Luiz Capitulino
Quoted 14 lines · Vitaly Kuznetsov
Older versions of
lddon'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-littleSections:
Quoted 8 lines
Idx Name Size VMA LMA File off Algn 0 .text 00b94000 0000000000001000 0000000000001000 00001000 2**2CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 000002000000000000b950000000000000b9500000b950002**2
CONTENTS, ALLOC, LOAD, DATAFixes 0f9a1739dd0e ("efi: zboot specific mechanism for embedding SBAT section")Signed-off-by Vitaly Kuznetsov <[email protected]>Thanks for fixing Vitaly:
Tested-by Luiz Capitulino <[email protected]>(this is for the build test, not SBAT testing).
Quoted 8 lines
Quoted 5 lines
Vitaly, Ard,
Are we planning to include this fix for 6.16? I'm afraid we'll introduce a regression if we don't include it.
Apologies, I let this sit for a bit longer than I intended. I'll send out the PR today.
Thanks a lot, Ard!