linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jeffy <jeffy.chen@rock-chips.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: Ingo Molnar <mingo@kernel.org>,
	Chris Zhong <chris.zhong@rock-chips.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] ARM: Fix zImage file size not aligned with CONFIG_EFI_STUB enabled
Date: Tue, 24 Oct 2017 17:16:02 +0800	[thread overview]
Message-ID: <59EF04D2.20102@rock-chips.com> (raw)
In-Reply-To: <CAKv+Gu_R+OfHMxcZEJML4Pm54DyOji6S42LihMgi6+vxi9LOAQ@mail.gmail.com>

Hi guys,

On 10/24/2017 04:09 PM, Ard Biesheuvel wrote:
> The following patch appears to fix the issue as well:
>
> diff --git a/arch/arm/boot/compressed/vmlinux.lds.S
> b/arch/arm/boot/compressed/vmlinux.lds.S
> index 7a4c59154361..0e0f504e256e 100644
> --- a/arch/arm/boot/compressed/vmlinux.lds.S
> +++ b/arch/arm/boot/compressed/vmlinux.lds.S
> @@ -83,7 +83,9 @@ SECTIONS
>     __pecoff_data_rawsize = . - ADDR(.data);
>   #endif
>
> -  _edata = .;
> +  .edata (NOLOAD) : {
> +    _edata = .;
> +  }
>
>     _magic_sig = ZIMAGE_MAGIC(0x016f2818);
>     _magic_start = ZIMAGE_MAGIC(_start);
>
> because the NOLOAD triggers the linker to emit all PROGBITS sections
> before _edata, including unknown ones.
>
> E.g., in my binary, it gives me
>
> 00798020 D __pecoff_data_end
> 00798200 d __ksymtab_sort
> 00798208 B __bss_start
> 00798208 D _edata

this works too:

+++ b/arch/arm/boot/compressed/vmlinux.lds.S
@@ -70,10 +70,6 @@ SECTIONS
    .got                 : { *(.got) }
    _got_end = .;

-  /* ensure the zImage file size is always a multiple of 64 bits */
-  /* (without a dummy byte, ld just ignores the empty section) */
-  .pad                 : { BYTE(0); . = ALIGN(8); }
-
  #ifdef CONFIG_EFI_STUB
    .data : ALIGN(4096) {
      __pecoff_data_start = .;
@@ -93,7 +89,10 @@ SECTIONS
    __pecoff_data_rawsize = . - ADDR(.data);
  #endif

-  _edata = .;
+  /* ensure the zImage file size is always a multiple of 64 bits */
+  .edata : ALIGN(8) {
+    _edata = .;
+  }



    339: 006cf200     8 OBJECT  LOCAL  DEFAULT    9 __ksymtab_sort
...
    528: 006cf208     0 NOTYPE  GLOBAL DEFAULT    9 _edata

      parent reply	other threads:[~2017-10-24  9:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18  5:01 [PATCH] ARM: Fix zImage file size not aligned with CONFIG_EFI_STUB enabled Jeffy Chen
2017-10-18  6:19 ` Chris Zhong
2017-10-22 11:01 ` Ard Biesheuvel
2017-10-22 12:47   ` Russell King - ARM Linux
2017-10-22 13:01     ` Ard Biesheuvel
2017-10-23  3:26       ` jeffy
2017-10-23  8:50         ` Russell King - ARM Linux
2017-10-23 10:24           ` jeffy
2017-10-23 10:50             ` Russell King - ARM Linux
2017-10-23 11:45               ` Russell King - ARM Linux
2017-10-24  8:09                 ` Ard Biesheuvel
2017-10-24  9:09                   ` Russell King - ARM Linux
2017-10-24  9:13                     ` Ard Biesheuvel
2017-10-24  9:22                       ` Russell King - ARM Linux
2017-10-24  9:26                         ` Ard Biesheuvel
2017-10-24  9:30                           ` Ard Biesheuvel
2017-10-24  9:38                             ` Russell King - ARM Linux
2017-10-24  9:44                               ` Ard Biesheuvel
2017-10-24  9:54                                 ` Russell King - ARM Linux
2017-10-24 10:03                                   ` Ard Biesheuvel
2017-10-24  9:16                   ` jeffy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59EF04D2.20102@rock-chips.com \
    --to=jeffy.chen@rock-chips.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=chris.zhong@rock-chips.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).