public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Liao Shihua <shihua@iscas.ac.cn>
Cc: kito.cheng@sifive.com, jiawei@iscas.ac.cn, palmer@dabbelt.com,
	guoren@kernel.org, wuwei2016@iscas.ac.cn, shiyulong@iscas.ac.cn,
	chenyixuan@iscas.ac.cn, binutils@sourceware.org
Subject: Re: [RFC PATCH 2/4] RISC-V : Add support for rv64 arch using ilp32 abi
Date: Fri, 19 May 2023 08:33:51 +0200	[thread overview]
Message-ID: <fd1c5ac8-801b-4b6d-626b-8757ef64b6a9@suse.com> (raw)
In-Reply-To: <20230519034835.664-3-shihua@iscas.ac.cn>

On 19.05.2023 05:48, Liao Shihua wrote:
> This patch add a new bfd_mach bfd_mach_riscv64x32 and a new e_flags X32.
> bfd_mach_riscv64x32 has the same bits in a word/address and ARCH_SIZE
> with rv32, but use rv64's PRSTATUS. X32 use the 6th bit of e_flags layout.

And this has been added already to the official version of the spec? (A
reference might be good, maybe here or maybe in the cover letter.)

> --- a/bfd/elfnn-riscv.c
> +++ b/bfd/elfnn-riscv.c
> @@ -122,6 +122,11 @@
>  
>  #define RISCV_ELF_WORD_BYTES (1 << RISCV_ELF_LOG_WORD_BYTES)
>  
> +#define ABI_X32_P(abfd) \
> +  ((elf_elfheader (abfd)->e_flags & EF_RISCV_X32) != 0)
> +
> +static bool ABI_X32 = false;

While I'm not sure in how far libbfd, when built as a shared object, is
fully usable in multi-threaded programs, I don't think new code should
make the situation worse by adding new (non-const) static/global
variables. What's yet more odd about this variable is that ...

> @@ -5140,7 +5148,7 @@ _bfd_riscv_relax_section (bfd *abfd, asection *sec,
>    return ret;
>  }
>  
> -#if ARCH_SIZE == 32
> +#if ARCH_SIZE == 32 && !ABI_X32
>  # define PRSTATUS_SIZE			204
>  # define PRSTATUS_OFFSET_PR_CURSIG	12
>  # define PRSTATUS_OFFSET_PR_PID		24

... you use it in a pre-processor conditional here.

Jan

  reply	other threads:[~2023-05-19  6:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19  3:48 [RFC PATCH V2 0/4] RISC-V : Support ilp32 abi on rv64 isa Liao Shihua
2023-05-19  3:48 ` [RFC PATCH 1/4] RISC-V : Remove checking when -march=rv64XX and -mabi=ilp32X Liao Shihua
2023-05-19  6:25   ` Jan Beulich
2023-05-19  3:48 ` [RFC PATCH 2/4] RISC-V : Add support for rv64 arch using ilp32 abi Liao Shihua
2023-05-19  6:33   ` Jan Beulich [this message]
2023-05-19  6:58     ` shihua
2023-05-19  3:48 ` [RFC PATCH 3/4] RISC-V : Add rv64 ilp32 support in disassemble Liao Shihua
2023-05-25 15:35   ` Guo Ren
2023-05-19  3:48 ` [RFC PATCH 4/4] gdb/riscv : Add rv64 ilp32 support in gdb Liao Shihua

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=fd1c5ac8-801b-4b6d-626b-8757ef64b6a9@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=chenyixuan@iscas.ac.cn \
    --cc=guoren@kernel.org \
    --cc=jiawei@iscas.ac.cn \
    --cc=kito.cheng@sifive.com \
    --cc=palmer@dabbelt.com \
    --cc=shihua@iscas.ac.cn \
    --cc=shiyulong@iscas.ac.cn \
    --cc=wuwei2016@iscas.ac.cn \
    /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).