mbox series

[-next,0/3] arm64: Mark constants in .S files as data

Message ID 20220922130452.233323-1-chenzhongjin@huawei.com
Headers show
Series arm64: Mark constants in .S files as data | expand

Message

Chen Zhongjin Sept. 22, 2022, 1:04 p.m. UTC
There are some constant numbers insdide .S files which is mixed with
text sections. When tools are reading the ELF files they cannot
distinguish these constants out of normal instructions.

Mark these constants as data symbols by wrapping then with SYM_DATA
macro.

Chen Zhongjin (3):
  arm64: efi-header: Mark efi header as data
  arm64: head: Mark constants as data
  arm64: crypto: Mark constant as data

 arch/arm64/crypto/aes-neonbs-core.S | 14 +++++++-------
 arch/arm64/crypto/poly1305-armv8.pl |  4 ++++
 arch/arm64/crypto/polyval-ce-core.S |  7 +++----
 arch/arm64/crypto/sha512-armv8.pl   | 24 ++++++++++++++----------
 arch/arm64/kernel/efi-header.S      |  2 ++
 arch/arm64/kernel/head.S            |  6 ++++--
 6 files changed, 34 insertions(+), 23 deletions(-)

Comments

Ard Biesheuvel Sept. 22, 2022, 1:13 p.m. UTC | #1
On Thu, 22 Sept 2022 at 15:08, Chen Zhongjin <chenzhongjin@huawei.com> 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 <jthierry@redhat.com>
> Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
> Reviewed-by: Mark Brown <broonie@kernel.org>

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
>