From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH] sim: use bfd_vma when reading start addr from bfd info
Date: Thu, 22 Dec 2022 19:05:49 -0500 [thread overview]
Message-ID: <20221223000549.29177-1-vapier@gentoo.org> (raw)
Since SIM_ADDR is always 32-bit, it might truncate the address with
64-bit ELFs. Since we load that addr from the bfd, use the bfd_vma
type which matches the bfd_get_start_address API.
---
sim/avr/interp.c | 2 +-
sim/bfin/interp.c | 2 +-
sim/bpf/sim-if.c | 2 +-
sim/cris/sim-if.c | 4 ++--
sim/frv/sim-if.c | 2 +-
sim/iq2000/sim-if.c | 2 +-
sim/lm32/sim-if.c | 2 +-
sim/m32r/sim-if.c | 2 +-
sim/or1k/sim-if.c | 2 +-
sim/pru/interp.c | 2 +-
sim/riscv/interp.c | 2 +-
11 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/sim/avr/interp.c b/sim/avr/interp.c
index 3b0397b8f89f..3acf09b15ada 100644
--- a/sim/avr/interp.c
+++ b/sim/avr/interp.c
@@ -1769,7 +1769,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
{
struct avr_sim_state *state = AVR_SIM_STATE (sd);
SIM_CPU *cpu = STATE_CPU (sd, 0);
- SIM_ADDR addr;
+ bfd_vma addr;
/* Set the PC. */
if (abfd != NULL)
diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c
index f4071ce47398..493c3b62ffb8 100644
--- a/sim/bfin/interp.c
+++ b/sim/bfin/interp.c
@@ -1118,7 +1118,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
{
SIM_CPU *cpu = STATE_CPU (sd, 0);
host_callback *cb = STATE_CALLBACK (sd);
- SIM_ADDR addr;
+ bfd_vma addr;
/* Set the PC. */
if (abfd != NULL)
diff --git a/sim/bpf/sim-if.c b/sim/bpf/sim-if.c
index 25ea76346ec1..b29300f03287 100644
--- a/sim/bpf/sim-if.c
+++ b/sim/bpf/sim-if.c
@@ -195,7 +195,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
{
SIM_CPU *current_cpu = STATE_CPU (sd, 0);
host_callback *cb = STATE_CALLBACK (sd);
- SIM_ADDR addr;
+ bfd_vma addr;
/* Determine the start address.
diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c
index 7568b856661a..c3b46afb34e5 100644
--- a/sim/cris/sim-if.c
+++ b/sim/cris/sim-if.c
@@ -974,10 +974,10 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
{
SIM_CPU *current_cpu = STATE_CPU (sd, 0);
host_callback *cb = STATE_CALLBACK (sd);
- SIM_ADDR addr;
+ bfd_vma addr;
if (sd != NULL)
- addr = cris_start_address != (SIM_ADDR) -1
+ addr = cris_start_address != (bfd_vma) -1
? cris_start_address
: (interp_start_addr != 0
? interp_start_addr
diff --git a/sim/frv/sim-if.c b/sim/frv/sim-if.c
index f0487f5732ff..6e0f1bbaba64 100644
--- a/sim/frv/sim-if.c
+++ b/sim/frv/sim-if.c
@@ -182,7 +182,7 @@ sim_create_inferior (SIM_DESC sd, bfd *abfd, char * const *argv,
{
SIM_CPU *current_cpu = STATE_CPU (sd, 0);
host_callback *cb = STATE_CALLBACK (sd);
- SIM_ADDR addr;
+ bfd_vma addr;
if (abfd != NULL)
addr = bfd_get_start_address (abfd);
diff --git a/sim/iq2000/sim-if.c b/sim/iq2000/sim-if.c
index 1b1b3ac6e615..e9b66b6a7ef9 100644
--- a/sim/iq2000/sim-if.c
+++ b/sim/iq2000/sim-if.c
@@ -137,7 +137,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char * const *argv,
{
SIM_CPU *current_cpu = STATE_CPU (sd, 0);
host_callback *cb = STATE_CALLBACK (sd);
- SIM_ADDR addr;
+ bfd_vma addr;
if (abfd != NULL)
addr = bfd_get_start_address (abfd);
diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c
index a2a33620bdbc..82f2e117671e 100644
--- a/sim/lm32/sim-if.c
+++ b/sim/lm32/sim-if.c
@@ -198,7 +198,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char * const *argv,
{
SIM_CPU *current_cpu = STATE_CPU (sd, 0);
host_callback *cb = STATE_CALLBACK (sd);
- SIM_ADDR addr;
+ bfd_vma addr;
if (abfd != NULL)
addr = bfd_get_start_address (abfd);
diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c
index 401d1020d704..3594162956e1 100644
--- a/sim/m32r/sim-if.c
+++ b/sim/m32r/sim-if.c
@@ -151,7 +151,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char * const *argv,
{
SIM_CPU *current_cpu = STATE_CPU (sd, 0);
host_callback *cb = STATE_CALLBACK (sd);
- SIM_ADDR addr;
+ bfd_vma addr;
if (abfd != NULL)
addr = bfd_get_start_address (abfd);
diff --git a/sim/or1k/sim-if.c b/sim/or1k/sim-if.c
index a60c8815772b..d698d7035bf7 100644
--- a/sim/or1k/sim-if.c
+++ b/sim/or1k/sim-if.c
@@ -263,7 +263,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
char * const *argv, char * const *envp)
{
SIM_CPU *current_cpu = STATE_CPU (sd, 0);
- SIM_ADDR addr;
+ bfd_vma addr;
if (abfd != NULL)
addr = bfd_get_start_address (abfd);
diff --git a/sim/pru/interp.c b/sim/pru/interp.c
index c7226a349b60..250a32a889a5 100644
--- a/sim/pru/interp.c
+++ b/sim/pru/interp.c
@@ -856,7 +856,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *prog_bfd,
SIM_CPU *cpu = STATE_CPU (sd, 0);
struct pru_regset *pru_cpu = PRU_SIM_CPU (cpu);
host_callback *cb = STATE_CALLBACK (sd);
- SIM_ADDR addr;
+ bfd_vma addr;
addr = bfd_get_start_address (prog_bfd);
diff --git a/sim/riscv/interp.c b/sim/riscv/interp.c
index 46f19165971d..50b5a514e327 100644
--- a/sim/riscv/interp.c
+++ b/sim/riscv/interp.c
@@ -139,7 +139,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
{
SIM_CPU *cpu = STATE_CPU (sd, 0);
host_callback *cb = STATE_CALLBACK (sd);
- SIM_ADDR addr;
+ bfd_vma addr;
/* Set the PC. */
if (abfd != NULL)
--
2.39.0
reply other threads:[~2022-12-23 0:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20221223000549.29177-1-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=gdb-patches@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).