All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/5] arm: efi: Generate Microsoft PE format complaint images
Date: Tue, 2 Oct 2018 20:13:35 +0200	[thread overview]
Message-ID: <05637331-a28d-b801-9d0a-c4d570d7f818@gmx.de> (raw)
In-Reply-To: <CAEUhbmUKq8PYtbXF61myadvM+WsiuNwdAJL00P7EZJTUjmBZ4A@mail.gmail.com>

On 10/02/2018 04:16 PM, Bin Meng wrote:
> Hi Heinrich,
> 
> On Thu, Sep 27, 2018 at 1:51 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>>
>> On 09/26/2018 08:03 AM, Bin Meng wrote:
>>> Per Microsoft PE Format documentation [1], PointerToSymbolTable and
>>> NumberOfSymbols should be zero for an image in the COFF file header.
>>> Currently the COFF file header is hardcoded on ARM and these two
>>> members are not zero.
>>>
>>> This updates the hardcoded structure to clear these two members, as
>>> well as setting the flag IMAGE_FILE_LOCAL_SYMS_STRIPPED so that we
>>> can generate compliant *.efi images.
>>>
>>> [1] https://docs.microsoft.com/zh-cn/windows/desktop/Debug/pe-format
>>>
>>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>> ---
>>>
>>>  arch/arm/lib/crt0_aarch64_efi.S | 7 ++++---
>>>  arch/arm/lib/crt0_arm_efi.S     | 6 +++---
>>>  2 files changed, 7 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/arch/arm/lib/crt0_aarch64_efi.S b/arch/arm/lib/crt0_aarch64_efi.S
>>> index 0db4360..a489d05 100644
>>> --- a/arch/arm/lib/crt0_aarch64_efi.S
>>> +++ b/arch/arm/lib/crt0_aarch64_efi.S
>>> @@ -28,13 +28,14 @@ coff_header:
>>>       .short  2                               /* nr_sections */
>>>       .long   0                               /* TimeDateStamp */
>>>       .long   0                               /* PointerToSymbolTable */
>>> -     .long   1                               /* NumberOfSymbols */
>>> +     .long   0                               /* NumberOfSymbols */
>>>       .short  section_table - optional_header /* SizeOfOptionalHeader */
>>>       /*
>>>        * Characteristics: IMAGE_FILE_DEBUG_STRIPPED |
>>> -      * IMAGE_FILE_EXECUTABLE_IMAGE | IMAGE_FILE_LINE_NUMS_STRIPPED
>>> +      * IMAGE_FILE_EXECUTABLE_IMAGE | IMAGE_FILE_LINE_NUMS_STRIPPED |
>>> +      * IMAGE_FILE_LOCAL_SYMS_STRIPPED
>>>        */
>>> -     .short  0x206
>>> +     .short  0x20e
>>
>> I think your code misses to set IMAGE_FILE_32BIT_MACHINE in dependence
>> of the bitness of the system.
>>
> 
> Do you mean currently for aarch64 targets, U-Boot only supports
> loading 32-bit EFI images?

I misread your patch. Sorry for the noise.

> 
>> I would prefer if these constants were defined in asm-generic/pe.h:
>>
>> #define IMAGE_FILE_RELOCS_STRIPPED              0x0001
>> #define IMAGE_FILE_EXECUTABLE_IMAGE             0x0002
>> #define IMAGE_FILE_LINE_NUMS_STRIPPED           0x0004
>> #define IMAGE_FILE_LOCAL_SYMS_STRIPPED          0x0008
>> #define IMAGE_FILE_AGGRESSIVE_WS_TRIM           0x0010
>> #define IMAGE_FILE_LARGE_ADDRESS_AWARE          0x0020
>> /* Reserved                                     0x0040 */
>> #define IMAGE_FILE_BYTES_REVERSED_LO            0x0080
>> #define IMAGE_FILE_32BIT_MACHINE                0x0100
>> #define IMAGE_FILE_DEBUG_STRIPPED               0x0200
>> #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP      0x0400
>> #define IMAGE_FILE_NET_RUN_FROM_SWAP            0x0800
>> #define IMAGE_FILE_SYSTEM                       0x1000
>> #define IMAGE_FILE_DLL                          0x2000
>> #define IMAGE_FILE_UP_SYSTEM_ONLY               0x4000
>> #define IMAGE_FILE_BYTES_REVERSED_HI            0x8000
>>
> 
> Will add these macros in v2.
> 
> Regards,
> Bin
> 

  reply	other threads:[~2018-10-02 18:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26  6:03 [U-Boot] [PATCH 1/5] efi_loader: Generate Microsoft PE format complaint images Bin Meng
2018-09-26  6:03 ` [U-Boot] [PATCH 2/5] x86: efi: payload: Generate Microsoft PE format complaint image Bin Meng
2018-09-26  6:03 ` [U-Boot] [PATCH 3/5] x86: efi: app: " Bin Meng
2018-09-26  6:03 ` [U-Boot] [PATCH 4/5] arm: efi: Generate Microsoft PE format complaint images Bin Meng
2018-09-26 17:51   ` Heinrich Schuchardt
2018-10-02 14:16     ` Bin Meng
2018-10-02 18:13       ` Heinrich Schuchardt [this message]
2018-09-26  6:03 ` [U-Boot] [PATCH 5/5] riscv: " Bin Meng
2018-09-26 17:49   ` Heinrich Schuchardt
2018-09-26 18:40 ` [U-Boot] [PATCH 1/5] efi_loader: " Heinrich Schuchardt
2018-10-02 14:31   ` Bin Meng

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=05637331-a28d-b801-9d0a-c4d570d7f818@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.