public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim: use bfd_vma when reading start addr from bfd info
@ 2022-12-23  0:29 Michael Frysinger
  0 siblings, 0 replies; only message in thread
From: Michael Frysinger @ 2022-12-23  0:29 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=20fea6638f1785b241c39454dcb707234a675524

commit 20fea6638f1785b241c39454dcb707234a675524
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sat Nov 12 01:13:26 2022 +0700

    sim: use bfd_vma when reading start addr from bfd info
    
    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.

Diff:
---
 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 3b0397b8f89..3acf09b15ad 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 f4071ce4739..493c3b62ffb 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 25ea76346ec..b29300f0328 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 7568b856661..a952a27fc52 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 != (USI) -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 f0487f5732f..6e0f1bbaba6 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 1b1b3ac6e61..e9b66b6a7ef 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 a2a33620bdb..82f2e117671 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 49e36958ebf..e11545461c5 100644
--- a/sim/m32r/sim-if.c
+++ b/sim/m32r/sim-if.c
@@ -152,7 +152,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 a60c8815772..d698d7035bf 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 c7226a349b6..250a32a889a 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 46f19165971..50b5a514e32 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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-23  0:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-23  0:29 [binutils-gdb] sim: use bfd_vma when reading start addr from bfd info Michael Frysinger

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).