diff --git a/bfd/config.bfd b/bfd/config.bfd index 4dde5321f23..94c1a871ec2 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -242,7 +242,17 @@ esac case "${targ}" in # START OF targmatch.h + i[3-7]86-*-rosetta*) + targ_defvec=i386_elf32_vec + targ_selvecs= + targ64_selvecs=x86_64_elf64_vec + ;; #ifdef BFD64 + x86_64-*-rosetta*) + targ_defvec=x86_64_elf64_vec + targ_selvecs=i386_elf32_vec + want64=true + ;; aarch64-*-darwin*) targ_defvec=aarch64_mach_o_vec targ_selvecs="arm_mach_o_vec mach_o_le_vec mach_o_be_vec mach_o_fat_vec" diff --git a/config.sub b/config.sub index 3d35cde174d..19cd8f07cd7 100755 --- a/config.sub +++ b/config.sub @@ -2102,6 +2102,7 @@ case $os in | rhapsody* \ | riscix* \ | riscos* \ + | rosetta* \ | rtems* \ | rtmk* \ | rtu* \ diff --git a/gas/configure.tgt b/gas/configure.tgt index f0ea55d9def..4f194e70501 100644 --- a/gas/configure.tgt +++ b/gas/configure.tgt @@ -126,6 +126,7 @@ esac generic_target=${cpu_type}-$vendor-$os # Note: This table is alpha-sorted, please try to keep it that way. case ${generic_target} in + i386-*-rosetta*) fmt=elf em=gnu;; aarch64*-*-elf*) fmt=elf;; aarch64*-*-fuchsia*) fmt=elf;; aarch64*-*-haiku*) fmt=elf em=haiku ;; diff --git a/ld/Makefile.am b/ld/Makefile.am index c219662d2e3..8d17fed7581 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -153,6 +153,7 @@ endif # These all start with e so 'make clean' can find them. ALL_EMULATION_SOURCES = \ + eelf_i386_rosetta.c \ eaix5ppc.c \ eaix5rs6.c \ eaixppc.c \ @@ -373,6 +374,7 @@ ALL_EMULATION_SOURCES = \ ALL_EMULATIONS = $(ALL_EMULATION_SOURCES:.c=.@OBJEXT@) ALL_64_EMULATION_SOURCES = \ + eelf_x86_64_rosetta.c \ eaarch64elf.c \ eaarch64elf32.c \ eaarch64elf32b.c \ diff --git a/ld/Makefile.in b/ld/Makefile.in index f1ba6af5269..a4d76c4cc0b 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -668,6 +668,7 @@ LIBIBERTY = ../libiberty/libiberty.a # These all start with e so 'make clean' can find them. ALL_EMULATION_SOURCES = \ + eelf_i386_rosetta.c \ eaix5ppc.c \ eaix5rs6.c \ eaixppc.c \ @@ -887,6 +888,7 @@ ALL_EMULATION_SOURCES = \ ALL_EMULATIONS = $(ALL_EMULATION_SOURCES:.c=.@OBJEXT@) ALL_64_EMULATION_SOURCES = \ + eelf_x86_64_rosetta.c \ eaarch64elf.c \ eaarch64elf32.c \ eaarch64elf32b.c \ @@ -1474,6 +1476,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_be.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_fbsd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_haiku.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_rosetta.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_sol2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_vxworks.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_iamcu.Po@am__quote@ @@ -1482,6 +1485,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_rosetta.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_sol2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eh8300elf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eh8300elf_linux.Po@am__quote@ diff --git a/ld/configure.tgt b/ld/configure.tgt index 3e158913b89..53c091fb78f 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -82,6 +82,13 @@ fi # Please try to keep this table more or less in alphabetic order - it # makes it much easier to lookup a specific archictecture. case "${targ}" in +i[3-7]86-*-rosetta*) targ_emul=elf_i386_rosetta + targ_extra_emuls=elf_i386 + targ64_extra_emuls="elf_x86_64_rosetta elf_x86_64" + ;; +x86_64-*-rosetta*) targ_emul=elf_x86_64_rosetta + targ_extra_emuls="elf_i386_rosetta elf_x86_64 elf_i386" + ;; aarch64_be-*-elf) targ_emul=aarch64elfb targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf" ;; diff --git a/ld/emulparams/elf_i386_rosetta.sh b/ld/emulparams/elf_i386_rosetta.sh new file mode 100644 index 00000000000..002e918bc53 --- /dev/null +++ b/ld/emulparams/elf_i386_rosetta.sh @@ -0,0 +1,4 @@ +source_sh ${srcdir}/emulparams/elf_i386.sh +TEXT_START_ADDR=0x08000000 +GENERATE_SHLIB_SCRIPT=yes +GENERATE_PIE_SCRIPT=yes diff --git a/ld/emulparams/elf_x86_64_rosetta.sh b/ld/emulparams/elf_x86_64_rosetta.sh new file mode 100644 index 00000000000..4ddde5ab2a5 --- /dev/null +++ b/ld/emulparams/elf_x86_64_rosetta.sh @@ -0,0 +1,3 @@ +source_sh ${srcdir}/emulparams/elf_x86_64.sh +GENERATE_SHLIB_SCRIPT=yes +GENERATE_PIE_SCRIPT=yes