public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: Palmer Dabbelt <palmer@dabbelt.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] Add basic support for RISC-V 64-bit EFI objects
Date: Wed, 09 Aug 2023 10:10:14 +0200	[thread overview]
Message-ID: <mvmleekhc0p.fsf@suse.de> (raw)
In-Reply-To: <mhng-477120fd-8120-4e99-856a-8efa055c57ac@palmer-ri-x1c9a> (Palmer Dabbelt's message of "Tue, 08 Aug 2023 18:54:34 -0700 (PDT)")

On Aug 08 2023, Palmer Dabbelt wrote:

> So the idea is to just objcopy an ELF into a PE for EFI?  IIUC that's
> generally the way to go for this sort of thing.  In Linux we just have a
> PE header manually embedded in a flat binary, but presumably EFI folks
> want to have objcopy support for some reason?

My main intention is to let BFD recognize EFI objects so that I can
objdump them easily.  The support for objcopy comes in naturally, and
some packages do use objcopy to create EFI objects from ELF (on archs
where BFD supports it).

> Is the idea that anyone who wants EFI also wants 64-bit?

That's not my intention.  It's just that I have no 32-bit setup for
testing.

>> binutils:
>> 	* testsuite/binutils-all/loongarch64/pei-riscv64.d: New.
>> 	* testsuite/binutils-all/loongarch64/pei-riscv64.s: New.
>
> I think those paths are wrong?

Yes, that reveals where I copied the whole thing from. ;-)

>> diff --git a/include/coff/pe.h b/include/coff/pe.h
>> index 6b26d533218..dd4cf547a77 100644
>> --- a/include/coff/pe.h
>> +++ b/include/coff/pe.h
>> @@ -156,6 +156,8 @@
>>  #define IMAGE_FILE_MACHINE_R10000            0x0168
>>  #define IMAGE_FILE_MACHINE_R3000             0x0162
>>  #define IMAGE_FILE_MACHINE_R4000             0x0166
>> +#define IMAGE_FILE_MACHINE_RISCV32           0x5032
>> +#define IMAGE_FILE_MACHINE_RISCV64           0x5064
>
> The spec has rv128 as well, but I guess nothing's supporting that so it
> doesn't really matter?

I don't think we will see any 128-bit CPU of any kind any time soon.

>> +#define	RISCV64MAGIC	0x5064  /* From Microsoft specification. */
>
> Which is the same as IMAGE_FILE_MACHINE_RISCV64, not sure if we can use
> that here though?

I think the intention is to separate the PE stuff from the COFF base.

>> +/* We use the .rdata section to hold read only data.  */
>> +#define _LIT	".rdata"
>
> Is that a PE-ism?  It's ".rodata" elsewhere in RISC-V.  It looks like the
> other PE/COFF ports are ".rdata", though.

.rdata seems to be a normal PE/COFF thing.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

  reply	other threads:[~2023-08-09  8:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-08 14:18 Andreas Schwab
2023-08-09  1:54 ` Palmer Dabbelt
2023-08-09  8:10   ` Andreas Schwab [this message]
2023-08-25  2:15     ` Nelson Chu
2023-08-25 13:26       ` Palmer Dabbelt
2023-08-28  2:03         ` Nelson Chu
2023-09-06 15:40           ` Palmer Dabbelt
2023-09-06 20:01 ` Peter Jones
2023-09-06 20:01   ` [PATCH] Handle "efi-app-riscv64" and similar targets in objcopy Peter Jones
2023-12-04 17:16     ` Palmer Dabbelt
2023-12-05  6:45       ` Nelson Chu

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=mvmleekhc0p.fsf@suse.de \
    --to=schwab@suse.de \
    --cc=binutils@sourceware.org \
    --cc=palmer@dabbelt.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).