From: Andrew Waterman <andrew@sifive.com>
To: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
Jim Wilson <jim.wilson.gcc@gmail.com>,
Nelson Chu <nelson@rivosinc.com>,
binutils@sourceware.org, Prabhakar <prabhakar.csengg@gmail.com>
Subject: Re: [RFC PATCH] ld/emulparams: elf32lriscv-defs: Add support tune the text segment start address
Date: Sat, 17 Dec 2022 01:19:54 -0800 [thread overview]
Message-ID: <CA++6G0A6M-SZ8Q-BY_0tz9eZFh=SeH_Jb9hLTD7+HLYSEP4q4g@mail.gmail.com> (raw)
In-Reply-To: <20221216214310.13155-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
I would like to clarify for the record that the purpose of this patch
has little to do with tuning, as that suggests a performance matter
rather than a functional one. This is a workaround for incompliant
behavior in a processor on the chip that Lad mentioned.
I have no technical objections to this patch, but I think it's
important that we be forthright about our intent.
On Fri, Dec 16, 2022 at 1:43 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
>
> On the RISC-V architecture the TEXT_START_ADDR defaults to 0x10000. On
> some RISC-V platforms we want to set this offset to something else. So
> this patch provides a way to tune the text segment start address.
> elf32lriscv-defs.sh now checks for DEFAULT_TEXT_START_ADDR variable and
> if being set it overrides TEXT_START_ADDR to the value set by
> DEFAULT_TEXT_START_ADDR or else defaults to 0x10000.
>
> Renesas RZ/Five RISC-V SoC has Instruction local memory and Data local
> memory (ILM & DLM) which maps between region 0x30000 - 0x4FFFF. When the
> virtual address falls in this range the MMU doesn't trigger a page
> fault and assumes the virtual address as physical address and causes
> undesired behaviours of statically applications/libraries. Hence introduce
> an option to tune the TEXT_START_ADDR.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> Hi All,
>
> This patch is inspired from the current ld/emulparams/nds32elf_linux.sh file
> where similar approach is being used and DEFAULT_TEXT_START_ADDR variable is
> checked to adjust the TEXT_START_ADDR for the platform.
>
> I am not sure if this is the right approach the above issue has been discussed
> on the ML [0].
>
> [0] https://sourceware.org/pipermail/binutils/2022-November/124813.html
>
> Cheers,
> Prabhakar
> ---
> ld/emulparams/elf32lriscv-defs.sh | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/ld/emulparams/elf32lriscv-defs.sh b/ld/emulparams/elf32lriscv-defs.sh
> index b823cedacab..026aef4714b 100644
> --- a/ld/emulparams/elf32lriscv-defs.sh
> +++ b/ld/emulparams/elf32lriscv-defs.sh
> @@ -27,7 +27,11 @@ case "$target" in
> esac
>
> IREL_IN_PLT=
> -TEXT_START_ADDR=0x10000
> +if [ -z ${DEFAULT_TEXT_START_ADDR+x} ]; then
> + TEXT_START_ADDR=0x10000
> +else
> + TEXT_START_ADDR=$DEFAULT_TEXT_START_ADDR
> +fi
> MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
> COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
>
> --
> 2.17.1
>
next prev parent reply other threads:[~2022-12-17 9:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 21:43 Lad Prabhakar
2022-12-17 9:19 ` Andrew Waterman [this message]
2022-12-18 6:24 ` Fangrui Song
2022-12-18 22:44 ` Lad, Prabhakar
2022-12-18 23:09 ` Fangrui Song
2022-12-19 9:02 ` Lad, Prabhakar
2022-12-19 5:00 ` Jeff Law
2022-12-19 9:11 ` Lad, Prabhakar
2022-12-19 21:33 ` Palmer Dabbelt
2022-12-21 13:24 ` Nelson Chu
2022-12-21 20:15 ` Lad, Prabhakar
2022-12-22 2:12 ` Nelson Chu
2022-12-21 20:06 ` Lad, Prabhakar
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='CA++6G0A6M-SZ8Q-BY_0tz9eZFh=SeH_Jb9hLTD7+HLYSEP4q4g@mail.gmail.com' \
--to=andrew@sifive.com \
--cc=binutils@sourceware.org \
--cc=jim.wilson.gcc@gmail.com \
--cc=nelson@rivosinc.com \
--cc=palmer@dabbelt.com \
--cc=prabhakar.csengg@gmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.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).