diff options
author | Mike Frysinger <vapier@gentoo.org> | 2022-11-12 01:13:26 +0700 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2022-12-22 19:29:10 -0500 |
commit | 20fea6638f1785b241c39454dcb707234a675524 (patch) | |
tree | 9a192d2692268726fb466753904ed6eea4443855 | |
parent | 7dc3ab91259b96e87f7dbc423b9d5aeaf4e447ed (diff) | |
download | fsf-binutils-gdb-20fea6638f1785b241c39454dcb707234a675524.zip fsf-binutils-gdb-20fea6638f1785b241c39454dcb707234a675524.tar.gz fsf-binutils-gdb-20fea6638f1785b241c39454dcb707234a675524.tar.bz2 |
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.
-rw-r--r-- | sim/avr/interp.c | 2 | ||||
-rw-r--r-- | sim/bfin/interp.c | 2 | ||||
-rw-r--r-- | sim/bpf/sim-if.c | 2 | ||||
-rw-r--r-- | sim/cris/sim-if.c | 4 | ||||
-rw-r--r-- | sim/frv/sim-if.c | 2 | ||||
-rw-r--r-- | sim/iq2000/sim-if.c | 2 | ||||
-rw-r--r-- | sim/lm32/sim-if.c | 2 | ||||
-rw-r--r-- | sim/m32r/sim-if.c | 2 | ||||
-rw-r--r-- | sim/or1k/sim-if.c | 2 | ||||
-rw-r--r-- | sim/pru/interp.c | 2 | ||||
-rw-r--r-- | 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 3b0397b..3acf09b 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 f4071ce..493c3b6 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 25ea763..b29300f 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 7568b85..a952a27 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 f0487f5..6e0f1bb 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 1b1b3ac..e9b66b6 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 a2a3362..82f2e11 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 49e3695..e115454 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 a60c881..d698d70 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 c7226a3..250a32a 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 46f1916..50b5a51 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) |