aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sim/mips/ChangeLog6
-rw-r--r--sim/mips/interp.c11
2 files changed, 11 insertions, 6 deletions
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index 85ce1ac..123d722 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,9 @@
+2021-05-22 Faraz Shahbazker <fshahbazker@wavecomp.com>
+
+sim/mips/ChangeLog:
+ * interp.c (sim_create_inferior): Only truncate sign extension
+ bits for 32-bit target models.
+
2021-05-17 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Delete.
diff --git a/sim/mips/interp.c b/sim/mips/interp.c
index 2839715..6e00fd0 100644
--- a/sim/mips/interp.c
+++ b/sim/mips/interp.c
@@ -1014,12 +1014,11 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
sim_cpu *cpu = STATE_CPU (sd, cpu_nr);
sim_cia pc = bfd_get_start_address (abfd);
- /* We need to undo brain-dead bfd behavior where it sign-extends
- addresses that are supposed to be unsigned. See the mips bfd
- sign_extend_vma setting. We have to check the ELF data itself
- in order to handle o32 & n32 ABIs. */
- if (abfd->tdata.elf_obj_data->elf_header->e_ident[EI_CLASS] ==
- ELFCLASS32)
+ /* The 64-bit BFD sign-extends MIPS addresses to model
+ 32-bit compatibility segments with 64-bit addressing.
+ These addresses work as is on 64-bit targets but
+ can be truncated for 32-bit targets. */
+ if (WITH_TARGET_WORD_BITSIZE == 32)
pc = (unsigned32) pc;
CPU_PC_SET (cpu, pc);