2022-09-22 13:18:44

by Chen Zhongjin

[permalink] [raw]
Subject: [PATCH -next 1/3] arm64: efi-header: Mark efi header as data

This file only contains a set of constants forming the efi header.

Make the constants part of data symbols by wrapping them with
SYM_DATA.

Signed-off-by: Julien Thierry <[email protected]>
Signed-off-by: Chen Zhongjin <[email protected]>
Reviewed-by: Mark Brown <[email protected]>
---
arch/arm64/kernel/efi-header.S | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/arm64/kernel/efi-header.S b/arch/arm64/kernel/efi-header.S
index 28d8a5dca5f1..3eacd27ab761 100644
--- a/arch/arm64/kernel/efi-header.S
+++ b/arch/arm64/kernel/efi-header.S
@@ -28,6 +28,7 @@
.macro __EFI_PE_HEADER
#ifdef CONFIG_EFI
.set .Lpe_header_offset, . - .L_head
+SYM_DATA_START_LOCAL(arm64_efi_header)
.long PE_MAGIC
.short IMAGE_FILE_MACHINE_ARM64 // Machine
.short .Lsection_count // NumberOfSections
@@ -160,6 +161,7 @@

.balign SEGMENT_ALIGN
.Lefi_header_end:
+SYM_DATA_END_LABEL(arm64_efi_header, SYM_L_LOCAL, efi_header_end)
#else
.set .Lpe_header_offset, 0x0
#endif
--
2.17.1


2022-09-22 13:23:54

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: [PATCH -next 1/3] arm64: efi-header: Mark efi header as data

On Thu, 22 Sept 2022 at 15:08, Chen Zhongjin <[email protected]> wrote:
>
> This file only contains a set of constants forming the efi header.
>
> Make the constants part of data symbols by wrapping them with
> SYM_DATA.
>
> Signed-off-by: Julien Thierry <[email protected]>
> Signed-off-by: Chen Zhongjin <[email protected]>
> Reviewed-by: Mark Brown <[email protected]>

Why is this necessary? These are not emitted into a .text section, and
are not even covered by the kernel's mapping of memory. So the .L
prefixed labels are deliberate: it prevents the symbols from polluting
the symbol namespace with symbols pointing nowhere.


> ---
> arch/arm64/kernel/efi-header.S | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm64/kernel/efi-header.S b/arch/arm64/kernel/efi-header.S
> index 28d8a5dca5f1..3eacd27ab761 100644
> --- a/arch/arm64/kernel/efi-header.S
> +++ b/arch/arm64/kernel/efi-header.S
> @@ -28,6 +28,7 @@
> .macro __EFI_PE_HEADER
> #ifdef CONFIG_EFI
> .set .Lpe_header_offset, . - .L_head
> +SYM_DATA_START_LOCAL(arm64_efi_header)
> .long PE_MAGIC
> .short IMAGE_FILE_MACHINE_ARM64 // Machine
> .short .Lsection_count // NumberOfSections
> @@ -160,6 +161,7 @@
>
> .balign SEGMENT_ALIGN
> .Lefi_header_end:
> +SYM_DATA_END_LABEL(arm64_efi_header, SYM_L_LOCAL, efi_header_end)
> #else
> .set .Lpe_header_offset, 0x0
> #endif
> --
> 2.17.1
>

2022-09-22 14:34:45

by Chen Zhongjin

[permalink] [raw]
Subject: Re: [PATCH -next 1/3] arm64: efi-header: Mark efi header as data

Hi,

On 2022/9/22 21:13, Ard Biesheuvel wrote:
> On Thu, 22 Sept 2022 at 15:08, Chen Zhongjin <[email protected]> wrote:
>> This file only contains a set of constants forming the efi header.
>>
>> Make the constants part of data symbols by wrapping them with
>> SYM_DATA.
>>
>> Signed-off-by: Julien Thierry <[email protected]>
>> Signed-off-by: Chen Zhongjin <[email protected]>
>> Reviewed-by: Mark Brown <[email protected]>
> Why is this necessary? These are not emitted into a .text section, and
> are not even covered by the kernel's mapping of memory. So the .L
> prefixed labels are deliberate: it prevents the symbols from polluting
> the symbol namespace with symbols pointing nowhere.
>
This is basically because when I'm developing objtool and these
constants will disrupts

the instruction decoding so I just mark them as x86 did.


I tried to sent this patch set is because now the objtool patch set is
growing huge so I

want to split some independent part. But now I found you are right that
this are

meaningless. They are not even inside vmlinux. I'll discard them.


Sorry for bothering and thanks for your advise and patient!

Best,

Chen

>> ---
>> arch/arm64/kernel/efi-header.S | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/arm64/kernel/efi-header.S b/arch/arm64/kernel/efi-header.S
>> index 28d8a5dca5f1..3eacd27ab761 100644
>> --- a/arch/arm64/kernel/efi-header.S
>> +++ b/arch/arm64/kernel/efi-header.S
>> @@ -28,6 +28,7 @@
>> .macro __EFI_PE_HEADER
>> #ifdef CONFIG_EFI
>> .set .Lpe_header_offset, . - .L_head
>> +SYM_DATA_START_LOCAL(arm64_efi_header)
>> .long PE_MAGIC
>> .short IMAGE_FILE_MACHINE_ARM64 // Machine
>> .short .Lsection_count // NumberOfSections
>> @@ -160,6 +161,7 @@
>>
>> .balign SEGMENT_ALIGN
>> .Lefi_header_end:
>> +SYM_DATA_END_LABEL(arm64_efi_header, SYM_L_LOCAL, efi_header_end)
>> #else
>> .set .Lpe_header_offset, 0x0
>> #endif
>> --
>> 2.17.1
>>