Binutils with MCST patches

This commit is contained in:
Nobody 2020-10-14 00:22:48 +03:00
parent 85e95c9817
commit e0892d32d3
179 changed files with 50476 additions and 312 deletions

View File

@ -73,7 +73,7 @@ BFD32_LIBS = \
cache.lo coff-bfd.lo compress.lo corefile.lo format.lo hash.lo \
init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo \
section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo \
binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
binary.lo ihex.lo srec.lo tekhex.lo verilog.lo eir.lo
BFD64_LIBS = archive64.lo
@ -82,7 +82,7 @@ BFD32_LIBS_CFILES = \
cache.c coff-bfd.c compress.c corefile.c format.c hash.c \
init.c libbfd.c linker.c merge.c opncls.c reloc.c \
section.c simple.c stab-syms.c stabs.c syms.c targets.c \
binary.c ihex.c srec.c tekhex.c verilog.c
binary.c ihex.c srec.c tekhex.c verilog.c eir.c
BFD64_LIBS_CFILES = archive64.c
@ -102,6 +102,7 @@ ALL_MACHINES = \
cpu-d10v.lo \
cpu-d30v.lo \
cpu-dlx.lo \
cpu-e2k.lo \
cpu-epiphany.lo \
cpu-fr30.lo \
cpu-frv.lo \
@ -192,6 +193,7 @@ ALL_MACHINES_CFILES = \
cpu-d10v.c \
cpu-d30v.c \
cpu-dlx.c \
cpu-e2k.c \
cpu-epiphany.c \
cpu-fr30.c \
cpu-frv.c \
@ -337,6 +339,8 @@ BFD32_BACKENDS = \
elf32-d10v.lo \
elf32-d30v.lo \
elf32-dlx.lo \
elf32-e2k.lo \
elf32-e2k-pm.lo \
elf32-epiphany.lo \
elf32-fr30.lo \
elf32-frv.lo \
@ -393,6 +397,7 @@ BFD32_BACKENDS = \
elf32-xtensa.lo \
elf32.lo \
elflink.lo \
elfxx-e2k.lo \
elfxx-sparc.lo \
elfxx-tilegx.lo \
epoc-pe-arm.lo \
@ -533,6 +538,8 @@ BFD32_BACKENDS_CFILES = \
elf32-d10v.c \
elf32-d30v.c \
elf32-dlx.c \
elf32-e2k.c \
elf32-e2k-pm.c \
elf32-epiphany.c \
elf32-fr30.c \
elf32-frv.c \
@ -589,6 +596,7 @@ BFD32_BACKENDS_CFILES = \
elf32-xtensa.c \
elf32.c \
elflink.c \
elfxx-e2k.c \
elfxx-sparc.c \
elfxx-tilegx.c \
epoc-pe-arm.c \
@ -681,6 +689,7 @@ BFD64_BACKENDS = \
elf32-score.lo \
elf32-score7.lo \
elf64-alpha.lo \
elf64-e2k.lo \
elf64-gen.lo \
elf64-hppa.lo \
elf64-ia64.lo \
@ -723,6 +732,7 @@ BFD64_BACKENDS_CFILES = \
elf32-score.c \
elf32-score7.c \
elf64-alpha.c \
elf64-e2k.c \
elf64-gen.c \
elf64-hppa.c \
elf64-ia64-vms.c \
@ -1082,7 +1092,7 @@ DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) libtool-soversion
bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
@echo "creating $@"
@bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
bfd_version_string="\"$(VERSION)\"" ;\
bfd_version_string="\"$(VERSION)-23.008\"" ;\
bfd_soversion="$(VERSION)" ;\
bfd_version_package="\"$(PKGVERSION)\"" ;\
report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\

View File

@ -148,7 +148,7 @@ am__objects_1 = archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \
cache.lo coff-bfd.lo compress.lo corefile.lo format.lo hash.lo \
init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo \
section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo \
binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
binary.lo ihex.lo srec.lo tekhex.lo verilog.lo eir.lo
am_libbfd_la_OBJECTS = $(am__objects_1)
libbfd_la_OBJECTS = $(am_libbfd_la_OBJECTS)
libbfd_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@ -407,7 +407,7 @@ BFD32_LIBS = \
cache.lo coff-bfd.lo compress.lo corefile.lo format.lo hash.lo \
init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo \
section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo \
binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
binary.lo ihex.lo srec.lo tekhex.lo verilog.lo eir.lo
BFD64_LIBS = archive64.lo
BFD32_LIBS_CFILES = \
@ -415,7 +415,7 @@ BFD32_LIBS_CFILES = \
cache.c coff-bfd.c compress.c corefile.c format.c hash.c \
init.c libbfd.c linker.c merge.c opncls.c reloc.c \
section.c simple.c stab-syms.c stabs.c syms.c targets.c \
binary.c ihex.c srec.c tekhex.c verilog.c
binary.c ihex.c srec.c tekhex.c verilog.c eir.c
BFD64_LIBS_CFILES = archive64.c
@ -435,6 +435,7 @@ ALL_MACHINES = \
cpu-d10v.lo \
cpu-d30v.lo \
cpu-dlx.lo \
cpu-e2k.lo \
cpu-epiphany.lo \
cpu-fr30.lo \
cpu-frv.lo \
@ -525,6 +526,7 @@ ALL_MACHINES_CFILES = \
cpu-d10v.c \
cpu-d30v.c \
cpu-dlx.c \
cpu-e2k.c \
cpu-epiphany.c \
cpu-fr30.c \
cpu-frv.c \
@ -671,6 +673,8 @@ BFD32_BACKENDS = \
elf32-d10v.lo \
elf32-d30v.lo \
elf32-dlx.lo \
elf32-e2k.lo \
elf32-e2k-pm.lo \
elf32-epiphany.lo \
elf32-fr30.lo \
elf32-frv.lo \
@ -727,6 +731,7 @@ BFD32_BACKENDS = \
elf32-xtensa.lo \
elf32.lo \
elflink.lo \
elfxx-e2k.lo \
elfxx-sparc.lo \
elfxx-tilegx.lo \
epoc-pe-arm.lo \
@ -867,6 +872,8 @@ BFD32_BACKENDS_CFILES = \
elf32-d10v.c \
elf32-d30v.c \
elf32-dlx.c \
elf32-e2k.c \
elf32-e2k-pm.c \
elf32-epiphany.c \
elf32-fr30.c \
elf32-frv.c \
@ -923,6 +930,7 @@ BFD32_BACKENDS_CFILES = \
elf32-xtensa.c \
elf32.c \
elflink.c \
elfxx-e2k.c \
elfxx-sparc.c \
elfxx-tilegx.c \
epoc-pe-arm.c \
@ -1016,6 +1024,7 @@ BFD64_BACKENDS = \
elf32-score.lo \
elf32-score7.lo \
elf64-alpha.lo \
elf64-e2k.lo \
elf64-gen.lo \
elf64-hppa.lo \
elf64-ia64.lo \
@ -1058,6 +1067,7 @@ BFD64_BACKENDS_CFILES = \
elf32-score.c \
elf32-score7.c \
elf64-alpha.c \
elf64-e2k.c \
elf64-gen.c \
elf64-hppa.c \
elf64-ia64-vms.c \
@ -1387,6 +1397,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-d10v.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-d30v.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-dlx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-e2k.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-epiphany.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-fr30.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-frv.Plo@am__quote@
@ -1467,6 +1478,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecoff.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecofflink.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eir.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-attrs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-eh-frame.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-ifunc.Plo@am__quote@
@ -1490,6 +1502,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-d10v.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-d30v.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-dlx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-e2k-pm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-e2k.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-epiphany.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-fr30.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-frv.Plo@am__quote@
@ -1552,6 +1566,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-aarch64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-alpha.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-e2k.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-gen.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-hppa.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ia64-vms.Plo@am__quote@
@ -1569,6 +1584,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elflink.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfn32-mips.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-aarch64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-e2k.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-ia64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-mips.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-riscv.Plo@am__quote@
@ -2197,8 +2213,8 @@ stmp-lcoff-h: $(LIBCOFF_H_FILES)
bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
@echo "creating $@"
@bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
bfd_version_string="\"$(VERSION)\"" ;\
@bfd_version="22923009" ;\
bfd_version_string="\"$(VERSION)-23.008\"" ;\
bfd_soversion="$(VERSION)" ;\
bfd_version_package="\"$(PKGVERSION)\"" ;\
report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\

View File

@ -149,9 +149,11 @@ DESCRIPTION
.#define bfd_mach_sparc_v9m 20 {* with OSA2015 and M7 add'ns. *}
.#define bfd_mach_sparc_v8plusm8 21 {* with OSA2017 and M8 add'ns. *}
.#define bfd_mach_sparc_v9m8 22 {* with OSA2017 and M8 add'ns. *}
.#define bfd_mach_sparc_v8plus_mcst 23 {* with mcst add'ns. *}
.#define bfd_mach_sparc_v9_mcst 24 {* with mcst add'ns. *}
.{* Nonzero if MACH has the v9 instruction set. *}
.#define bfd_mach_sparc_v9_p(mach) \
. ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9m8 \
. ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9_mcst \
. && (mach) != bfd_mach_sparc_sparclite_le)
.{* Nonzero if MACH is a 64 bit sparc architecture. *}
.#define bfd_mach_sparc_64bit_p(mach) \
@ -162,7 +164,8 @@ DESCRIPTION
. && (mach) != bfd_mach_sparc_v8pluse \
. && (mach) != bfd_mach_sparc_v8plusv \
. && (mach) != bfd_mach_sparc_v8plusm \
. && (mach) != bfd_mach_sparc_v8plusm8)
. && (mach) != bfd_mach_sparc_v8plusm8 \
. && (mach) != bfd_mach_sparc_v8plus_mcst)
. bfd_arch_spu, {* PowerPC SPU *}
.#define bfd_mach_spu 256
. bfd_arch_mips, {* MIPS Rxxxx *}
@ -518,6 +521,24 @@ DESCRIPTION
. bfd_arch_lm32, {* Lattice Mico32 *}
.#define bfd_mach_lm32 1
. bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
. bfd_arch_e2k, {* MCST E2K. *}
.{* It's crucial that the underlying `bfd_mach_e2k*' have the same values as *}
.{* the corresponding `E_E2K_MACH_*'s!!! *}
.#define bfd_mach_e2k_generic 0
.#define bfd_mach_e2k_ev1 1
.{* This is interpreted as the common subset of all Elbrus V2 iterations.
. Currently it is the same as the common subset of all elbrus-2c+. *}
.#define bfd_mach_e2k_ev2 2
.#define bfd_mach_e2k_ev3 3
.#define bfd_mach_e2k_ev4 4
.#define bfd_mach_e2k_ev5 5
.#define bfd_mach_e2k_ev6 6
.{* Values 16, 17 and 18 used to be reserved for the first three iterations
. of `elbrus-v2'. See `include/elf/e2k.h' for why they can't be reused right
. now. *}
.#define bfd_mach_e2k_8c 19
.#define bfd_mach_e2k_1cplus 20
. bfd_arch_tilepro, {* Tilera TILEPro *}
. bfd_arch_tilegx, {* Tilera TILE-Gx *}
.#define bfd_mach_tilepro 1
@ -593,6 +614,7 @@ extern const bfd_arch_info_type bfd_crx_arch;
extern const bfd_arch_info_type bfd_d10v_arch;
extern const bfd_arch_info_type bfd_d30v_arch;
extern const bfd_arch_info_type bfd_dlx_arch;
extern const bfd_arch_info_type bfd_e2k_arch;
extern const bfd_arch_info_type bfd_epiphany_arch;
extern const bfd_arch_info_type bfd_fr30_arch;
extern const bfd_arch_info_type bfd_frv_arch;
@ -688,6 +710,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_d10v_arch,
&bfd_d30v_arch,
&bfd_dlx_arch,
&bfd_e2k_arch,
&bfd_epiphany_arch,
&bfd_fr30_arch,
&bfd_frv_arch,

View File

@ -2008,9 +2008,11 @@ enum bfd_architecture
#define bfd_mach_sparc_v9m 20 /* with OSA2015 and M7 add'ns. */
#define bfd_mach_sparc_v8plusm8 21 /* with OSA2017 and M8 add'ns. */
#define bfd_mach_sparc_v9m8 22 /* with OSA2017 and M8 add'ns. */
#define bfd_mach_sparc_v8plus_mcst 23 /* with mcst add'ns. */
#define bfd_mach_sparc_v9_mcst 24 /* with mcst add'ns. */
/* Nonzero if MACH has the v9 instruction set. */
#define bfd_mach_sparc_v9_p(mach) \
((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9m8 \
((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9_mcst \
&& (mach) != bfd_mach_sparc_sparclite_le)
/* Nonzero if MACH is a 64 bit sparc architecture. */
#define bfd_mach_sparc_64bit_p(mach) \
@ -2021,7 +2023,8 @@ enum bfd_architecture
&& (mach) != bfd_mach_sparc_v8pluse \
&& (mach) != bfd_mach_sparc_v8plusv \
&& (mach) != bfd_mach_sparc_v8plusm \
&& (mach) != bfd_mach_sparc_v8plusm8)
&& (mach) != bfd_mach_sparc_v8plusm8 \
&& (mach) != bfd_mach_sparc_v8plus_mcst)
bfd_arch_spu, /* PowerPC SPU */
#define bfd_mach_spu 256
bfd_arch_mips, /* MIPS Rxxxx */
@ -2377,6 +2380,23 @@ enum bfd_architecture
bfd_arch_lm32, /* Lattice Mico32 */
#define bfd_mach_lm32 1
bfd_arch_microblaze,/* Xilinx MicroBlaze. */
bfd_arch_e2k, /* MCST E2K. */
/* It's crucial that the underlying `bfd_mach_e2k*' have the same values as */
/* the corresponding `E_E2K_MACH_*'s!!! */
#define bfd_mach_e2k_generic 0
#define bfd_mach_e2k_ev1 1
/* This is interpreted as the common subset of all Elbrus V2 iterations.
Currently it is the same as the common subset of all elbrus-2c+. */
#define bfd_mach_e2k_ev2 2
#define bfd_mach_e2k_ev3 3
#define bfd_mach_e2k_ev4 4
#define bfd_mach_e2k_ev5 5
#define bfd_mach_e2k_ev6 6
/* Values 16, 17 and 18 used to be reserved for the first three iterations
of `elbrus-v2'. See `include/elf/e2k.h' for why they can't be reused right
now. */
#define bfd_mach_e2k_8c 19
#define bfd_mach_e2k_1cplus 20
bfd_arch_tilepro, /* Tilera TILEPro */
bfd_arch_tilegx, /* Tilera TILE-Gx */
#define bfd_mach_tilepro 1
@ -6496,6 +6516,83 @@ assembler and not (currently) written to any object files. */
BFD_RELOC_WASM32_CODE_POINTER,
BFD_RELOC_WASM32_INDEX,
BFD_RELOC_WASM32_PLT_SIG,
/* This one corresponds to R_E2K_64_ABS_LIT. */
BFD_RELOC_E2K_64_ABS_LIT,
/* This one corresponds to R_E2K_DISP. */
BFD_RELOC_E2K_DISP,
/* This one corresponds to R_E2K_GOT. */
BFD_RELOC_E2K_GOT,
/* This one corresponds to R_E2K_TLS_GDMOD. */
BFD_RELOC_E2K_TLS_GDMOD,
/* This one corresponds to R_E2K_TLS_GDREL. */
BFD_RELOC_E2K_TLS_GDREL,
/* This one corresponds to R_E2K_TLS_IE. */
BFD_RELOC_E2K_TLS_IE,
/* This one corresponds to R_E2K_32_TLS_LE. */
BFD_RELOC_E2K_32_TLS_LE,
/* This one corresponds to R_E2K_64_TLS_LE. */
BFD_RELOC_E2K_64_TLS_LE,
/* This one corresponds to R_E2K_TLS_32_DTPREL. */
BFD_RELOC_E2K_32_DTPREL,
/* This one corresponds to R_E2K_TLS_64_DTPREL. */
BFD_RELOC_E2K_64_DTPREL,
/* This one corresponds to R_E2K_PLT. */
BFD_RELOC_E2K_PLT,
/* This one corresponds to R_E2K_GOTPLT. */
BFD_RELOC_E2K_GOTPLT,
/* This one corresponds to R_E2K_ISLOCAL. */
BFD_RELOC_E2K_ISLOCAL,
/* This one corresponds to R_E2K_AP_GOT. */
BFD_RELOC_E2K_AP_GOT,
/* This one corresponds to R_E2K_PL_GOT. */
BFD_RELOC_E2K_PL_GOT,
/* This one corresponds to R_E2K_PREF. */
BFD_RELOC_E2K_PREF,
/* This one corresponds to R_E2K_ISLOCAL32. */
BFD_RELOC_E2K_ISLOCAL32,
/* This one corresponds to R_E2K_GOTOFF64. */
BFD_RELOC_E2K_GOTOFF64,
/* This one corresponds to R_E2K_GOTOFF64_LIT. */
BFD_RELOC_E2K_GOTOFF64_LIT,
/* This one corresponds to R_E2K_AP. */
BFD_RELOC_E2K_AP,
/* This one corresponds to R_E2K_PL. */
BFD_RELOC_E2K_PL,
/* Elvees Elcore relocations. */
BFD_RELOC_ELCORE32,
BFD_RELOC_ELCORE16NPC,
BFD_RELOC_ELCORE16PC,
BFD_RELOC_ELCORE16S,
BFD_RELOC_ELCORE16,
BFD_RELOC_ELCORE5,
BFD_RELOC_ELCORE32_FAKE,
BFD_RELOC_ELCORE16NPC_FAKE,
BFD_RELOC_ELCORE16PC_FAKE,
BFD_RELOC_ELCORE16S_FAKE,
BFD_RELOC_ELCORE16_FAKE,
BFD_RELOC_ELCORE5_FAKE,
BFD_RELOC_UNUSED };
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;

View File

@ -168,6 +168,7 @@ cr16*) targ_archs=bfd_cr16_arch ;;
crisv32) targ_archs=bfd_cris_arch ;;
crx*) targ_archs=bfd_crx_arch ;;
dlx*) targ_archs=bfd_dlx_arch ;;
e2k*) targ_archs=bfd_e2k_arch ;;
fido*) targ_archs=bfd_m68k_arch ;;
hppa*) targ_archs=bfd_hppa_arch ;;
i[3-7]86) targ_archs=bfd_i386_arch ;;
@ -527,6 +528,18 @@ case "${targ}" in
targ_defvec=d30v_elf32_vec
;;
e2k-*-linux-*)
targ_defvec=e2k_elf32_vec
targ_selvecs="e2k_pm_elf32_vec"
targ64_selvecs="e2k_elf64_vec"
want64=true
;;
e2k-*-kpda)
targ_defvec=e2k_kpda_elf64_vec
want64=true
;;
epiphany-*-*)
targ_defvec=epiphany_elf32_vec
targ_underscore=yes

4
bfd/configure vendored
View File

@ -14359,6 +14359,10 @@ do
d10v_elf32_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
d30v_elf32_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
dlx_elf32_be_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;;
e2k_elf32_vec) tb="$tb elf32-e2k.lo elfxx-e2k.lo elf-ifunc.lo $elf"; want64=true;;
e2k_pm_elf32_vec) tb="$tb elf32-e2k-pm.lo elfxx-e2k.lo elf-ifunc.lo $elf";;
e2k_elf64_vec) tb="$tb elf64-e2k.lo elfxx-e2k.lo elf-ifunc.lo $elf"; target_size=64;;
e2k_kpda_elf64_vec) tb="$tb elf64-e2k-kpda.lo elfxx-e2k.lo elf-ifunc.lo $elf"; target_size=64;;
elf32_be_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
elf32_le_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
elf64_be_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;

View File

@ -441,6 +441,10 @@ do
d10v_elf32_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
d30v_elf32_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
dlx_elf32_be_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;;
e2k_elf32_vec) tb="$tb elf32-e2k.lo elfxx-e2k.lo elf-ifunc.lo $elf"; want64=true;;
e2k_pm_elf32_vec) tb="$tb elf32-e2k-pm.lo elfxx-e2k.lo elf-ifunc.lo $elf";;
e2k_elf64_vec) tb="$tb elf64-e2k.lo elfxx-e2k.lo elf-ifunc.lo $elf"; target_size=64;;
e2k_kpda_elf64_vec) tb="$tb elf64-e2k-kpda.lo elfxx-e2k.lo elf-ifunc.lo $elf"; target_size=64;;
elf32_be_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
elf32_le_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
elf64_be_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;

282
bfd/cpu-e2k.c Normal file
View File

@ -0,0 +1,282 @@
/* BFD support for the E2K architecture.
Copyright 1992, 1995, 1996, 1998, 2000, 2002, 2005, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
struct archname_item
{
const char *str;
size_t len;
};
static const char *
canonicalize_arch_name (const char *name, int *pmode)
{
int mode;
size_t len;
const char *pcolon = strchr (name, ':');
if (pcolon != NULL)
{
if (((pcolon[1] == '3' && pcolon[2] == '2' && (mode = 32))
|| (pcolon[1] == '6' && pcolon[2] == '4' && (mode = 64))
|| (pcolon[1] == 'p' && pcolon[2] == 'm' && (mode = 128)))
&& pcolon[3] == '\0')
len = pcolon - name;
else
return NULL;
}
else
{
mode = 64;
len = strlen (name);
}
#define STRNCMP(s1, s2, n) \
((n == sizeof (s2) - 1 && strncmp (s1, s2, n) == 0) ? 0 : 1)
if (STRNCMP (name, "generic", len) == 0
/* FIXME: `ARCH=e2k' is still used within the generated LD scripts for
E2K. Changing it to "generic" would result in a reference to some dummy
`bfd_arch_generic' which is definitely not the thing I need. */
|| STRNCMP (name, "e2k", len) == 0)
name = "generic";
else if (STRNCMP (name, "elbrus-v1", len) == 0
|| STRNCMP (name, "elbrus", len) == 0)
name = "elbrus-v1";
else if (STRNCMP (name, "elbrus-v2", len) == 0
|| STRNCMP (name, "elbrus-2c+", len) == 0
|| STRNCMP (name, "elbrus-2cm", len) == 0)
name = "elbrus-v2";
else if (STRNCMP (name, "elbrus-v3", len) == 0
|| STRNCMP (name, "elbrus-4c", len) == 0)
name = "elbrus-v3";
else if (STRNCMP (name, "elbrus-v4", len) == 0)
name = "elbrus-v4";
else if (STRNCMP (name, "elbrus-8c", len) == 0)
name = "elbrus-8c";
else if (STRNCMP (name, "elbrus-1c+", len) == 0)
name = "elbrus-1c+";
else if (STRNCMP (name, "elbrus-v5", len) == 0
|| STRNCMP (name, "elbrus-8c2", len) == 0)
name = "elbrus-v5";
else if (STRNCMP (name, "elbrus-v6", len) == 0)
name = "elbrus-v6";
else
return NULL;
#undef STRNCMP
*pmode = mode;
return name;
}
static bfd_boolean
e2k_scan (const struct bfd_arch_info *info, const char *string)
{
static const int modes[] = {64, 32, 128};
const char *canon;
int mode;
canon = canonicalize_arch_name (string, &mode);
if (canon != NULL
&& mode == modes[info->mach % 3]
&& strncmp (canon, info->printable_name, strlen (canon)) == 0)
return TRUE;
return FALSE;
}
extern const bfd_arch_info_type bfd_e2k_arch;
static const bfd_arch_info_type *
bfd_e2k_compatible (const bfd_arch_info_type *i, const bfd_arch_info_type *o)
{
if (i->arch != o->arch)
return NULL;
/* Check whether input and output BFDs have the same ABI. */
if (i->mach % 3 != o->mach % 3)
return NULL;
/* Nowadays that we should be able to dynamically choose an output
machine without `-A' (see Bug #58358) any further checks here
are meaningless. They are moved to `_bfd_e2k_merge_private_bfd_data'.
Just return our "generic" arch info in order not to upset
`lang_check ()'. It turns out that a value returned by this function
is not actually used at all except for aforementioned formal(?) check and
. . . GDB's `can_run_code_for ()' which expects us to return the "more
featureful" of the two arches. For it to succeed the returned arch should
coincide with that of the executable, which is the `I' argument of this
function). I think that it's quite reasonable to return `I' for now, since
its arch can't certainly turn out to be "less featureful" than the minimal
arch of the GDB's handler, represented by `O'. But this may very well
change once GDB for E2K gets "non-minimal" handlers!
By the way, why don't they want to let GDB's handler have a more advanced
arch than that of the executable? As far as I remember, this is because a
more "featureful" handler may require registers which aren't provided by
the executable's primitive ABI. */
return i;
}
#define BITS_ADDR_64 64
#define BITS_ADDR_32 32
#define BITS_ADDR_pm 32
#define MACH_64(mach) (3 * (mach))
#define MACH_32(mach) (3 * (mach) + 1)
#define MACH_pm(mach) (3 * (mach) + 2)
#define PRINT_PREFIX_64 "64-bit ABI for "
#define PRINT_PREFIX_32 "32-bit ABI for "
#define PRINT_PREFIX_PM "Protected ABI for "
#define N(ARCH, MODE, PRINT, DEFAULT, NEXT) \
{ \
/* We believe that E2k has 32 bits in a word for all architectures \
in all supported ABIs. I wonder whether it's actually so from \
the point of view of binutils. */ \
32, \
/* Number of bits in an address */ \
BITS_ADDR_##MODE, \
/* We have 8 bits in a byte everywhere. */ \
8, \
bfd_arch_e2k, \
/* Get an actual machine number used inside binutils while \
performing further checks. */ \
MACH_##MODE (ARCH), \
"e2k", \
PRINT ":" #MODE, \
/* Section alignment power. This should probably be \
revisited. */ \
4, \
DEFAULT, \
bfd_e2k_compatible, \
e2k_scan, \
bfd_arch_default_fill, \
NEXT \
}
/* These indices are used to refer to the next arch_info entry. I_generic_64
is not needed here since the corresponding entry is defined apart. */
enum
{
I_generic_32,
I_generic_pm,
I_ev1_64,
I_ev1_32,
I_ev1_pm,
I_ev2_64,
I_ev2_32,
I_ev2_pm,
I_ev3_64,
I_ev3_32,
I_ev3_pm,
I_ev4_64,
I_ev4_32,
I_ev4_pm,
I_ev5_64,
I_ev5_32,
I_ev5_pm,
I_ev6_64,
I_ev6_32,
I_ev6_pm,
I_8c_64,
I_8c_32,
I_8c_pm,
I_1cplus_64,
I_1cplus_32,
I_1cplus_pm,
};
#define NN(index) (&arch_info_struct[(index) + 1])
static const bfd_arch_info_type arch_info_struct[] =
{
/* The two remaining generic entries. */
N (bfd_mach_e2k_generic, 32, "generic", FALSE, NN (I_generic_32)),
N (bfd_mach_e2k_generic, pm, "generic", FALSE, NN (I_generic_pm)),
/* `elbrus-v1' entries. */
N (bfd_mach_e2k_ev1, 64, "elbrus-v1", FALSE, NN (I_ev1_64)),
N (bfd_mach_e2k_ev1, 32, "elbrus-v1", FALSE, NN (I_ev1_32)),
N (bfd_mach_e2k_ev1, pm, "elbrus-v1", FALSE, NN (I_ev1_pm)),
/* `elbrus-v2' entries. */
N (bfd_mach_e2k_ev2, 64, "elbrus-v2", FALSE, NN (I_ev2_64)),
N (bfd_mach_e2k_ev2, 32, "elbrus-v2", FALSE, NN (I_ev2_32)),
N (bfd_mach_e2k_ev2, pm, "elbrus-v2", FALSE, NN (I_ev2_pm)),
/* `elbrus-v3' entries. */
N (bfd_mach_e2k_ev3, 64, "elbrus-v3", FALSE, NN (I_ev3_64)),
N (bfd_mach_e2k_ev3, 32, "elbrus-v3", FALSE, NN (I_ev3_32)),
N (bfd_mach_e2k_ev3, pm, "elbrus-v3", FALSE, NN (I_ev3_pm)),
/* `elbrus-v4' entries. */
N (bfd_mach_e2k_ev4, 64, "elbrus-v4", FALSE, NN (I_ev4_64)),
N (bfd_mach_e2k_ev4, 32, "elbrus-v4", FALSE, NN (I_ev4_32)),
N (bfd_mach_e2k_ev4, pm, "elbrus-v4", FALSE, NN (I_ev4_pm)),
/* `elbrus-v5' entries. */
N (bfd_mach_e2k_ev5, 64, "elbrus-v5", FALSE, NN (I_ev5_64)),
N (bfd_mach_e2k_ev5, 32, "elbrus-v5", FALSE, NN (I_ev5_32)),
N (bfd_mach_e2k_ev5, pm, "elbrus-v5", FALSE, NN (I_ev5_pm)),
/* `elbrus-v6' entries. */
N (bfd_mach_e2k_ev6, 64, "elbrus-v6", FALSE, NN (I_ev6_64)),
N (bfd_mach_e2k_ev6, 32, "elbrus-v6", FALSE, NN (I_ev6_32)),
N (bfd_mach_e2k_ev6, pm, "elbrus-v6", FALSE, NN (I_ev6_pm)),
/* Entries, describing the specific `elbrus-8c' processor also known as
Processor-1 (elbrus-v4). */
N (bfd_mach_e2k_8c, 64, "elbrus-8c", FALSE, NN (I_8c_64)),
N (bfd_mach_e2k_8c, 32, "elbrus-8c", FALSE, NN (I_8c_32)),
N (bfd_mach_e2k_8c, pm, "elbrus-8c", FALSE, NN (I_8c_pm)),
/* Entries, describing the specific `elbrus-1c+' processor also known as
Processor-2 (elbrus-v4). */
N (bfd_mach_e2k_1cplus, 64, "elbrus-1c+", FALSE, NN (I_1cplus_64)),
N (bfd_mach_e2k_1cplus, 32, "elbrus-1c+", FALSE, NN (I_1cplus_32)),
N (bfd_mach_e2k_1cplus, pm, "elbrus-1c+", FALSE, NULL)
};
/* I don't remember for sure what DEFAULT actually means here. We should
probably only one default arch, however. Let it be a 64-bit elbrus
generic arch. */
const bfd_arch_info_type bfd_e2k_arch =
N (bfd_mach_e2k_generic, 64, "generic", TRUE, &arch_info_struct[0]);

View File

@ -337,6 +337,36 @@ static const bfd_arch_info_type arch_info_struct[] =
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
&arch_info_struct[21],
},
{
32,/* bits in a word */
32,/* bits in an address */
8,/* bits in a byte */
bfd_arch_sparc,
bfd_mach_sparc_v8plus_mcst,
"sparc",
"sparc:v8plus_mcst",
3,
FALSE,
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
&arch_info_struct[22],
},
{
64,/* bits in a word */
64,/* bits in an address */
8,/* bits in a byte */
bfd_arch_sparc,
bfd_mach_sparc_v9_mcst,
"sparc",
"sparc:r1000",
3,
FALSE,
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
0,
}
};

View File

@ -16,4 +16,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Controls whether to enable development-mode features by default.
development=true
# development=true

102
bfd/eir.c Normal file
View File

@ -0,0 +1,102 @@
/* BFD back-end for objects containing EIR.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
#define eir_set_arch_mach _bfd_generic_set_arch_mach
static bfd_boolean
eir_set_section_contents (bfd *abfd,
asection *sec,
const void *data,
file_ptr offset,
bfd_size_type size)
{
static file_ptr crnt_pos;
file_ptr mask;
if (size == 0 || (strcmp (sec->name, ".pack_pure_eir") != 0
&& strcmp (sec->name, ".pack_mixed_eir") != 0))
return TRUE;
mask = (1 << sec->alignment_power) - 1;
crnt_pos = (crnt_pos + mask) & ~mask;
sec->filepos = crnt_pos;
crnt_pos += size;
return _bfd_generic_set_section_contents (abfd, sec, data, offset, size);
}
const bfd_target eir_vec =
{
"eir", /* name */
bfd_target_unknown_flavour, /* flavour */
BFD_ENDIAN_UNKNOWN, /* byteorder */
BFD_ENDIAN_UNKNOWN, /* header_byteorder */
EXEC_P, /* object_flags */
(SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA
| SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */
0, /* symbol_leading_char */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
255, /* match priority. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
{ /* bfd_check_format */
_bfd_dummy_target,
_bfd_dummy_target,
_bfd_dummy_target,
_bfd_dummy_target,
},
{ /* bfd_set_format */
bfd_false,
bfd_true,
bfd_false,
bfd_false,
},
{ /* bfd_write_contents */
bfd_false,
bfd_true,
bfd_false,
bfd_false,
},
BFD_JUMP_TABLE_GENERIC (_bfd_generic),
BFD_JUMP_TABLE_COPY (_bfd_generic),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (eir),
BFD_JUMP_TABLE_LINK (_bfd_nolink),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
NULL
};

View File

@ -500,6 +500,7 @@ enum elf_target_id
TILEGX_ELF_DATA,
TILEPRO_ELF_DATA,
RISCV_ELF_DATA,
E2K_ELF_DATA,
GENERIC_ELF_DATA
};
@ -1552,6 +1553,8 @@ struct elf_backend_data
/* True if `_bfd_elf_link_renumber_dynsyms' must be called even for
static binaries. */
unsigned always_renumber_dynsyms : 1;
bfd_vma r_none_info;
};
/* Information about reloc sections associated with a bfd_elf_section_data
@ -2653,7 +2656,8 @@ extern bfd_boolean _bfd_elf_allocate_ifunc_dyn_relocs
unsigned int, unsigned int, bfd_boolean);
extern long _bfd_elf_ifunc_get_synthetic_symtab
(bfd *, long, asymbol **, long, asymbol **, asymbol **, asection *,
bfd_vma *(*) (bfd *, asymbol **, asection *, asection *));
int,
bfd_vma *(*) (bfd *, asymbol **, asection *, asection *, int));
extern void elf_append_rela (bfd *, asection *, Elf_Internal_Rela *);
extern void elf_append_rel (bfd *, asection *, Elf_Internal_Rela *);

View File

@ -142,6 +142,10 @@ read_sleb128 (bfd_byte **iter, bfd_byte *end, bfd_signed_vma *value)
static
int get_DW_EH_PE_width (int encoding, int ptr_size)
{
/* For the sake of E2K Protected Mode. */
if (encoding == DW_EH_PE_aligned)
return 16;
/* DW_EH_PE_ values of 0x60 and 0x70 weren't defined at the time .eh_frame
was added to bfd. */
if ((encoding & 0x60) == 0x60)

View File

@ -356,6 +356,8 @@ keep:
return TRUE;
}
/* Leave the underlying function in place since E2K needs it. */
/* Similar to _bfd_elf_get_synthetic_symtab, optimized for unsorted PLT
entries. PLT is the PLT section. PLT_SYM_VAL is a function pointer
which returns an array of PLT entry symbol values. */
@ -365,7 +367,9 @@ _bfd_elf_ifunc_get_synthetic_symtab
(bfd *abfd, long symcount ATTRIBUTE_UNUSED,
asymbol **syms ATTRIBUTE_UNUSED, long dynsymcount, asymbol **dynsyms,
asymbol **ret, asection *plt,
bfd_vma *(*get_plt_sym_val) (bfd *, asymbol **, asection *, asection *))
int kind,
bfd_vma *(*get_plt_sym_val) (bfd *, asymbol **, asection *, asection *,
int))
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
asection *relplt;
@ -378,6 +382,26 @@ _bfd_elf_ifunc_get_synthetic_symtab
Elf_Internal_Shdr *hdr;
char *names;
bfd_vma *plt_sym_val;
const char *plt_sfx;
size_t plt_sfx_sz;
switch (kind)
{
case 0:
plt_sfx = "@plt";
plt_sfx_sz = sizeof ("@plt");
break;
case 1:
plt_sfx = "@secondary_plt";
plt_sfx_sz = sizeof ("@secondary_plt");
break;
case 2:
plt_sfx = "@plt.got";
plt_sfx_sz = sizeof ("@plt.got");
break;
default:
return -1;
}
*ret = NULL;
@ -390,10 +414,30 @@ _bfd_elf_ifunc_get_synthetic_symtab
if (dynsymcount <= 0)
return 0;
relplt_name = bed->relplt_name;
if (relplt_name == NULL)
relplt_name = bed->rela_plts_and_copies_p ? ".rela.plt" : ".rel.plt";
relplt = bfd_get_section_by_name (abfd, relplt_name);
/* When looking for primary and secondary PLT entries one should iterate
over `.rela.plt', whereas for `.plt.got' entries (recall that they are
created for functions a pointer to which should be resolved in a non-lazy
way (in a shared library?)) - over `.rela.dyn'. */
if (kind == 0 || kind == 1)
{
relplt_name = bed->relplt_name;
if (relplt_name == NULL)
relplt_name = bed->rela_plts_and_copies_p ? ".rela.plt" : ".rel.plt";
relplt = bfd_get_section_by_name (abfd, relplt_name);
}
else
{
/* FIXME: currently this function is called with `kind == 2' for E2K
only. How should I properly choose between `.rel{,a}.dyn' on other
platforms? */
relplt_name = ".rela.dyn";
/* FIXME: is it worthwhile to iterate over a potentially huge `.rela.dyn'
for just a few relocations related to `.plt.got' entries? There are a
couple of such entries in libc.so . . . */
relplt = bfd_get_section_by_name (abfd, relplt_name);
}
if (relplt == NULL)
return 0;
@ -411,7 +455,7 @@ _bfd_elf_ifunc_get_synthetic_symtab
p = relplt->relocation;
for (i = 0; i < count; i++, p += bed->s->int_rels_per_ext_rel)
{
size += strlen ((*p->sym_ptr_ptr)->name) + sizeof ("@plt");
size += strlen ((*p->sym_ptr_ptr)->name) + plt_sfx_sz;
if (p->addend != 0)
{
#ifdef BFD64
@ -422,7 +466,7 @@ _bfd_elf_ifunc_get_synthetic_symtab
}
}
plt_sym_val = get_plt_sym_val (abfd, dynsyms, plt, relplt);
plt_sym_val = get_plt_sym_val (abfd, dynsyms, plt, relplt, kind);
if (plt_sym_val == NULL)
return -1;
@ -471,8 +515,8 @@ _bfd_elf_ifunc_get_synthetic_symtab
memcpy (names, a, len);
names += len;
}
memcpy (names, "@plt", sizeof ("@plt"));
names += sizeof ("@plt");
memcpy (names, plt_sfx, plt_sfx_sz);
names += plt_sfx_sz;
++s, ++n;
}

130
bfd/elf32-e2k-pm.c Normal file
View File

@ -0,0 +1,130 @@
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/e2k.h"
#include "elfxx-e2k.h"
static bfd_boolean
segment_executable (struct elf_segment_map *seg)
{
if (seg->p_flags_valid)
return (seg->p_flags & PF_X) != 0;
else
{
/* The p_flags value has not been computed yet,
so we have to look through the sections. */
unsigned int i;
for (i = 0; i < seg->count; ++i)
if (seg->sections[i]->flags & SEC_CODE)
return TRUE;
}
return FALSE;
}
/* Determine if this segment is eligible to receive the file and program
headers. It must be read-only and non-executable.
Its first section must start far enough past the page boundary to
allow space for the headers. */
static bfd_boolean
segment_eligible_for_headers (struct elf_segment_map *seg,
bfd_vma minpagesize, bfd_vma sizeof_headers)
{
unsigned int i;
if (seg->count == 0 || seg->sections[0]->lma % minpagesize < sizeof_headers)
return FALSE;
for (i = 0; i < seg->count; ++i)
{
if ((seg->sections[i]->flags & (SEC_CODE|SEC_READONLY)) != SEC_READONLY)
return FALSE;
}
return TRUE;
}
static bfd_boolean
_bfd_e2k_pm_elf_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
{
const struct elf_backend_data *const bed = get_elf_backend_data (abfd);
struct elf_segment_map **m = &elf_seg_map (abfd);
struct elf_segment_map **first_load = NULL;
struct elf_segment_map **last_load = NULL;
bfd_boolean moved_headers = FALSE;
int sizeof_headers;
sizeof_headers = bfd_sizeof_headers (abfd, info);
while (*m != NULL)
{
struct elf_segment_map *seg = *m;
if (seg->p_type == PT_LOAD)
{
bfd_boolean executable = segment_executable (seg);
/* First, we're just finding the earliest PT_LOAD.
By the normal rules, this will be the lowest-addressed one.
We only have anything interesting to do if it's executable. */
last_load = m;
if (first_load == NULL)
{
if (!executable)
goto next;
first_load = m;
}
/* Now that we've noted the first PT_LOAD, we're looking for
the first non-executable PT_LOAD with a nonempty p_filesz. */
else if (!moved_headers
&& segment_eligible_for_headers (seg, bed->minpagesize,
sizeof_headers))
{
/* This is the one we were looking for!
First, clear the flags on previous segments that
say they include the file header and phdrs. */
struct elf_segment_map *prevseg;
for (prevseg = *first_load;
prevseg != seg;
prevseg = prevseg->next)
if (prevseg->p_type == PT_LOAD)
{
prevseg->includes_filehdr = 0;
prevseg->includes_phdrs = 0;
}
/* This segment will include those headers instead. */
seg->includes_filehdr = 1;
seg->includes_phdrs = 1;
moved_headers = TRUE;
}
}
next:
m = &seg->next;
}
if (first_load != last_load && moved_headers)
{
/* Now swap the first and last PT_LOAD segments'
positions in segment_map. */
struct elf_segment_map *first = *first_load;
struct elf_segment_map *last = *last_load;
*first_load = first->next;
first->next = last->next;
last->next = first;
}
return TRUE;
}
#define elf_backend_modify_segment_map _bfd_e2k_pm_elf_modify_segment_map
/* The first Elf32_Addr GOT entry containing link-time "address" of `_DYNAMIC'
is followed by two 16 bytes long appropriately aligned descriptors containing
`struct link_map *' and `&_dl_fixup ()'. */
#define elf_backend_got_header_size 48
#define TARGET_LITTLE_SYM e2k_pm_elf32_vec
#define TARGET_LITTLE_NAME "elf32-e2k-pm"
#include "elf32-e2k.c"

198
bfd/elf32-e2k.c Normal file
View File

@ -0,0 +1,198 @@
/* E2K-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#if ! defined TARGET_LITTLE_SYM
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/e2k.h"
#include "elfxx-e2k.h"
#endif
static int
elf32_e2k_write_out_phdrs (bfd *abfd,
const Elf_Internal_Phdr *phdr,
unsigned int count)
{
/* There is no point in hacking VMA's unless we are creating an executable
containing DSP-specific segments. Otherwise we may very well set wrong
VMA's when creating non-trivial ELF files (e.g. Kernels, BIOSes and so
on) which may have segments with `VMA != LMA'. Later when creating binary
images OBJCOPY may very well figure out wrong LMAs for the corresponding
sections since it'll be unable to find appropriate segments containing
them and set `LMA = VMA' (see `_bfd_elf_make_section_from_shdr ()'). This
may very well lead to binary images having HUGE sizes (see Bug #67966). */
if (!e2k_dsp_linux_mode)
return bfd_elf32_write_out_phdrs (abfd, phdr, count);
while (count--)
{
Elf32_External_Phdr extphdr;
if (phdr->p_vaddr != phdr->p_paddr)
{
Elf_Internal_Phdr fake;
memcpy (&fake, phdr, sizeof (fake));
fake.p_vaddr = phdr->p_paddr;
bfd_elf32_swap_phdr_out (abfd, &fake, &extphdr);
}
else
bfd_elf32_swap_phdr_out (abfd, phdr, &extphdr);
if (bfd_bwrite (&extphdr, sizeof (Elf32_External_Phdr), abfd)
!= sizeof (Elf32_External_Phdr))
return -1;
phdr++;
}
return 0;
}
/* All fields are set to their default values from
`elfcode.h' except `write_out_phdrs' which shoud
fool the Kernel in case of DSP segments. */
static const struct elf_size_info elf32_e2k_size_info = {
sizeof (Elf32_External_Ehdr),
sizeof (Elf32_External_Phdr),
sizeof (Elf32_External_Shdr),
sizeof (Elf32_External_Rel),
sizeof (Elf32_External_Rela),
sizeof (Elf32_External_Sym),
sizeof (Elf32_External_Dyn),
sizeof (Elf_External_Note),
4,
1,
32, 2,
1, 1,
elf32_e2k_write_out_phdrs,
bfd_elf32_write_shdrs_and_ehdr,
bfd_elf32_checksum_contents,
bfd_elf32_write_relocs,
bfd_elf32_swap_symbol_in,
bfd_elf32_swap_symbol_out,
bfd_elf32_slurp_reloc_table,
bfd_elf32_slurp_symbol_table,
bfd_elf32_swap_dyn_in,
bfd_elf32_swap_dyn_out,
bfd_elf32_swap_reloc_in,
bfd_elf32_swap_reloc_out,
bfd_elf32_swap_reloca_in,
bfd_elf32_swap_reloca_out
};
#define bfd_elf32_bfd_link_add_symbols _bfd_e2k_elf_link_add_symbols
#define bfd_elf32_bfd_reloc_type_lookup _bfd_e2k_elf_reloc_type_lookup
#define bfd_elf32_bfd_reloc_name_lookup _bfd_e2k_elf_reloc_name_lookup
#define bfd_elf32_bfd_merge_private_bfd_data _bfd_e2k_elf_merge_private_bfd_data
#define bfd_elf32_mkobject _bfd_e2k_elf_mkobject
#define bfd_elf32_bfd_link_hash_table_create _bfd_e2k_elf_link_hash_table_create
#define bfd_elf32_bfd_final_link _bfd_e2k_elf_final_link
#define bfd_elf32_get_synthetic_symtab _bfd_e2k_elf_get_synthetic_symtab
#define bfd_elf32_write_object_contents _bfd_e2k_elf_write_object_contents
#define bfd_elf32_bfd_copy_private_bfd_data _bfd_e2k_elf_copy_private_bfd_data
#define elf_info_to_howto _bfd_e2k_elf_info_to_howto
#define elf_backend_add_symbol_hook _bfd_e2k_elf_add_symbol_hook
#define elf_backend_special_sections _bfd_e2k_elf_special_sections
#define elf_backend_common_definition _bfd_e2k_elf_common_definition
#define elf_backend_merge_symbol_attribute _bfd_e2k_elf_merge_symbol_attribute
#define elf_backend_grok_prstatus _bfd_e2k_elf_grok_prstatus
#define elf_backend_write_core_note _bfd_e2k_elf_write_core_note
#define elf_backend_create_dynamic_sections _bfd_e2k_elf_create_dynamic_sections
#define elf_backend_copy_indirect_symbol _bfd_e2k_elf_copy_indirect_symbol
#define elf_backend_check_directives _bfd_e2k_elf_check_directives
#define elf_backend_check_relocs _bfd_e2k_elf_check_relocs
#define elf_backend_gc_sweep_hook _bfd_e2k_elf_gc_sweep_hook
#define elf_backend_adjust_dynamic_symbol _bfd_e2k_elf_adjust_dynamic_symbol
#define elf_backend_size_dynamic_sections _bfd_e2k_elf_size_dynamic_sections
#define elf_backend_action_discarded _bfd_e2k_elf_action_discarded
#define elf_backend_relocate_section _bfd_e2k_elf_relocate_section
#define elf_backend_finish_dynamic_symbol _bfd_e2k_elf_finish_dynamic_symbol
#define elf_backend_reloc_type_class _bfd_e2k_elf_reloc_type_class
#define elf_backend_finish_dynamic_sections _bfd_e2k_elf_finish_dynamic_sections
#define elf_backend_post_process_headers _bfd_e2k_elf_post_process_headers
#define elf_backend_ignore_discarded_relocs _bfd_e2k_elf_ignore_discarded_relocs
#define elf_backend_hide_symbol _bfd_e2k_elf_hide_symbol
#define elf_backend_object_p _bfd_e2k_elf_object_p
#define elf_backend_setup_gnu_properties _bfd_e2k_elf_link_setup_gnu_properties
/* Make tests employing `gc-sections' option PASS. I wonder if any backend-
specific support is required. TODO: place here actual names of the tests. */
#define elf_backend_can_gc_sections 1
#define elf_backend_want_got_sym 1
/* I want got.refcount start from `0', not from `-1'
(see _bfd_elf_link_hash_table_init). */
#define elf_backend_can_refcount 1
#define elf_backend_want_got_plt 1
#define elf_backend_plt_readonly 1
/* This is required to ensure that addends of rela-relocations against section
symbols are adjusted correctly during the relocatable linkage in
`elf_link_input_bfd ()'. */
#define elf_backend_rela_normal 1
#define elf_backend_plt_alignment 3
#define elf_backend_size_info elf32_e2k_size_info
#define elf_backend_extern_protected_data 1
#define elf_backend_r_none_info R_E2K_NONE
#define ELF_ARCH bfd_arch_e2k
#define ELF_MACHINE_CODE EM_MCST_ELBRUS
/* This is the value we initially used. */
#define ELF_MACHINE_ALT1 EM_E2K_OLD
#define ELF_MAXPAGESIZE 0x1000
#ifndef elf_backend_got_header_size
/* The first entry in `.got' is reserved for the `_DYNAMIC' link-time
address. */
# define elf_backend_got_header_size 12
#endif
#ifndef TARGET_LITTLE_SYM
#define TARGET_LITTLE_SYM e2k_elf32_vec
#endif
#ifndef TARGET_LITTLE_NAME
#define TARGET_LITTLE_NAME "elf32-e2k"
#endif
#include "elf32-target.h"

View File

@ -75,6 +75,13 @@ elf32_sparc_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
/* FIXME: This should not be static. */
static unsigned long previous_ibfd_e_flags = (unsigned long) -1;
/* No matter whether the output BFD is ELF or not, check magic in the input
one provided that it is. */
if (bfd_get_flavour (ibfd) == bfd_target_elf_flavour
&& ! _bfd_sparc_elf_check_magic (ibfd))
return FALSE;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
@ -148,6 +155,15 @@ elf32_sparc_final_write_processing (bfd *abfd,
elf_elfheader (abfd)->e_flags |= EF_SPARC_32PLUS | EF_SPARC_SUN_US1
| EF_SPARC_SUN_US3;
break;
/* I cannot understand why in 32-bit mode the same functionality as in
(sparc_elf_final_processing (), tc-sparc.c) is DUPLICATED here. In fact
we set the same value of `e_flags' both there and here. */
case bfd_mach_sparc_v8plus_mcst :
elf_elfheader (abfd)->e_machine = EM_SPARC32PLUS;
elf_elfheader (abfd)->e_flags &=~ EF_SPARC_32PLUS_MASK;
elf_elfheader (abfd)->e_flags |= (EF_SPARC_32PLUS | EF_SPARC_SUN_US1
| EF_SPARC_SUN_US3 | EF_SPARC_MCST);
break;
case bfd_mach_sparc_sparclite_le :
elf_elfheader (abfd)->e_flags |= EF_SPARC_LEDATA;
break;
@ -252,6 +268,18 @@ elf32_sparc_add_symbol_hook (bfd * abfd,
#define elf_backend_add_symbol_hook elf32_sparc_add_symbol_hook
/* EIR-specific hacks. */
#define bfd_elf32_bfd_link_add_symbols _bfd_sparc_elf_link_add_symbols
#define bfd_elf32_bfd_final_link _bfd_sparc_elf_final_link
#define elf_backend_ignore_discarded_relocs _bfd_sparc_elf_ignore_discarded_relocs
#define elf_backend_hide_symbol _bfd_sparc_elf_hide_symbol
#define bfd_elf32_write_object_contents _bfd_sparc_elf_write_object_contents
/* Let `.magic' section be `SHT_NOTE'. */
#define elf_backend_special_sections _bfd_sparc_elf_special_sections
#define elf_backend_extern_protected_data 1
#include "elf32-target.h"
/* Solaris 2. */

34
bfd/elf64-e2k-kpda.c Normal file
View File

@ -0,0 +1,34 @@
/* Signalize that elf64-e2k.c shouldn't set up bfd target vector for us.
We'll do it ourselves after redefining a few macros. */
#define TARGET_KPDA
#include "elf64-e2k.c"
#undef TARGET_KPDA
#if 0
static void
_bfd_e2k_kpda_elf64_post_process_headers (bfd *abfd,
struct bfd_link_info *link_info)
{
Elf_Internal_Ehdr *i_ehdrp;
i_ehdrp = elf_elfheader (abfd);
i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_KPDA;
_bfd_elf_post_process_headers (abfd, link_info);
}
#undef elf_backend_post_process_headers
#define elf_backend_post_process_headers _bfd_e2k_kpda_elf64_post_process_headers
#endif /* 0 */
#undef TARGET_LITTLE_SYM
#define TARGET_LITTLE_SYM e2k_kpda_elf64_vec
#undef TARGET_LITTLE_NAME
#define TARGET_LITTLE_NAME "elf64-e2k-kpda"
#define ELF_OSABI ELFOSABI_KPDA
/* Now set up the target vector. */
#include "elf64-target.h"

187
bfd/elf64-e2k.c Normal file
View File

@ -0,0 +1,187 @@
/* E2K-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/e2k.h"
#include "elfxx-e2k.h"
static int
elf64_e2k_write_out_phdrs (bfd *abfd,
const Elf_Internal_Phdr *phdr,
unsigned int count)
{
/* See a more detailed comment in `elf32-e2k.c'. */
if (!e2k_dsp_linux_mode)
return bfd_elf64_write_out_phdrs (abfd, phdr, count);
while (count--)
{
Elf64_External_Phdr extphdr;
if (phdr->p_vaddr != phdr->p_paddr)
{
Elf_Internal_Phdr fake;
memcpy (&fake, phdr, sizeof (fake));
fake.p_vaddr = phdr->p_paddr;
bfd_elf64_swap_phdr_out (abfd, &fake, &extphdr);
}
else
bfd_elf64_swap_phdr_out (abfd, phdr, &extphdr);
if (bfd_bwrite (&extphdr, sizeof (Elf64_External_Phdr), abfd)
!= sizeof (Elf64_External_Phdr))
return -1;
phdr++;
}
return 0;
}
/* All fields are set to their default values from
`elfcode.h' except `write_out_phdrs' which shoud
fool the Kernel in case of DSP segments. */
static const struct elf_size_info elf64_e2k_size_info = {
sizeof (Elf64_External_Ehdr),
sizeof (Elf64_External_Phdr),
sizeof (Elf64_External_Shdr),
sizeof (Elf64_External_Rel),
sizeof (Elf64_External_Rela),
sizeof (Elf64_External_Sym),
sizeof (Elf64_External_Dyn),
sizeof (Elf_External_Note),
4,
1,
64, 3,
2, 1,
elf64_e2k_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr,
bfd_elf64_checksum_contents,
bfd_elf64_write_relocs,
bfd_elf64_swap_symbol_in,
bfd_elf64_swap_symbol_out,
bfd_elf64_slurp_reloc_table,
bfd_elf64_slurp_symbol_table,
bfd_elf64_swap_dyn_in,
bfd_elf64_swap_dyn_out,
bfd_elf64_swap_reloc_in,
bfd_elf64_swap_reloc_out,
bfd_elf64_swap_reloca_in,
bfd_elf64_swap_reloca_out
};
#define bfd_elf64_bfd_link_add_symbols _bfd_e2k_elf_link_add_symbols
#define bfd_elf64_bfd_reloc_type_lookup _bfd_e2k_elf_reloc_type_lookup
#define bfd_elf64_bfd_reloc_name_lookup _bfd_e2k_elf_reloc_name_lookup
#define bfd_elf64_bfd_merge_private_bfd_data _bfd_e2k_elf_merge_private_bfd_data
#define bfd_elf64_mkobject _bfd_e2k_elf_mkobject
#define bfd_elf64_bfd_link_hash_table_create _bfd_e2k_elf_link_hash_table_create
#define bfd_elf64_bfd_final_link _bfd_e2k_elf_final_link
#define bfd_elf64_get_synthetic_symtab _bfd_e2k_elf_get_synthetic_symtab
#define bfd_elf64_write_object_contents _bfd_e2k_elf_write_object_contents
#define bfd_elf64_bfd_copy_private_bfd_data _bfd_e2k_elf_copy_private_bfd_data
#define elf_info_to_howto _bfd_e2k_elf_info_to_howto
#define elf_backend_add_symbol_hook _bfd_e2k_elf_add_symbol_hook
#define elf_backend_special_sections _bfd_e2k_elf_special_sections
#define elf_backend_common_definition _bfd_e2k_elf_common_definition
#define elf_backend_merge_symbol_attribute _bfd_e2k_elf_merge_symbol_attribute
#define elf_backend_grok_prstatus _bfd_e2k_elf_grok_prstatus
#define elf_backend_write_core_note _bfd_e2k_elf_write_core_note
/* This one is required in order to create `{,.rela}.plt' and . . .
Typically backends have their own `create_dynamic_sections' method which
calls `_bfd_elf_create_dynamic_sections ()'. */
#define elf_backend_create_dynamic_sections _bfd_e2k_elf_create_dynamic_sections
#define elf_backend_copy_indirect_symbol _bfd_e2k_elf_copy_indirect_symbol
#define elf_backend_check_directives _bfd_e2k_elf_check_directives
#define elf_backend_check_relocs _bfd_e2k_elf_check_relocs
#define elf_backend_gc_sweep_hook _bfd_e2k_elf_gc_sweep_hook
#define elf_backend_adjust_dynamic_symbol _bfd_e2k_elf_adjust_dynamic_symbol
#define elf_backend_size_dynamic_sections _bfd_e2k_elf_size_dynamic_sections
#define elf_backend_action_discarded _bfd_e2k_elf_action_discarded
#define elf_backend_relocate_section _bfd_e2k_elf_relocate_section
#define elf_backend_finish_dynamic_symbol _bfd_e2k_elf_finish_dynamic_symbol
#define elf_backend_reloc_type_class _bfd_e2k_elf_reloc_type_class
#define elf_backend_finish_dynamic_sections _bfd_e2k_elf_finish_dynamic_sections
#define elf_backend_post_process_headers _bfd_e2k_elf_post_process_headers
#define elf_backend_ignore_discarded_relocs _bfd_e2k_elf_ignore_discarded_relocs
#define elf_backend_hide_symbol _bfd_e2k_elf_hide_symbol
#define elf_backend_object_p _bfd_e2k_elf_object_p
#define elf_backend_setup_gnu_properties _bfd_e2k_elf_link_setup_gnu_properties
/* Make tests employing `gc-sections' option PASS. I wonder if any backend-
specific support is required. TODO: place here actual names of the tests. */
#define elf_backend_can_gc_sections 1
#define elf_backend_want_got_sym 1
/* I want got.refcount start from `0', not from `-1'
(see _bfd_elf_link_hash_table_init). */
#define elf_backend_can_refcount 1
#define elf_backend_want_got_plt 1
#define elf_backend_plt_readonly 1
/* The first entry in `.got' is reserved for the `_DYNAMIC' link-time
address. */
#define elf_backend_got_header_size 24
/* This is required to ensure that addends of rela-relocations against section
symbols are adjusted correctly during the relocatable linkage in
`elf_link_input_bfd ()'. */
#define elf_backend_rela_normal 1
#define elf_backend_plt_alignment 3
#define elf_backend_size_info elf64_e2k_size_info
#define elf_backend_extern_protected_data 1
#define elf_backend_r_none_info R_E2K_NONE
#define TARGET_LITTLE_SYM e2k_elf64_vec
#define TARGET_LITTLE_NAME "elf64-e2k"
#define ELF_ARCH bfd_arch_e2k
#define ELF_MACHINE_CODE EM_MCST_ELBRUS
/* This is the value we initially used. */
#define ELF_MACHINE_ALT1 EM_E2K_OLD
#define ELF_MAXPAGESIZE 0x1000
/* Don't rush to set up BFD target vector if we are included on behalf of KPDA
target: some of the above definitions are going to be altered by it. */
#ifndef TARGET_KPDA
#include "elf64-target.h"
#endif /* ! TARGET_KPDA */

View File

@ -662,6 +662,12 @@ elf64_sparc_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
flagword new_flags, old_flags;
int new_mm, old_mm;
/* No matter whether the output BFD is ELF or not, check magic in the input
one provided that it is. */
if (bfd_get_flavour (ibfd) == bfd_target_elf_flavour
&& ! _bfd_sparc_elf_check_magic (ibfd))
return FALSE;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
@ -682,8 +688,10 @@ elf64_sparc_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
{
error = FALSE;
/* MCST extensions should be considered Sun- rather than HAL-compatible.
See the code below. */
#define EF_SPARC_ISA_EXTENSIONS \
(EF_SPARC_SUN_US1 | EF_SPARC_SUN_US3 | EF_SPARC_HAL_R1)
(EF_SPARC_SUN_US1 | EF_SPARC_SUN_US3 | EF_SPARC_MCST | EF_SPARC_HAL_R1)
if ((ibfd->flags & DYNAMIC) != 0)
{
@ -699,12 +707,14 @@ elf64_sparc_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
/* Choose the highest architecture requirements. */
old_flags |= (new_flags & EF_SPARC_ISA_EXTENSIONS);
new_flags |= (old_flags & EF_SPARC_ISA_EXTENSIONS);
if ((old_flags & (EF_SPARC_SUN_US1 | EF_SPARC_SUN_US3))
if ((old_flags & (EF_SPARC_SUN_US1 | EF_SPARC_SUN_US3
| EF_SPARC_MCST))
&& (old_flags & EF_SPARC_HAL_R1))
{
error = TRUE;
_bfd_error_handler
(_("%B: linking UltraSPARC specific with HAL specific code"),
(_("%B: linking either UltraSPARC or MCST specific "
"with HAL specific code"),
ibfd);
}
/* Choose the most restrictive memory ordering. */
@ -946,6 +956,18 @@ const struct elf_size_info elf64_sparc_size_info =
/* Section 5.2.4 of the ABI specifies a 256-byte boundary for the table. */
#define elf_backend_plt_alignment 8
/* EIR-specific hacks. */
#define bfd_elf64_bfd_link_add_symbols _bfd_sparc_elf_link_add_symbols
#define bfd_elf64_bfd_final_link _bfd_sparc_elf_final_link
#define elf_backend_ignore_discarded_relocs _bfd_sparc_elf_ignore_discarded_relocs
#define elf_backend_hide_symbol _bfd_sparc_elf_hide_symbol
#define bfd_elf64_write_object_contents _bfd_sparc_elf_write_object_contents
/* Let `.magic' section be `SHT_NOTE'. */
#define elf_backend_special_sections _bfd_sparc_elf_special_sections
#define elf_backend_extern_protected_data 1
#include "elf64-target.h"
/* FreeBSD support */

View File

@ -1874,26 +1874,23 @@ _bfd_elf_add_default_symbol (bfd *abfd,
if (hi->def_regular)
{
struct bfd_elf_version_tree *vertree = hi->verinfo.vertree;
/* If the undecorated symbol will have a version added by a
script different to H, then don't indirect to/from the
undecorated symbol. This isn't ideal because we may not yet
have seen symbol versions, if given by a script on the
command line rather than via --version-script. */
if (hi->verinfo.vertree == NULL && info->version_info != NULL)
if (vertree == NULL && info->version_info != NULL)
{
bfd_boolean hide;
hi->verinfo.vertree
vertree
= bfd_find_version_for_sym (info->version_info,
hi->root.root.string, &hide);
if (hi->verinfo.vertree != NULL && hide)
{
(*bed->elf_backend_hide_symbol) (info, hi, TRUE);
goto nondefault;
}
}
if (hi->verinfo.vertree != NULL
&& strcmp (p + 1 + (p[1] == '@'), hi->verinfo.vertree->name) != 0)
if (vertree != NULL
&& strcmp (p + 1 + (p[1] == '@'), vertree->name) != 0)
goto nondefault;
}
@ -9022,6 +9019,12 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
free (sort);
return 0;
}
/* FIXME: currently there's an unresolved issue on Sparc making me
occasionally allocate excessive space in `.rela.got', which is why
'>=' is temporarely used here instead of '=='. */
BFD_ASSERT (o->size >= o->reloc_count * ext_size);
erel = o->contents;
erelend = o->contents + o->size;
p = sort + o->output_offset * opb / ext_size * sort_elt;
@ -10423,7 +10426,16 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
/* We need to reverse-copy input .ctors/.dtors sections if
they are placed in .init_array/.finit_array for output. */
if (o->size > address_size
if (
#if 1
/* However, there's no point in doing so in E2K Protected
Mode. */
(((elf_elfheader (input_bfd)->e_flags & 32 /* EF_E2K_PM */)
!= 32 /* EF_E2K_PM */)
|| strcmp (input_bfd->xvec->name, "elf32-e2k-pm") != 0)
&&
#endif /* 0 */
o->size > address_size
&& ((strncmp (o->name, ".ctors", 6) == 0
&& strcmp (o->output_section->name,
".init_array") == 0)
@ -10686,7 +10698,14 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
bfd_elf_discard_info rely on reloc offsets
being ordered. */
irela->r_offset = last_offset;
irela->r_info = 0;
/* FIXME: I suppose that the original code setting
`r_info' to 0 is sure to lead for an invalid result not
only for E2K but for all targets with `R_xxx_NONE
!= 0'. Moreover, it discards my attempts to setup
R_E2K_NONE instead of an original relocation against a
symbol coming from a discarded section in `_bfd_e2k_elf
_relocate_section ()'. */
irela->r_info = bed->r_none_info;
irela->r_addend = 0;
continue;
}
@ -14240,9 +14259,13 @@ _bfd_elf_copy_link_hash_symbol_type (bfd *abfd,
void
elf_append_rela (bfd *abfd, asection *s, Elf_Internal_Rela *rel)
{
static const char zero_rel[sizeof (Elf_Internal_Rela)];
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
bfd_byte *loc = s->contents + (s->reloc_count++ * bed->s->sizeof_rela);
BFD_ASSERT (loc + bed->s->sizeof_rela <= s->contents + s->size);
BFD_ASSERT (memcmp (rel, zero_rel, sizeof (zero_rel)) != 0);
bed->s->swap_reloca_out (abfd, rel, loc);
}

6994
bfd/elfxx-e2k.c Normal file

File diff suppressed because it is too large Load Diff

303
bfd/elfxx-e2k.h Normal file
View File

@ -0,0 +1,303 @@
/* E2k ELF specific backend routines.
Copyright 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
/* E2K ELF linker hash table */
struct export_pl_list
{
struct export_pl_list *next;
struct elf_link_hash_entry *h;
};
struct _bfd_e2k_elf_link_hash_table
{
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
/* A section containing code performing static initialization of pointers
in Protected Mode. */
asection *selfinit;
bfd_vma selfinit_off;
/* A set of PLs which should be made accessible to ld.so in Protected
Mode. */
asection *export_pl;
struct export_pl_list *export_pl_list;
/* Small local sym cache. For example, it's used when we need local
symbols to account for dynamic relocs against them (see
check_relocs ()). Does this cache actually save any resources? */
struct sym_cache sym_cache;
void (* put_word) (bfd *, bfd_vma, void *);
bfd_vma (* r_info) (bfd_vma, bfd_vma);
/* Adjust offset of the corresponding dynamic relocation in a lazy PLT
entry as soon as this offset is known. */
void (* adjust_plt_lazy_entry_reloc_offset)
(bfd *,
struct _bfd_e2k_elf_link_hash_table *htab,
asection *,
bfd_vma,
bfd_vma);
unsigned int word_align_power;
/* Interestingly enough, unlike Sparc i386 holds `plt_entry_size'
in elf_backend_arch_data rather than in the hash table. Moreover, only
i386 makes use of `elf_backend_arch_data' at present . . . */
/* PLTGOT header, its size and offsets at which it should be adjusted at
link time. */
const unsigned int *plt_got_header;
unsigned int plt_got_link_map_ld_offset;
unsigned int plt_got_dl_fixup_ld_offset;
unsigned int plt_got_header_size;
const unsigned int *plt_got_primary_entry;
unsigned int plt_got_target_ld_offset;
unsigned int plt_got_primary_entry_size;
const unsigned int *plt_got_secondary_entry;
unsigned int plt_got_reloc_arg_offset;
unsigned int plt_got_disp_offset;
unsigned int plt_got_secondary_entry_size;
int bytes_per_word;
/* Stores `sizeof (Elfxx_External_Sym)'. */
int bytes_per_sym;
int bytes_per_rela;
int abs_reloc;
int abs_lit_reloc;
int copy_reloc;
int relative_reloc;
int relative_lit_reloc;
int dtpmod_reloc;
int dtpoff_reloc;
int tpoff_reloc;
int jmp_slot_reloc;
int irelative_reloc;
/* Ancient semantics value is stored here depending on the output file's
ABI. Used when producing an old-style output ELF. */
int ancient_semantics;
/* Throw them away from our hash table so that we don't need to duplicate
these fields in PM hash table and then decide which hash table should
be used within common code. */
#if 0
/* `--e2k-ipd' option may take values 0, 1 and 2 only. */
int e2k_ipd:2;
int e2k_is_x86app:1;
int e2k_is_4mpages:1;
#endif /* 0 */
/* `relaxed_e2k_machine_check' is required when merging private bfd data
where link_info is not available. Therefore it's not present here.
Probably `output_new_e_machine' may be set when link_info does not exist
at all. Therefore, it's absent here as well. This issue is to be
revisited. */
bfd_boolean have_dsp_output;
bfd_boolean dsp_non_empty_data[16];
bfd_boolean dsp_non_empty_rodata[16];
/* Offset of a GOT entry holding runtime index of the module being linked
(OBFD). To specify this module a runtime relocation against the dynamic
symbol #0, which is local by its nature, is used. */
bfd_vma gdmod_zero_off;
/* The numbers of primary and secondary PLT entries in the current link. */
bfd_vma primary_plt_num;
bfd_vma secondary_plt_num;
};
/* This variable should be accessible from multiple modules. Moreover, it
shouldn't be associated with LINK_INFO since its value may be required when
no LINK_INFO exists at all, e.g. when writing out Program Headers and
deciding whether to hack VMA's or not. */
extern bfd_boolean e2k_dsp_linux_mode;
/* Get the E2k ELF linker hash table from a link_info structure. */
#define _bfd_e2k_elf_hash_table(p) \
(elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
== E2K_ELF_DATA ? ((struct _bfd_e2k_elf_link_hash_table *) ((p)->hash)) : NULL)
/* Methods of struct bfd_target */
extern bfd_boolean _bfd_e2k_elf_link_add_symbols
(bfd *, struct bfd_link_info *);
extern reloc_howto_type * _bfd_e2k_elf_reloc_type_lookup
(bfd *, bfd_reloc_code_real_type);
extern reloc_howto_type * _bfd_e2k_elf_reloc_name_lookup
(bfd *, const char *);
extern bfd_boolean _bfd_e2k_elf_merge_private_bfd_data_1
(bfd *, bfd *, bfd_boolean);
extern bfd_boolean _bfd_e2k_elf_merge_private_bfd_data
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_e2k_elf_mkobject
(bfd *);
extern struct bfd_link_hash_table * _bfd_e2k_elf_link_hash_table_create
(bfd *);
extern bfd_boolean _bfd_e2k_elf_create_dynamic_sections
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_e2k_elf_final_link
(bfd *abfd, struct bfd_link_info *info);
/* Methods of struct elf_backend_data */
extern void _bfd_e2k_elf_info_to_howto
(bfd *, arelent *, Elf_Internal_Rela *);
extern bfd_boolean _bfd_e2k_elf_add_symbol_hook
(bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **,
flagword *, asection **, bfd_vma *);
extern void _bfd_e2k_elf_copy_indirect_symbol (struct bfd_link_info *,
struct elf_link_hash_entry *,
struct elf_link_hash_entry *);
extern bfd_boolean
_bfd_e2k_elf_check_directives (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_e2k_elf_check_relocs
(bfd *, struct bfd_link_info *,
asection *, const Elf_Internal_Rela *);
extern bfd_boolean _bfd_e2k_elf_gc_sweep_hook
(bfd *abfd,
struct bfd_link_info *info,
asection *sec,
const Elf_Internal_Rela *relocs);
extern bfd_boolean _bfd_e2k_elf_adjust_dynamic_symbol
(struct bfd_link_info *, struct elf_link_hash_entry *);
extern bfd_boolean _bfd_e2k_elf_size_dynamic_sections
(bfd *, struct bfd_link_info *);
extern unsigned int _bfd_e2k_elf_action_discarded
(asection *);
extern bfd_boolean simulating_mode;
extern int simulate_relocate_section (bfd *input_bfd,
asection *input_section,
bfd_byte *contents,
Elf_Internal_Rela *relocs);
extern int _bfd_e2k_elf_relocate_section
(bfd *, struct bfd_link_info *, bfd *,
asection *, bfd_byte *, Elf_Internal_Rela *,
Elf_Internal_Sym *, asection **);
extern bfd_boolean _bfd_e2k_elf_finish_dynamic_symbol
(bfd *, struct bfd_link_info *,
struct elf_link_hash_entry *, Elf_Internal_Sym *sym);
extern enum elf_reloc_type_class
_bfd_e2k_elf_reloc_type_class (const struct bfd_link_info *,
const asection *,
const Elf_Internal_Rela *);
extern bfd_boolean _bfd_e2k_elf_finish_dynamic_sections
(bfd *, struct bfd_link_info *);
extern void _bfd_e2k_elf_post_process_headers_1
(bfd *, struct bfd_link_info *, bfd_boolean);
extern void _bfd_e2k_elf_post_process_headers
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_e2k_elf_ignore_discarded_relocs
(asection *);
extern void _bfd_e2k_elf_hide_symbol_1
(struct bfd_link_info *,
struct elf_link_hash_entry *,
bfd_boolean,
bfd_boolean);
extern void _bfd_e2k_elf_hide_symbol
(struct bfd_link_info *,
struct elf_link_hash_entry *,
bfd_boolean);
extern bfd_boolean _bfd_e2k_elf_write_object_contents
(bfd *);
extern bfd_boolean _bfd_e2k_elf_copy_private_bfd_data_1
(bfd *, bfd *, bfd_boolean);
extern bfd_boolean _bfd_e2k_elf_copy_private_bfd_data
(bfd *, bfd *);
extern bfd_boolean _bfd_e2k_elf_object_p_1
(bfd *, bfd_boolean);
extern bfd_boolean _bfd_e2k_elf_object_p
(bfd *);
extern bfd * _bfd_e2k_elf_link_setup_gnu_properties
(struct bfd_link_info *);
extern long _bfd_e2k_elf_get_synthetic_symtab
(bfd *, long, asymbol **, long, asymbol **, asymbol **);
extern void _bfd_e2k_elf_after_parse (int);
extern void _bfd_e2k_elf_after_open (int, int, int, bfd_boolean, bfd_boolean,
bfd_boolean, bfd_boolean, bfd_boolean);
extern const struct bfd_elf_special_section _bfd_e2k_elf_special_sections[];
extern bfd_boolean _bfd_e2k_elf_common_definition (Elf_Internal_Sym *);
extern void _bfd_e2k_elf_merge_symbol_attribute (struct elf_link_hash_entry *,
const Elf_Internal_Sym *,
bfd_boolean,
bfd_boolean);
extern bfd_boolean _bfd_e2k_elf_grok_prstatus (bfd *, Elf_Internal_Note *);
extern char * _bfd_e2k_elf_write_core_note (bfd *, char *, int *, int, ...);

190
bfd/elfxx-elcore-howto.h Normal file
View File

@ -0,0 +1,190 @@
#define MYHOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
[C] = HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC)
MYHOWTO (R_ELCORE_NONE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ELCORE_NONE", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE), /* pcrel_offset */
/* relocation for I5 */
MYHOWTO (R_ELCORE_I5, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
5, /* bitsize */
FALSE, /* pc_relative */
27, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ELCORE_I5", /* name */
FALSE, /* partial_inplace */
0xf8000000, /* src_mask */
0xf8000000, /* dst_mask */
FALSE), /* pcrel_offset */
/* relocation for I5 */
MYHOWTO (R_ELCORE_I5_FAKE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
5, /* bitsize */
FALSE, /* pc_relative */
27, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ELCORE_I5_FAKE", /* name */
FALSE, /* partial_inplace */
0xf8000000, /* src_mask */
0xf8000000, /* dst_mask */
FALSE), /* pcrel_offset */
MYHOWTO (R_ELCORE_I16, /* type */
2, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ELCORE_I16", /* name */
FALSE, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
MYHOWTO (R_ELCORE_I16_FAKE, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ELCORE_I16_FAKE", /* name */
FALSE, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
MYHOWTO (R_ELCORE_I16PC, /* type */
2, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ELCORE_I16PC", /* name */
FALSE, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
MYHOWTO (R_ELCORE_I16PC_FAKE, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ELCORE_I16PC_FAKE", /* name */
FALSE, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
MYHOWTO (R_ELCORE_S16, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
11, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ELCORE_S16", /* name */
FALSE, /* partial_inplace */
0x07fff800, /* src_mask */
0x07fff800, /* dst_mask */
FALSE), /* pcrel_offset */
MYHOWTO (R_ELCORE_S16_FAKE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
11, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ELCORE_S16_FAKE", /* name */
FALSE, /* partial_inplace */
0x07fff800, /* src_mask */
0x07fff800, /* dst_mask */
FALSE), /* pcrel_offset */
MYHOWTO (R_ELCORE_S16PC, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
11, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ELCORE_S16PC", /* name */
FALSE, /* partial_inplace */
0x07fff800, /* src_mask */
0x07fff800, /* dst_mask */
FALSE), /* pcrel_offset */
MYHOWTO (R_ELCORE_S16PC_FAKE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
11, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ELCORE_S16PC_FAKE", /* name */
FALSE, /* partial_inplace */
0x07fff800, /* src_mask */
0x07fff800, /* dst_mask */
FALSE), /* pcrel_offset */
/* A standard 32 bit relocation. */
MYHOWTO (R_ELCORE_I32, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ELCORE_I32", /* name */
FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
MYHOWTO (R_ELCORE_I32_FAKE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ELCORE_I32_FAKE", /* name */
FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
#undef MYHOWTO

View File

@ -2548,6 +2548,16 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
return FALSE;
}
}
/* Input relocations in `.rela.xxx' sections against ifunctions defined
in regular object files are not copied to the output file (see how
they are treated in relocate_section () below). Therefore, avoid
allocating redundant space for them below. The failure to recognize
this issue turned out to be the reason for Bugs #81941 and #88486. */
if (eh->dyn_relocs != NULL
&& h->type == STT_GNU_IFUNC
&& h->def_regular)
eh->dyn_relocs = NULL;
}
else
{
@ -2704,6 +2714,20 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
{
struct _bfd_sparc_elf_dyn_relocs *p;
/* Don't allocate space for dynamic relocations not only if the
section to which they are applied is discarded (condition in the
loop a few lines below takes care of that), but also if the section
"against" which they are resolved is. This lets me resolve an issue
when LD manages without creation of dynamic relocations against
discarded `.gnu.linkonce'-sections within kept `.eh_frame's (as you
remember the contents of the latter is modified somehow to
eliminate the need for dynamic relocations then): allocation of
redundant space would lead to an assertion failure described in
Bug #79553. For a more detailed example see the commit. */
if (!bfd_is_abs_section (s)
&& bfd_is_abs_section (s->output_section))
continue;
for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next)
{
if (!bfd_is_abs_section (p->sec)
@ -3442,7 +3466,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
relative_reloc = TRUE;
}
SPARC_ELF_PUT_WORD (htab, output_bfd, relocation,
SPARC_ELF_PUT_WORD (htab, output_bfd,
!relative_reloc ? relocation : 0,
htab->elf.sgot->contents + off);
local_got_offsets[r_symndx] |= 1;
}
@ -5026,20 +5051,29 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
? 0 : htab->plt_entry_size);
}
/* Set the first entry in the global offset table to the address of
the dynamic section. */
if (htab->elf.sgot && htab->elf.sgot->size > 0)
{
bfd_vma val = (sdyn ?
sdyn->output_section->vma + sdyn->output_offset :
0);
SPARC_ELF_PUT_WORD (htab, output_bfd, val, htab->elf.sgot->contents);
}
if (htab->elf.sgot)
elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize =
SPARC_ELF_WORD_BYTES (htab);
{
if (bfd_is_abs_section (htab->elf.sgot->output_section))
{
_bfd_error_handler
(_("discarded output section: `%A'"), htab->elf.sgot);
return FALSE;
}
/* Set the first entry in the global offset table to the address of
the dynamic section. */
if (htab->elf.sgot->size > 0)
{
bfd_vma val = (sdyn ?
sdyn->output_section->vma + sdyn->output_offset :
0);
SPARC_ELF_PUT_WORD (htab, output_bfd, val, htab->elf.sgot->contents);
}
elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize =
SPARC_ELF_WORD_BYTES (htab);
}
/* Fill PLT and GOT entries for local STT_GNU_IFUNC symbols. */
htab_traverse (htab->loc_hash_table, finish_local_dynamic_symbol, info);
@ -5098,7 +5132,9 @@ _bfd_sparc_elf_object_p (bfd *abfd)
{
unsigned long mach = bfd_mach_sparc_v9;
if (hwcaps2->i & m8_hwcaps2_mask)
if (elf_elfheader (abfd)->e_flags & EF_SPARC_MCST)
mach = bfd_mach_sparc_v9_mcst;
else if (hwcaps2->i & m8_hwcaps2_mask)
mach = bfd_mach_sparc_v9m8;
else if (hwcaps2->i & v9m_hwcaps2_mask)
mach = bfd_mach_sparc_v9m;
@ -5120,7 +5156,10 @@ _bfd_sparc_elf_object_p (bfd *abfd)
{
if (elf_elfheader (abfd)->e_machine == EM_SPARC32PLUS)
{
if (hwcaps2->i & m8_hwcaps2_mask)
if (elf_elfheader (abfd)->e_flags & EF_SPARC_MCST)
return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
bfd_mach_sparc_v8plus_mcst);
else if (hwcaps2->i & m8_hwcaps2_mask)
return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
bfd_mach_sparc_v8plusm8);
else if (hwcaps2->i & v9m_hwcaps2_mask)
@ -5222,3 +5261,380 @@ _bfd_sparc_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
return TRUE;
}
/* EIR specific methods. */
static int link_mixed_eir_phase;
static bfd_boolean met_eir_section;
static bfd_boolean eir_in_this_bfd;
void
_bfd_sparc_elf_after_parse (int phase)
{
link_mixed_eir_phase = phase;
}
static void
search_eir (bfd *abfd ATTRIBUTE_UNUSED, asection *sect, void *obj ATTRIBUTE_UNUSED)
{
if (strcmp (sect->name, ".pack_pure_eir") == 0
|| strcmp (sect->name, ".pack_mixed_eir") == 0)
{
met_eir_section = TRUE;
eir_in_this_bfd = TRUE;
}
}
static void
discard_unsuitable_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sect, void *obj ATTRIBUTE_UNUSED)
{
if ((link_mixed_eir_phase == 1 && met_eir_section)
|| (link_mixed_eir_phase == 3
&& (!(met_eir_section && !eir_in_this_bfd)
|| abfd->my_archive)))
{
/* SEC_DEBUGGING is required to fool lang_gc_sections in ldlang.c */
sect->flags |= (SEC_EXCLUDE | SEC_DEBUGGING);
}
}
static void
search_pure_eir (bfd *abfd, asection *sec, void *no_pure_eir)
{
if (strcmp (sec->name, ".pack_pure_eir") == 0)
{
*((bfd_boolean *) no_pure_eir) = FALSE;
_bfd_error_handler ("%B with '.pack_pure_eir' is illegal during "
"non-relocatable linkage", abfd);
}
}
bfd_boolean
_bfd_sparc_elf_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
{
bfd_boolean ret;
/* Check for the absence of `.pack_pure_eir' sections during
non-relocatable linkage (see Bug #41413). */
if (bfd_get_format (abfd) == bfd_object && info
&& !bfd_link_relocatable (info))
{
bfd_boolean no_pure_eir = TRUE;
bfd_map_over_sections (abfd, search_pure_eir, &no_pure_eir);
if (! no_pure_eir)
return FALSE;
}
ret = bfd_elf_link_add_symbols (abfd, info);
/* COMMON sections are created while COMMON symbols are being
read rather than while parsing input file's section headers.
Therefore, a call to `bfd_elf_link_add_symbols ()' should
precede the following, provided that we need to be able to
discard COMMON sections. And we actually need this (see
Bug #57962). */
if ((link_mixed_eir_phase == 1
|| link_mixed_eir_phase == 3)
&& bfd_get_format (abfd) == bfd_object)
{
eir_in_this_bfd = FALSE;
bfd_map_over_sections (abfd, search_eir, NULL);
bfd_map_over_sections (abfd, discard_unsuitable_section, NULL);
}
return ret;
}
bfd_boolean
_bfd_sparc_elf_final_link (bfd *abfd, struct bfd_link_info *info)
{
/* There is nothing to be done here if we are going to output
a binary file when linking EIR (see Bug #59012, Comment # ). */
if (link_mixed_eir_phase == 2)
return TRUE;
return bfd_elf_final_link (abfd, info);
}
bfd_boolean
_bfd_sparc_elf_ignore_discarded_relocs (asection *sec)
{
bfd *abfd;
size_t locsymcount;
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *internal_relocs;
Elf_Internal_Rela *rel, *relend;
struct elf_link_hash_entry **sym_hashes;
const struct elf_backend_data *bed;
int r_sym_shift;
if (link_mixed_eir_phase != 1
&& link_mixed_eir_phase !=3)
return FALSE;
abfd = sec->owner;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
locsymcount = symtab_hdr->sh_info;
bed = get_elf_backend_data (abfd);
internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, FALSE);
rel = internal_relocs;
relend = rel + sec->reloc_count * bed->s->int_rels_per_ext_rel;
r_sym_shift = (bed->s->arch_size == 32) ? 8 : 32;
sym_hashes = elf_sym_hashes (abfd);
for ( ; rel < relend; rel++)
{
unsigned long r_symndx = rel->r_info >> r_sym_shift;
struct elf_link_hash_entry *h = NULL;
if (r_symndx == STN_UNDEF)
continue;
if (r_symndx >= locsymcount)
{
h = sym_hashes[r_symndx - locsymcount];
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
if (((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& discarded_section (h->root.u.def.section))
/* Don't forget about common symbols. Their sections may
very well be discarded as well. */
|| (h->root.type == bfd_link_hash_common
&& discarded_section (h->root.u.c.p->section)))
#if 0
/* I don't have legal access to this (link) info . . . */
&& (h->root.u.def.next || . . .)
#endif /* 0 */
{
/* Stupidly make it undefined. Is it going to work? */
h->root.type = bfd_link_hash_undefined;
}
}
}
/* free (internal_relocs); */
return TRUE;
}
void
_bfd_sparc_elf_hide_symbol (struct bfd_link_info *info,
struct elf_link_hash_entry *h,
bfd_boolean force_local)
{
/* I don't want to hide (make local) symbols from unsuitable
(SEC_EXCLUDE | SEC_DEBUGGING) sections
(see discard_unsuitable_section () before) in EIR linkage
mode. Prevent the code in `elf_link_add_object_symbols ()'
from achieving this. Interestingly enough, there is no attempt
to hide these symbols in binutils-2.21. */
if (link_mixed_eir_phase != 1 && link_mixed_eir_phase != 3)
_bfd_elf_link_hash_hide_symbol (info, h, force_local);
}
struct write_eir_info
{
bfd_size_type max_size;
bfd_byte *contents;
/* This is set to FALSE if `_bfd_e2k_write_eir_contens ()' fails
for any section. */
bfd_boolean res;
};
static void
write_eir_contents (bfd *abfd ATTRIBUTE_UNUSED,
asection *s,
void *param)
{
static bfd_vma s_offset;
bfd_vma next_s_offset;
bfd_vma mask;
struct bfd_link_order *p;
struct write_eir_info *wei;
/* There is nothing to do for non-EIR sections. */
if (strcmp (s->name, ".pack_pure_eir") != 0
&& strcmp (s->name, ".pack_mixed_eir") != 0)
return;
wei = (struct write_eir_info *) param;
/* If we've already failed, there is no point in continuing. */
if (wei->res == FALSE)
return;
mask = (1 << s->alignment_power) - 1;
s_offset = (s_offset + mask) & ~mask;
next_s_offset = s_offset;
for (p = s->map_head.link_order; p != NULL; p = p->next)
{
asection *i;
if (p->type != bfd_indirect_link_order)
continue;
i = p->u.indirect.section;
if (i->size > 0)
{
if (i->size > wei->max_size)
{
wei->max_size = i->size;
wei->contents = (bfd_byte *) bfd_realloc (wei->contents,
wei->max_size);
}
if (s_offset + i->output_offset + i->size > next_s_offset)
next_s_offset = s_offset + i->output_offset + i->size;
if (! bfd_get_section_contents (i->owner, i, wei->contents,
0, i->size)
|| bfd_seek (abfd, s_offset + i->output_offset, SEEK_SET) != 0
|| bfd_bwrite (wei->contents, i->size, abfd) != i->size)
{
wei->res = FALSE;
return;
}
}
}
/* Setting initial `s_offset' value for the next invocation. */
s_offset = next_s_offset;
}
/* This function gets called when BFD is being closed. Avoid calling
an ELF-specific method (which outputs strtab, . . .) when a raw
binary for EIR is required. */
bfd_boolean
_bfd_sparc_elf_write_object_contents (bfd *abfd)
{
struct write_eir_info wei;
if (link_mixed_eir_phase != 2)
return _bfd_elf_write_object_contents (abfd);
wei.max_size = 0;
wei.contents = NULL;
wei.res = TRUE;
/* Calculating positions of EIR sections and setting their contents. */
bfd_map_over_sections (abfd, write_eir_contents, &wei);
if (wei.contents)
free (wei.contents);
return wei.res;
}
/* This is a helper of `_bfd_sparc_elf_check_magic () below. */
static bfd_boolean
check_magic (bfd *abfd, asection *magic_sec)
{
char *magic = getenv ("MAGIC");
size_t magic_size;
char *data;
bfd_boolean res = FALSE;
BFD_ASSERT (magic);
magic_size = strlen (magic) + 1;
data = xmalloc (magic_sec->size);
if (! bfd_get_section_contents (abfd, magic_sec, data, 0, magic_sec->size))
{
_bfd_error_handler (_("%B: cannot read contents of section %A\n"),
abfd, magic_sec);
}
if (magic_sec->size == (12 + ((sizeof ("MCST") + 3) & 0xfffffffc)
+ ((magic_size + 3) & 0xfffffffc))
&& bfd_get_32 (abfd, data) == sizeof ("MCST")
&& bfd_get_32 (abfd, data + 4) == magic_size
&& bfd_get_32 (abfd, data + 8) == NT_MAGIC
&& data[12 + sizeof ("MCST") - 1] == '\0'
&& data[12 + ((sizeof ("MCST") + 3) & 0xfffffffc)
+ magic_size - 1] == '\0'
&& strncmp (data + 12, "MCST", sizeof ("MCST") - 1) == 0
&& strncmp (data + 12 + ((sizeof ("MCST") + 3) & 0xfffffffc), magic,
magic_size - 1) == 0)
res = TRUE;
free (data);
return res;
}
/* This function is required to implement MCST-specific MAGIC checks
(see Bug #67430). It gets called from `elf{32,64}_sparc_merge_private_bfd
_data ()' so that they don't have a chance to `return TRUE' without
performing this test (see their code just after the call to this function
for how it may happen).
FIXME: this function replicates the analogous part of
`_bfd_e2k_elf_merge_private_bfd_data_1 ()' in `elfxx-e2k.c'. Get rid of this
awful Copy/Paste by placing them in some common (for E2K and Sparc) source
file. Its`check_magic ()' helper and EIR-specific functions should probably
go there as well. */
bfd_boolean
_bfd_sparc_elf_check_magic (bfd *ibfd)
{
if (! getenv ("MAGIC"))
return TRUE;
asection *magic_sec;
static bfd_boolean first_ibfd_saved = TRUE;
bfd_boolean res, first_ibfd = first_ibfd_saved;
/* Next time `first_ibfd' will be set to FALSE. */
first_ibfd_saved = FALSE;
magic_sec = bfd_get_section_by_name (ibfd, ".magic");
if (magic_sec == NULL)
{
_bfd_error_handler (_("Input object %B doesn't have a .magic "
"section"), ibfd);
return FALSE;
}
res = check_magic (ibfd, magic_sec);
/* Exclude this section from output no matter what `check_magic ()'
returned, though it's not absolutely necessary if it failed: we are
not going to have any output in this case. */
if (! first_ibfd)
{
magic_sec->flags |= SEC_EXCLUDE;
magic_sec->size = 0;
}
if (! res)
{
_bfd_error_handler (_("Input object %B contains wrong MAGIC "),
ibfd);
return FALSE;
}
return TRUE;
}
const struct bfd_elf_special_section _bfd_sparc_elf_special_sections[] =
{
{ STRING_COMMA_LEN (".magic"), 0, SHT_NOTE, 0 },
{ NULL, 0, 0, 0, 0 }
};

View File

@ -147,3 +147,27 @@ extern bfd_vma _bfd_sparc_elf_plt_sym_val
(bfd_vma, const asection *, const arelent *);
extern bfd_boolean _bfd_sparc_elf_merge_private_bfd_data
(bfd *, struct bfd_link_info *);
/* EIR specific methods. */
extern bfd_boolean _bfd_sparc_elf_link_add_symbols
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_sparc_elf_final_link
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_sparc_elf_ignore_discarded_relocs
(asection *);
extern void _bfd_sparc_elf_hide_symbol
(struct bfd_link_info *, struct elf_link_hash_entry *,
bfd_boolean);
extern bfd_boolean _bfd_sparc_elf_write_object_contents (bfd *);
extern void _bfd_sparc_elf_after_parse (int);
extern bfd_boolean _bfd_sparc_elf_check_magic (bfd *ibfd);
extern const struct bfd_elf_special_section _bfd_sparc_elf_special_sections[];

View File

@ -84,7 +84,16 @@
#define bfd_elfNN_set_section_contents _bfd_elf_set_section_contents
#endif
#define bfd_elfNN_sizeof_headers _bfd_elf_sizeof_headers
/* We should be able to override this method if output file format
is not ELF as it happens in case of EIR linkage (see Bug #59012,
Comment # ). Take into account that calling `bfd_elf_final_link'
is inappropriate in this case either, since it also performs some
ELF-specific output. */
#ifndef bfd_elfNN_write_object_contents
#define bfd_elfNN_write_object_contents _bfd_elf_write_object_contents
#endif
#define bfd_elfNN_write_corefile_contents _bfd_elf_write_corefile_contents
#define bfd_elfNN_get_section_contents_in_window \
@ -742,6 +751,10 @@
#define elf_backend_cant_unwind_opcode 0
#endif
#ifndef elf_backend_r_none_info
#define elf_backend_r_none_info 0
#endif
#ifndef elf_match_priority
#define elf_match_priority \
(ELF_ARCH == bfd_arch_unknown ? 2 : ELF_OSABI == ELFOSABI_NONE ? 1 : 0)
@ -891,7 +904,8 @@ static struct elf_backend_data elfNN_bed =
elf_backend_default_execstack,
elf_backend_caches_rawsize,
elf_backend_extern_protected_data,
elf_backend_always_renumber_dynsyms
elf_backend_always_renumber_dynsyms,
elf_backend_r_none_info
};
/* Forward declaration for use when initialising alternative_target field. */

21
bfd/hosts/e2klinux.h Normal file
View File

@ -0,0 +1,21 @@
/* Copyright 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
/* Other architectures place here some definitions regarding to
core file handling. */

View File

@ -3182,6 +3182,39 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_WASM32_CODE_POINTER",
"BFD_RELOC_WASM32_INDEX",
"BFD_RELOC_WASM32_PLT_SIG",
"BFD_RELOC_E2K_64_ABS_LIT",
"BFD_RELOC_E2K_DISP",
"BFD_RELOC_E2K_GOT",
"BFD_RELOC_E2K_TLS_GDMOD",
"BFD_RELOC_E2K_TLS_GDREL",
"BFD_RELOC_E2K_TLS_IE",
"BFD_RELOC_E2K_32_TLS_LE",
"BFD_RELOC_E2K_64_TLS_LE",
"BFD_RELOC_E2K_32_DTPREL",
"BFD_RELOC_E2K_64_DTPREL",
"BFD_RELOC_E2K_PLT",
"BFD_RELOC_E2K_GOTPLT",
"BFD_RELOC_E2K_ISLOCAL",
"BFD_RELOC_E2K_AP_GOT",
"BFD_RELOC_E2K_PL_GOT",
"BFD_RELOC_E2K_PREF",
"BFD_RELOC_E2K_ISLOCAL32",
"BFD_RELOC_E2K_GOTOFF64",
"BFD_RELOC_E2K_GOTOFF64_LIT",
"BFD_RELOC_E2K_AP",
"BFD_RELOC_E2K_PL",
"BFD_RELOC_ELCORE32",
"BFD_RELOC_ELCORE16NPC",
"BFD_RELOC_ELCORE16PC",
"BFD_RELOC_ELCORE16S",
"BFD_RELOC_ELCORE16",
"BFD_RELOC_ELCORE5",
"BFD_RELOC_ELCORE32_FAKE",
"BFD_RELOC_ELCORE16NPC_FAKE",
"BFD_RELOC_ELCORE16PC_FAKE",
"BFD_RELOC_ELCORE16S_FAKE",
"BFD_RELOC_ELCORE16_FAKE",
"BFD_RELOC_ELCORE5_FAKE",
"@@overflow: BFD_RELOC_UNUSED@@",
};
#endif

View File

@ -7889,6 +7889,119 @@ ENUMX
ENUMDOC
WebAssembly relocations.
ENUM
BFD_RELOC_E2K_64_ABS_LIT
ENUMDOC
This one corresponds to R_E2K_64_ABS_LIT.
ENUM
BFD_RELOC_E2K_DISP
ENUMDOC
This one corresponds to R_E2K_DISP.
ENUM
BFD_RELOC_E2K_GOT
ENUMDOC
This one corresponds to R_E2K_GOT.
ENUM
BFD_RELOC_E2K_TLS_GDMOD
ENUMDOC
This one corresponds to R_E2K_TLS_GDMOD.
ENUM
BFD_RELOC_E2K_TLS_GDREL
ENUMDOC
This one corresponds to R_E2K_TLS_GDREL.
ENUM
BFD_RELOC_E2K_TLS_IE
ENUMDOC
This one corresponds to R_E2K_TLS_IE.
ENUM
BFD_RELOC_E2K_32_TLS_LE
ENUMDOC
This one corresponds to R_E2K_32_TLS_LE.
ENUM
BFD_RELOC_E2K_64_TLS_LE
ENUMDOC
This one corresponds to R_E2K_64_TLS_LE.
ENUM
BFD_RELOC_E2K_32_DTPREL
ENUMDOC
This one corresponds to R_E2K_TLS_32_DTPREL.
ENUM
BFD_RELOC_E2K_64_DTPREL
ENUMDOC
This one corresponds to R_E2K_TLS_64_DTPREL.
ENUM
BFD_RELOC_E2K_PLT
ENUMDOC
This one corresponds to R_E2K_PLT.
ENUM
BFD_RELOC_E2K_GOTPLT
ENUMDOC
This one corresponds to R_E2K_GOTPLT.
ENUM
BFD_RELOC_E2K_ISLOCAL
ENUMDOC
This one corresponds to R_E2K_ISLOCAL.
ENUM
BFD_RELOC_E2K_AP_GOT
ENUMDOC
This one corresponds to R_E2K_AP_GOT.
ENUM
BFD_RELOC_E2K_PL_GOT
ENUMDOC
This one corresponds to R_E2K_PL_GOT.
ENUM
BFD_RELOC_E2K_PREF
ENUMDOC
This one corresponds to R_E2K_PREF.
ENUM
BFD_RELOC_E2K_ISLOCAL32
ENUMDOC
This one corresponds to R_E2K_ISLOCAL32.
ENUM
BFD_RELOC_E2K_GOTOFF64
ENUMDOC
This one corresponds to R_E2K_GOTOFF64.
ENUM
BFD_RELOC_E2K_GOTOFF64_LIT
ENUMDOC
This one corresponds to R_E2K_GOTOFF64_LIT.
ENUM
BFD_RELOC_E2K_AP
ENUMDOC
This one corresponds to R_E2K_AP.
ENUM
BFD_RELOC_E2K_PL
ENUMDOC
This one corresponds to R_E2K_PL.
ENUM
BFD_RELOC_ELCORE32
ENUMX
BFD_RELOC_ELCORE16NPC
ENUMX
BFD_RELOC_ELCORE16PC
ENUMX
BFD_RELOC_ELCORE16S
ENUMX
BFD_RELOC_ELCORE16
ENUMX
BFD_RELOC_ELCORE5
ENUMX
BFD_RELOC_ELCORE32_FAKE
ENUMX
BFD_RELOC_ELCORE16NPC_FAKE
ENUMX
BFD_RELOC_ELCORE16PC_FAKE
ENUMX
BFD_RELOC_ELCORE16S_FAKE
ENUMX
BFD_RELOC_ELCORE16_FAKE
ENUMX
BFD_RELOC_ELCORE5_FAKE
ENUMDOC
Elvees Elcore relocations.
ENDSENUM
BFD_RELOC_UNUSED
CODE_FRAGMENT

View File

@ -639,6 +639,12 @@ extern const bfd_target crx_elf32_vec;
extern const bfd_target d10v_elf32_vec;
extern const bfd_target d30v_elf32_vec;
extern const bfd_target dlx_elf32_be_vec;
extern const bfd_target e2k_elf32_vec;
extern const bfd_target e2k_elf64_vec;
extern const bfd_target e2k_pm_elf32_vec;
extern const bfd_target e2k_kpda_elf64_vec;
extern const bfd_target elcore_elf32_vec;
extern const bfd_target elcore_elf64_vec;
extern const bfd_target elf32_be_vec;
extern const bfd_target elf32_le_vec;
extern const bfd_target elf64_be_vec;
@ -932,6 +938,7 @@ extern const bfd_target verilog_vec;
extern const bfd_target tekhex_vec;
extern const bfd_target binary_vec;
extern const bfd_target ihex_vec;
extern const bfd_target eir_vec;
/* All of the xvecs for core files. */
extern const bfd_target core_aix386_vec;
@ -1055,6 +1062,12 @@ static const bfd_target * const _bfd_target_vector[] =
&dlx_elf32_be_vec,
&e2k_elf32_vec,
&e2k_elf64_vec,
&e2k_pm_elf32_vec,
&elcore_elf32_vec,
&elcore_elf64_vec,
/* This, and other vectors, may not be used in any *.mt configuration.
But that does not mean they are unnecessary. If configured with
--enable-targets=all, objdump or gdb should be able to examine
@ -1477,6 +1490,8 @@ static const bfd_target * const _bfd_target_vector[] =
&binary_vec,
/* Likewise for ihex. */
&ihex_vec,
/* Likewise for EIR. */
&eir_vec,
/* Add any required traditional-core-file-handler. */

View File

@ -187,6 +187,9 @@
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
/* Inhibit --show-raw-insn option. */
#undef INHIBIT_RAW_INSN
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR

8
binutils/configure vendored
View File

@ -14674,6 +14674,14 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
case "$target" in
e2k*)
$as_echo "#define INHIBIT_RAW_INSN 1" >>confdefs.h
;;
esac
targ=$target
. $srcdir/../bfd/config.bfd
if test "x$targ_underscore" = "xyes"; then

View File

@ -488,6 +488,12 @@ AC_SUBST(OBJDUMP_PRIVATE_OFILES)
AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
case "$target" in
e2k*)
AC_DEFINE(INHIBIT_RAW_INSN, 1, [Inhibit --show-raw-insn option.])
;;
esac
targ=$target
. $srcdir/../bfd/config.bfd
if test "x$targ_underscore" = "xyes"; then

View File

@ -2990,17 +2990,6 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
}
}
/* Allow the BFD backend to copy any private data it understands
from the input BFD to the output BFD. This is done last to
permit the routine to look at the filtered symbol table, which is
important for the ECOFF code at least. */
if (! bfd_copy_private_bfd_data (ibfd, obfd))
{
bfd_nonfatal_message (NULL, obfd, NULL,
_("error copying private BFD data"));
return FALSE;
}
/* Switch to the alternate machine code. We have to do this at the
very end, because we only initialize the header when we create
the first section. */
@ -3020,6 +3009,17 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
}
}
/* Allow the BFD backend to copy any private data it understands
from the input BFD to the output BFD. This is done last to
permit the routine to look at the filtered symbol table, which is
important for the ECOFF code at least. */
if (! bfd_copy_private_bfd_data (ibfd, obfd))
{
bfd_nonfatal_message (NULL, obfd, NULL,
_("error copying private BFD data"));
return FALSE;
}
return TRUE;
}

View File

@ -95,7 +95,14 @@ static char *dump_private_options; /* -P */
static int prefix_addresses; /* --prefix-addresses */
static int with_line_numbers; /* -l */
static bfd_boolean with_source_code; /* -S */
#ifndef INHIBIT_RAW_INSN
static int show_raw_insn; /* --show-raw-insn */
#else
static int show_raw_insn = -1;
static int show_raw_insn_fake;
#endif
static int dump_dwarf_section_info; /* --dwarf */
static int dump_stab_section_info; /* --stabs */
static int do_demangle; /* -C, --demangle */
@ -328,12 +335,24 @@ static struct option long_options[]=
{"help", no_argument, NULL, 'H'},
{"info", no_argument, NULL, 'i'},
{"line-numbers", no_argument, NULL, 'l'},
{"no-show-raw-insn", no_argument, &show_raw_insn, -1},
{"no-show-raw-insn", no_argument,
#ifndef INHIBIT_RAW_INSN
&show_raw_insn,
#else
&show_raw_insn_fake,
#endif
-1},
{"prefix-addresses", no_argument, &prefix_addresses, 1},
{"reloc", no_argument, NULL, 'r'},
{"section", required_argument, NULL, 'j'},
{"section-headers", no_argument, NULL, 'h'},
{"show-raw-insn", no_argument, &show_raw_insn, 1},
{"show-raw-insn", no_argument,
#ifndef INHIBIT_RAW_INSN
&show_raw_insn,
#else
&show_raw_insn_fake,
#endif
1},
{"source", no_argument, NULL, 'S'},
{"special-syms", no_argument, &dump_special_syms, 1},
{"include", required_argument, NULL, 'I'},

View File

@ -101,6 +101,7 @@
#include "elf/d10v.h"
#include "elf/d30v.h"
#include "elf/dlx.h"
#include "elf/e2k.h"
#include "elf/epiphany.h"
#include "elf/fr30.h"
#include "elf/frv.h"
@ -1515,6 +1516,10 @@ dump_relocations (FILE * file,
case EM_TI_PRU:
rtype = elf_pru_reloc_type (type);
break;
case EM_MCST_ELBRUS:
rtype = elf_e2k_reloc_type (type);
break;
}
if (rtype == NULL)
@ -1977,6 +1982,22 @@ get_nios2_dynamic_type (unsigned long type)
}
}
static const char *
get_e2k_dynamic_type (unsigned long type)
{
switch (type)
{
case DT_E2K_LAZY_GOT: return "E2K_LAZY_GOT";
case DT_PLTGOTSZ: return "PLTGOTSZ";
case DT_INIT_GOT: return "INIT_GOT";
case DT_EXPORT_PL: return "EXPORT_PL";
case DT_EXPORT_PLSZ: return "EXPORT_PLSZ";
case DT_REAL_PLTGOT: return "REAL_PLTGOT";
default: return NULL;
}
}
static const char *
get_solaris_dynamic_type (unsigned long type)
{
@ -2132,6 +2153,9 @@ get_dynamic_type (unsigned long type)
case EM_ALTERA_NIOS2:
result = get_nios2_dynamic_type (type);
break;
case EM_MCST_ELBRUS:
result = get_e2k_dynamic_type (type);
break;
default:
if (elf_header.e_ident[EI_OSABI] == ELFOSABI_SOLARIS)
result = get_solaris_dynamic_type (type);
@ -2251,7 +2275,10 @@ get_machine_name (unsigned e_machine)
case EM_H8_300: return "Renesas H8/300";
case EM_H8_300H: return "Renesas H8/300H";
case EM_H8S: return "Renesas H8S";
#if 0
case EM_H8_500: return "Renesas H8/500";
#endif /* 0 */
case EM_E2K_OLD: return "MCST Elbrus (old)";
/* 50 */
case EM_IA_64: return "Intel IA-64";
case EM_MIPS_X: return "Stanford MIPS-X";
@ -3006,7 +3033,11 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
buf[0] = '\0';
if (e_flags)
if (e_flags
/* We may have `e_flags == 0x0' at E2K which is worth being
described. */
|| e_machine == EM_MCST_ELBRUS
|| e_machine == EM_E2K_OLD)
{
switch (e_machine)
{
@ -3462,6 +3493,9 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
if (e_flags & EF_SPARC_SUN_US3)
strcat (buf, ", ultrasparcIII");
if (e_flags & EF_SPARC_MCST)
strcat (buf, ", MCST Sparc");
if (e_flags & EF_SPARC_HAL_R1)
strcat (buf, ", halr1");
@ -3635,6 +3669,102 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
if (e_flags & ~ EF_MSP430_MACH)
strcat (buf, _(": unknown extra flag bits also present"));
break;
case EM_E2K_OLD:
case EM_MCST_ELBRUS:
{
unsigned mach = (e_machine == EM_MCST_ELBRUS
? EF_E2K_FLAG_TO_MACH (e_flags)
: EF_E2K_OLD_FLAG_TO_MACH (e_flags));
switch (mach)
{
case E_E2K_MACH_BASE:
strcat (buf, ", generic");
break;
case E_E2K_MACH_EV1:
strcat (buf, ", elbrus-v1");
break;
case E_E2K_MACH_EV2:
/* Forward incompatible `elbrus-v2' ELF is currently interpreted
as `elbrus-2c+'-specific one at least until we have got other
processors of `elbrus-v2' family. */
strcat (buf,
((e_flags & EF_E2K_INCOMPAT)
? ", elbrus-2c+" : ", elbrus-v2"));
break;
case E_E2K_MACH_EV3:
/* Forward incompatible `elbrus-v3' ELF is currently interpreted
as `elbrus-4c'-specific one at least until we have got other
processors of `elbrus-v3' family. */
strcat (buf,
((e_flags & EF_E2K_INCOMPAT)
? ", elbrus-4c" : ", elbrus-v3"));
break;
case E_E2K_MACH_EV4:
strcat (buf, ", elbrus-v4");
break;
case E_E2K_MACH_EV5:
strcat (buf, ", elbrus-v5");
break;
case E_E2K_MACH_EV6:
strcat (buf, ", elbrus-v6");
break;
case E_E2K_MACH_8C:
strcat (buf, ", elbrus-8c");
break;
case E_E2K_MACH_1CPLUS:
strcat (buf, ", elbrus-1c+");
break;
default:
strcat (buf, ", unknown elbrus processor");
break;
}
/* Only a new-style ELF may be marked as forward incompatible As for
`elbrus-v1' it's considered to be forward incompatible even if
EF_E2K_INCOMPAT isn't set. A forward incompatible `elbrus-v{2,3}'
ELF has already been identified as `elbrus-{2c+,4c}' specific
above. This flag makes little sense for `elbrus-{8c,1c+}' ELFs.
Therefore, we are formally left with generic and `elbrus-v{4,5,
6}' cases here. They shouldn't be met in practice, though, since
there are no `e2k-linux-{as,ld}' options for producing them. */
if (e_machine == EM_MCST_ELBRUS
&& (mach == E_E2K_MACH_EV1
|| ((e_flags & EF_E2K_INCOMPAT)
&& (mach == E_E2K_MACH_BASE
|| (mach >= E_E2K_MACH_EV4
&& mach <= E_E2K_MACH_EV6)))))
strcat (buf, " (forward incompatible)");
if (e_machine == EM_MCST_ELBRUS
&& (e_flags & EF_E2K_PM))
strcat (buf, " (Protected Mode)");
switch (e_flags & EF_E2K_IPD)
{
case 1:
strcat (buf, ", ipd 0");
break;
case 2:
strcat (buf, ", ipd 1");
break;
case 3:
strcat (buf, ", ipd 2");
break;
default:
strcat (buf, ", default ipd");
break;
}
if (e_flags & EF_E2K_4MB_PAGES)
strcat (buf, ", 4MB pages");
if (e_flags & EF_E2K_X86APP)
strcat (buf, ", x86 app");
break;
}
}
}
@ -3665,6 +3795,7 @@ get_osabi_name (unsigned int osabi)
case ELFOSABI_FENIXOS: return "FenixOS";
case ELFOSABI_CLOUDABI: return "Nuxi CloudABI";
case ELFOSABI_OPENVOS: return "Stratus Technologies OpenVOS";
case ELFOSABI_KPDA: return "KPDA";
default:
if (osabi >= 64)
switch (elf_header.e_machine)
@ -14244,6 +14375,10 @@ display_sparc_hwcaps (unsigned int mask)
printf ("%sima", first ? "" : "|"), first = FALSE;
if (mask & ELF_SPARC_HWCAP_ASI_CACHE_SPARING)
printf ("%scspare", first ? "" : "|"), first = FALSE;
if (mask & ELF_SPARC_HWCAP_R1000)
printf ("%sr1000", first ? "" : "|"), first = FALSE;
if (mask & ELF_SPARC_HWCAP_SAPPHIRE)
printf ("%ssapphire", first ? "" : "|"), first = FALSE;
}
else
fputc ('0', stdout);
@ -16917,6 +17052,31 @@ print_stapsdt_note (Elf_Internal_Note *pnote)
return data == data_end;
}
static const char *
get_mcst_note_type (unsigned e_type)
{
static char buff[64];
switch (e_type)
{
case NT_MAGIC:
return _("NT_MAGIC (magic conjuration used by certifiers)");
default:
break;
}
snprintf (buff, sizeof (buff), _("Unknown note type: (0x%08x)"), e_type);
return buff;
}
static int
print_mcst_note (Elf_Internal_Note *pnote)
{
printf (_(" Secret phrase: %s\n"), pnote->descdata);
return 1;
}
static const char *
get_ia64_vms_note_type (unsigned e_type)
{
@ -17472,6 +17632,9 @@ process_note (Elf_Internal_Note * pnote,
else if (const_strneq (pnote->namedata, "stapsdt"))
nt = get_stapsdt_note_type (pnote->type);
else if (const_strneq (pnote->namedata, "MCST"))
nt = get_mcst_note_type (pnote->type);
else
/* Don't recognize this note name; just use the default set of
note type strings. */
@ -17499,6 +17662,8 @@ process_note (Elf_Internal_Note * pnote,
return print_gnu_note (pnote);
else if (const_strneq (pnote->namedata, "stapsdt"))
return print_stapsdt_note (pnote);
else if (const_strneq (pnote->namedata, "MCST"))
return print_mcst_note (pnote);
else if (const_strneq (pnote->namedata, "CORE"))
return print_core_note (pnote);
else if (((const_strneq (pnote->namedata, "GA")

3
config.guess vendored
View File

@ -967,6 +967,9 @@ EOF
hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
e2k:Linux:*.*)
echo "${UNAME_MACHINE}-mcst-linux-gnu"
exit ;;
i*86:Linux:*:*)
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;

13
config.sub vendored
View File

@ -259,7 +259,7 @@ case $basic_machine in
| bfin \
| c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| e2k | epiphany \
| epiphany \
| fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
@ -364,6 +364,12 @@ case $basic_machine in
i*86 | x86_64)
basic_machine=$basic_machine-pc
;;
e2k | e2k64 | e2k32)
basic_machine=$basic_machine-mcst
;;
elcore)
basic_machine=$basic_machine-elvees
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
@ -384,7 +390,7 @@ case $basic_machine in
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| e2k-* | elxsi-* \
| e2k-* | e2k64-* | e2k32-* | elcore-* | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
@ -1447,6 +1453,9 @@ case $os in
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-kpda)
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;

2
configure vendored
View File

@ -2971,7 +2971,7 @@ case "${ENABLE_GOLD}" in
# Check for target supported by gold.
case "${target}" in
i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
| aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-*)
| aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | e2k-*)
configdirs="$configdirs gold"
if test x${ENABLE_GOLD} = xdefault; then
default_ld=gold

View File

@ -345,7 +345,7 @@ case "${ENABLE_GOLD}" in
# Check for target supported by gold.
case "${target}" in
i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
| aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-*)
| aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | e2k-*)
configdirs="$configdirs gold"
if test x${ENABLE_GOLD} = xdefault; then
default_ld=gold

View File

@ -108,6 +108,7 @@ namespace elfcpp
#undef DW_FIRST_CFA
#undef DW_CFA
#undef DW_CFA_DUP
#undef DW_END_CFA
#undef DW_FIRST_IDX

57
elfcpp/e2k.h Normal file
View File

@ -0,0 +1,57 @@
// e2k.h -- ELF definitions specific to EM_MCST_ELBRUS -*- C++ -*-
// Copyright (C) 2008-2015 Free Software Foundation, Inc.
// Written by Ilya Yu. Malakhov <malakhov@mcst.ru>.
// This file is part of elfcpp.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public License
// as published by the Free Software Foundation; either version 2, or
// (at your option) any later version.
// In addition to the permissions in the GNU Library General Public
// License, the Free Software Foundation gives you unlimited
// permission to link the compiled version of this file into
// combinations with other programs, and to distribute those
// combinations without any restriction coming from the use of this
// file. (The Library Public License restrictions do apply in other
// respects; for example, they cover modification of the file, and
/// distribution when not linked into a combined executable.)
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
// You should have received a copy of the GNU Library General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
// 02110-1301, USA.
#ifndef ELFCPP_E2K_H
#define ELFCPP_E2K_H
namespace elfcpp
{
enum
{
R_E2K_32_ABS = 0,
R_E2K_32_PC = 2,
R_E2K_64_ABS = 50,
R_E2K_64_ABS_LIT = 51,
R_E2K_64_PC_LIT = 54,
R_E2K_TLS_IE = 74,
R_E2K_64_TLS_LE = 76,
R_E2K_GOT = 108,
R_E2K_GOTOFF = 109,
R_E2K_DISP = 110,
R_E2K_GOTPLT = 114,
R_E2K_ISLOCAL = 115,
R_E2K_ISLOCAL32 = 118,
};
} // End namespace elfcpp.
#endif // !defined(ELFCPP_E2K_H)

View File

@ -269,6 +269,7 @@ enum EM
EM_ALTERA_NIOS2 = 113,
EM_CRX = 114,
EM_TI_PRU = 144,
EM_MCST_ELBRUS = 175,
EM_AARCH64 = 183,
EM_TILEGX = 191,
// The Morph MT.

View File

@ -141,6 +141,8 @@ TARGET_CPU_CFILES = \
config/tc-d10v.c \
config/tc-d30v.c \
config/tc-dlx.c \
config/tc-e2k.c \
config/tc-stub.c \
config/tc-epiphany.c \
config/tc-fr30.c \
config/tc-frv.c \
@ -218,6 +220,8 @@ TARGET_CPU_HFILES = \
config/tc-d10v.h \
config/tc-d30v.h \
config/tc-dlx.h \
config/tc-e2k.h \
config/tc-stub.h \
config/tc-epiphany.h \
config/tc-fr30.h \
config/tc-frv.h \

View File

@ -437,6 +437,8 @@ TARGET_CPU_CFILES = \
config/tc-d10v.c \
config/tc-d30v.c \
config/tc-dlx.c \
config/tc-e2k.c \
config/tc-stub.c \
config/tc-epiphany.c \
config/tc-fr30.c \
config/tc-frv.c \
@ -514,6 +516,8 @@ TARGET_CPU_HFILES = \
config/tc-d10v.h \
config/tc-d30v.h \
config/tc-dlx.h \
config/tc-e2k.h \
config/tc-stub.h \
config/tc-epiphany.h \
config/tc-fr30.h \
config/tc-frv.h \
@ -874,6 +878,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-d10v.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-d30v.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-dlx.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-e2k.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-epiphany.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-fr30.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-frv.Po@am__quote@
@ -920,6 +925,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-sh64.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-sparc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-spu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-stub.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-tic30.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-tic4x.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-tic54x.Po@am__quote@
@ -1129,6 +1135,34 @@ tc-dlx.obj: config/tc-dlx.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tc-dlx.obj `if test -f 'config/tc-dlx.c'; then $(CYGPATH_W) 'config/tc-dlx.c'; else $(CYGPATH_W) '$(srcdir)/config/tc-dlx.c'; fi`
tc-e2k.o: config/tc-e2k.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tc-e2k.o -MD -MP -MF $(DEPDIR)/tc-e2k.Tpo -c -o tc-e2k.o `test -f 'config/tc-e2k.c' || echo '$(srcdir)/'`config/tc-e2k.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tc-e2k.Tpo $(DEPDIR)/tc-e2k.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config/tc-e2k.c' object='tc-e2k.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tc-e2k.o `test -f 'config/tc-e2k.c' || echo '$(srcdir)/'`config/tc-e2k.c
tc-e2k.obj: config/tc-e2k.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tc-e2k.obj -MD -MP -MF $(DEPDIR)/tc-e2k.Tpo -c -o tc-e2k.obj `if test -f 'config/tc-e2k.c'; then $(CYGPATH_W) 'config/tc-e2k.c'; else $(CYGPATH_W) '$(srcdir)/config/tc-e2k.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tc-e2k.Tpo $(DEPDIR)/tc-e2k.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config/tc-e2k.c' object='tc-e2k.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tc-e2k.obj `if test -f 'config/tc-e2k.c'; then $(CYGPATH_W) 'config/tc-e2k.c'; else $(CYGPATH_W) '$(srcdir)/config/tc-e2k.c'; fi`
tc-stub.o: config/tc-stub.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tc-stub.o -MD -MP -MF $(DEPDIR)/tc-stub.Tpo -c -o tc-stub.o `test -f 'config/tc-stub.c' || echo '$(srcdir)/'`config/tc-stub.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tc-stub.Tpo $(DEPDIR)/tc-stub.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config/tc-stub.c' object='tc-stub.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tc-stub.o `test -f 'config/tc-stub.c' || echo '$(srcdir)/'`config/tc-stub.c
tc-stub.obj: config/tc-stub.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tc-stub.obj -MD -MP -MF $(DEPDIR)/tc-stub.Tpo -c -o tc-stub.obj `if test -f 'config/tc-stub.c'; then $(CYGPATH_W) 'config/tc-stub.c'; else $(CYGPATH_W) '$(srcdir)/config/tc-stub.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tc-stub.Tpo $(DEPDIR)/tc-stub.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config/tc-stub.c' object='tc-stub.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tc-stub.obj `if test -f 'config/tc-stub.c'; then $(CYGPATH_W) 'config/tc-stub.c'; else $(CYGPATH_W) '$(srcdir)/config/tc-stub.c'; fi`
tc-epiphany.o: config/tc-epiphany.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tc-epiphany.o -MD -MP -MF $(DEPDIR)/tc-epiphany.Tpo -c -o tc-epiphany.o `test -f 'config/tc-epiphany.c' || echo '$(srcdir)/'`config/tc-epiphany.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tc-epiphany.Tpo $(DEPDIR)/tc-epiphany.Po

View File

@ -846,12 +846,17 @@ This program has absolutely no warranty.\n"));
listing_lhs_cont_lines = atoi (optarg);
break;
/* FIXME. Probably there is no other way to prevent gas
from handling this option in a "standard" way. My
md_parse_option is likely to "accept" it. */
#if 0
case 'M':
flag_mri = 1;
#ifdef TC_M68K
flag_m68k_mri = 1;
#endif
break;
#endif /* 0 */
case 'R':
flag_readonly_data_in_text = 1;

135
gas/config/e2k-linux-as.wrap Executable file
View File

@ -0,0 +1,135 @@
#!/bin/bash
# set -x
gas="${0}.real"
ld="$(dirname ${0})/e2k-linux-ld"
objcopy="$(dirname ${0})/e2k-linux-objcopy -O binary"
diffcode="$(dirname ${0})/e2k-linux-diffcode"
# At MCST mktemp doesn't recognize `--suffix' option.
tmp_s=$(mktemp) # --suffix=.s
tmp_gas_o=$(mktemp) # --suffix=.o
tmp_las_o=$(mktemp) # --suffix=.o
tmp_gas_ld=$(mktemp)
tmp_las_ld=$(mktemp)
tmp_gas_fin=$(mktemp)
tmp_las_fin=$(mktemp)
# Note that GAS exits with a non-zero code in preprocessing mode
# to avoid the need for creating an output object file. Therefore, don't
# check for success here.
$gas --preprocess "$@" > $tmp_s 2> /dev/null
options=()
for i in $@; do
case $i in
-mptr32)
las="las_i"
mptr=$i
emul="-melf32_e2k"
;;
-mptr128)
las="las_i -M"
mptr=$i
emul="-melf32_e2k_pm"
;;
-mptr64)
las=las64_i
mptr=$i
emul="-melf64_e2k"
;;
-mcpu=* | -*no_strict_delay | -*fmessage-length | -*permissive)
options+=($i)
;;
esac;
done
res=0
$gas $mptr ${options[@]} $tmp_s -o $tmp_gas_o
[ $? -eq 0 ] || res=1
lasdir=/auto/malakhov/tmp/migrate/lases
las=$lasdir/$las
$las ${options[@]} $tmp_s -o $tmp_las_o
[ $? -eq 0 ] || res=1
if [ $res -eq 0 ]; then
$ld --simulate $emul $tmp_gas_o -o $tmp_gas_ld 2> /dev/null
[ $? -eq 0 ] || res=1
$ld --simulate $emul $tmp_las_o -o $tmp_las_ld 2> /dev/null
[ $? -eq 0 ] || res=1
fi
if [ $res -eq 0 ]; then
# OBJCOPY may fail, for example, due to the absence of `.text' within the
# input file. This script shouldn't fail in such a case.
objcopy_res=0
$objcopy -j .text $tmp_gas_ld $tmp_gas_fin 2> /dev/null
[ $? -eq 0 ] || objcopy_res=1
$objcopy -j .text $tmp_las_ld $tmp_las_fin 2> /dev/null
[ $? -eq 0 ] || objcopy_res=1
if [ $objcopy_res -eq 0 ]; then
if ! diff $tmp_gas_fin $tmp_las_fin; then
msg=$($diffcode $tmp_gas_fin $tmp_las_fin) || res=1
fi
# Let the user see all positive results.
true # [ $res -eq 0 ] && echo -e "$$: synchronous code in\n\n $(ls -l $tmp_gas_fin $tmp_las_fin)\n\nis identical"
fi
fi
# Go on comparing fapb instructions only if the preceding comparison of
# .text sections has succeeded.
if [ $res -eq 0 ]; then
objcopy_res=0
$objcopy -j .fapb $tmp_gas_ld $tmp_gas_fin 2> /dev/null
[ $? -eq 0 ] || objcopy_res=1
[ -s $tmp_gas_fin ] || objcopy_res=1
$objcopy -j .fapb $tmp_las_ld $tmp_las_fin 2> /dev/null
[ $? -eq 0 ] || objcopy_res=1
[ -s $tmp_las_fin ] || objcopy_res=1
if [ $objcopy_res -eq 0 ]; then
if ! diff $tmp_gas_fin $tmp_las_fin; then
msg="sections with asynchronous code differ"
res=1
fi
# Let the user see all positive results.
true # [ $res -eq 0 ] && echo -e "$$: asynchronous code in\n\n $(ls -l $tmp_gas_fin $tmp_las_fin)\n\nis identical"
fi
fi
if [ $res -eq 0 ]; then
rm -f $tmp_s $tmp_gas_o $tmp_las_o $tmp_gas_ld $tmp_las_ld $tmp_gas_fin \
$tmp_las_fin
# echo "$$: $gas $@"
$gas "$@"
res=$?;
else
echo "$$: $msg"
echo "$$: assembler file: $tmp_s"
echo "$$: relocatable object files: $tmp_gas_o $tmp_las_o"
echo "$$: linked object files: $tmp_gas_ld $tmp_las_ld"
echo "$$: final binaries: $tmp_gas_fin $tmp_las_fin"
fi
exit $res

9285
gas/config/tc-e2k.c Normal file

File diff suppressed because it is too large Load Diff

112
gas/config/tc-e2k.h Normal file
View File

@ -0,0 +1,112 @@
/* tc-e2k.h - Macros and type defines for the E2k.
This file is part of GAS, the GNU Assembler.
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2,
or (at your option) any later version.
GAS is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the GNU General Public License for more details.
You should have received a copy of the GNU General Public
License along with GAS; see the file COPYING. If not, write
to the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef TC_E2K
#define TC_E2K 1
#define LEX_HASH (LEX_NAME|LEX_BEGIN_NAME) /* allow `#' inside symbol name */
extern const char *e2k_target_format (void);
#define TARGET_FORMAT e2k_target_format ()
#define TARGET_ARCH bfd_arch_e2k
extern unsigned long e2k_mach (void);
#define TARGET_MACH (e2k_mach ())
extern void e2k_elf_final_processing (void);
#define elf_tc_final_processing e2k_elf_final_processing
#define TARGET_BYTES_BIG_ENDIAN 0
#define MD_APPLY_FIX3
#define tc_fix_adjustable(X) tc_e2k_fix_adjustable(X)
extern int tc_e2k_fix_adjustable (struct fix *);
/* Values passed to md_apply_fix don't include the symbol value. */
#define MD_APPLY_SYM_VALUE(FIX) 0
#define md_convert_frag(b,s,f) \
as_fatal (_("e2k convert_frag\n"))
#define md_estimate_size_before_relax(f,s) \
(as_fatal(_("estimate_size_before_relax called")), 1)
#define md_start_line_hook() e2k_start_line_hook (input_line_pointer[-1])
#define md_cleanup() e2k_cleanup_hook ();
#define md_number_to_chars number_to_chars_littleendian
extern void e2k_start_line_hook (char);
extern void e2k_cleanup_hook (void);
extern void e2k_adjust_symtab (void);
#define tc_adjust_symtab() e2k_adjust_symtab ()
extern char *e2k_canonicalize_symbol_name (char *);
#define tc_canonicalize_symbol_name(s) e2k_canonicalize_symbol_name (s)
#define tc_init_after_args() e2k_init ()
extern void e2k_init (void);
extern int e2k_parse_name (char *, expressionS *, char *);
#define md_parse_name(name, e, m, nextP) e2k_parse_name (name, e, nextP)
extern void e2k_cons_fix_new (struct frag *, int,
int, struct expressionS *);
#define TC_CONS_FIX_NEW(FRAG, WHERE, NBYTES, EXP, RELOC) \
e2k_cons_fix_new (FRAG, WHERE, NBYTES, EXP)
/* This is probably required in order to make arithmetic on symbols coming
from different sections. Isn't it? */
#define DIFF_EXPR_OK 1
extern void e2k_end (void);
#define md_end() e2k_end ()
/* We want .cfi_* pseudo-ops for generating unwind info. */
#define TARGET_USE_CFIPOP 1
#define DWARF2_CIE_DATA_ALIGNMENT (-8)
#define DWARF2_DEFAULT_RETURN_COLUMN 0
/* This lets one ensure that `.eh_frame' is writable in PM. */
#define DWARF2_EH_FRAME_READ_ONLY e2k_dwarf2_eh_frame_read_only ()
extern int e2k_dwarf2_eh_frame_read_only (void);
#define md_register_arithmetic 0
#define tc_allow_U_suffix 0
/* Note that these are the powers of 2. */
#define EH_FRAME_ALIGNMENT \
(e2k_eh_frame_alignment () == 4 \
? 4 : (bfd_get_arch_size (stdoutput) == 64 ? 3 : 2))
extern int e2k_eh_frame_alignment (void);
#define tc_cfi_reloc_for_encoding e2k_cfi_reloc_for_encoding
extern bfd_reloc_code_real_type e2k_cfi_reloc_for_encoding (int encoding);
#endif /* TC_E2K */

View File

@ -286,6 +286,8 @@ static struct sparc_arch {
/* This exists to allow configure.tgt to pass one
value to specify both the default machine and default word size. */
{ "v9-64", "v9", v9, 64, 0, 0, 0 },
{ "r1000", "r1000", v9, 0, 1, 0, 0 },
{ "r2000", "r1000", v9, 0, 1, HWCAP_SAPPHIRE, 0 },
{ NULL, NULL, v8, 0, 0, 0, 0 }
};
@ -536,6 +538,22 @@ md_parse_option (int c, const char *arg)
if (opcode_arch == SPARC_OPCODE_ARCH_BAD)
as_fatal (_("Bad opcode table, broken assembler."));
/* This awful hack is required to let a user override an explicitly
specified `-Ar1000' with, say, `-Av9d' when assembling VIS3-dependent
glibc files. */
if (architecture_requested
&& max_architecture == SPARC_OPCODE_ARCH_V9_MCST)
{
architecture_requested = 0;
hwcap_allowed = 0;
}
/* This hack won't let `-Ar1000' override `-Av9d' if they turn out to
be swapped by LCC. */
if (architecture_requested
&& opcode_arch == SPARC_OPCODE_ARCH_V9_MCST)
break;
if (!architecture_requested
|| opcode_arch > max_architecture)
max_architecture = opcode_arch;
@ -1143,6 +1161,55 @@ md_begin (void)
}
}
/* FIXME: this is a Copy/Paste of `e2k_add_magic_info ()'. What can I do to
avoid it? */
static void
sparc_add_magic_info (void)
{
asection *magic_sec;
char *magic, *p;
size_t name_size, name_size_aligned;
size_t magic_size, magic_size_aligned;
static const char name[] = "MCST";
if (! (magic = getenv ("MAGIC")))
return;
name_size = sizeof (name);
name_size_aligned = (name_size + 3) & 0xfffffffc;
magic_size = strlen (magic) + 1;
magic_size_aligned = (magic_size + 3) & 0xfffffffc;
magic_sec = subseg_new (".magic", 0);
bfd_set_section_flags (stdoutput, magic_sec, SEC_HAS_CONTENTS | SEC_READONLY);
/* Follow the standard note section layout:
First write the length of the name string. */
p = frag_more (4);
md_number_to_chars (p, (valueT) name_size, 4);
/* Next comes the length of the "MAGIC" itself, i.e., the actual data. */
p = frag_more (4);
md_number_to_chars (p, (valueT) magic_size, 4);
/* Write the note NT_MAGIC type. */
p = frag_more (4);
md_number_to_chars (p, (valueT) NT_MAGIC, 4);
/* Write the name field. */
p = frag_more (name_size_aligned);
/* FIXME: I don't remember for sure if `frag_more ()' zeroes out allocated
memory. */
memset (p, 0, name_size_aligned);
memcpy (p, name, name_size);
/* Finally, write the descriptor. */
p = frag_more (magic_size_aligned);
memset (p, 0, magic_size_aligned);
memcpy (p, magic, magic_size);
}
/* Called after all assembly has been done. */
void
@ -1151,6 +1218,23 @@ sparc_md_end (void)
unsigned long mach = bfd_mach_sparc;
#if defined(OBJ_ELF) && !defined(TE_SOLARIS)
int hwcaps, hwcaps2;
if (current_architecture == SPARC_OPCODE_ARCH_V9_MCST)
{
/* We may introduce ourselves as ultrasparc3 without any harm. This will
let us be executed on a natural ultrasparc3 host. FIXME: now that the
definition for HWS_VB has been moved to `opcodes/sparc-opc.c' I have
to instantiate it as a unification of HWCAP's. */
if ((hwcap_seen & ~((HWCAP_MUL32 | HWCAP_DIV32 | HWCAP_FSMULD
| HWCAP_POPC | HWCAP_VIS | HWCAP_VIS2)
| HWCAP_FMAF)) == 0)
current_architecture = SPARC_OPCODE_ARCH_V9B;
/* There's no point in writing out this hwcap into an output r1000 file
because it's assumed by default. It's required within GAS to prevent
us from mistakenly falling back to ultrasparc3 one line above. */
hwcap_seen &= ~HWCAP_R1000;
}
#endif
if (sparc_arch_size == 64)
@ -1164,6 +1248,7 @@ sparc_md_end (void)
case SPARC_OPCODE_ARCH_V9V: mach = bfd_mach_sparc_v9v; break;
case SPARC_OPCODE_ARCH_V9M: mach = bfd_mach_sparc_v9m; break;
case SPARC_OPCODE_ARCH_M8: mach = bfd_mach_sparc_v9m8; break;
case SPARC_OPCODE_ARCH_V9_MCST: mach = bfd_mach_sparc_v9_mcst; break;
default: mach = bfd_mach_sparc_v9; break;
}
else
@ -1179,6 +1264,7 @@ sparc_md_end (void)
case SPARC_OPCODE_ARCH_V9V: mach = bfd_mach_sparc_v8plusv; break;
case SPARC_OPCODE_ARCH_V9M: mach = bfd_mach_sparc_v8plusm; break;
case SPARC_OPCODE_ARCH_M8: mach = bfd_mach_sparc_v8plusm8; break;
case SPARC_OPCODE_ARCH_V9_MCST: mach = bfd_mach_sparc_v8plus_mcst; break;
/* The sparclite is treated like a normal sparc. Perhaps it shouldn't
be but for now it is (since that's the way it's always been
treated). */
@ -1195,6 +1281,8 @@ sparc_md_end (void)
if (hwcaps2)
bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU, Tag_GNU_Sparc_HWCAPS2, hwcaps2);
#endif
sparc_add_magic_info ();
}
/* Return non-zero if VAL is in the range -(MAX+1) to MAX. */
@ -1613,6 +1701,13 @@ md_assemble (char *str)
as_warn (_("FP branch in delay slot"));
}
/* See Bug #29793, Comments #8 and #9 for an explanation why the underlying
code is disabled for E2k. Shortly speaking, a NOP is not required in this
situation at V8 hosts produced by MCST. Moreover, the code produced by
our GAS has never been executed at original Sun V8 hosts. It would be
better either to implement an additional configure option or a special
arch value for MCST specific V8 in order to bypass this check . . . */
#if 0
/* SPARC before v9 requires a nop instruction between a floating
point instruction and a floating point branch. We insert one
automatically, with a warning. */
@ -1628,6 +1723,7 @@ md_assemble (char *str)
output_insn (insn, &nop_insn);
as_warn (_("FP branch preceded by FP instruction; NOP inserted"));
}
#endif /* 0 */
switch (special_case)
{
@ -1731,6 +1827,10 @@ get_hwcap_name (bfd_uint64_t mask)
return "cbcond";
if (mask & HWCAP_CRC32C)
return "crc32c";
if (mask & HWCAP_R1000)
return "r1000";
if (mask & HWCAP_SAPPHIRE)
return "sapphire";
mask = mask >> 32;
if (mask & HWCAP2_FJATHPLUS)
@ -3238,10 +3338,6 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
bfd_uint64_t hwcaps
= (((bfd_uint64_t) insn->hwcaps2) << 32) | insn->hwcaps;
#if defined(OBJ_ELF) && !defined(TE_SOLARIS)
if (hwcaps)
hwcap_seen |= hwcaps;
#endif
if (v9_arg_p)
{
needed_arch_mask &=
@ -3291,6 +3387,15 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
char *p;
char required_archs[SPARC_OPCODE_ARCH_MAX * 16];
if (&insn[1] - sparc_opcodes < sparc_num_opcodes
&& (insn->name == insn[1].name
|| !strcmp (insn->name, insn[1].name)))
{
++insn;
s = argsStart;
continue;
}
/* Create a list of the architectures that support the insn. */
needed_arch_mask &= ~SPARC_OPCODE_SUPPORTED (max_architecture);
p = required_archs;
@ -3315,9 +3420,16 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
return special_case;
}
#if defined(OBJ_ELF) && !defined(TE_SOLARIS)
if (hwcaps)
hwcap_seen |= hwcaps;
#endif
/* Make sure the hwcaps used by the instruction are
currently enabled. */
if (hwcaps & ~hwcap_allowed)
if (!warn_on_bump && architecture_requested
&& (hwcaps & ~hwcap_allowed))
{
const char *hwcap_name = get_hwcap_name(hwcaps & ~hwcap_allowed);
@ -4877,6 +4989,10 @@ sparc_elf_final_processing (void)
elf_elfheader (stdoutput)->e_flags |= EF_SPARC_SUN_US1;
else if (current_architecture == SPARC_OPCODE_ARCH_V9B)
elf_elfheader (stdoutput)->e_flags |= EF_SPARC_SUN_US1|EF_SPARC_SUN_US3;
else if (current_architecture == SPARC_OPCODE_ARCH_V9_MCST)
elf_elfheader (stdoutput)->e_flags |= (EF_SPARC_SUN_US1
| EF_SPARC_SUN_US3
| EF_SPARC_MCST);
}
const char *

115
gas/config/tc-stub.c Normal file
View File

@ -0,0 +1,115 @@
#include "as.h"
#include <stdio.h>
/* All definitions below are needed just to build GAS. */
const char comment_chars[] = "!";
const char line_comment_chars[] = "#";
const char line_separator_chars[] = "{};";
const char EXP_CHARS[] = "eE";
const char FLT_CHARS[] = "rRsSfFdDxXpP";
int md_long_jump_size;
int md_short_jump_size;
const char *md_shortopts = "";
struct option md_longopts[] = {
{"", no_argument, NULL, 0},
};
size_t md_longopts_size = sizeof (md_longopts);
const pseudo_typeS md_pseudo_table[] =
{
{0, 0, 0}
};
void
md_show_usage (FILE *stream ATTRIBUTE_UNUSED)
{
}
int
md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
{
return 0;
}
void
md_begin ()
{
as_fatal (_("this is a stub version of GAS incapable of generating code"));
}
void
md_operand (expressionS * expressionP ATTRIBUTE_UNUSED)
{
}
symbolS *
md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
{
return 0;
}
void
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr ATTRIBUTE_UNUSED;
addressT from_addr ATTRIBUTE_UNUSED;
addressT to_addr ATTRIBUTE_UNUSED;
fragS * frag ATTRIBUTE_UNUSED;
symbolS * to_symbol ATTRIBUTE_UNUSED;
{
}
void
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr ATTRIBUTE_UNUSED;
addressT from_addr ATTRIBUTE_UNUSED;
addressT to_addr ATTRIBUTE_UNUSED;
fragS * frag ATTRIBUTE_UNUSED;
symbolS * to_symbol ATTRIBUTE_UNUSED;
{
}
void
md_assemble (char *str ATTRIBUTE_UNUSED)
{
}
valueT
md_section_align (segT segment ATTRIBUTE_UNUSED, valueT size)
{
return size;
}
char *
md_atof (type, litP, sizeP)
char type ATTRIBUTE_UNUSED;
char *litP ATTRIBUTE_UNUSED;
int *sizeP ATTRIBUTE_UNUSED;
{
return 0;
}
void
md_apply_fix (fixS *fixP ATTRIBUTE_UNUSED, valueT *valP ATTRIBUTE_UNUSED,
segT seg ATTRIBUTE_UNUSED)
{
}
long
md_pcrel_from (fixS *fixP ATTRIBUTE_UNUSED)
{
return 0;
}
arelent *
tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp ATTRIBUTE_UNUSED)
{
return NULL;
}

10
gas/config/tc-stub.h Normal file
View File

@ -0,0 +1,10 @@
#define TARGET_FORMAT "elf64-e2k"
#define TARGET_ARCH bfd_arch_e2k
#define md_number_to_chars number_to_chars_littleendian
#define md_convert_frag(b,s,f) \
as_fatal (_("stub convert_frag\n"))
#define md_estimate_size_before_relax(f,s) \
(as_fatal(_("estimate_size_before_relax called")), 1)

7
gas/config/te-kpda.h Normal file
View File

@ -0,0 +1,7 @@
#include "te-linux.h"
/* Hopefully "obj-format.h" included by "te-linux.h" isn't influenced by
TE_LINUX, is it? */
#undef TE_LINUX
#define TE_KPDA

18
gas/configure vendored
View File

@ -771,6 +771,7 @@ enable_checking
enable_compressed_debug_sections
enable_x86_relax_relocations
enable_elf_stt_common
enable_e2k_opcodes
enable_werror
enable_build_warnings
with_cpu
@ -1426,6 +1427,7 @@ Optional Features:
generate x86 relax relocations by default
--enable-elf-stt-common generate ELF common symbols with STT_COMMON type by
default
--enable-e2k-opcodes enable opcodes for E2K
--enable-werror treat compile warnings as errors
--enable-build-warnings enable build-time compiler warnings
--disable-nls do not use Native Language Support
@ -10987,7 +10989,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10990 "configure"
#line 10992 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11093,7 +11095,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11096 "configure"
#line 11098 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11749,6 +11751,18 @@ fi
using_cgen=no
# Check whether --enable-e2k-opcodes was given.
if test "${enable_e2k_opcodes+set}" = set; then :
enableval=$enable_e2k_opcodes; case "${enableval}" in
yes | no) enable_e2k_opcodes=$enableval ;;
*) as_fn_error "enable-e2k-opcodes option must specify either 'yes' or 'no'" "$LINENO" 5
;;
esac
else
enable_e2k_opcodes=yes
fi
# Set the 'development' global.
. $srcdir/../bfd/development.sh

View File

@ -102,6 +102,16 @@ esac])dnl
using_cgen=no
AC_ARG_ENABLE(e2k-opcodes,
[ --enable-e2k-opcodes enable opcodes for E2K],
[case "${enableval}" in
yes | no) enable_e2k_opcodes=$enableval ;;
*) AC_MSG_ERROR([enable-e2k-opcodes option must specify either 'yes' or 'no'])
;;
esac],
[enable_e2k_opcodes=yes])dnl
AM_BINUTILS_WARNINGS
# Generate a header file

View File

@ -58,6 +58,15 @@ case ${cpu} in
cr16*) cpu_type=cr16 endian=little ;;
crisv32) cpu_type=cris arch=crisv32 ;;
crx*) cpu_type=crx endian=little ;;
e2k)
if test $enable_e2k_opcodes = yes ; then
cpu_type=e2k
else
cpu_type=stub
fi
endian=little
;;
epiphany*) cpu_type=epiphany endian=little ;;
fido) cpu_type=m68k ;;
hppa*) cpu_type=hppa ;;
@ -186,6 +195,10 @@ case ${generic_target} in
d30v-*-*) fmt=elf ;;
dlx-*-*) fmt=elf ;;
e2k-*-linux*) fmt=elf em=linux ;;
e2k-*-kpda) fmt=elf em=kpda ;;
stub-*-linux*) fmt=elf em=linux ;;
epiphany-*-*) fmt=elf ;;
fr30-*-*) fmt=elf ;;

View File

@ -162,6 +162,11 @@ encoding_size (unsigned char encoding)
{
if (encoding == DW_EH_PE_omit)
return 0;
/* Try to use these ones for properly aligned PM PLs and APs for now. */
if (encoding == DW_EH_PE_funcrel || encoding == DW_EH_PE_aligned)
return 16;
switch (encoding & 0x7)
{
case 0:
@ -189,8 +194,17 @@ emit_expr_encoded (expressionS *exp, int encoding, bfd_boolean emit_encoding)
if (encoding == DW_EH_PE_omit)
return;
/* DW_EH_PE_funcrel is processed in some weird way in libgcc. I'm reluctant
to change that. Therefore, I use it internally within GAS to obtain the
proper relocation, which was already done one line above. As for
DW_EH_PE_aligned, libgcc should be capable of extracting both AP and PL
with its help. */
if (emit_encoding)
out_one (encoding);
out_one (encoding != DW_EH_PE_funcrel ? encoding : DW_EH_PE_aligned);
/* Stupidly ensure sufficient alignment for PM-specific encodings. */
if (encoding == DW_EH_PE_funcrel || encoding == DW_EH_PE_aligned)
frag_align (4, 0, 0);
code = tc_cfi_reloc_for_encoding (encoding);
if (code != BFD_RELOC_NONE)
@ -628,9 +642,29 @@ cfi_add_CFA_def_cfa (unsigned regno, offsetT offset)
/* Add a DW_CFA_register record to the CFI data. */
#if 0
extern void my_sleep (void);
void
my_sleep (void)
{
int cont = 1;
while (cont)
sleep (1);
}
#endif /* 0 */
void
cfi_add_CFA_register (unsigned reg1, unsigned reg2)
{
#if 0
if (reg1 != 15 || reg2 != 31)
my_sleep ();
#endif /* 0 */
cfi_add_CFA_insn_reg_reg (DW_CFA_register, reg1, reg2);
}
@ -639,6 +673,11 @@ cfi_add_CFA_register (unsigned reg1, unsigned reg2)
void
cfi_add_CFA_def_cfa_register (unsigned regno)
{
#if 0
if (regno != 30)
my_sleep ();
#endif /* 0 */
cfi_add_CFA_insn_reg (DW_CFA_def_cfa_register, regno);
}
@ -1823,9 +1862,9 @@ static void
output_cie (struct cie_entry *cie, bfd_boolean eh_frame, int align)
{
symbolS *after_size_address, *end_address;
symbolS *aug_start_address, *aug_end_address;
expressionS exp;
struct cfi_insn_data *i;
offsetT augmentation_size;
int enc;
enum dwarf2_format fmt = DWARF2_FORMAT (now_seg);
@ -1876,10 +1915,31 @@ output_cie (struct cie_entry *cie, bfd_boolean eh_frame, int align)
out_uleb128 (cie->return_column);
if (eh_frame)
{
augmentation_size = 1 + (cie->lsda_encoding != DW_EH_PE_omit);
if (cie->per_encoding != DW_EH_PE_omit)
augmentation_size += 1 + encoding_size (cie->per_encoding);
out_uleb128 (augmentation_size); /* Augmentation size. */
if (cie->per_encoding != DW_EH_PE_funcrel)
{
offsetT augmentation_size;
/* As far as I can see 1 is unconditionally reserved here for FDE
encoding output at the very end of the augmentation just before CFI
insns. Another byte may be required to output LSDA encoding. */
augmentation_size = 1 + (cie->lsda_encoding != DW_EH_PE_omit);
/* We may require one byte for personality encoding itself and other
ones for the encoded pointer to personality routine. */
if (cie->per_encoding != DW_EH_PE_omit)
augmentation_size += 1 + encoding_size (cie->per_encoding);
out_uleb128 (augmentation_size); /* Augmentation size. */
}
else
{
aug_start_address = symbol_temp_make ();
aug_end_address = symbol_temp_make ();
exp.X_op = O_subtract;
exp.X_add_symbol = aug_end_address;
exp.X_op_symbol = aug_start_address;
exp.X_add_number = 0;
emit_leb128_expr (&exp, 0);
symbol_set_value_now (aug_start_address);
}
emit_expr_encoded (&cie->personality, cie->per_encoding, TRUE);
@ -1910,7 +1970,12 @@ output_cie (struct cie_entry *cie, bfd_boolean eh_frame, int align)
#endif
cie->fde_encoding = enc;
if (eh_frame)
out_one (enc);
{
out_one (enc);
if (cie->per_encoding == DW_EH_PE_funcrel)
symbol_set_value_now (aug_end_address);
}
if (cie->first)
{
@ -1932,6 +1997,7 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie,
int align)
{
symbolS *after_size_address, *end_address;
symbolS *aug_start_address, *aug_end_address;
expressionS exp;
offsetT augmentation_size;
enum dwarf2_format fmt = DWARF2_FORMAT (now_seg);
@ -2018,12 +2084,30 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie,
exp.X_add_number = 0;
emit_expr (&exp, addr_size);
augmentation_size = encoding_size (fde->lsda_encoding);
if (eh_frame)
out_uleb128 (augmentation_size); /* Augmentation size. */
if (fde->lsda_encoding != DW_EH_PE_aligned)
{
augmentation_size = encoding_size (fde->lsda_encoding);
if (eh_frame)
out_uleb128 (augmentation_size); /* Augmentation size. */
}
else
{
aug_start_address = symbol_temp_make ();
aug_end_address = symbol_temp_make ();
exp.X_op = O_subtract;
exp.X_add_symbol = aug_end_address;
exp.X_op_symbol = aug_start_address;
exp.X_add_number = 0;
emit_leb128_expr (&exp, 0);
symbol_set_value_now (aug_start_address);
}
emit_expr_encoded (&fde->lsda, cie->lsda_encoding, FALSE);
if (fde->lsda_encoding == DW_EH_PE_aligned)
symbol_set_value_now (aug_end_address);
for (; first; first = first->next)
if (CUR_SEG (first) == CUR_SEG (fde))
output_cfi_insn (first);

View File

@ -60,7 +60,7 @@ extern void cfi_add_CFA_restore_state (void);
#define SUPPORT_FRAME_LINKONCE 0
#endif
#ifdef tc_cfi_reloc_for_encoding
#if defined (tc_cfi_reloc_for_encoding) && ! defined (TC_E2K)
#define SUPPORT_COMPACT_EH 1
#else
#define SUPPORT_COMPACT_EH 0

View File

@ -56,6 +56,8 @@ struct expr_symbol_line {
unsigned int line;
};
int hack_for_e2k = 0;
static struct expr_symbol_line *expr_symbol_lines;
/* Build a dummy symbol to hold a complex expression. This is how we
@ -69,7 +71,15 @@ make_expr_symbol (expressionS *expressionP)
symbolS *symbolP;
struct expr_symbol_line *n;
if (expressionP->X_op == O_symbol
/* FIXME: I don't quite understand what this "optimization" is intended to
do. In case `O_add' is constructed for a register and a symbol (e.g.,
`%b[3] + dummy') it replaces the latter (i.e. `O_symbol' expression) with
the underlying `O_constant' used to represent its `X_add_symbol' member.
Taking into account that currently I'm unable to properly recognize symbols
when parsing arguments of instructions unless they are `O_symbol's, undo
it. */
if (hack_for_e2k == 0
&& expressionP->X_op == O_symbol
&& expressionP->X_add_number == 0)
return expressionP->X_add_symbol;
@ -244,6 +254,11 @@ generic_bignum_to_int64 (void)
}
#endif
#ifdef TC_E2K
extern const char *maybe_symbol_ptr;
extern const char *symbol_ptr;
#endif /* TC_E2K */
static void
integer_constant (int radix, expressionS *expressionP)
{
@ -508,6 +523,28 @@ integer_constant (int radix, expressionS *expressionP)
&& input_line_pointer - 1 == suffix)
c = *input_line_pointer++;
/* FIXME: for now stupidly support `UL', `llu', `ull' and `u' C constant
suffixes encountered while assembling the Kernel and binary compiler for
E2K. A more generic approach is required . . . */
if (c == 'U' && input_line_pointer[0] == 'L')
{
c = input_line_pointer[1];
input_line_pointer += 2;
}
else if ((c == 'l' && input_line_pointer[0] == 'l'
&& input_line_pointer[1] == 'u')
|| (c == 'u' && input_line_pointer[0] == 'l'
&& input_line_pointer[1] == 'l'))
{
c = input_line_pointer[2];
input_line_pointer += 3;
}
else if ((c == 'u' && input_line_pointer[0] != 'l')
|| c == 'U')
c = *input_line_pointer++;
#ifndef tc_allow_U_suffix
#define tc_allow_U_suffix 1
#endif
@ -533,6 +570,13 @@ integer_constant (int radix, expressionS *expressionP)
if (LOCAL_LABELS_FB && c == 'b')
{
#ifdef TC_E2K
/* Now that we are certain that this is a reference to 'b' local
label remember its position for the sake of E2K preprocessing
mode. */
symbol_ptr = maybe_symbol_ptr;
#endif /* TC_E2K */
/* Backward ref to local label.
Because it is backward, expect it to be defined. */
/* Construct a local label. */
@ -563,6 +607,13 @@ integer_constant (int radix, expressionS *expressionP)
} /* case 'b' */
else if (LOCAL_LABELS_FB && c == 'f')
{
#ifdef TC_E2K
/* Now that we are certain that this is a reference to 'f' local
label remember its position for the sake of E2K preprocessing
mode. */
symbol_ptr = maybe_symbol_ptr;
#endif /* TC_E2K */
/* Forward reference. Expect symbol to be undefined or
unknown. undefined: seen it before. unknown: never seen
it before.
@ -773,6 +824,12 @@ operand (expressionS *expressionP, enum expr_mode mode)
case '9':
input_line_pointer--;
#ifdef TC_E2K
/* This may turn out to be just a constant, not a reference to a local
'fb' label. Therefore, postpone setting SYMBOL_PTR until you are
absolutely certain. */
maybe_symbol_ptr = input_line_pointer;
#endif /* TC_E2K */
integer_constant ((NUMBERS_WITH_SUFFIX || flag_m68k_mri)
? 0 : 10,
expressionP);
@ -835,9 +892,21 @@ operand (expressionS *expressionP, enum expr_mode mode)
}
else
{
/* The string was only zero. */
expressionP->X_op = O_constant;
expressionP->X_add_number = 0;
/* FIXME: all this is for the sake of these awful `u', `ul{,}',
`lu', `UL' . . . suffixes which may follow this "only zero".
Ensure that they are slurped by `integer_constant ()' and don't
confuse subsequent parsing. */
if (hack_for_e2k != 0)
{
input_line_pointer--;
integer_constant (10, expressionP);
}
else
{
/* The string was only zero. */
expressionP->X_op = O_constant;
expressionP->X_add_number = 0;
}
}
break;
@ -857,6 +926,14 @@ operand (expressionS *expressionP, enum expr_mode mode)
{
/* Parse this as a back reference to label 0. */
input_line_pointer--;
#ifdef TC_E2K
/* As far as I understand, this is a special case of `0b'
symbolic reference. The peculiarity is that such labels are
believed to be decimal, while decimal constants don't normally
start with '0'. */
maybe_symbol_ptr = input_line_pointer;
#endif /* TC_E2K */
integer_constant (10, expressionP);
break;
}
@ -914,6 +991,13 @@ operand (expressionS *expressionP, enum expr_mode mode)
if (is_label)
{
input_line_pointer--;
#ifdef TC_E2K
/* As far as I understand, this is a special case of `0f'
symbolic reference. The peculiarity is that such labels
are believed to be decimal, while decimal constants don't
normally start with '0'. */
maybe_symbol_ptr = input_line_pointer;
#endif /* TC_E2K */
integer_constant (10, expressionP);
break;
}
@ -1344,6 +1428,13 @@ operand (expressionS *expressionP, enum expr_mode mode)
}
#endif
#ifdef TC_E2K
/* As far as I understand, here is the place to remember the start of
a symbol reference without an explicitly specified relocation for
the sake of E2K preprocessing mode. */
symbol_ptr = name;
#endif /* TC_E2K */
symbolP = symbol_find_or_make (name);
/* If we have an absolute symbol or a reg, then we know its
@ -2010,7 +2101,15 @@ expr (int rankarg, /* Larger # is higher rank. */
break;
}
}
else if (resultP->X_op == O_symbol
/* FIXME: this hack lets me prevent `O_add' of two `O_symbol's from being
converted to `O_add' of two underlying `O_constant's when parsing
arguments of LD/ST instructions. In the latter case I'd be unable to
properly recognize the (forbidden) sum of two symbols. I suspect that
it may very well break something when parsing `O_subtract' outside of
instructions . . . */
else if (hack_for_e2k == 0
&& resultP->X_op == O_symbol
&& right.X_op == O_symbol
&& (op_left == O_add
|| op_left == O_subtract

View File

@ -154,6 +154,8 @@ enum expr_mode
expr_defer
};
extern int hack_for_e2k;
/* "result" should be type (expressionS *). */
#define expression(result) expr (0, result, expr_normal)
#define expression_and_evaluate(result) expr (0, result, expr_evaluate)

View File

@ -468,3 +468,13 @@ as_bad_value_out_of_range (const char *prefix,
{
as_internal_value_out_of_range (prefix, value, min, max, file, line, 1);
}
/* These are sinvv's hacks. */
void inc_error (void);
void
inc_error (void)
{
error_count++;
}

View File

@ -60,6 +60,8 @@ config/tc-d30v.c
config/tc-d30v.h
config/tc-dlx.c
config/tc-dlx.h
config/tc-e2k.c
config/tc-e2k.h
config/tc-epiphany.c
config/tc-epiphany.h
config/tc-fr30.c

View File

@ -806,6 +806,10 @@ do_align (unsigned int n, char *fill, unsigned int len, unsigned int max)
record_alignment (now_seg, n - OCTETS_PER_BYTE_POWER);
}
#if 0
extern void my_sleep (void);
#endif /* 0 */
/* We read the file, putting things into a web that represents what we
have been reading. */
void
@ -1083,6 +1087,23 @@ read_a_source_file (const char *name)
if (pop && !pop->poc_handler)
pop = NULL;
#if 0
if (pop
&& pop->poc_name[0] == 'c'
&& pop->poc_name[1] == 'f'
&& pop->poc_name[2] == 'i')
{
if (strcmp (pop->poc_name, "cfi_startproc")
&& strcmp (pop->poc_name, "cfi_endproc")
&& strcmp (pop->poc_name, "cfi_lsda")
&& strcmp (pop->poc_name, "cfi_personality")
&& strcmp (pop->poc_name, "cfi_window_save")
&& strcmp (pop->poc_name, "cfi_register")
&& strcmp (pop->poc_name, "cfi_def_cfa_register"))
my_sleep ();
}
#endif /* 0 */
/* In MRI mode, we may need to insert an
automatic alignment directive. What a hack
this is. */
@ -5271,7 +5292,7 @@ output_big_leb128 (char *p, LITTLENUM_TYPE *bignum, unsigned int size, int sign)
/* Generate the appropriate fragments for a given expression to emit a
leb128 value. SIGN is 1 for sleb, 0 for uleb. */
static void
void
emit_leb128_expr (expressionS *exp, int sign)
{
operatorT op = exp->X_op;

View File

@ -131,6 +131,7 @@ extern void emit_expr_with_reloc (expressionS *exp, unsigned int nbytes,
TC_PARSE_CONS_RETURN_TYPE);
extern void emit_expr_fix (expressionS *, unsigned int, fragS *, char *,
TC_PARSE_CONS_RETURN_TYPE);
extern void emit_leb128_expr (expressionS *exp, int sign);
extern void equals (char *, int);
extern void float_cons (int);
extern void ignore_rest_of_line (void);

View File

@ -173,13 +173,14 @@ diststuff: $(EXTRA_DIST)
TARGETSOURCES = \
i386.cc x86_64.cc sparc.cc powerpc.cc arm.cc arm-reloc-property.cc tilegx.cc \
mips.cc aarch64.cc aarch64-reloc-property.cc s390.cc
mips.cc aarch64.cc aarch64-reloc-property.cc s390.cc e2k.cc
ALL_TARGETOBJS = \
i386.$(OBJEXT) x86_64.$(OBJEXT) sparc.$(OBJEXT) powerpc.$(OBJEXT) \
arm.$(OBJEXT) arm-reloc-property.$(OBJEXT) tilegx.$(OBJEXT) \
mips.$(OBJEXT) aarch64.$(OBJEXT) aarch64-reloc-property.$(OBJEXT) \
s390.$(OBJEXT)
s390.$(OBJEXT) \
e2k.$(OBJEXT)
libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES) $(DEFFILES)
libgold_a_LIBADD = $(LIBOBJS)

View File

@ -609,13 +609,14 @@ DEFFILES = arm-reloc.def aarch64-reloc.def
EXTRA_DIST = yyscript.c yyscript.h
TARGETSOURCES = \
i386.cc x86_64.cc sparc.cc powerpc.cc arm.cc arm-reloc-property.cc tilegx.cc \
mips.cc aarch64.cc aarch64-reloc-property.cc s390.cc
mips.cc aarch64.cc aarch64-reloc-property.cc s390.cc e2k.cc
ALL_TARGETOBJS = \
i386.$(OBJEXT) x86_64.$(OBJEXT) sparc.$(OBJEXT) powerpc.$(OBJEXT) \
arm.$(OBJEXT) arm-reloc-property.$(OBJEXT) tilegx.$(OBJEXT) \
mips.$(OBJEXT) aarch64.$(OBJEXT) aarch64-reloc-property.$(OBJEXT) \
s390.$(OBJEXT)
s390.$(OBJEXT) \
e2k.$(OBJEXT)
libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES) $(DEFFILES)
libgold_a_LIBADD = $(LIBOBJS)

View File

@ -181,6 +181,13 @@ s390x-*-*)
targ_big_endian=true
targ_extra_big_endian=false
;;
e2k-*)
targ_obj=e2k
targ_machine=EM_MCST_ELBRUS
targ_size=64
targ_extra_size=32
targ_big_endian=false
;;
*)
targ_obj=UNKNOWN
;;

873
gold/e2k.cc Normal file
View File

@ -0,0 +1,873 @@
#include "gold.h"
#include <cstdlib>
#include "elfcpp.h"
#include "e2k.h"
#include "output.h"
#include "target.h"
#include "target-reloc.h"
#include "target-select.h"
namespace
{
using namespace gold;
// A class to handle the `.got.plt' section
class Output_data_got_plt_e2k : public Output_section_data_build
{
public:
Output_data_got_plt_e2k(Layout*)
: Output_section_data_build(8)
{ }
protected:
void do_write(Output_file*)
{ }
};
// A class to handle the PLT data.
class Output_data_plt_e2k : public Output_section_data
{
public:
Output_data_plt_e2k(Layout*, Output_data_got_plt_e2k*)
: Output_section_data(8)
{ }
// Add an entry to the PLT
void
add_entry(Symbol_table*, Layout*, Symbol*)
{ }
protected:
void do_write(Output_file*)
{ }
};
template<int size>
class Target_e2k : public Sized_target<size, false>
{
public:
Target_e2k()
: Sized_target<size, false>(&e2k_info),
got_(NULL)
{
}
// Process the relocations to determine unreferenced sections for
// garbage collection.
void
gc_process_relocs(Symbol_table*,
Layout*,
Sized_relobj_file<size, false>*,
unsigned int,
unsigned int,
const unsigned char*,
size_t,
Output_section*,
bool,
size_t,
const unsigned char*)
{
}
// Scan the relocations to look for symbol adjustments.
void
scan_relocs(Symbol_table*,
Layout*,
Sized_relobj_file<size, false>*,
unsigned int,
unsigned int,
const unsigned char*,
size_t,
Output_section*,
bool,
size_t,
const unsigned char*);
// Relocate a section.
void
relocate_section(const Relocate_info<size, false>*,
unsigned int,
const unsigned char*,
size_t,
Output_section*,
bool,
unsigned char*,
typename elfcpp::Elf_types<size>::Elf_Addr,
section_size_type,
const Reloc_symbol_changes*);
// Scan the relocs during a relocatable link.
void
scan_relocatable_relocs(Symbol_table*,
Layout*,
Sized_relobj_file<size, false>*,
unsigned int,
unsigned int,
const unsigned char*,
size_t,
Output_section*,
bool,
size_t,
const unsigned char*,
Relocatable_relocs*)
{
}
// Scan the relocs for --emit-relocs.
void
emit_relocs_scan(Symbol_table*,
Layout*,
Sized_relobj_file<size, false>*,
unsigned int,
unsigned int,
const unsigned char*,
size_t,
Output_section*,
bool,
size_t,
const unsigned char*,
Relocatable_relocs*)
{
}
// Emit relocations for a section.
void
relocate_relocs(const Relocate_info<size, false>*,
unsigned int,
const unsigned char*,
size_t,
Output_section*,
typename elfcpp::Elf_types<size>::Elf_Off,
unsigned char*,
typename elfcpp::Elf_types<size>::Elf_Addr,
section_size_type,
unsigned char*,
section_size_type)
{
}
int64_t
do_tls_offset_for_local(const Relobj*, unsigned int, unsigned int) const
{
return 2 * size / 8;
}
// Return the offset to use for the GOT_INDX'th got entry which is
// for global tls symbol GSYM. Note that unlike `_bfd_e2k_elf_tpoff_base'
// this function returns the value having an opposite sign. Moreover, here we
// probably shouldn't care about subtraction of the output TLS section's VMA
// since unlike LD the generic part of GOLD hasn't taken it into account when
// calculating relocation for a TLS symbol prior to calling us (see
// `Got_entry::write ()').
// FIXME: take care of the output TLS section's alignment here. How am I going
// to get access to it?
int64_t
do_tls_offset_for_global(Symbol*, unsigned int) const
{
return 2 * size / 8;
}
protected:
void
do_adjust_elf_header(unsigned char*, int)
{ }
void
do_function_location(Symbol_location*) const
{ }
private:
bool has_got_section() const
{ return this->got_ != NULL; }
// Get the GOT section, creating it if necessary
Output_data_got<size, false>*
got_section(Symbol_table*, Layout*);
// Create the PLT section.
void
make_plt_section(Symbol_table*, Layout*);
// Create a PLT entry for a global symbol
void
make_plt_entry(Symbol_table* symtab, Layout* layout,
Symbol* gsym);
// Return the address of the GOT.
uint64_t
got_address() const
{
// FIXME: what is explicit usage of `this->' needed for?
if (this->got_ == NULL)
return 0;
return this->got_->address ();
}
Output_data_plt_e2k*
make_data_plt(Layout* layout, Output_data_got_plt_e2k* got_plt)
{
return new Output_data_plt_e2k(layout, got_plt);
}
// The class which scans relocations.
class Scan
{
public:
void
local(Symbol_table*, Layout*, Target_e2k*,
Sized_relobj_file<size, false>*,
unsigned int,
Output_section*,
const elfcpp::Rela<size, false>&, unsigned int,
const elfcpp::Sym<size, false>&,
bool);
void
global(Symbol_table*, Layout*, Target_e2k*,
Sized_relobj_file<size, false>*,
unsigned int,
Output_section*,
const elfcpp::Rela<size, false>&, unsigned int,
Symbol*);
private:
// FIXME: what can `static' mean for a private class member?
static void
unsupported_reloc_local(
Sized_relobj_file<size, false>*,
unsigned int);
static void
unsupported_reloc_global(Sized_relobj_file<size, false>*,
unsigned int r_type,
Symbol*);
};
// The class which implements a relocation.
class Relocate
{
public:
Relocate ()
{ }
// Do a relocation. Return false if the caller should not issue
// any warnings about this relocation.
bool
relocate(const Relocate_info<size, false> *,
unsigned int,
Target_e2k*,
Output_section*,
size_t,
const unsigned char *preloc,
const Sized_symbol<size>*,
const Symbol_value<size>*,
unsigned char*,
typename elfcpp::Elf_types<size>::Elf_Addr,
section_size_type);
};
// Information about this specific target which we pass to the
// general Target structure.
static const Target::Target_info e2k_info;
// The types of GOT entries needed for this platform.
enum Got_type
{
GOT_TYPE_STANDARD = 0, // GOT entry for a regular symbol
GOT_TYPE_TLS_IE = 1, // GOT entry for TLS IE model
};
// The GOT section.
Output_data_got<size, false>* got_;
// The PLT section.
Output_data_plt_e2k* plt_;
// The GOT PLT section.
Output_data_got_plt_e2k* got_plt_;
};
template<>
const Target::Target_info Target_e2k<32>::e2k_info =
{
32, // size
false, // is_big_endian
elfcpp::EM_MCST_ELBRUS, // machine_code
false, // has_make_symbol
false, // has_resolve
false, // has_code_fill
false, // is_default_stack_executable
false, // can_icf_inline_merge_sections
'\0', // wrap_char
"/lib32/ld-linux.so.2", // dynamic_linker
0x00010000, // default_text_segment_address
64 * 1024, // abi_pagesize (overridable by -z max-page-size)
4 * 1024, // common_pagesize (overridable by -z common-page-size)
false, // isolate_execinstr
0, // rosegment_gap
elfcpp::SHN_UNDEF, // small_common_shndx
elfcpp::SHN_UNDEF, // large_common_shndx
0, // small_common_section_flags
0, // large_common_section_flags
NULL, // attributes_section
NULL, // attributes_vendor
"_start", // entry_symbol_name
32, // hash_entry_size
};
template<>
const Target::Target_info Target_e2k<64>::e2k_info =
{
64, // size
false, // is_big_endian
elfcpp::EM_MCST_ELBRUS, // machine_code
false, // has_make_symbol
false, // has_resolve
false, // has_code_fill
false, // is_default_stack_executable
false, // can_icf_inline_merge_sections
'\0', // wrap_char
"/lib64/ld-linux.so.2", // dynamic_linker
0x00010000, // default_text_segment_address
64 * 1024, // abi_pagesize (overridable by -z max-page-size)
4 * 1024, // common_pagesize (overridable by -z common-page-size)
false, // isolate_execinstr
0, // rosegment_gap
elfcpp::SHN_UNDEF, // small_common_shndx
elfcpp::SHN_UNDEF, // large_common_shndx
0, // small_common_section_flags
0, // large_common_section_flags
NULL, // attributes_section
NULL, // attributes_vendor
"_start", // entry_symbol_name
64, // hash_entry_size
};
// Class for performing E2K-specific sophisticated relocations for which
// standard Relocate_functions class turns out to be unsuitable.
template<int size>
class E2k_relocate_functions
{
public:
static void
islocal(unsigned char* view)
{
typedef typename elfcpp::Swap<32, false>::Valtype Valtype;
Valtype* wv = reinterpret_cast<Valtype*>(view);
Valtype val = elfcpp::Swap<32, false>::readval(wv);
Valtype reloc;
// Zero out ALS.src1 bits. Don't I zero too many bits in fact? It would
// suffice to toggle the least significant one in fact for the sake of this
// relocation.
val &= ~(0xff << 16);
// For now pretend that the symbol is always a subject for a "local"
// call.
reloc = 0xc1 << 16;
elfcpp::Swap<32, false>::writeval(wv, val | reloc);
}
static void
islocal32(unsigned char* view)
{
typedef typename elfcpp::Swap<32, false>::Valtype Valtype;
Valtype* wv = reinterpret_cast<Valtype*>(view);
// For now pretend that the symbol is always a subject for a "local"
// call.
elfcpp::Swap<32, false>::writeval(wv, 0x1);
}
static void
disp(unsigned char* view,
const Sized_relobj_file<size, false>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
{
typedef typename elfcpp::Swap<32, false>::Valtype Valtype;
Valtype* wv = reinterpret_cast<Valtype*>(view);
Valtype val = elfcpp::Swap<32, false>::readval(wv);
Valtype reloc = ((psymval->value(object, addend) - address)
>> 3);
// Zero out 4 most significant bits. This is crucial if displacement
// turns out to be negative. Can't I use an unsigned type when performing
// right shift instead?
reloc &= ~(0xf << 28);
val &= (0xf << 28);
elfcpp::Swap<32, false>::writeval(wv, val | reloc);
}
static void
abs_lit(unsigned char* view,
const Sized_relobj_file<size, false>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
typedef typename elfcpp::Swap<64, false>::Valtype Valtype;
Valtype reloc = psymval->value(object, addend);
reloc = ((reloc & 0xffffffff) << 32) | (reloc >> 32);
elfcpp::Swap<64, false>::writeval(view, reloc);
}
static void
pc_lit(unsigned char* view,
const Sized_relobj_file<size, false>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
{
typedef typename elfcpp::Swap<64, false>::Valtype Valtype;
Valtype reloc = psymval->value(object, addend) - address;
reloc = ((reloc & 0xffffffff) << 32) | (reloc >> 32);
elfcpp::Swap<64, false>::writeval(view, reloc);
}
};
template<int size>
Output_data_got<size, false>*
Target_e2k<size>::got_section(Symbol_table* symtab,
Layout* layout)
{
if (this->got_ == NULL)
{
gold_assert(symtab != NULL && layout != NULL);
// When using `-z now', we can tread `.got.plt' as a relro section.
// Without `-z now', it is modified after program startup by lazy
// PLT relocations.
bool is_got_plt_relro = parameters->options().now();
Output_section_order got_order = (is_got_plt_relro
? ORDER_RELRO
: ORDER_RELRO_LAST);
Output_section_order got_plt_order = (is_got_plt_relro
? ORDER_RELRO
: ORDER_NON_RELRO_FIRST);
this->got_ = new Output_data_got<size, false>();
layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
(elfcpp::SHF_ALLOC
| elfcpp::SHF_WRITE),
this->got_, got_order, true);
this->got_plt_ = new Output_data_got_plt_e2k(layout);
layout->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS,
(elfcpp::SHF_ALLOC | elfcpp::SHF_WRITE),
this->got_plt_, got_plt_order,
is_got_plt_relro);
// The first three entries are reserved for the link-time address of the
// `.dynamic' section (filled in by ld) and runtime addresses of the link
// map and `_dl_fixup ()' (initialized by ld.so).
this->got_plt_->set_current_data_size(3 * size / 8);
if (!is_got_plt_relro)
{
// These entries can go into the relro segment.
layout->increase_relro(3 * size / 8);
}
// Define _GLOBAL_OFFSET_TABLE_ at the start of the `.got.plt' section.
symtab->define_in_output_data("_GLOBAL_OFFSET_TABLE_", NULL,
Symbol_table::PREDEFINED,
this->got_plt_,
0, 0, elfcpp::STT_OBJECT,
elfcpp::STB_LOCAL,
elfcpp::STV_HIDDEN, 0,
false, false);
}
return this->got_;
}
// Create the PLT section
template<int size>
void
Target_e2k<size>::make_plt_section(Symbol_table* symtab, Layout* layout)
{
if (this->plt_ == NULL)
{
// Create the GOT sections first.
this->got_section(symtab, layout);
this->plt_ = this->make_data_plt(layout, this->got_plt_);
}
}
// Create a PLT entry for a global symbol
template<int size>
void
Target_e2k<size>::make_plt_entry(Symbol_table* symtab, Layout* layout,
Symbol* gsym)
{
if (gsym->has_plt_offset())
return;
if (this->plt_ == NULL)
this->make_plt_section(symtab, layout);
this->plt_->add_entry(symtab, layout, gsym);
}
// Report an unsupported relocation against a local symbol.
template<int size>
void
Target_e2k<size>::Scan::unsupported_reloc_local(
Sized_relobj_file<size, false>* object,
unsigned int r_type)
{
gold_error(_("%s: unsupported reloc %u against local symbol"),
object->name().c_str(), r_type);
}
// Scan a relocation for a local symbol.
template<int size>
void
Target_e2k<size>::Scan::local(
Symbol_table* symtab,
Layout* layout,
Target_e2k* target,
Sized_relobj_file<size, false>* object,
unsigned int,
Output_section*,
const elfcpp::Rela<size, false>& rela,
unsigned int r_type,
const elfcpp::Sym<size, false>&,
bool)
{
switch (r_type)
{
case elfcpp::R_E2K_32_ABS:
case elfcpp::R_E2K_32_PC:
case elfcpp::R_E2K_64_ABS:
case elfcpp::R_E2K_64_ABS_LIT:
case elfcpp::R_E2K_64_PC_LIT:
break;
case elfcpp::R_E2K_TLS_IE:
{
Output_data_got<size, false>* got;
unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
got = target->got_section(symtab, layout);
got->add_local_tls(object, r_sym, GOT_TYPE_TLS_IE);
}
break;
case elfcpp::R_E2K_64_TLS_LE:
case elfcpp::R_E2K_GOT:
case elfcpp::R_E2K_GOTOFF:
case elfcpp::R_E2K_DISP:
case elfcpp::R_E2K_GOTPLT:
case elfcpp::R_E2K_ISLOCAL:
case elfcpp::R_E2K_ISLOCAL32:
break;
default:
unsupported_reloc_local(object, r_type);
break;
}
}
// Report an unsupported relocation against a global symbol.
template<int size>
void
Target_e2k<size>::Scan::unsupported_reloc_global(
Sized_relobj_file<size, false>* object,
unsigned int r_type,
Symbol* gsym)
{
gold_error(_("%s: unsupported reloc %u against global symbol %s"),
object->name().c_str(), r_type, gsym->demangled_name().c_str());
}
// Scan a relocation for a global symbol.
template<int size>
void
Target_e2k<size>::Scan::global(
Symbol_table* symtab,
Layout* layout,
Target_e2k* target,
Sized_relobj_file<size, false>* object,
unsigned int,
Output_section*,
const elfcpp::Rela<size, false>&,
unsigned int r_type,
Symbol* gsym)
{
if (!target->has_got_section()
&& strcmp (gsym->name(), "_GLOBAL_OFFSET_TABLE_") == 0)
target->got_section(symtab, layout);
switch (r_type)
{
case elfcpp::R_E2K_32_ABS:
case elfcpp::R_E2K_32_PC:
case elfcpp::R_E2K_64_ABS:
case elfcpp::R_E2K_64_ABS_LIT:
case elfcpp::R_E2K_64_PC_LIT:
break;
case elfcpp::R_E2K_TLS_IE:
{
Output_data_got<size, false>* got;
got = target->got_section(symtab, layout);
got->add_global_tls(gsym, GOT_TYPE_TLS_IE);
}
break;
case elfcpp::R_E2K_64_TLS_LE:
break;
case elfcpp::R_E2K_GOT:
{
Output_data_got<size, false>* got;
got = target->got_section(symtab, layout);
got->add_global(gsym, GOT_TYPE_STANDARD);
}
break;
case elfcpp::R_E2K_GOTOFF:
break;
case elfcpp::R_E2K_DISP:
if (gsym->needs_plt_entry())
target->make_plt_entry(symtab, layout, gsym);
break;
case elfcpp::R_E2K_GOTPLT:
case elfcpp::R_E2K_ISLOCAL:
case elfcpp::R_E2K_ISLOCAL32:
break;
default:
unsupported_reloc_global(object, r_type, gsym);
break;
}
}
// Scan relocations for a section.
template <int size>
void
Target_e2k<size>::scan_relocs(
Symbol_table* symtab,
Layout* layout,
Sized_relobj_file<size, false>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
size_t reloc_count,
Output_section* output_section,
bool needs_special_offset_handling,
size_t local_symbol_count,
const unsigned char* plocal_symbols)
{
typedef Target_e2k<size> E2k;
typedef typename Target_e2k<size>::Scan Scan;
typedef gold::Default_classify_reloc<elfcpp::SHT_RELA, size, false>
Classify_reloc;
if (sh_type == elfcpp::SHT_REL)
{
gold_error (_("%s: unsupported REL reloc section"),
object->name().c_str());
return;
}
gold::scan_relocs<size, false, E2k, Scan, Classify_reloc>(
symtab,
layout,
this,
object,
data_shndx,
prelocs,
reloc_count,
output_section,
needs_special_offset_handling,
local_symbol_count,
plocal_symbols);
}
// Perform a relocation.
template<int size>
bool
Target_e2k<size>::Relocate::relocate(
const Relocate_info<size, false>* relinfo,
unsigned int,
Target_e2k* target,
Output_section*,
size_t relnum,
const unsigned char *preloc,
const Sized_symbol<size>* gsym,
const Symbol_value<size>* psymval,
unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr address,
section_size_type)
{
/* The next two variables used to be parameters to this function. */
const elfcpp::Rela<size, false> rela(preloc);
unsigned int r_type = elfcpp::elf_r_type<size>(rela.get_r_info());
typedef E2k_relocate_functions<size> Reloc;
const Sized_relobj_file<size, false>* object = relinfo->object;
typename elfcpp::Elf_types<size>::Elf_Addr addend = rela.get_r_addend();
switch (r_type)
{
case elfcpp::R_E2K_64_ABS:
Relocate_functions<size, false>::rela64(view, object, psymval, addend);
break;
case elfcpp::R_E2K_32_ABS:
Relocate_functions<size, false>::rela32(view, object, psymval, addend);
break;
case elfcpp::R_E2K_32_PC:
case elfcpp::R_E2K_64_ABS_LIT:
Reloc::abs_lit(view, object, psymval, addend);
break;
case elfcpp::R_E2K_64_PC_LIT:
Reloc::pc_lit(view, object, psymval, addend, address);
break;
case elfcpp::R_E2K_TLS_IE:
{
unsigned int got_offset;
if (gsym != NULL)
got_offset = gsym->got_offset(GOT_TYPE_TLS_IE);
else
{
unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
got_offset = object->local_got_offset(r_sym, GOT_TYPE_TLS_IE);
}
Relocate_functions<size,false>::rela32(view, got_offset, addend);
}
break;
case elfcpp::R_E2K_64_TLS_LE:
break;
case elfcpp::R_E2K_GOT:
{
unsigned int got_offset;
got_offset = gsym->got_offset(GOT_TYPE_STANDARD);
Relocate_functions<size,false>::rela32(view, got_offset, addend);
}
break;
case elfcpp::R_E2K_GOTOFF:
{
unsigned int got_offset;
got_offset = psymval->value(object, 0) - target->got_address ();
Relocate_functions<size,false>::rela32(view, got_offset, addend);
}
break;
case elfcpp::R_E2K_DISP:
Reloc::disp(view, object, psymval, addend, address);
break;
case elfcpp::R_E2K_GOTPLT:
break;
case elfcpp::R_E2K_ISLOCAL:
Reloc::islocal(view);
break;
case elfcpp::R_E2K_ISLOCAL32:
Reloc::islocal32(view);
break;
default:
gold_error_at_location(relinfo, relnum, rela.get_r_offset(),
_("unexpected reloc %u in object file"),
r_type);
}
return true;
}
// Relocate section data.
template<int size>
void
Target_e2k<size>::relocate_section(
const Relocate_info<size, false> *relinfo,
unsigned int sh_type,
const unsigned char *prelocs,
size_t reloc_count,
Output_section *output_section,
bool needs_special_offset_handling,
unsigned char *view,
typename elfcpp::Elf_types<size>::Elf_Addr address,
section_size_type view_size,
const Reloc_symbol_changes *reloc_symbol_changes)
{
typedef Target_e2k<size> E2k;
typedef gold::Default_classify_reloc<elfcpp::SHT_RELA, size, false>
Classify_reloc;
gold_assert(sh_type == elfcpp::SHT_RELA);
gold::relocate_section<size, false, E2k, E2k::Relocate,
gold::Default_comdat_behavior, Classify_reloc>(
relinfo,
this,
prelocs,
reloc_count,
output_section,
needs_special_offset_handling,
view,
address,
view_size,
reloc_symbol_changes);
}
// The selector for E2K object files.
template<int size>
class Target_selector_e2k : public Target_selector
{
public:
Target_selector_e2k()
: Target_selector(elfcpp::EM_MCST_ELBRUS, size, false,
(size == 64 ? "elf64-e2k" : "elf32-e2k"),
(size == 64 ? "elf64_e2k" : "elf32_e2k"))
{ }
virtual Target*
do_instantiate_target()
{ return new Target_e2k<size>(); }
};
Target_selector_e2k<32> target_selector_e2k32;
Target_selector_e2k<64> target_selector_e2k64;
} // End anonymous namespace.

View File

@ -207,7 +207,7 @@ So instead we use the macro below and test it against specific values. */
a function pointer. Format attributes were allowed on function
pointers as of gcc 3.1. */
#ifndef ATTRIBUTE_FPTR_PRINTF
# if (GCC_VERSION >= 3001)
# if (GCC_VERSION >= 3001) && (!defined __LCC__)
# define ATTRIBUTE_FPTR_PRINTF(m, n) ATTRIBUTE_PRINTF(m, n)
# else
# define ATTRIBUTE_FPTR_PRINTF(m, n)

View File

@ -75,6 +75,7 @@
#define ELFOSABI_FENIXOS 16 /* FenixOS */
#define ELFOSABI_CLOUDABI 17 /* Nuxi CloudABI */
#define ELFOSABI_OPENVOS 18 /* Stratus Technologies OpenVOS */
#define ELFOSABI_KPDA 30 /* KPDA ABI */
#define ELFOSABI_C6000_ELFABI 64 /* Bare-metal TMS320C6000 */
#define ELFOSABI_C6000_LINUX 65 /* Linux TMS320C6000 */
@ -155,6 +156,7 @@
#define EM_H8_300H 47 /* Renesas (formerly Hitachi) H8/300H */
#define EM_H8S 48 /* Renesas (formerly Hitachi) H8S */
#define EM_H8_500 49 /* Renesas (formerly Hitachi) H8/500 */
#define EM_E2K_OLD 49 /* Old E2K arch code (rather confusing) */
#define EM_IA_64 50 /* Intel IA-64 Processor */
#define EM_MIPS_X 51 /* Stanford MIPS-X */
#define EM_COLDFIRE 52 /* Motorola Coldfire */
@ -339,6 +341,8 @@
#define EM_LANAI 244 /* Lanai 32-bit processor. */
#define EM_BPF 247 /* Linux BPF in-kernel virtual machine. */
#define EM_ELCORE 0x2718 /* Elvees multicore DSP architecture */
/* If it is necessary to assign new unofficial EM_* values, please pick large
random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
with official or non-GNU unofficial values.
@ -665,6 +669,10 @@
#define NT_SPU 1
/* Values of note segment descriptor types for object files on
MCST systems. Note name is "MCST". */
#define NT_MAGIC 1
/* Values of note segment descriptor types for object files. */
#define NT_VERSION 1 /* Contains a version string. */

164
include/elf/e2k.h Normal file
View File

@ -0,0 +1,164 @@
/* E2k ELF support for BFD.
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2008, 2009
Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _ELF_E2K_H
#define _ELF_E2K_H
#include "elf/reloc-macros.h"
/* Relocation types on E2K are assigned their values according to the
following logic: */
START_RELOC_NUMBERS (elf_e2k_reloc_type)
/* 32-bit ones. */
RELOC_NUMBER (R_E2K_32_ABS, 0)
RELOC_NUMBER (R_E2K_32_PC, 2)
/* A couple of bogus 32-bit relocations for Protected Mode. */
RELOC_NUMBER (R_E2K_AP_GOT, 3)
RELOC_NUMBER (R_E2K_PL_GOT, 4)
/* 32-bit ones. */
RELOC_NUMBER (R_E2K_32_JMP_SLOT, 8)
RELOC_NUMBER (R_E2K_32_COPY, 9)
RELOC_NUMBER (R_E2K_32_RELATIVE, 10)
RELOC_NUMBER (R_E2K_32_IRELATIVE, 11)
RELOC_NUMBER (R_E2K_32_SIZE, 12)
/* 64-bit ones. */
RELOC_NUMBER (R_E2K_64_ABS, 50)
RELOC_NUMBER (R_E2K_64_ABS_LIT, 51)
RELOC_NUMBER (R_E2K_64_PC_LIT, 54)
RELOC_NUMBER (R_E2K_64_JMP_SLOT, 63)
RELOC_NUMBER (R_E2K_64_COPY, 64)
RELOC_NUMBER (R_E2K_64_RELATIVE, 65)
RELOC_NUMBER (R_E2K_64_RELATIVE_LIT, 66)
RELOC_NUMBER (R_E2K_64_IRELATIVE, 67)
RELOC_NUMBER (R_E2K_64_SIZE, 68)
RELOC_NUMBER (R_E2K_64_GOTOFF, 69)
/* Because of the originally stupid order of assigning numbers to relocations
we have reached the upper border for pure 64-bit ones. To avoid possible
collisions with pure 32-bit relocations I prefer to go on with the
increasing sequence of numbers starting from 256 rather than with the
decreasing one starting from 49 (see Bug #91797, Comment #3). Note that
this will make it impossible to use these relocations in 32-bit mode, but
they shouldn't be intended for that in fact . . . */
RELOC_NUMBER (R_E2K_64_GOTOFF_LIT, 256)
/* All TLS-specific 32, 64-bit and common relocations are grouped here,
which is rather inconsistent. */
RELOC_NUMBER (R_E2K_TLS_GDMOD, 70)
RELOC_NUMBER (R_E2K_TLS_GDREL, 71)
RELOC_NUMBER (R_E2K_TLS_IE, 74)
RELOC_NUMBER (R_E2K_32_TLS_LE, 75)
RELOC_NUMBER (R_E2K_64_TLS_LE, 76)
RELOC_NUMBER (R_E2K_TLS_32_DTPMOD, 80)
RELOC_NUMBER (R_E2K_TLS_32_DTPREL, 81)
RELOC_NUMBER (R_E2K_TLS_64_DTPMOD, 82)
RELOC_NUMBER (R_E2K_TLS_64_DTPREL, 83)
RELOC_NUMBER (R_E2K_TLS_TPOFF32, 84)
RELOC_NUMBER (R_E2K_TLS_TPOFF64, 85)
/* These two are for protected mode dynamic linker. */
RELOC_NUMBER (R_E2K_AP, 100)
RELOC_NUMBER (R_E2K_PL, 101)
/* Common relocations for 32 and 64-bit modes. */
RELOC_NUMBER (R_E2K_GOT, 108)
RELOC_NUMBER (R_E2K_GOTOFF, 109)
RELOC_NUMBER (R_E2K_DISP, 110)
RELOC_NUMBER (R_E2K_PREF, 111)
RELOC_NUMBER (R_E2K_NONE, 112)
RELOC_NUMBER (R_E2K_GOTPLT, 114)
RELOC_NUMBER (R_E2K_ISLOCAL, 115)
RELOC_NUMBER (R_E2K_ISLOCAL32, 118)
END_RELOC_NUMBERS (R_E2K_max)
/* Processor specific flags for the ELF header e_flags field. */
#define EF_E2K_IPD 3
#define EF_E2K_X86APP 4
#define EF_E2K_4MB_PAGES 8
#define EF_E2K_INCOMPAT 16
#define EF_E2K_PM 32
/* Three bit E2K machine type field. */
#define EF_E2K_MACH_TO_OLD_FLAG(x) ((x) << 28)
#define EF_E2K_OLD_FLAG_TO_MACH(x) (((x) >> 28) & 7)
#define EF_E2K_MACH_TO_FLAG(x) ((x) << 24)
#define EF_E2K_FLAG_TO_MACH(x) (((x) >> 24) & 255)
/* Various CPU types. */
#define E_E2K_MACH_BASE 0
#define E_E2K_MACH_EV1 1
#define E_E2K_MACH_EV2 2
#define E_E2K_MACH_EV3 3
#define E_E2K_MACH_EV4 4
#define E_E2K_MACH_EV5 5
#define E_E2K_MACH_EV6 6
/* Values 16, 17 and 18 used to be reserved for `E_E2K_MACH_CUBE_{1,2,3}'
respectively, which have never been used in ELF files in practice. However,
they can't be reused right now because they are recognized in all Kernel
versions installed on many E2K hosts all over the World and at MCST.
Otherwise, it would be possible to mistakenly execute ELFs for `elbrus-{8c,
1c+}' at respective iterations of `elbrus-2c+'. Reuse them a few years later
after they are eliminated from the Kernel. */
#define E_E2K_MACH_8C 19
#define E_E2K_MACH_1CPLUS 20
/* E2K-specific program header types. */
#define PT_E2K_TAG (PT_LOPROC + 0)
enum
{
/* Defective "prior to Bug #60151" lazy binding implementation which requires
additional fixup of all PLT entries. It's not used starting with this
version of binutils. */
DT_E2K_LAZY_DEFECTIVE = DT_LOPROC,
DT_E2K_LAZY,
/* This dynamic tag marks objects with lazy binding implementation requiring
no modification of the text segment at runtime. */
DT_E2K_LAZY_GOT = DT_LOPROC + 3,
/* There's no standard DT-entry intended to hold the size of `.got'. This one
is named by analogy with DT_PLTGOT holding the address of this section.
Its value is inherited from binutils-2.18 where numerous entries used to
be reserved for C++ hardware support. */
DT_PLTGOTSZ = DT_LOPROC + 0x101b,
/* This entry is used to obtain PL of `__selfinit ()' in the containing
dynamic object. */
DT_INIT_GOT,
DT_EXPORT_PL,
DT_EXPORT_PLSZ,
DT_REAL_PLTGOT,
};
#endif /* _ELF_E2K_H */

53
include/elf/elcore.h Normal file
View File

@ -0,0 +1,53 @@
/* This file holds definitions specific to the ELCORE ELF */
#ifndef _ELF_ELCORE_H
#define _ELF_ELCORE_H
#include "elf/reloc-macros.h"
/* Relocations. */
START_RELOC_NUMBERS (elf_elcore_reloc_type)
RELOC_NUMBER (R_ELCORE_NONE, 200)
RELOC_NUMBER (R_ELCORE_I5, 201)
RELOC_NUMBER (R_ELCORE_I16, 202)
RELOC_NUMBER (R_ELCORE_I16PC, 203)
RELOC_NUMBER (R_ELCORE_S16, 204)
RELOC_NUMBER (R_ELCORE_S16PC, 205)
RELOC_NUMBER (R_ELCORE_I32, 206)
RELOC_NUMBER (R_ELCORE_I5_FAKE, 207)
RELOC_NUMBER (R_ELCORE_I16_FAKE, 208)
RELOC_NUMBER (R_ELCORE_I16PC_FAKE, 209)
RELOC_NUMBER (R_ELCORE_S16_FAKE, 210)
RELOC_NUMBER (R_ELCORE_S16PC_FAKE, 211)
RELOC_NUMBER (R_ELCORE_I32_FAKE, 212)
END_RELOC_NUMBERS (R_ELCORE_max)
/* Processor specific flags for the ELF header e_flags field. */
/* Four bit ... machine type field. */
/* Various CPU types. */
/* Leave bits 0xf0 alone in case we ever have more than 16 cpu types.
Highly unlikely, but what the heck. */
/* File contains position independent code. */
#define SHN_DSP_COMMON_00 SHN_LORESERVE
#define SHN_DSP_COMMON_01 (SHN_LORESERVE + 1)
#define SHN_DSP_COMMON_02 (SHN_LORESERVE + 2)
#define SHN_DSP_COMMON_03 (SHN_LORESERVE + 3)
#define SHN_DSP_COMMON_04 (SHN_LORESERVE + 4)
#define SHN_DSP_COMMON_05 (SHN_LORESERVE + 5)
#define SHN_DSP_COMMON_06 (SHN_LORESERVE + 6)
#define SHN_DSP_COMMON_07 (SHN_LORESERVE + 7)
#define SHN_DSP_COMMON_08 (SHN_LORESERVE + 8)
#define SHN_DSP_COMMON_09 (SHN_LORESERVE + 9)
#define SHN_DSP_COMMON_10 (SHN_LORESERVE + 10)
#define SHN_DSP_COMMON_11 (SHN_LORESERVE + 11)
#define SHN_DSP_COMMON_12 (SHN_LORESERVE + 12)
#define SHN_DSP_COMMON_13 (SHN_LORESERVE + 13)
#define SHN_DSP_COMMON_14 (SHN_LORESERVE + 14)
#define SHN_DSP_COMMON_15 (SHN_LORESERVE + 15)
#endif /* _ELF_ELCORE_H */

View File

@ -31,6 +31,7 @@
#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */
#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */
#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */
#define EF_SPARC_MCST 0x001000 /* MCST Ultra extensions */
#define EF_SPARC_LEDATA 0x800000 /* little endian data */
@ -236,6 +237,12 @@ enum
#define ELF_SPARC_HWCAP_CBCOND 0x10000000 /* Compare and Branch insns */
#define ELF_SPARC_HWCAP_CRC32C 0x20000000 /* CRC32C insn */
/* I doubt that this one should be visible to the outer world. At first it'll
be used internally by GAS. */
#define ELF_SPARC_HWCAP_R1000 0x40000000
#define ELF_SPARC_HWCAP_SAPPHIRE \
0x80000000 /* MCST R2000 also known as Sapphire */
#define ELF_SPARC_HWCAP2_FJATHPLUS 0x00000001 /* Fujitsu Athena+ */
#define ELF_SPARC_HWCAP2_VIS3B 0x00000002 /* Subset of VIS3 present on sparc64 X+ */
#define ELF_SPARC_HWCAP2_ADP 0x00000004 /* Application Data Protection */

View File

@ -196,7 +196,19 @@ SET (GDB_EXC_BREAKPOINT, 150, "EXC_BREAKPOINT", "Breakpoint")
SET (GDB_SIGNAL_LIBRT, 151, "SIGLIBRT", "librt internal signal")
/* I don't know what this signal is actually used for, but it's defined
at E2k. */
SET (GDB_SIGNAL_RESTART, 152, "SIGRESTART", "SIGRESTART E2k-specific signal")
/* The latter three signals are used by E2k binary compiler. */
SET (GDB_SIGNAL_SRP, 153, "SIGSRP", "SRP signal for E2k binary compiler")
SET (GDB_SIGNAL_MLT, 154, "SIGMLT", "MLT signal for E2k binary compiler")
SET (GDB_SIGNAL_BIN, 155, "SIGBIN", "BIN signal for E2k binary compiler")
SET (GDB_SIGNAL_STKFLT, 156, "SIGSTKFLT", "Coprocessor stack error")
/* If you are adding a new signal, add it just above this comment. */
/* Last and unused enum value, for sizing arrays, etc. */
SET (GDB_SIGNAL_LAST, 152, NULL, "GDB_SIGNAL_LAST")
SET (GDB_SIGNAL_LAST, 157, NULL, "GDB_SIGNAL_LAST")

555
include/opcode/e2k.h Normal file
View File

@ -0,0 +1,555 @@
#include <sys/types.h>
#define COMMON_PART \
const char *name; \
int (* parse_args) (char **, const struct e2k_opcode_templ *); \
const char * (* merge) (struct e2k_opcode_templ *, const struct e2k_opcode_templ *)
#define ALOPF1 1
#define ALOPF2 2
#define ALOPF3 3
#define ALOPF7 4
#define ALOPF8 5
#define ALOPF10 6
#define ALOPF11 7
#define ALOPF11_LIT8 8
#define ALOPF11_MERGE 9
#define ALOPF12 10
#define ALOPF12_PSHUFH 11
#define ALOPF12_IBRANCHD 12
#define ALOPF12_ICALLD 13
#define ALOPF13 14
#define ALOPF15 15
#define ALOPF16 16
#define ALOPF21 17
#define ALOPF21_MERGE 18
#define ALOPF22 19
#define MERGE 20
#define MMURR 21
#define MMURW 22
#define AAURR 23
#define AAURW 24
#define ALOPF17 25
#define ALF_PART \
u_int8_t alopf; \
int need_mas; \
u_int8_t opc; \
int allowed_channels[6]
#define MAS 1
#define NO_MAS 0
/* ALES.opc2 values. See B.1.2 in iset.single. */
#define EXT 0x1
#define EXT1 0x2
#define EXT2 0x3
#define FLB 0x4
#define FLH 0x5
#define FLW 0x6
#define FLD 0x7
#define ICMB0 0x8
#define ICMB1 0x9
#define ICMB2 0xA
#define ICMB3 0xB
#define FCMB0 0xC
#define FCMB1 0xD
#define PFCMB0 0XE
#define PFCMB1 0xF
#define LCMBD0 0x10
#define LCMBD1 0x11
#define LCMBQ0 0x12
#define LCMBQ1 0x13
#define QPFCMB0 0x16
#define QPFCMB1 0x17
/* ALES.opce values. */
#define NONE 0xc0
/* It seems that LAS doesn't support %xr's, that's
why everywhere where an x-args is supposed we
use a d-one. */
typedef enum {
SINGLE,
DOUBLE,
QUAD,
QPACKED
} e2k_register_format;
#define ARGS_S SINGLE
#define ARGS_D DOUBLE
#define ARGS_Q QUAD
#define ARGS_P QPACKED
#define ARGS_SS {SINGLE, SINGLE}
#define ARGS_SD {SINGLE, DOUBLE}
#define ARGS_SQ {SINGLE, QUAD}
#define ARGS_DS {DOUBLE, SINGLE}
#define ARGS_DD {DOUBLE, DOUBLE}
#define ARGS_DQ {DOUBLE, QUAD}
#define ARGS_DP {DOUBLE, QPACKED}
#define ARGS_QS {QUAD, SINGLE}
#define ARGS_PS {QPACKED, SINGLE}
#define ARGS_QD {QUAD, DOUBLE}
#define ARGS_PD {QPACKED, DOUBLE}
#define ARGS_QQ {QUAD, QUAD}
#define ARGS_PP {QPACKED, QPACKED}
#define ARGS_SSS {SINGLE, SINGLE, SINGLE}
#define ARGS_SSD {SINGLE, SINGLE, DOUBLE}
#define ARGS_SSQ {SINGLE, SINGLE, QUAD}
#define ARGS_SSP {SINGLE, SINGLE, QPACKED}
#define ARGS_SDD {SINGLE, DOUBLE, DOUBLE}
#define ARGS_DSS {DOUBLE, SINGLE, SINGLE}
#define ARGS_DSD {DOUBLE, SINGLE, DOUBLE}
#define ARGS_DDS {DOUBLE, DOUBLE, SINGLE}
#define ARGS_DDD {DOUBLE, DOUBLE, DOUBLE}
#define ARGS_DDQ {DOUBLE, DOUBLE, QUAD}
#define ARGS_DDP {DOUBLE, DOUBLE, QPACKED}
#define ARGS_DQQ {DOUBLE, QUAD, QUAD}
#define ARGS_DPP {DOUBLE, QPACKED, QPACKED}
#define ARGS_QSS {QUAD, SINGLE, SINGLE}
#define ARGS_QSD {QUAD, SINGLE, DOUBLE}
#define ARGS_QSQ {QUAD, SINGLE, QUAD}
#define ARGS_PSP {QPACKED, SINGLE, QPACKED}
#define ARGS_QSP {QUAD, SINGLE, QPACKED}
#define ARGS_QDQ {QUAD, DOUBLE, QUAD}
#define ARGS_PDP {QPACKED, DOUBLE, QPACKED}
#define ARGS_QQD {QUAD, QUAD, DOUBLE}
#define ARGS_PPD {QPACKED, QPACKED, DOUBLE}
#define ARGS_QQQ {QUAD, QUAD, QUAD}
#define ARGS_PPP {QPACKED, QPACKED, QPACKED}
#define ARGS_SSSS {SINGLE, SINGLE, SINGLE, SINGLE}
#define ARGS_DDSD {DOUBLE, DOUBLE, SINGLE, DOUBLE}
#define ARGS_DDDD {DOUBLE, DOUBLE, DOUBLE, DOUBLE}
#define ARGS_QQQQ {QUAD, QUAD, QUAD, QUAD}
#define ARGS_PPPP {QPACKED, QPACKED, QPACKED, QPACKED}
#define ALL_SINGLE {SINGLE, SINGLE, SINGLE}
#define ALL_DOUBLE {DOUBLE, DOUBLE, DOUBLE}
typedef struct e2k_opcode_templ
{
COMMON_PART;
} e2k_opcode_templ;
typedef struct
{
COMMON_PART;
ALF_PART;
} e2k_alf_opcode_templ;
#define ALF1_PART \
e2k_register_format arg_fmt[3]
typedef struct
{
COMMON_PART;
ALF_PART;
ALF1_PART;
} e2k_alf1_opcode_templ;
#define ALF2_PART \
e2k_register_format arg_fmt[2]; \
u_int8_t opce
typedef struct
{
COMMON_PART;
ALF_PART;
ALF2_PART;
} e2k_alf2_opcode_templ;
#define ALF3_PART \
e2k_register_format arg_fmt[3]
typedef struct
{
COMMON_PART;
ALF_PART;
ALF3_PART;
} e2k_alf3_opcode_templ;
#define ALOPF12_PART \
e2k_register_format arg_fmt[2]; \
u_int8_t opce; \
u_int8_t ales_opce; \
u_int8_t ales_opc2
typedef struct
{
COMMON_PART;
ALF_PART;
ALOPF12_PART;
} e2k_alopf12_opcode_templ;
#define ALOPF13_PART \
e2k_register_format arg_fmt[3]; \
u_int8_t ales_opce; \
u_int8_t ales_opc2
typedef struct
{
COMMON_PART;
ALF_PART;
ALOPF13_PART;
} e2k_alopf13_opcode_templ;
#define ALOPF15_PART \
e2k_register_format arg_fmt
typedef struct
{
COMMON_PART;
ALF_PART;
ALOPF15_PART;
} e2k_alopf15_opcode_templ;
typedef e2k_alopf15_opcode_templ e2k_alopf16_opcode_templ;
#define CMPsb 0x20
#define CMPdb 0x21
#define CMPANDsb 0x22
#define FXCMPxb 0x2b
#define FCMPdb 0x2f
typedef enum {
CMPOPCE_0 = 0,
CMPOPCE_1,
CMPOPCE_2,
CMPOPCE_3,
CMPOPCE_4,
CMPOPCE_5,
CMPOPCE_6,
CMPOPCE_7
} cmpopce_t;
#define ALF7_PART \
e2k_register_format arg_fmt[2]; \
cmpopce_t cmpopce; \
int implicit_nops;
typedef struct
{
COMMON_PART;
ALF_PART;
ALF7_PART;
} e2k_alf7_opcode_templ;
#define ALF9_PART \
e2k_register_format arg_fmt;
typedef struct
{
COMMON_PART;
ALF_PART;
ALF9_PART;
} e2k_alf9_opcode_templ;
#define ALF10_PART \
e2k_register_format arg_fmt;
typedef struct
{
COMMON_PART;
ALF_PART;
ALF10_PART;
} e2k_alf10_opcode_templ;
#define ALF8_PART \
e2k_register_format arg_fmt; \
cmpopce_t cmpopce
typedef struct
{
COMMON_PART;
ALF_PART;
ALF8_PART;
} e2k_alf8_opcode_templ;
#define ALOPF11_PART \
e2k_register_format arg_fmt[3]; \
u_int8_t ales_opce; \
u_int8_t ales_opc2[6]; \
int explicit_ales25_v4
typedef struct
{
COMMON_PART;
ALF_PART;
ALOPF11_PART;
} e2k_alopf11_opcode_templ;
#define ALOPF11_LIT8_PART \
u_int8_t max_lit8; \
const char *warn
typedef struct
{
COMMON_PART;
ALF_PART;
ALOPF11_PART;
ALOPF11_LIT8_PART;
} e2k_alopf11_lit8_opcode_templ;
#define ALOPF21_PART \
e2k_register_format arg_fmt[4]; \
u_int8_t ales_opc2;
typedef struct
{
COMMON_PART;
ALF_PART;
ALOPF21_PART;
} e2k_alopf21_opcode_templ;
#define NO_LABEL 0
#define EXPECT_LABEL 1
#define NO_CTPR {0, 0, 0}
#define CTPR2 {0, 1, 0}
#define CTPR3 {0, 0, 1}
#define ALL_CTPRS {1, 1, 1}
typedef struct
{
COMMON_PART;
u_int8_t ctp_opc;
int allowed_ctprs[3];
int label_expected;
} e2k_copf2_opcode_templ;
typedef struct
{
COMMON_PART;
unsigned id;
} e2k_setcmd_opcode_templ;
#define MOVA_PART \
u_int16_t opc; \
e2k_register_format arg_fmt;
typedef struct
{
COMMON_PART;
MOVA_PART;
} e2k_mova_opcode_templ;
int parse_alf_args (char **, const e2k_opcode_templ *);
int parse_copf2_args (char **, const e2k_opcode_templ *);
int parse_pref_args (char **, const e2k_opcode_templ *);
int parse_copf4_args (char **, const e2k_opcode_templ *);
int parse_nop_args (char **, const e2k_opcode_templ *);
int parse_setcmd_args (char **, const e2k_opcode_templ *);
int parse_setsft_args (char **, const e2k_opcode_templ *);
int parse_wait_args (char **, const e2k_opcode_templ *);
int parse_ct_args (char **, const e2k_opcode_templ *);
int parse_hcall_args (char **, const e2k_opcode_templ *);
int parse_ipd_args (char **, const e2k_opcode_templ *);
int parse_loop_mode_args (char **, const e2k_opcode_templ *);
int parse_alc_args (char **, const e2k_opcode_templ *);
int parse_abn_args (char **, const e2k_opcode_templ *);
int parse_abp_args (char **, const e2k_opcode_templ *);
int parse_abg_args (char **, const e2k_opcode_templ *);
int parse_bap_args (char **, const e2k_opcode_templ *);
int parse_eap_args (char **, const e2k_opcode_templ *);
int parse_pass_args (char **, const e2k_opcode_templ *);
int parse_andp_args (char **, const e2k_opcode_templ *);
int parse_landp_args (char **, const e2k_opcode_templ *);
int parse_ibranch_args (char **, const e2k_opcode_templ *);
int parse_done_hret_glaunch_args (char **, const e2k_opcode_templ *);
int parse_incr_args (char **, const e2k_opcode_templ *);
int parse_mova_args (char **, const e2k_opcode_templ *);
int parse_fapb_args (char **, const e2k_opcode_templ *);
int parse_movep_args (char **, const e2k_opcode_templ *);
int parse_flushts_args (char **, const e2k_opcode_templ *);
int parse_cpl_args (char **, const e2k_opcode_templ *);
int parse_set_mark_args (char **, const e2k_opcode_templ *);
int parse_vfdi_args (char **, const e2k_opcode_templ *);
extern struct e2k_opcode_templ *e2k_opcode_templs[];
extern size_t e2k_num_opcodes;
typedef enum {
WINDOW,
BASED,
GLOBAL,
SPECIAL,
AASTI
} e2k_register_type;
typedef struct {
u_int8_t idx;
e2k_register_type type;
e2k_register_format fmt;
} e2k_generic_register;
typedef enum {
LITERAL_4 = -3,
LITERAL_5,
/* LITERAL_8 should be used exclusively for encoding ALEF2.opce
in PSHUF{W,H}. */
LITERAL_8,
LITERAL_16,
LITERAL_32,
LITERAL_64
} e2k_literal_size;
typedef struct {
e2k_literal_size size;
int sgnd;
} e2k_literal_format;
typedef struct
{
int negated;
int pred_num;
int pred_fld;
} e2k_pred;
/* The maximal possible number of ALCes in the wide instruction. */
#define ALS_CHANNELS_NUMBER 6
#define opc_field \
struct { \
u_int8_t cop : 7; \
u_int8_t spec : 1; \
} opc
#define GENERIC_ALS \
/* May be 1, 2, 3, 5, 6, 7, 8, 9, 10 for appropriate ALF's. */ \
int fmt; \
/* Pointer to a function which will finalize this ALS after all long \
literals in the containing wide instruction have been \
accommodated. */ \
int (* finish) (struct e2k_als *); \
/* The value of ALS which should be encoded. */ \
union { \
struct { \
u_int8_t dst, src2, src1; \
opc_field; \
} alf1; \
struct { \
u_int8_t dst, src2, opce; \
opc_field; \
} alf2; \
struct { \
u_int8_t src3, src2, src1; \
opc_field; \
} alf3; \
struct { \
u_int8_t regn, src2, opce; \
opc_field; \
} alf5; \
struct { \
u_int8_t dst, none, regn; \
opc_field; \
} alf6; \
struct { \
struct { \
u_int8_t pdst : 5; \
u_int8_t cmpopce : 3; \
} dst2; \
u_int8_t src2, src1; \
opc_field; \
} alf7; \
struct { \
struct { \
u_int8_t pdst : 5; \
u_int8_t cmpopce : 3; \
} dst2; \
u_int8_t src2, opce; \
opc_field; \
} alf8; \
struct { \
u_int8_t dst; \
u_int8_t opce1_lo; \
u_int8_t opce1_hi; \
opc_field; \
} alf9; \
struct { \
u_int8_t src3; \
u_int8_t opce1_lo; \
u_int8_t opce1_hi; \
opc_field; \
} alf10; \
u_int32_t val; \
} u[2]; \
\
/* Therse two are used for quad ops occupying two channels. */ \
unsigned real_als_nmb; \
/* The first element in real_alses will always be the minor \
channel number. I want the user to be able to write \
stapq,5 instead of stapq,2. */ \
unsigned real_alses[6][2]; \
\
/* This means that ALS{j,k}.src1 should contain the same value \
in both channels. This is required to encode LDAPQ and STAPQ \
properly. */ \
int same_src1_quad; \
\
/* The number of valid placements. It can be 6 at maximum, which \
corresponds to ALC0, . . , ALC5. */ \
int plcmnt_nmb; \
int pos[ALS_CHANNELS_NUMBER]; \
/* The most optimal index in pos[]. */ \
int optimal_plcmnt_idx
typedef union {
struct {
u_int8_t src3;
u_int8_t opc2;
} alef1;
struct {
u_int8_t opce;
u_int8_t opc2;
} alef2;
u_int16_t hword;
} e2k_ales;
extern void init_opcode_templs (void);
extern int mcpu;

View File

@ -0,0 +1,222 @@
ENTRY_ALS_D ("%aadr0", 0x10, 0x0)
ENTRY_ALS_D ("%aadr1", 0x10, 0x1)
ENTRY_ALS_D ("%aadr2", 0x10, 0x2)
ENTRY_ALS_D ("%aadr3", 0x10, 0x3)
ENTRY_ALS_D ("%aadr4", 0x10, 0x4)
ENTRY_ALS_D ("%aadr5", 0x10, 0x5)
ENTRY_ALS_D ("%aadr6", 0x10, 0x6)
ENTRY_ALS_D ("%aadr7", 0x10, 0x7)
ENTRY_ALS_D ("%aadr8", 0x10, 0x8)
ENTRY_ALS_D ("%aadr9", 0x10, 0x9)
ENTRY_ALS_D ("%aadr10", 0x10, 0xa)
ENTRY_ALS_D ("%aadr11", 0x10, 0xb)
ENTRY_ALS_D ("%aadr12", 0x10, 0xc)
ENTRY_ALS_D ("%aadr13", 0x10, 0xd)
ENTRY_ALS_D ("%aadr14", 0x10, 0xe)
ENTRY_ALS_D ("%aadr15", 0x10, 0xf)
ENTRY_ALS_D ("%aadr16", 0x10, 0x10)
ENTRY_ALS_D ("%aadr17", 0x10, 0x11)
ENTRY_ALS_D ("%aadr18", 0x10, 0x12)
ENTRY_ALS_D ("%aadr19", 0x10, 0x13)
ENTRY_ALS_D ("%aadr20", 0x10, 0x14)
ENTRY_ALS_D ("%aadr21", 0x10, 0x15)
ENTRY_ALS_D ("%aadr22", 0x10, 0x16)
ENTRY_ALS_D ("%aadr23", 0x10, 0x17)
ENTRY_ALS_D ("%aadr24", 0x10, 0x18)
ENTRY_ALS_D ("%aadr25", 0x10, 0x19)
ENTRY_ALS_D ("%aadr26", 0x10, 0x1a)
ENTRY_ALS_D ("%aadr27", 0x10, 0x1b)
ENTRY_ALS_D ("%aadr28", 0x10, 0x1c)
ENTRY_ALS_D ("%aadr29", 0x10, 0x1d)
ENTRY_ALS_D ("%aadr30", 0x10, 0x1e)
ENTRY_ALS_D ("%aadr31", 0x10, 0x1f)
ENTRY ("%aasti_tag", 0x11)
ENTRY ("%aaind_tag", 0x12)
ENTRY ("%aaincr_tag", 0x13)
ENTRY ("%aasr", 0x1b)
ENTRY_ALS_D ("%aad0", 0x0, 0x0)
ENTRY_ALS_D ("%aad1", 0x0, 0x1)
ENTRY_ALS_D ("%aad2", 0x0, 0x2)
ENTRY_ALS_D ("%aad3", 0x0, 0x3)
ENTRY_ALS_D ("%aad4", 0x0, 0x4)
ENTRY_ALS_D ("%aad5", 0x0, 0x5)
ENTRY_ALS_D ("%aad6", 0x0, 0x6)
ENTRY_ALS_D ("%aad7", 0x0, 0x7)
ENTRY_ALS_D ("%aad8", 0x0, 0x8)
ENTRY_ALS_D ("%aad9", 0x0, 0x9)
ENTRY_ALS_D ("%aad10", 0x0, 0xa)
ENTRY_ALS_D ("%aad11", 0x0, 0xb)
ENTRY_ALS_D ("%aad12", 0x0, 0xc)
ENTRY_ALS_D ("%aad13", 0x0, 0xd)
ENTRY_ALS_D ("%aad14", 0x0, 0xe)
ENTRY_ALS_D ("%aad15", 0x0, 0xf)
ENTRY_ALS_D ("%aad16", 0x0, 0x10)
ENTRY_ALS_D ("%aad17", 0x0, 0x11)
ENTRY_ALS_D ("%aad18", 0x0, 0x12)
ENTRY_ALS_D ("%aad19", 0x0, 0x13)
ENTRY_ALS_D ("%aad20", 0x0, 0x14)
ENTRY_ALS_D ("%aad21", 0x0, 0x15)
ENTRY_ALS_D ("%aad22", 0x0, 0x16)
ENTRY_ALS_D ("%aad23", 0x0, 0x17)
ENTRY_ALS_D ("%aad24", 0x0, 0x18)
ENTRY_ALS_D ("%aad25", 0x0, 0x19)
ENTRY_ALS_D ("%aad26", 0x0, 0x1a)
ENTRY_ALS_D ("%aad27", 0x0, 0x1b)
ENTRY_ALS_D ("%aad28", 0x0, 0x1c)
ENTRY_ALS_D ("%aad29", 0x0, 0x1d)
ENTRY_ALS_D ("%aad30", 0x0, 0x1e)
ENTRY_ALS_D ("%aad31", 0x0, 0x1f)
ENTRY_ALS_IND ("%aasti0", 0x1, 0x0)
ENTRY_ALS_IND ("%aasti1", 0x1, 0x1)
ENTRY_ALS_IND ("%aasti2", 0x1, 0x2)
ENTRY_ALS_IND ("%aasti3", 0x1, 0x3)
ENTRY_ALS_IND ("%aasti4", 0x1, 0x4)
ENTRY_ALS_IND ("%aasti5", 0x1, 0x5)
ENTRY_ALS_IND ("%aasti6", 0x1, 0x6)
ENTRY_ALS_IND ("%aasti7", 0x1, 0x7)
ENTRY_ALS_IND ("%aasti8", 0x1, 0x8)
ENTRY_ALS_IND ("%aasti9", 0x1, 0x9)
ENTRY_ALS_IND ("%aasti10", 0x1, 0xa)
ENTRY_ALS_IND ("%aasti11", 0x1, 0xb)
ENTRY_ALS_IND ("%aasti12", 0x1, 0xc)
ENTRY_ALS_IND ("%aasti13", 0x1, 0xd)
ENTRY_ALS_IND ("%aasti14", 0x1, 0xe)
ENTRY_ALS_IND ("%aasti15", 0x1, 0xf)
ENTRY_ALS_IND ("%aaind0", 0x2, 0x0)
ENTRY_ALS_IND ("%aaind1", 0x2, 0x1)
ENTRY_ALS_IND ("%aaind2", 0x2, 0x2)
ENTRY_ALS_IND ("%aaind3", 0x2, 0x3)
ENTRY_ALS_IND ("%aaind4", 0x2, 0x4)
ENTRY_ALS_IND ("%aaind5", 0x2, 0x5)
ENTRY_ALS_IND ("%aaind6", 0x2, 0x6)
ENTRY_ALS_IND ("%aaind7", 0x2, 0x7)
ENTRY_ALS_IND ("%aaind8", 0x2, 0x8)
ENTRY_ALS_IND ("%aaind9", 0x2, 0x9)
ENTRY_ALS_IND ("%aaind10", 0x2, 0xa)
ENTRY_ALS_IND ("%aaind11", 0x2, 0xb)
ENTRY_ALS_IND ("%aaind12", 0x2, 0xc)
ENTRY_ALS_IND ("%aaind13", 0x2, 0xd)
ENTRY_ALS_IND ("%aaind14", 0x2, 0xe)
ENTRY_ALS_IND ("%aaind15", 0x2, 0xf)
ENTRY_ALS_IND ("%aaincr0", 0x3, 0x0)
ENTRY_ALS_IND ("%aaincr1", 0x3, 0x1)
ENTRY_ALS_IND ("%aaincr2", 0x3, 0x2)
ENTRY_ALS_IND ("%aaincr3", 0x3, 0x3)
ENTRY_ALS_IND ("%aaincr4", 0x3, 0x4)
ENTRY_ALS_IND ("%aaincr5", 0x3, 0x5)
ENTRY_ALS_IND ("%aaincr6", 0x3, 0x6)
ENTRY_ALS_IND ("%aaincr7", 0x3, 0x7)
ENTRY_ALS_IND ("%aaincr8", 0x3, 0x8)
ENTRY_ALS_IND ("%aaincr9", 0x3, 0x9)
ENTRY_ALS_IND ("%aaincr10", 0x3, 0xa)
ENTRY_ALS_IND ("%aaincr11", 0x3, 0xb)
ENTRY_ALS_IND ("%aaincr12", 0x3, 0xc)
ENTRY_ALS_IND ("%aaincr13", 0x3, 0xd)
ENTRY_ALS_IND ("%aaincr14", 0x3, 0xe)
ENTRY_ALS_IND ("%aaincr15", 0x3, 0xf)
ENTRY_ALS_D ("%aaldi0", 0x4, 0x0)
ENTRY_ALS_D ("%aaldi1", 0x4, 0x1)
ENTRY_ALS_D ("%aaldi2", 0x4, 0x2)
ENTRY_ALS_D ("%aaldi3", 0x4, 0x3)
ENTRY_ALS_D ("%aaldi4", 0x4, 0x4)
ENTRY_ALS_D ("%aaldi5", 0x4, 0x5)
ENTRY_ALS_D ("%aaldi6", 0x4, 0x6)
ENTRY_ALS_D ("%aaldi7", 0x4, 0x7)
ENTRY_ALS_D ("%aaldi8", 0x4, 0x8)
ENTRY_ALS_D ("%aaldi9", 0x4, 0x9)
ENTRY_ALS_D ("%aaldi10", 0x4, 0xa)
ENTRY_ALS_D ("%aaldi11", 0x4, 0xb)
ENTRY_ALS_D ("%aaldi12", 0x4, 0xc)
ENTRY_ALS_D ("%aaldi13", 0x4, 0xd)
ENTRY_ALS_D ("%aaldi14", 0x4, 0xe)
ENTRY_ALS_D ("%aaldi15", 0x4, 0xf)
ENTRY_ALS_D ("%aaldi16", 0x4, 0x10)
ENTRY_ALS_D ("%aaldi17", 0x4, 0x11)
ENTRY_ALS_D ("%aaldi18", 0x4, 0x12)
ENTRY_ALS_D ("%aaldi19", 0x4, 0x13)
ENTRY_ALS_D ("%aaldi20", 0x4, 0x14)
ENTRY_ALS_D ("%aaldi21", 0x4, 0x15)
ENTRY_ALS_D ("%aaldi22", 0x4, 0x16)
ENTRY_ALS_D ("%aaldi23", 0x4, 0x17)
ENTRY_ALS_D ("%aaldi24", 0x4, 0x18)
ENTRY_ALS_D ("%aaldi25", 0x4, 0x19)
ENTRY_ALS_D ("%aaldi26", 0x4, 0x1a)
ENTRY_ALS_D ("%aaldi27", 0x4, 0x1b)
ENTRY_ALS_D ("%aaldi28", 0x4, 0x1c)
ENTRY_ALS_D ("%aaldi29", 0x4, 0x1d)
ENTRY_ALS_D ("%aaldi30", 0x4, 0x1e)
ENTRY_ALS_D ("%aaldi31", 0x4, 0x1f)
/* According to Table A.2.2 only indices being multiple of 4 seem to
make sense for %aalda<j> because the lowermost two bits of ALS.d
are said to be ignored. However, because of these stupid E2KT tests
containing explicit accesses to all of '%aalda{0, . . ., 31}' I have to
support all of them. */
ENTRY_ALS_D ("%aalda0", 0x5, 0x0)
ENTRY_ALS_D ("%aalda1", 0x5, 0x1)
ENTRY_ALS_D ("%aalda2", 0x5, 0x2)
ENTRY_ALS_D ("%aalda3", 0x5, 0x3)
ENTRY_ALS_D ("%aalda4", 0x5, 0x4)
ENTRY_ALS_D ("%aalda5", 0x5, 0x5)
ENTRY_ALS_D ("%aalda6", 0x5, 0x6)
ENTRY_ALS_D ("%aalda7", 0x5, 0x7)
ENTRY_ALS_D ("%aalda8", 0x5, 0x8)
ENTRY_ALS_D ("%aalda9", 0x5, 0x9)
ENTRY_ALS_D ("%aalda10", 0x5, 0xa)
ENTRY_ALS_D ("%aalda11", 0x5, 0xb)
ENTRY_ALS_D ("%aalda12", 0x5, 0xc)
ENTRY_ALS_D ("%aalda13", 0x5, 0xd)
ENTRY_ALS_D ("%aalda14", 0x5, 0xe)
ENTRY_ALS_D ("%aalda15", 0x5, 0xf)
ENTRY_ALS_D ("%aalda16", 0x5, 0x10)
ENTRY_ALS_D ("%aalda17", 0x5, 0x11)
ENTRY_ALS_D ("%aalda18", 0x5, 0x12)
ENTRY_ALS_D ("%aalda19", 0x5, 0x13)
ENTRY_ALS_D ("%aalda20", 0x5, 0x14)
ENTRY_ALS_D ("%aalda21", 0x5, 0x15)
ENTRY_ALS_D ("%aalda22", 0x5, 0x16)
ENTRY_ALS_D ("%aalda23", 0x5, 0x17)
ENTRY_ALS_D ("%aalda24", 0x5, 0x18)
ENTRY_ALS_D ("%aalda25", 0x5, 0x19)
ENTRY_ALS_D ("%aalda26", 0x5, 0x1a)
ENTRY_ALS_D ("%aalda27", 0x5, 0x1b)
ENTRY_ALS_D ("%aalda28", 0x5, 0x1c)
ENTRY_ALS_D ("%aalda29", 0x5, 0x1d)
ENTRY_ALS_D ("%aalda30", 0x5, 0x1e)
ENTRY_ALS_D ("%aalda31", 0x5, 0x1f)
ENTRY ("%aafstr", 0x8)
ENTRY ("%aaldv", 0x9)
ENTRY ("%aaldm", 0xa)
/* It turns out to be that by the "value for modification of AAU load flags" in
Table A.2.2 they imply just the index <J> of `%aabf<J>' register. */
ENTRY_ALS_IND ("%aabf0", 0xc, 0x0)
ENTRY_ALS_IND ("%aabf1", 0xc, 0x1)
ENTRY_ALS_IND ("%aabf2", 0xc, 0x2)
ENTRY_ALS_IND ("%aabf3", 0xc, 0x3)
ENTRY_ALS_IND ("%aabf4", 0xc, 0x4)
ENTRY_ALS_IND ("%aabf5", 0xc, 0x5)
ENTRY_ALS_IND ("%aabf6", 0xc, 0x6)
ENTRY_ALS_IND ("%aabf7", 0xc, 0x7)
ENTRY_ALS_IND ("%aabf8", 0xc, 0x8)
ENTRY_ALS_IND ("%aabf9", 0xc, 0x9)
ENTRY_ALS_IND ("%aabf10", 0xc, 0xa)
ENTRY_ALS_IND ("%aabf11", 0xc, 0xb)
ENTRY_ALS_IND ("%aabf12", 0xc, 0xc)
ENTRY_ALS_IND ("%aabf13", 0xc, 0xd)
ENTRY_ALS_IND ("%aabf14", 0xc, 0xe)
ENTRY_ALS_IND ("%aabf15", 0xc, 0xf)

View File

@ -0,0 +1,392 @@
ENTRY (1, "%mmu_cr", 0x0, 0x8, 2, 1)
ENTRY (1, "%cont", 0x10, 0x8, 2, 1)
ENTRY (6, "%pid", 0x10, 0x8, 2, 1)
ENTRY (1, "%cr3_rg", 0x20, 0x8, 2, 1)
ENTRY (6, "%u2_pptb", 0x20, 0x8, 2, 1)
ENTRY (1, "%elb_ptb", 0x30, 0x8, 2, 1)
ENTRY (6, "%u_vptb", 0x30, 0x8, 2, 1)
ENTRY (1, "%root_ptb", 0x40, 0x8, 2, 1)
ENTRY (6, "%u_pptb", 0x40, 0x8, 2, 1)
ENTRY (1, "%trap_point", 0x50, 0x8, 2, 1)
ENTRY (1, "%trap_count", 0x60, 0x8, 2, 0)
ENTRY (1, "%mpt_b", 0x70, 0x8, 2, 1)
ENTRY (1, "%pci_l_b", 0x80, 0x8, 2, 1)
ENTRY (1, "%us_cl_d", 0x90, 0x8, 2, 1)
ENTRY (1, "%ph_h_b", 0xa0, 0x8, 2, 1)
/* These idiots name the underlying two entries as %apic_base in
iset-v1.single. Therefore I believe that the corresponding registers are
missing from elbrus-v1, though it may be just a misprint. */
ENTRY (2, "%used_4kb_dtlb", 0xb0, 0x8, 2, 1)
ENTRY (2, "%used_dtlb_mpt_dw", 0xc0, 0x8, 2, 1)
/* This seems to be the real %apic_base which is present everywhere. */
ENTRY (1, "%apic_base", 0xd0, 0x8, 2, 1)
ENTRY (2, "%mu_hw0", 0xe0, 0x8, 2, 1)
ENTRY (3, "%cont_second", 0xf0, 0x8, 2, 1)
ENTRY (6, "%pid2", 0xf0, 0x8, 2, 1)
/* `0x100 + 0x10 * j' with `0 <= j <= 32'. */
ENTRY (1, "%mtrr0", 0x100, 0x8, 2, 1)
ENTRY (1, "%mtrr1", 0x110, 0x8, 2, 1)
ENTRY (1, "%mtrr2", 0x120, 0x8, 2, 1)
ENTRY (1, "%mtrr3", 0x130, 0x8, 2, 1)
ENTRY (1, "%mtrr4", 0x140, 0x8, 2, 1)
ENTRY (1, "%mtrr5", 0x150, 0x8, 2, 1)
ENTRY (1, "%mtrr6", 0x160, 0x8, 2, 1)
ENTRY (1, "%mtrr7", 0x170, 0x8, 2, 1)
ENTRY (1, "%mtrr8", 0x180, 0x8, 2, 1)
ENTRY (1, "%mtrr9", 0x190, 0x8, 2, 1)
ENTRY (1, "%mtrr10", 0x1a0, 0x8, 2, 1)
ENTRY (1, "%mtrr11", 0x1b0, 0x8, 2, 1)
ENTRY (1, "%mtrr12", 0x1c0, 0x8, 2, 1)
ENTRY (1, "%mtrr13", 0x1d0, 0x8, 2, 1)
ENTRY (1, "%mtrr14", 0x1e0, 0x8, 2, 1)
ENTRY (1, "%mtrr15", 0x1f0, 0x8, 2, 1)
ENTRY (1, "%mtrr16", 0x200, 0x8, 2, 1)
ENTRY (1, "%mtrr17", 0x210, 0x8, 2, 1)
ENTRY (1, "%mtrr18", 0x220, 0x8, 2, 1)
ENTRY (1, "%mtrr19", 0x230, 0x8, 2, 1)
ENTRY (1, "%mtrr20", 0x240, 0x8, 2, 1)
ENTRY (1, "%mtrr21", 0x250, 0x8, 2, 1)
ENTRY (1, "%mtrr22", 0x260, 0x8, 2, 1)
ENTRY (1, "%mtrr23", 0x270, 0x8, 2, 1)
ENTRY (1, "%mtrr24", 0x280, 0x8, 2, 1)
ENTRY (1, "%mtrr25", 0x290, 0x8, 2, 1)
ENTRY (1, "%mtrr26", 0x2a0, 0x8, 2, 1)
ENTRY (1, "%mtrr27", 0x2b0, 0x8, 2, 1)
ENTRY (1, "%mtrr28", 0x2c0, 0x8, 2, 1)
ENTRY (1, "%mtrr29", 0x2d0, 0x8, 2, 1)
ENTRY (1, "%mtrr30", 0x2e0, 0x8, 2, 1)
ENTRY (1, "%mtrr31", 0x2f0, 0x8, 2, 1)
ENTRY (1, "%mtrr32", 0x300, 0x8, 2, 1)
ENTRY (3, "%pat", 0x310, 0x8, 2, 1)
ENTRY (3, "%ph_hi_l_b", 0x320, 0x8, 2, 1)
ENTRY (3, "%ph_hi_h_b", 0x330, 0x8, 2, 1)
ENTRY (6, "%os_vptb", 0x340, 0x8, 2, 1)
ENTRY (6, "%os_pptb", 0x350, 0x8, 2, 1)
/* FIXME: these ones are supported starting from elbrus-v3 only. However,
because of the inability of LCC to take this into account when producing
`MMURR's accessing these registers from loads in `-masm-inline' mode (see
Bug #91866) I have to support them for all iset versions for the sake of
E2KT. */
ENTRY (1, "%pdpte0", 0x380, 0x8, 2, 1)
ENTRY (1, "%pdpte1", 0x390, 0x8, 2, 1)
ENTRY (1, "%pdpte2", 0x3a0, 0x8, 2, 1)
ENTRY (1, "%pdpte3", 0x3b0, 0x8, 2, 1)
ENTRY (3, "%tlu_cache", 0x3c0, 0x8, 2, 1)
ENTRY (3, "%tlu_cmd_mem", 0x3e0, 0x8, 2, 1)
ENTRY (6, "%virt_ctrl_mu", 0x400, 0x8, 2, 1)
ENTRY (6, "%gid", 0x410, 0x8, 2, 1)
ENTRY (6, "%gp_vptb", 0x420, 0x8, 2, 1)
ENTRY (6, "%gp_pptb", 0x430, 0x8, 2, 1)
ENTRY (6, "%intc_info_mu", 0x440, 0x8, 2, 1)
ENTRY (6, "%intc_ptr_mu", 0x450, 0x8, 2, 1)
ENTRY (6, "%sh_os_vptb", 0x460, 0x8, 2, 1)
ENTRY (6, "%sh_os_pptb", 0x470, 0x8, 2, 1)
ENTRY (6, "%g_w_imask_mmu_cr", 0x480, 0x8, 2, 1)
ENTRY (6, "%sh_pid", 0x490, 0x8, 2, 1)
ENTRY (6, "%sh_mmu_cr", 0x4a0, 0x8, 2, 1)
ENTRY (6, "%os_vab", 0x4c0, 0x8, 2, 1)
ENTRY (6, "%sh_os_vab", 0x4d0, 0x8, 2, 1)
ENTRY (1, "%us_cl_b", 0x24, 0xd, 5, 0)
ENTRY (1, "%us_cl_up", 0x124, 0xd, 5, 0)
ENTRY (1, "%us_cl_m0", 0x4, 0xd, 5, 0)
ENTRY (1, "%us_cl_m1", 0x84, 0xd, 5, 0)
ENTRY (1, "%us_cl_m2", 0x104, 0xd, 5, 0)
ENTRY (1, "%us_cl_m3", 0x184, 0xd, 5, 0)
ENTRY (1, "%mlta0", 0x5, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta0", 0x6, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta0", 0x7, 0xd, 2, 0)
ENTRY (1, "%mltb0", 0x25, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb0", 0x26, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb0", 0x27, 0xd, 2, 0)
ENTRY (1, "%mltc0", 0x45, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc0", 0x46, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc0", 0x47, 0xd, 2, 0)
ENTRY (1, "%mlta1", 0x85, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta1", 0x86, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta1", 0x87, 0xd, 2, 0)
ENTRY (1, "%mltb1", 0xa5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb1", 0xa6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb1", 0xa7, 0xd, 2, 0)
ENTRY (1, "%mltc1", 0xc5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc1", 0xc6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc1", 0xc7, 0xd, 2, 0)
ENTRY (1, "%mlta2", 0x105, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta2", 0x106, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta2", 0x107, 0xd, 2, 0)
ENTRY (1, "%mltb2", 0x125, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb2", 0x126, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb2", 0x127, 0xd, 2, 0)
ENTRY (1, "%mltc2", 0x145, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc2", 0x146, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc2", 0x147, 0xd, 2, 0)
ENTRY (1, "%mlta3", 0x185, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta3", 0x186, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta3", 0x187, 0xd, 2, 0)
ENTRY (1, "%mltb3", 0x1a5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb3", 0x1a6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb3", 0x1a7, 0xd, 2, 0)
ENTRY (1, "%mltc3", 0x1c5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc3", 0x1c6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc3", 0x1c7, 0xd, 2, 0)
ENTRY (1, "%mlta4", 0x205, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta4", 0x206, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta4", 0x207, 0xd, 2, 0)
ENTRY (1, "%mltb4", 0x225, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb4", 0x226, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb4", 0x227, 0xd, 2, 0)
ENTRY (1, "%mltc4", 0x245, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc4", 0x246, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc4", 0x247, 0xd, 2, 0)
ENTRY (1, "%mlta5", 0x285, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta5", 0x286, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta5", 0x287, 0xd, 2, 0)
ENTRY (1, "%mltb5", 0x2a5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb5", 0x2a6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb5", 0x2a7, 0xd, 2, 0)
ENTRY (1, "%mltc5", 0x2c5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc5", 0x2c6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc5", 0x2c7, 0xd, 2, 0)
ENTRY (1, "%mlta6", 0x305, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta6", 0x306, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta6", 0x307, 0xd, 2, 0)
ENTRY (1, "%mltb6", 0x325, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb6", 0x326, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb6", 0x327, 0xd, 2, 0)
ENTRY (1, "%mltc6", 0x345, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc6", 0x346, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc6", 0x347, 0xd, 2, 0)
ENTRY (1, "%mlta7", 0x385, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta7", 0x386, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta7", 0x387, 0xd, 2, 0)
ENTRY (1, "%mltb7", 0x3a5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb7", 0x3a6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb7", 0x3a7, 0xd, 2, 0)
ENTRY (1, "%mltc7", 0x3c5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc7", 0x3c6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc7", 0x3c7, 0xd, 2, 0)
ENTRY (1, "%mlta8", 0x405, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta8", 0x406, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta8", 0x407, 0xd, 2, 0)
ENTRY (1, "%mltb8", 0x425, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb8", 0x426, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb8", 0x427, 0xd, 2, 0)
ENTRY (1, "%mltc8", 0x445, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc8", 0x446, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc8", 0x447, 0xd, 2, 0)
ENTRY (1, "%mlta9", 0x485, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta9", 0x486, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta9", 0x487, 0xd, 2, 0)
ENTRY (1, "%mltb9", 0x4a5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb9", 0x4a6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb9", 0x4a7, 0xd, 2, 0)
ENTRY (1, "%mltc9", 0x4c5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc9", 0x4c6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc9", 0x4c7, 0xd, 2, 0)
ENTRY (1, "%mlta10", 0x505, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta10", 0x506, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta10", 0x507, 0xd, 2, 0)
ENTRY (1, "%mltb10", 0x525, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb10", 0x526, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb10", 0x527, 0xd, 2, 0)
ENTRY (1, "%mltc10", 0x545, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc10", 0x546, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc10", 0x547, 0xd, 2, 0)
ENTRY (1, "%mlta11", 0x585, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta11", 0x586, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta11", 0x587, 0xd, 2, 0)
ENTRY (1, "%mltb11", 0x5a5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb11", 0x5a6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb11", 0x5a7, 0xd, 2, 0)
ENTRY (1, "%mltc11", 0x5c5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc11", 0x5c6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc11", 0x5c7, 0xd, 2, 0)
ENTRY (1, "%mlta12", 0x605, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta12", 0x606, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta12", 0x607, 0xd, 2, 0)
ENTRY (1, "%mltb12", 0x625, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb12", 0x626, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb12", 0x627, 0xd, 2, 0)
ENTRY (1, "%mltc12", 0x645, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc12", 0x646, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc12", 0x647, 0xd, 2, 0)
ENTRY (1, "%mlta13", 0x685, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta13", 0x686, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta13", 0x687, 0xd, 2, 0)
ENTRY (1, "%mltb13", 0x6a5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb13", 0x6a6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb13", 0x6a7, 0xd, 2, 0)
ENTRY (1, "%mltc13", 0x6c5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc13", 0x6c6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc13", 0x6c7, 0xd, 2, 0)
ENTRY (1, "%mlta14", 0x705, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta14", 0x706, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta14", 0x707, 0xd, 2, 0)
ENTRY (1, "%mltb14", 0x725, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb14", 0x726, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb14", 0x727, 0xd, 2, 0)
ENTRY (1, "%mltc14", 0x745, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc14", 0x746, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc14", 0x747, 0xd, 2, 0)
ENTRY (1, "%mlta15", 0x785, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta15", 0x786, 0xd, 2, 0)
DIS_ENTRY (1, "%mlta15", 0x787, 0xd, 2, 0)
ENTRY (1, "%mltb15", 0x7a5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb15", 0x7a6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltb15", 0x7a7, 0xd, 2, 0)
ENTRY (1, "%mltc15", 0x7c5, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc15", 0x7c6, 0xd, 2, 0)
DIS_ENTRY (1, "%mltc15", 0x7c7, 0xd, 2, 0)
ENTRY (1, "%ddbcr", 0x87, 0xd, 5, 1)
DIS_ENTRY (1, "%ddbcr", 0x85, 0xd, 5, 1)
DIS_ENTRY (1, "%ddbcr", 0x86, 0xd, 5, 1)
ENTRY (1, "%ddmcr", 0x107, 0xd, 5, 1)
DIS_ENTRY (1, "%ddmcr", 0x105, 0xd, 5, 1)
DIS_ENTRY (1, "%ddmcr", 0x106, 0xd, 5, 1)
ENTRY (1, "%ddbsr", 0xa7, 0xd, 5, 1)
DIS_ENTRY (1, "%ddbsr", 0xa5, 0xd, 5, 1)
DIS_ENTRY (1, "%ddbsr", 0xa6, 0xd, 5, 1)
ENTRY (1, "%ddbar0", 0x7, 0xd, 5, 1)
DIS_ENTRY (1, "%ddbar0", 0x5, 0xd, 5, 1)
DIS_ENTRY (1, "%ddbar0", 0x6, 0xd, 5, 1)
ENTRY (1, "%ddbar1", 0x27, 0xd, 5, 1)
DIS_ENTRY (1, "%ddbar1", 0x25, 0xd, 5, 1)
DIS_ENTRY (1, "%ddbar1", 0x26, 0xd, 5, 1)
ENTRY (1, "%ddbar2", 0x47, 0xd, 5, 1)
DIS_ENTRY (1, "%ddbar2", 0x45, 0xd, 5, 1)
DIS_ENTRY (1, "%ddbar2", 0x46, 0xd, 5, 1)
ENTRY (1, "%ddbar3", 0x67, 0xd, 5, 1)
DIS_ENTRY (1, "%ddbar3", 0x65, 0xd, 5, 1)
DIS_ENTRY (1, "%ddbar3", 0x66, 0xd, 5, 1)
ENTRY (1, "%ddmar0", 0xc7, 0xd, 5, 1)
DIS_ENTRY (1, "%ddmar0", 0xc5, 0xd, 5, 1)
DIS_ENTRY (1, "%ddmar0", 0xc6, 0xd, 5, 1)
ENTRY (1, "%ddmar1", 0xe7, 0xd, 5, 1)
DIS_ENTRY (1, "%ddmar1", 0xe5, 0xd, 5, 1)
DIS_ENTRY (1, "%ddmar1", 0xe6, 0xd, 5, 1)
ENTRY (2, "%l2_b0_bist_sig1", 0x0, 0xb, 2, 0)
ENTRY (2, "%l2_b0_bist_sig2", 0x100, 0xb, 2, 1)
ENTRY (2, "%l2_b0_bisr_ctrl", 0x200, 0xb, 2, 1)
ENTRY (2, "%l2_b0_ctrl", 0x300, 0xb, 2, 1)
ENTRY (2, "%l2_b0_ecc_dbg", 0x400, 0xb, 2, 1)
ENTRY (2, "%l2_b0_err", 0x500, 0xb, 2, 1)
ENTRY (2, "%l2_b1_bist_sig1", 0x40, 0xb, 2, 0)
ENTRY (2, "%l2_b1_bist_sig2", 0x140, 0xb, 2, 1)
ENTRY (2, "%l2_b1_bisr_ctrl", 0x240, 0xb, 2, 1)
ENTRY (2, "%l2_b1_ctrl", 0x340, 0xb, 2, 1)
ENTRY (2, "%l2_b1_ecc_dbg", 0x440, 0xb, 2, 1)
ENTRY (2, "%l2_b1_err", 0x540, 0xb, 2, 1)
ENTRY (2, "%l2_b2_bist_sig1", 0x80, 0xb, 2, 0)
ENTRY (2, "%l2_b2_bist_sig2", 0x180, 0xb, 2, 1)
ENTRY (2, "%l2_b2_bisr_ctrl", 0x280, 0xb, 2, 1)
ENTRY (2, "%l2_b2_ctrl", 0x380, 0xb, 2, 1)
ENTRY (2, "%l2_b2_ecc_dbg", 0x480, 0xb, 2, 1)
ENTRY (2, "%l2_b2_err", 0x580, 0xb, 2, 1)
ENTRY (2, "%l2_b3_bist_sig1", 0xc0, 0xb, 2, 0)
ENTRY (2, "%l2_b3_bist_sig2", 0x1c0, 0xb, 2, 1)
ENTRY (2, "%l2_b3_bisr_ctrl", 0x2c0, 0xb, 2, 1)
ENTRY (2, "%l2_b3_ctrl", 0x3c0, 0xb, 2, 1)
ENTRY (2, "%l2_b3_ecc_dbg", 0x4c0, 0xb, 2, 1)
ENTRY (2, "%l2_b3_err", 0x5c0, 0xb, 2, 1)
/* Those in Table A.3.2 are write-only. */
/* Strangely enough this one is present in `iset-v{1,3,4,5,6}', but missing
from `iset-v2', however, believe that it's available everywhere. */
WONLY (1, "%dam_inv", 0x0, 0x3)
/* These ones are present starting from `iset-v3'. However, if `%dam_inf' has
been missed from `iset-v2' by mistake, these ones may have been lost from
`iset-v2' too . . . */
WONLY (3, "%mlt_inv", 0x1, 0x3)
WONLY (3, "%ldstgt_inv", 0x2, 0x3)

View File

@ -0,0 +1,101 @@
/* ALT_ENTRies below make sense for assembler only to allow for different
variants of state register names. They are ignored in disassembler. */
ENTRY("%psr", 0x00, 1, 0)
ENTRY("%wd", 0x01, 0, 0)
ENTRY("%core_mode", 0x04, 0, 0)
ENTRY("%cwd", 0x06, 1, 0)
ENTRY("%psp.hi", 0x07, 1, 0)
ENTRY("%psp.lo", 0x09, 1, 0)
ENTRY("%pshtp", 0x0b, 1, 0)
ENTRY("%pcsp.hi", 0x0d, 1, 0)
ENTRY("%pcsp.lo", 0x0f, 1, 0)
ENTRY("%pcshtp", 0x13, 0, 0)
ENTRY("%ctpr1", 0x15, 0, 0)
ENTRY("%ctpr2", 0x16, 0, 0)
ENTRY("%ctpr3", 0x17, 0, 0)
ENTRY("%sbr", 0x1e, 0, 0)
/* This flavour of %sbr register name won't be used in disassembler. */
ALT_ENTRY("%usbr", 0x1e, 0, 0)
ENTRY("%cutd", 0x21, 1, 0)
ENTRY("%eir", 0x23, 0, 0)
/* Note that `%tsd' register corresponding to 0x24 has been "officially"
eliminated from all versions of Elbrus instruction set (see Bug #74420
and Bug #53587). In fact it's not supported starting from elbrus-v3
only. */
ENTRY("%cuir", 0x25, 0, 0)
ENTRY("%oscud.hi", 0x26, 1, 0)
ENTRY("%oscud.lo", 0x27, 1, 0)
ENTRY("%osgd.hi", 0x28, 1, 0)
ENTRY("%osgd.lo", 0x29, 1, 0)
ENTRY("%osem", 0x2a, 1, 0)
ENTRY("%usd.hi", 0x2c, 1, 0)
ENTRY("%usd.lo", 0x2d, 1, 0)
/* `%tr' register which used to be encoded with 0x2e has been eliminated
together with `%tsd' (see above). */
ENTRY("%osr0", 0x2f, 0, 0)
ENTRY("%cud.hi", 0x30, 0, 1)
ENTRY("%cud.lo", 0x31, 0, 1)
ENTRY("%gd.hi", 0x32, 0, 1)
ENTRY("%gd.lo", 0x33, 0, 1)
ENTRY("%cs.hi", 0x34, 1, 0)
ENTRY("%cs.lo", 0x35, 1, 0)
ENTRY("%ds.hi", 0x36, 1, 0)
ENTRY("%ds.lo", 0x37, 1, 0)
ENTRY("%es.hi", 0x38, 1, 0)
ENTRY("%es.lo", 0x39, 1, 0)
ENTRY("%fs.hi", 0x3a, 1, 0)
ENTRY("%fs.lo", 0x3b, 1, 0)
ENTRY("%gs.hi", 0x3c, 1, 0)
ENTRY("%gs.lo", 0x3d, 1, 0)
ENTRY("%ss.hi", 0x3e, 1, 0)
ENTRY("%ss.lo", 0x3f, 1, 0)
ENTRY("%dibcr", 0x40, 0, 0)
ENTRY("%dimcr", 0x41, 0, 0)
ENTRY("%dibsr", 0x42, 0, 0)
ENTRY("%dtcr", 0x43, 0, 0)
ENTRY("%dibar0", 0x48, 0, 0)
ENTRY("%dibar1", 0x49, 0, 0)
ENTRY("%dibar2", 0x4a, 0, 0)
ENTRY("%dibar3", 0x4b, 0, 0)
ENTRY("%dimar0", 0x4c, 0, 0)
ENTRY("%dimar1", 0x4d, 0, 0)
ENTRY("%dtarf", 0x4e, 0, 0)
ENTRY("%dtart", 0x4f, 0, 0)
ENTRY("%cr0.hi", 0x51, 0, 0)
ENTRY("%cr0.lo", 0x53, 0, 0)
ENTRY("%cr1.hi", 0x55, 0, 0)
ENTRY("%cr1.lo", 0x57, 0, 0)
ENTRY(__e2s("%sclkm1"), 0x70, 0, 0)
ENTRY(__e2s("%sclkm2"), 0x71, 0, 0)
ENTRY(__e3s("%cu_hw0"), 0x78, 0, 0)
ENTRY(__v5("%cu_hw1"), 0x79, 0, 0)
ENTRY("%upsr", 0x80, 0, 0)
ENTRY("%ip", 0x81, 0, 0)
ENTRY("%nip", 0x82, 0, 0)
ENTRY("%lsr1", 0xc3, 0, 0)
ENTRY("%lsr", 0x83, 0, 0)
ENTRY("%pfpfr", 0x84, 0, 0)
ENTRY("%fpcr", 0x85, 0, 0)
ENTRY("%fpsr", 0x86, 0, 0)
ENTRY("%ilcr1", 0xc7, 0, 0)
ENTRY("%ilcr", 0x87, 0, 0)
ENTRY("%br", 0x88, 0, 0)
ENTRY("%bgr", 0x89, 0, 0)
ENTRY(__e3s("%idr"), 0x8a, 0, 0)
ENTRY("%clkr", 0x90, 0, 0)
ENTRY("%rndpr", 0x91, 0, 0)
ENTRY(__e2s("%sclkr"), 0x92, 0, 0)
ENTRY("%tir.hi", 0x9c, 0, 0)
ENTRY("%tir.lo", 0x9d, 0, 0)
ENTRY("%rpr.lo", 0xa0, 0, 0)
ENTRY("%sbbp", 0xa1, 0, 0)
ENTRY("%rpr.hi", 0xa2, 0, 0)
/* This flavour of %rpr.hi register name won't be used in disassembler. */
ALT_ENTRY("%rpr", 0xa0, 0, 0)
ENTRY("%upsrm", 0xc0, 0, 0)

View File

@ -0,0 +1,147 @@
/* TODO: R/W permissions should be eventually specified for each register in
the table below. */
/* ALT_ENTRies below make sense for assembler only to allow for different
variants of state register names. They are ignored in disassembler. */
ENTRY(1, "%psr", 0x00, 1, 0)
ENTRY(1, "%wd", 0x01, 0, 0)
ENTRY(1, "%core_mode", 0x04, 0, 0)
ENTRY(1, "%cwd", 0x06, 1, 0)
ENTRY(1, "%psp.hi", 0x07, 1, 0)
ENTRY(1, "%psp.lo", 0x09, 1, 0)
ENTRY(1, "%pshtp", 0x0b, 1, 0)
ENTRY(1, "%pcsp.hi", 0x0d, 1, 0)
ENTRY(1, "%pcsp.lo", 0x0f, 1, 0)
ENTRY(1, "%pcshtp", 0x13, 0, 0)
ENTRY(1, "%ctpr1", 0x15, 0, 0)
ENTRY(6, "%ctpr1.lo", 0x15, 0, 0)
ENTRY(1, "%ctpr2", 0x16, 0, 0)
ENTRY(6, "%ctpr2.lo", 0x16, 0, 0)
ENTRY(1, "%ctpr3", 0x17, 0, 0)
ENTRY(6, "%ctpr3.lo", 0x17, 0, 0)
ENTRY(6, "%ctpr1.hi", 0x19, 0, 0)
ENTRY(6, "%ctpr2.hi", 0x1a, 0, 0)
ENTRY(6, "%ctpr3.hi", 0x1b, 0, 0)
ENTRY(1, "%usbr", 0x1e, 0, 0)
/* This flavour of %usbr register name won't be used in disassembler. */
ALT_ENTRY(1, "%sbr", 0x1e, 0, 0)
ENTRY(1, "%cutd", 0x21, 1, 0)
ENTRY(6, "%oscutd", 0x22, 1, 0)
ENTRY(1, "%eir", 0x23, 0, 0)
/* Note that `%tsd' register corresponding to 0x24 has been "officially"
eliminated from all versions of Elbrus instruction set (see Bug #74420
and Bug #53587). In fact it's not supported starting from elbrus-v3
only. */
STALE_ENTRY(1, 2, "%tsd", 0x24, 0, 0)
ENTRY(1, "%cuir", 0x25, 0, 0)
ENTRY(1, "%oscud.hi", 0x26, 1, 0)
ENTRY(1, "%oscud.lo", 0x27, 1, 0)
ENTRY(1, "%osgd.hi", 0x28, 1, 0)
ENTRY(1, "%osgd.lo", 0x29, 1, 0)
ENTRY(1, "%osem", 0x2a, 1, 0)
ENTRY(6, "%oscuir", 0x2b, 0, 0)
ENTRY(1, "%usd.hi", 0x2c, 1, 0)
ENTRY(1, "%usd.lo", 0x2d, 1, 0)
/* `%tr' register which used to be encoded with 0x2e has been eliminated
together with `%tsd' (see above). */
STALE_ENTRY(1, 2, "%tr", 0x2e, 0, 0)
ENTRY(1, "%osr0", 0x2f, 0, 0)
ENTRY(1, "%cud.hi", 0x30, 0, 1)
ENTRY(1, "%cud.lo", 0x31, 0, 1)
ENTRY(1, "%gd.hi", 0x32, 0, 1)
ENTRY(1, "%gd.lo", 0x33, 0, 1)
ENTRY(1, "%cs.hi", 0x34, 1, 0)
ENTRY(1, "%cs.lo", 0x35, 1, 0)
ENTRY(1, "%ds.hi", 0x36, 1, 0)
ENTRY(1, "%ds.lo", 0x37, 1, 0)
ENTRY(1, "%es.hi", 0x38, 1, 0)
ENTRY(1, "%es.lo", 0x39, 1, 0)
ENTRY(1, "%fs.hi", 0x3a, 1, 0)
ENTRY(1, "%fs.lo", 0x3b, 1, 0)
ENTRY(1, "%gs.hi", 0x3c, 1, 0)
ENTRY(1, "%gs.lo", 0x3d, 1, 0)
ENTRY(1, "%ss.hi", 0x3e, 1, 0)
ENTRY(1, "%ss.lo", 0x3f, 1, 0)
ENTRY(1, "%dibcr", 0x40, 0, 0)
ENTRY(1, "%dimcr", 0x41, 0, 0)
ENTRY(1, "%dibsr", 0x42, 0, 0)
ENTRY(1, "%dtcr", 0x43, 0, 0)
ENTRY(1, "%dibar0", 0x48, 0, 0)
ENTRY(1, "%dibar1", 0x49, 0, 0)
ENTRY(1, "%dibar2", 0x4a, 0, 0)
ENTRY(1, "%dibar3", 0x4b, 0, 0)
ENTRY(1, "%dimar0", 0x4c, 0, 0)
ENTRY(1, "%dimar1", 0x4d, 0, 0)
ENTRY(1, "%dtarf", 0x4e, 0, 0)
ENTRY(1, "%dtart", 0x4f, 0, 0)
ENTRY(1, "%cr0.hi", 0x51, 0, 0)
ENTRY(1, "%cr0.lo", 0x53, 0, 0)
ENTRY(1, "%cr1.hi", 0x55, 0, 0)
ENTRY(1, "%cr1.lo", 0x57, 0, 0)
ENTRY(6, "%sh_psp.hi", 0x58, 0, 0)
ENTRY(6, "%sh_psp.lo", 0x59, 0, 0)
ENTRY(6, "%bu_psp.hi", 0x5a, 0, 0)
ENTRY(6, "%bu_psp.lo", 0x5b, 0, 0)
ENTRY(6, "%sh_pcsp.hi", 0x5c, 0, 0)
ENTRY(6, "%sh_pcsp.lo", 0x5d, 0, 0)
ENTRY(6, "%sh_pshtp", 0x5e, 0, 0)
ENTRY(6, "%sh_pcshtp", 0x5f, 0, 0)
ENTRY(6, "%virt_ctrl_cu", 0x60, 0, 0)
ENTRY(6, "%hceb", 0x61, 0, 0)
ENTRY(6, "%hcem", 0x62, 0, 0)
ENTRY(6, "%g_preempt_tmr", 0x63, 0, 0)
ENTRY(6, "%intc_info_cu", 0x64, 0, 0)
ENTRY(6, "%intc_ptr_cu", 0x65, 0, 0)
ENTRY(6, "%sh_psr", 0x66, 0, 0)
ENTRY(6, "%sh_core_mode", 0x67, 0, 0)
ENTRY(6, "%sh_oscud.hi", 0x68, 0, 0)
ENTRY(6, "%sh_oscud.lo", 0x69, 0, 0)
ENTRY(6, "%sh_osgd.hi", 0x6a, 0, 0)
ENTRY(6, "%sh_osgd.lo", 0x6b, 0, 0)
ENTRY(6, "%sh_oscutd", 0x6c, 0, 0)
ENTRY(6, "%sh_oscuir", 0x6d, 0, 0)
ENTRY(6, "%sh_osr0", 0x6e, 0, 0)
ENTRY(6, "%sh_sclkm3", 0x6f, 0, 0)
ENTRY(3, "%sclkm1", 0x70, 0, 0)
ENTRY(3, "%sclkm2", 0x71, 0, 0)
ENTRY(3, "%sclkm3", 0x72, 0, 0)
ENTRY(6, "%bu_pcsp.hi", 0x74, 0, 0)
ENTRY(6, "%bu_pcsp.lo", 0x75, 0, 0)
ENTRY(2, "%cu_hw0", 0x78, 0, 0)
ENTRY(5, "%cu_hw1", 0x79, 0, 0)
ENTRY(1, "%upsr", 0x80, 0, 0)
ENTRY(1, "%ip", 0x81, 0, 0)
ENTRY(1, "%nip", 0x82, 0, 0)
ENTRY(1, "%lsr", 0x83, 0, 0)
ENTRY(1, "%pfpfr", 0x84, 0, 0)
ENTRY(1, "%fpcr", 0x85, 0, 0)
ENTRY(1, "%fpsr", 0x86, 0, 0)
ENTRY(1, "%ilcr", 0x87, 0, 0)
ENTRY(1, "%br", 0x88, 0, 0)
ENTRY(1, "%bgr", 0x89, 0, 0)
ENTRY(1, "%idr", 0x8a, 0, 0)
ENTRY(1, "%clkr", 0x90, 0, 0)
ENTRY(3, "%rndpr", 0x91, 0, 0)
ENTRY(3, "%sclkr", 0x92, 0, 0)
ENTRY(1, "%tir.hi", 0x9c, 0, 0)
ENTRY(1, "%tir.lo", 0x9d, 0, 0)
ENTRY(1, "%rpr.lo", 0xa0, 0, 0)
/* This flavour of %rpr.lo register name won't be used in disassembler. */
ALT_ENTRY(1, "%rpr", 0xa0, 0, 0)
ENTRY(1, "%sbbp", 0xa1, 0, 0)
ENTRY(1, "%rpr.hi", 0xa2, 0, 0)
ENTRY(3, "%upsrm", 0xc0, 0, 0)
ENTRY(5, "%lsr1", 0xc3, 0, 0)
ENTRY(5, "%ilcr1", 0xc7, 0, 0)

View File

@ -59,7 +59,8 @@ enum sparc_opcode_arch_val
multiply and Fujitsu fp multiply-add. */
SPARC_OPCODE_ARCH_V9M, /* V9 with OSA2015 and M7 additions. */
SPARC_OPCODE_ARCH_M8, /* V9 with OSA2017 and M8 additions. */
SPARC_OPCODE_ARCH_MAX = SPARC_OPCODE_ARCH_M8,
SPARC_OPCODE_ARCH_V9_MCST, /* V9B with MCST additions. */
SPARC_OPCODE_ARCH_MAX = SPARC_OPCODE_ARCH_V9_MCST,
SPARC_OPCODE_ARCH_BAD /* Error return from sparc_opcode_lookup_arch. */
};
@ -172,6 +173,11 @@ typedef struct
#define HWCAP_CBCOND 0x10000000 /* Compare and Branch insns */
#define HWCAP_CRC32C 0x20000000 /* CRC32C insn */
#define HWCAP_R1000 0x40000000
/* This hardware capability is intended to be used in R2000. I wonder if it's
really free . . . */
#define HWCAP_SAPPHIRE 0x80000000
#define HWCAP2_FJATHPLUS 0x00000001 /* Fujitsu Athena+ */
#define HWCAP2_VIS3B 0x00000002 /* Subset of VIS3 present on sparc64 X+. */
#define HWCAP2_ADP 0x00000004 /* Application Data Protection */

2264
ld-/Makefile.am Normal file

File diff suppressed because it is too large Load Diff

View File

@ -220,6 +220,8 @@ ALL_EMULATION_SOURCES = \
ed30velf.c \
edelta68.c \
eelf32_dlx.c \
eelf32_e2k.c \
eelf32_e2k_pm_latest.c \
eelf32_i860.c \
eelf32_i960.c \
eelf32_sparc.c \
@ -477,6 +479,8 @@ ALL_64_EMULATION_SOURCES = \
eelf32ltsmipn32_fbsd.c \
eelf32mipswindiss.c \
eelf64_aix.c \
eelf64_e2k.c \
eelf64_e2k_kpda.c \
eelf64_ia64.c \
eelf64_ia64_fbsd.c \
eelf64_ia64_vms.c \
@ -669,7 +673,7 @@ stringify.sed: ${srcdir}/emultempl/$(STRINGIFY)
# These all start with e so 'make clean' can find them.
GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh "${srcdir}" "${libdir}" "${prefix}" "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@ @enable_initfini_array@
GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh "${srcdir}" "${libdir}" "${prefix}" "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@ @enable_initfini_array@ @enable_debian_multiarch@
GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
ELF_DEPS = $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/elf-generic.em $(srcdir)/scripttempl/DWARF.sc
ELF_GEN_DEPS = $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/elf-generic.em $(srcdir)/emultempl/genelf.em $(srcdir)/scripttempl/DWARF.sc
@ -959,6 +963,17 @@ edelta68.c: $(srcdir)/emulparams/delta68.sh \
eelf32_dlx.c: $(srcdir)/emulparams/elf32_dlx.sh \
$(ELF_GEN_DEPS) $(srcdir)/scripttempl/dlx.sc ${GEN_DEPENDS}
eelf32_e2k.c: $(srcdir)/emulparams/elf_e2k.sh \
$(srcdir)/emulparams/elf32_e2k.sh \
$(ELF_DEPS) $(srcdir)/emultempl/e2kelf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf32_e2k_pm_latest.c: $(srcdir)/emulparams/elf_e2k.sh \
$(srcdir)/emulparams/elf32_e2k_pm_latest.sh \
$(ELF_DEPS) $(srcdir)/emultempl/e2kelf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \
$(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
@ -1921,6 +1936,18 @@ eelf32_x86_64_nacl.c: $(srcdir)/emulparams/elf32_x86_64_nacl.sh \
eelf64_aix.c: $(srcdir)/emulparams/elf64_aix.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf64_e2k.c: $(srcdir)/emulparams/elf_e2k.sh \
$(srcdir)/emulparams/elf64_e2k.sh \
$(ELF_DEPS) $(srcdir)/emultempl/e2kelf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf64_e2k_kpda.c: $(srcdir)/emulparams/elf_e2k.sh \
$(srcdir)/emulparams/elf64_e2k.sh \
$(srcdir)/emulparams/elf64_e2k_kpda.sh \
$(ELF_DEPS) $(srcdir)/emultempl/e2kelf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf64_ia64.c: $(srcdir)/emulparams/elf64_ia64.sh \
$(ELF_DEPS) $(srcdir)/emultempl/ia64elf.em \
$(srcdir)/emultempl/needrelax.em \
@ -2138,13 +2165,13 @@ if ENABLE_PLUGINS
noinst_LTLIBRARIES = libldtestplug.la libldtestplug2.la \
libldtestplug3.la libldtestplug4.la
libldtestplug_la_SOURCES = testplug.c
libldtestplug_la_CFLAGS= -g -O2
libldtestplug_la_CFLAGS= -g -O0
libldtestplug_la_LDFLAGS = -no-undefined -rpath /nowhere
libldtestplug2_la_SOURCES = testplug2.c
libldtestplug2_la_CFLAGS= -g -O2
libldtestplug2_la_CFLAGS= -g -O0
libldtestplug2_la_LDFLAGS = -no-undefined -rpath /nowhere
libldtestplug3_la_SOURCES = testplug3.c
libldtestplug3_la_CFLAGS= -g -O2
libldtestplug3_la_CFLAGS= -g -O0
libldtestplug3_la_LDFLAGS = -no-undefined -rpath /nowhere
libldtestplug4_la_SOURCES = testplug4.c
libldtestplug4_la_CFLAGS= -g -O2

View File

@ -380,6 +380,7 @@ dvidir = @dvidir@
elf_list_options = @elf_list_options@
elf_plt_unwind_list_options = @elf_plt_unwind_list_options@
elf_shlib_list_options = @elf_shlib_list_options@
enable_debian_multiarch = @enable_debian_multiarch@
enable_initfini_array = @enable_initfini_array@
exec_prefix = @exec_prefix@
host = @host@
@ -589,6 +590,8 @@ ALL_EMULATION_SOURCES = \
ed30velf.c \
edelta68.c \
eelf32_dlx.c \
eelf32_e2k.c \
eelf32_e2k_pm_latest.c \
eelf32_i860.c \
eelf32_i960.c \
eelf32_sparc.c \
@ -845,6 +848,8 @@ ALL_64_EMULATION_SOURCES = \
eelf32ltsmipn32_fbsd.c \
eelf32mipswindiss.c \
eelf64_aix.c \
eelf64_e2k.c \
eelf64_e2k_kpda.c \
eelf64_ia64.c \
eelf64_ia64_fbsd.c \
eelf64_ia64_vms.c \
@ -924,7 +929,7 @@ EMULATION_FILES = emultempl/pe.em emultempl/armcoff.em
POTFILES = $(CFILES) $(HFILES) $(EMULATION_FILES)
# These all start with e so 'make clean' can find them.
GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh "${srcdir}" "${libdir}" "${prefix}" "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@ @enable_initfini_array@
GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh "${srcdir}" "${libdir}" "${prefix}" "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@ @enable_initfini_array@ @enable_debian_multiarch@
GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
ELF_DEPS = $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/elf-generic.em $(srcdir)/scripttempl/DWARF.sc
ELF_GEN_DEPS = $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/elf-generic.em $(srcdir)/emultempl/genelf.em $(srcdir)/scripttempl/DWARF.sc
@ -958,13 +963,13 @@ ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBIBERTY) $
@ENABLE_PLUGINS_TRUE@ libldtestplug3.la libldtestplug4.la
@ENABLE_PLUGINS_TRUE@libldtestplug_la_SOURCES = testplug.c
@ENABLE_PLUGINS_TRUE@libldtestplug_la_CFLAGS = -g -O2
@ENABLE_PLUGINS_TRUE@libldtestplug_la_CFLAGS = -g -O0
@ENABLE_PLUGINS_TRUE@libldtestplug_la_LDFLAGS = -no-undefined -rpath /nowhere
@ENABLE_PLUGINS_TRUE@libldtestplug2_la_SOURCES = testplug2.c
@ENABLE_PLUGINS_TRUE@libldtestplug2_la_CFLAGS = -g -O2
@ENABLE_PLUGINS_TRUE@libldtestplug2_la_CFLAGS = -g -O0
@ENABLE_PLUGINS_TRUE@libldtestplug2_la_LDFLAGS = -no-undefined -rpath /nowhere
@ENABLE_PLUGINS_TRUE@libldtestplug3_la_SOURCES = testplug3.c
@ENABLE_PLUGINS_TRUE@libldtestplug3_la_CFLAGS = -g -O2
@ENABLE_PLUGINS_TRUE@libldtestplug3_la_CFLAGS = -g -O0
@ENABLE_PLUGINS_TRUE@libldtestplug3_la_LDFLAGS = -no-undefined -rpath /nowhere
@ENABLE_PLUGINS_TRUE@libldtestplug4_la_SOURCES = testplug4.c
@ENABLE_PLUGINS_TRUE@libldtestplug4_la_CFLAGS = -g -O2
@ -1202,6 +1207,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ed30velf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edelta68.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32_dlx.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32_e2k.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32_e2k_pm_latest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32_i860.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32_i960.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32_sparc.Po@am__quote@
@ -1293,6 +1300,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xstormy16.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xtensa.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_aix.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_e2k.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_e2k_kpda.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64_vms.Po@am__quote@
@ -2523,6 +2532,16 @@ edelta68.c: $(srcdir)/emulparams/delta68.sh \
eelf32_dlx.c: $(srcdir)/emulparams/elf32_dlx.sh \
$(ELF_GEN_DEPS) $(srcdir)/scripttempl/dlx.sc ${GEN_DEPENDS}
eelf32_e2k.c: $(srcdir)/emulparams/elf_e2k.sh \
$(srcdir)/emulparams/elf32_e2k.sh \
$(ELF_DEPS) $(srcdir)/emultempl/e2kelf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf32_e2k_pm_latest.c: $(srcdir)/emulparams/elf_e2k.sh \
$(srcdir)/emulparams/elf32_e2k_pm_latest.sh \
$(ELF_DEPS) $(srcdir)/emultempl/e2kelf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \
$(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
@ -3485,6 +3504,17 @@ eelf32_x86_64_nacl.c: $(srcdir)/emulparams/elf32_x86_64_nacl.sh \
eelf64_aix.c: $(srcdir)/emulparams/elf64_aix.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf64_e2k.c: $(srcdir)/emulparams/elf_e2k.sh \
$(srcdir)/emulparams/elf64_e2k.sh \
$(ELF_DEPS) $(srcdir)/emultempl/e2kelf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf64_e2k_kpda.c: $(srcdir)/emulparams/elf_e2k.sh \
$(srcdir)/emulparams/elf64_e2k.sh \
$(srcdir)/emulparams/elf64_e2k_kpda.sh \
$(ELF_DEPS) $(srcdir)/emultempl/e2kelf.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf64_ia64.c: $(srcdir)/emulparams/elf64_ia64.sh \
$(ELF_DEPS) $(srcdir)/emultempl/ia64elf.em \
$(srcdir)/emultempl/needrelax.em \

19
ld/configure vendored
View File

@ -613,6 +613,7 @@ elf_shlib_list_options
elf_list_options
STRINGIFY
enable_initfini_array
enable_debian_multiarch
ENABLE_PLUGINS_FALSE
ENABLE_PLUGINS_TRUE
NATIVE_LIB_DIRS
@ -793,6 +794,7 @@ enable_relro
enable_werror
enable_build_warnings
enable_nls
enable_debian_multiarch
enable_initfini_array
'
ac_precious_vars='build_alias
@ -1453,6 +1455,7 @@ Optional Features:
--enable-werror treat compile warnings as errors
--enable-build-warnings enable build-time compiler warnings
--disable-nls do not use Native Language Support
--enable-debian-multiarch use debian multiarch library search paths
--disable-initfini-array do not use .init_array/.fini_array sections
Optional Packages:
@ -11722,7 +11725,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11725 "configure"
#line 11728 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11828,7 +11831,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11831 "configure"
#line 11834 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -16913,6 +16916,18 @@ else
fi
# Check whether --enable-debian-multiarch was given.
if test "${enable_debian_multiarch+set}" = set; then :
enableval=$enable_debian_multiarch; case "${enableval}" in
yes|no) ;;
*) as_fn_error "invalid --enable-debian-multiarch argument" "$LINENO" 5 ;;
esac
else
enable_debian_multiarch=no
fi
# Check whether --enable-initfini-array was given.
if test "${enable_initfini_array+set}" = set; then :
enableval=$enable_initfini_array; case "${enableval}" in

View File

@ -232,6 +232,14 @@ AC_FUNC_MMAP
AC_SEARCH_LIBS([dlopen], [dl])
AM_CONDITIONAL([ENABLE_PLUGINS], [test x$plugins = xyes])
AC_ARG_ENABLE(debian-multiarch,
[ --enable-debian-multiarch use debian multiarch library search paths],
[case "${enableval}" in
yes|no) ;;
*) AC_MSG_ERROR([invalid --enable-debian-multiarch argument]) ;;
esac], [enable_debian_multiarch=no])
AC_SUBST(enable_debian_multiarch)
AC_ARG_ENABLE(initfini-array,
[ --disable-initfini-array do not use .init_array/.fini_array sections],
[case "${enableval}" in

View File

@ -206,6 +206,11 @@ d30v-*-*) targ_emul=d30velf; targ_extra_emuls="d30v_e d30v_o"
;;
dlx-*-elf*) targ_emul=elf32_dlx
;;
e2k-mcst-linux-gnu) targ_emul=elf64_e2k
targ_extra_emuls="elf32_e2k elf32_e2k_pm_latest"
;;
e2k-mcst-kpda) targ_emul=elf64_e2k_kpda
;;
epiphany-*-*) targ_emul=elf32epiphany
targ_extra_emuls="elf32epiphany_4x4"
;;

View File

@ -0,0 +1,14 @@
# At present I'd prefer to have `OUTPUT_ARCH(e2k:32)' rather than just
# `OUTPUT_ARCH (e2k)' inside the corresponding LD script (see elf.sc).
MACHINE=32
OUTPUT_FORMAT="elf32-e2k"
# This suffix is appended to various paths when generating SEARCH_DIRs. Keep in
# mind that it is appended even in case when USE_LIBPATH is not set to yes (e.g.
# to paths coming from TOOL_DIR when building a cross-ld). The failure to set it
# turned out to be a reason for Bug #70607 (a duplicate of Bug #45284 for
# up-to-date binutils).
LIBPATH_SUFFIX=32
. ${srcdir}/emulparams/elf_e2k.sh

View File

@ -0,0 +1,32 @@
# At present I'd prefer to have `OUTPUT_ARCH(e2k:pm)' rather than just
# `OUTPUT_ARCH (e2k)' inside the corresponding LD script (see elf.sc).
MACHINE=pm
ENABLE_BUG_89922=yes
OUTPUT_FORMAT="elf32-e2k-pm"
# Avoid placing read-only data sections into the code segment in E2K
# Protected Mode this way:
SEPARATE_CODE=yes
# Ensure that `/{,usr/,...}lib128' libraries are inserted at the start
# of SEARCH_DIRs.
LIBPATH_SUFFIX=128
. ${srcdir}/emulparams/elf_e2k.sh
# Unlike ordinary modes I'd prefer a shared library's text segment to start
# from a non-zero address since zero link-time relocation values are currently
# used to distinguish weak undefined symbols when generating `__selfinit ()' in
# my PM BFD backend.
SHLIB_TEXT_START_ADDR=$TEXT_START_ADDR
# Taking into account that 'SEGMENT_SIZE == MAXPAGESIZE' by default this
# ensures that RO segment has a suitable alignment for placing ELF and Program
# Headers in the very beginning of it. Sufficient space for them is allocated
# in ld/scripttempl/elf.sc by means of SIZEOF_HEADERS.
RODATA_ADDR="ALIGN(${SEGMENT_SIZE})"
SHLIB_RODATA_ADDR=$RODATA_ADDR
TEXT_START_SYMBOLS="
PROVIDE_HIDDEN (__selfinit = .);
*(.text.selfinit)"

View File

@ -11,8 +11,36 @@ ALIGNMENT=8
ARCH=sparc
MACHINE=
TEMPLATE_NAME=elf32
EXTRA_EM_FILE=sparcelf
DATA_PLT=
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NOP=0x01000000
NO_SMALL_DATA=yes
# Configurations with `--host=sparc-linux' and `--target=sparc-linux-elf'
# (see Bug #60990 for motivations which make us configure binutils this way)
# should be considered native so that `/usr/local/lib /lib /usr/lib' can find
# their way to SEARCH_DIR (". . .") as it happens when both
# `--{host,target}=sparc-linux'. The absence of the aforementioned paths in
# SEARCH_DIR (". . .") led to Bug #65304.
# Fix this problem in the most primitive way: if the host seems to be Sparc of
# any kind, treat this configuration as native.
case "$host" in
sparc*-*)
NATIVE=yes
;;
esac
# Support EIR linkage. This variable is used in `elf32.em' to emit the code
# which prevents us from customizing `__ehdr_start' when linking EIR.
SUPPORT_EIR=yes
# On modern Sparc64 Debian sid 32-bit glibc is installed into `{,/usr}/lib32'.
# Ensure that `sparc64-linux-ld' is capable of finding it without the help of
# `-L/lib/../lib32 -L/usr/lib/../lib32' options which are explicitly passed to
# it by GCC on such systems as I'm reluctant to replicate this idiotic
# behaviour.
if [ "x${enable_debian_multiarch}" = "xyes" ]; then
LIBPATH_SUFFIX=32
fi

View File

@ -0,0 +1,14 @@
# At present I'd prefer to have `OUTPUT_ARCH(e2k:64)' rather than just
# `OUTPUT_ARCH (e2k)' inside the corresponding LD script (see elf.sc).
MACHINE=64
OUTPUT_FORMAT="elf64-e2k"
# This suffix is appended to various paths when generating SEARCH_DIRs. Keep in
# mind that it is appended even in case when USE_LIBPATH is not set to yes (e.g.
# to paths coming from TOOL_DIR when building a cross-ld). The failure to set it
# turned out to be a reason for Bug #70607 (a duplicate of Bug #45284 for
# up-to-date binutils).
LIBPATH_SUFFIX=64
. ${srcdir}/emulparams/elf_e2k.sh

View File

@ -0,0 +1,7 @@
# Prevent e2k_set_output_arch () in e2kelf.em from referencing 32 and Protected
# Mode target vectors which are not supported for KPDA meanwhile.
KPDA=1
. ${srcdir}/emulparams/elf64_e2k.sh
# Ensure that a KPDA-specific BFD target is used.
OUTPUT_FORMAT="elf64-e2k-kpda"

View File

@ -1,6 +1,7 @@
SCRIPT_NAME=elf
ELFSIZE=64
TEMPLATE_NAME=elf32
EXTRA_EM_FILE=sparcelf
OUTPUT_FORMAT="elf64-sparc"
NO_REL_RELOCS=yes
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
@ -48,3 +49,7 @@ case "$EMULATION_NAME" in
esac
;;
esac
# Support EIR linkage. This variable is used in `elf32.em' to emit the code
# which prevents us from customizing `__ehdr_start' when linking EIR.
SUPPORT_EIR=yes

44
ld/emulparams/elf_e2k.sh Normal file
View File

@ -0,0 +1,44 @@
SCRIPT_NAME=elf
NO_REL_RELOCS=yes
TEXT_START_ADDR="MAX (0x10000, CONSTANT (MAXPAGESIZE))"
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
ALIGNMENT=8
ARCH=e2k
TEMPLATE_NAME=elf32
EXTRA_EM_FILE=e2kelf
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
# I'd like '-rpath' option to take effect when performing the link
# (see the implementation of after_open () in elf32.em).
# Am not I going to break anything . . . ?
# . . . as a consequence directories coming from the NATIVE_LIB_DIRS parameter
# of 'genscripts.sh' (i.e. "/usr/local/lib /lib /usr/lib") are included in
# SEARCH_DIRs of cross-ld for which USE_LIBPATH shouldn't be normally set . . .
# What was the point for treating '-rpath' specially in case of cross-ld? Can
# I stop setting 'USE_LIBPATH' here? In case you do, don't forget to add
# 'elf32_e2k' to 'EMULATION_LIBPATH' in 'genscripts.sh' by setting
# 'targ_extra_libpath=elf32_e2k' in ld/configure.tgt . Otherwise it won't be
# set when generating 'elf32_e2k' emulation for native LD and it'll never get
# NATIVE_LIB_DIRS . . .
USE_LIBPATH=yes
# In non-protected mode we need a special `place_orphan'
# method to group dsp sections together without a script.
LDEMUL_PLACE_ORPHAN=${EMULATION_NAME}_place_orphan
# In non-protected mode we need a special `after_allocation'
# method to correct DSP sections' VMAs.
LDEMUL_AFTER_ALLOCATION=${EMULATION_NAME}_after_allocation;
# Support EIR linkage. This variable is used in `elf32.em' to emit the code
# which prevents us from customizing `__ehdr_start' when linking EIR.
SUPPORT_EIR=yes
# Delay checking ELF relocations until opening all input files
CHECK_RELOCS_AFTER_OPEN_INPUT=yes

569
ld/emultempl/e2kelf.em Normal file
View File

@ -0,0 +1,569 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2003, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
#
# This file is sourced from elf32.em, and defines extra e2k-elf
# specific routines.
#
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
fragment <<EOF
#include "elfxx-e2k.h"
static int e2k_ipd;
static int e2k_is_x86app;
static int e2k_is_4mpages;
/* Specifies that an architecture has been explicitly set via a command
line. */
static bfd_boolean arch_set_via_cmdline;
/* Whether the target should restrict itself to input files having an
architecture set via cmdline by means of '--restrict-to-arch ARCH' only (see
Bug #82047). Provided that this variable is TRUE, the former should be TRUE
as well, since --restrict-to-arch specifies output ARCH at the same
time. */
static bfd_boolean restrict_to_arch;
static bfd_boolean relaxed_e2k_machine_check;
static int link_mixed_eir;
static bfd_boolean output_new_e_machine = TRUE;
static bfd_boolean mark_objects;
static bfd_boolean inside_marked_objects;
/* A simulating mode which should make it possible to "link" any input object
file alone in a reproducible way. The goal is to get rid of relocations
which make it so difficult to compare output files produced by different
assemblers. */
static bfd_boolean simulate;
static bfd_boolean ignore_pure_eir_files;
/* Placeholders used to restore the corresponding values set
via cmdline. */
static enum bfd_architecture cmdline_output_architecture;
static unsigned long cmdline_output_machine;
EOF
# This code gets inserted into the generic elf32.sc linker script
# and allows us to define our own command line switches.
PARSE_AND_LIST_PROLOGUE='
#define OPTION_E2K_IPD 301
#define OPTION_E2K_X86APP 302
#define OPTION_E2K_4MPAGES 303
#define OPTION_RELAXED_E2K_MACHINE_CHECK 304
#define OPTION_LINK_MIXED_EIR 305
#define OPTION_OLD_E_MACHINE 306
#define OPTION_NEW_PM_SEMANTICS 307
#define OPTION_DSP_LINUX_MODE 308
#define OPTION_MARK_REGULAR_OBJECTS 309
#define OPTION_START_REGULAR_OBJECTS 310
#define OPTION_END_REGULAR_OBJECTS 311
#define OPTION_BINARY_EIR_OUTPUT 312
#define OPTION_RESTRICT_TO_ARCH 313
#define OPTION_SIMULATE 314
#define OPTION_IGNORE_PURE_EIR_FILES 315
'
PARSE_AND_LIST_LONGOPTS='
{ "e2k-ipd", required_argument, NULL, OPTION_E2K_IPD },
{ "e2k-x86app", no_argument, NULL, OPTION_E2K_X86APP },
{ "e2k-4mpages", no_argument, NULL, OPTION_E2K_4MPAGES },
{ "relaxed-e2k-machine-check", no_argument, NULL, OPTION_RELAXED_E2K_MACHINE_CHECK },
{ "link-mixed-eir", required_argument, NULL, OPTION_LINK_MIXED_EIR},
{ "old-e-machine", no_argument, NULL, OPTION_OLD_E_MACHINE},
{ "force-new-pm-semantics", no_argument, NULL, OPTION_NEW_PM_SEMANTICS},
{ "dsp-linux-mode", no_argument, NULL, OPTION_DSP_LINUX_MODE},
{ "mark-regular-objects", no_argument, NULL, OPTION_MARK_REGULAR_OBJECTS},
{ "start-regular-objects", no_argument, NULL, OPTION_START_REGULAR_OBJECTS},
{ "end-regular-objects", no_argument, NULL, OPTION_END_REGULAR_OBJECTS},
{ "binary-eir-output", no_argument, NULL, OPTION_BINARY_EIR_OUTPUT},
{ "restrict-to-arch", required_argument, NULL, OPTION_RESTRICT_TO_ARCH},
{ "simulate", no_argument, NULL, OPTION_SIMULATE},
{ "ignore-pure-eir-files", no_argument, NULL, OPTION_IGNORE_PURE_EIR_FILES},
'
PARSE_AND_LIST_OPTIONS='
fprintf (file, _(" --link-mixed-eir={1,2,3}\n"));
fprintf (file, _("\t\t\tLink mixed EIR\n"));
'
PARSE_AND_LIST_ARGS_CASES='
case OPTION_E2K_IPD:
{
const char *end;
e2k_ipd = (int) bfd_scan_vma (optarg, &end, 0);
if (*end
|| e2k_ipd < 0
|| e2k_ipd > 2)
einfo (_("%P%F: invalid argument '\''%s'\'' to option '\''%s'\''\n"), optarg, "--e2k-ipd");
e2k_ipd += 1;
}
break;
case OPTION_E2K_X86APP:
e2k_is_x86app = 1;
break;
case OPTION_E2K_4MPAGES:
e2k_is_4mpages = 1;
break;
case OPTION_DSP_LINUX_MODE:
e2k_dsp_linux_mode = TRUE;
break;
case OPTION_RESTRICT_TO_ARCH:
restrict_to_arch = TRUE;
/* Fall through. */
case '\'A\'':
/* This option has a very special meaning for E2k. It is not
absolutely necessary at present though. TODO: find out whether the
underlying code (especially "ldfile_set_output_arch ()") is needed at
all now that the output architecture is finally set in
_bfd_e2k_elf_merge_private_bfd_data (). Probably it is, because the
latter function makes use of OBFD->arch_info. */
{
char *arch_name = xmalloc (strlen (optarg) + 4);
sprintf (arch_name, "%s:%s", optarg, "'$MACHINE'");
ldfile_set_output_arch (arch_name, bfd_arch_e2k);
arch_set_via_cmdline = TRUE;
free (arch_name);
}
/* Save architecture and machine values obtained two lines above in
order to be able to restore them later in set_output_arch method. */
cmdline_output_architecture = ldfile_output_architecture;
cmdline_output_machine = ldfile_output_machine;
break;
case OPTION_RELAXED_E2K_MACHINE_CHECK:
relaxed_e2k_machine_check = TRUE;
break;
case OPTION_LINK_MIXED_EIR:
if ((optarg[0] != '\''1'\'' && optarg[0] != '\''2'\''
&& optarg[0] != '\''3'\'')
|| optarg[1] != '\''\0'\'')
einfo (_("%P%F: invalid value for '\''--link-mixed-eir'\'' option: '\''%s'\''\n"), optarg);
link_mixed_eir = optarg[0] - '\''0'\'';
break;
case OPTION_OLD_E_MACHINE:
output_new_e_machine = FALSE;
break;
case OPTION_NEW_PM_SEMANTICS:
break;
case OPTION_MARK_REGULAR_OBJECTS:
mark_objects = TRUE;
break;
case OPTION_START_REGULAR_OBJECTS:
inside_marked_objects = TRUE;
break;
case OPTION_END_REGULAR_OBJECTS:
inside_marked_objects = FALSE;
break;
case OPTION_BINARY_EIR_OUTPUT:
break;
case OPTION_SIMULATE:
simulate = 1;
break;
case OPTION_IGNORE_PURE_EIR_FILES:
ignore_pure_eir_files = TRUE;
break;
case 1:
/* Beware that this macro becomes part of emulation-specific "handle_
option ()" method. Returning TRUE for a filename below prevents
parse_args () in ld/lexsup.c from adding it as an input file. */
if (!mark_objects || inside_marked_objects)
return FALSE;
{
bfd_boolean ret = FALSE;
bfd *abfd = bfd_openr (optarg, "default");
if (abfd == NULL)
return FALSE;
/* My goal is to prevent relocatable objects not surrounded by
"--{start,end}-regular-objects" options from being included into
the final link. As you remember such a situation emerges if an object
is passed via "-Wl,f.o". This should apply neither to static nor to
shared libraries explicitly passed by their filenames (i.e. not via
-l option). Indeed, one may need to fetch some objects from the
former in case the mixed EIR contained in them has not been linked
into total EIR at "--link-mixed-eir=2" stage, while the latter never
take part in EIR linkage at all. It was Bug #81255 that made me
revisit the latter case. */
if (bfd_check_format (abfd, bfd_object)
&& (bfd_get_flavour (abfd) != bfd_target_elf_flavour
|| elf_elfheader (abfd)->e_type != ET_DYN))
ret = TRUE;
bfd_close (abfd);
return ret;
}
break;
'
fragment <<EOF
/* This is called before the hash table is allocated. */
static void
e2k_after_parse (void)
{
/* Inhibit '--export-dynamic' in '--link-mixed-eir=X' mode. These options turn
out to be passed together by LCC when it's invoked with '-fsanitize=address
-fwhole' (see Bug #82854). Now that '--export-dynamic' enforces creation of
dynamic sections, it would lead to appearance of a bogus '.dynamic' section
in the relocatable output at '--linux-mixed-eir=1' stage. If this
irrelevant '.dynamic' coming from an input file was eventually linked into
the executable at the final stage, its bogus entries would override the
ones created by LD during the final link, which would lead to a runtime
failure described in the above bug. */
if (link_mixed_eir >=1 && link_mixed_eir <= 3)
link_info.export_dynamic = FALSE;
/* LINK_MIXED_EIR should be available by the time we open each input
file. */
_bfd_e2k_elf_after_parse (link_mixed_eir);
gld${EMULATION_NAME}_after_parse ();
}
static bfd_boolean gld${EMULATION_NAME}_load_symbols
(lang_input_statement_type *);
static bfd_boolean
pure_eir_finder (bfd *abfd ATTRIBUTE_UNUSED,
asection *section,
void *ptr ATTRIBUTE_UNUSED)
{
return strcmp (section->name, ".pack_pure_eir") == 0;
}
static bfd_boolean
e2k_recognized_file (lang_input_statement_type *entry)
{
if (link_mixed_eir != 0 && (entry->the_bfd->flags & DYNAMIC) != 0)
return TRUE;
if (ignore_pure_eir_files
&& bfd_sections_find_if (entry->the_bfd, pure_eir_finder, NULL))
return TRUE;
/* Otherwise, the standard implementation from 'elf32.em' will do. */
return gld${EMULATION_NAME}_load_symbols (entry);
}
static bfd_boolean
e2k_allow_dynamic_entries_in_relocatable_link (void)
{
if (link_mixed_eir != 0)
return TRUE;
return FALSE;
}
/* This is called after the input files have been opened. TODO: some of the
parameters below could be probably set via
e2k_create_output_section_statements () which doesn't exist at
present . . . */
static void
e2k_after_open (void)
{
/* Hash table has been already allocated by the time I call this
function (see the end of 'open_output ()' in 'ldlang.c'. */
_bfd_e2k_elf_after_open (e2k_ipd, e2k_is_x86app, e2k_is_4mpages,
arch_set_via_cmdline, restrict_to_arch,
relaxed_e2k_machine_check, output_new_e_machine,
simulate);
gld${EMULATION_NAME}_after_open ();
}
static char * gld${EMULATION_NAME}_get_script (int *);
static char *
e2k_get_script (int *isfile)
{
if (link_mixed_eir == 2)
{
*isfile = 0;
return ("SECTIONS\n"
"{\n"
"\t.pack_pure_eir : { *(.pack_pure_eir) }\n"
"\t.pack_mixed_eir : { *(.pack_mixed_eir) }\n"
"\t/DISCARD/ : { *(*) }\n"
"}\n");
}
return gld${EMULATION_NAME}_get_script (isfile);
}
static void
e2k_set_output_arch (void)
{
EOF
if test -z "$KPDA"; then
if test "$MACHINE" = "64"; then
fragment <<EOF
int addend = 0;
EOF
elif test "$MACHINE" = "32"; then
fragment <<EOF
int addend = 1;
EOF
else
fragment <<EOF
int addend = 2;
EOF
fi
fi
fragment <<EOF
if (arch_set_via_cmdline)
{
/* Restore the values obtained from the commandline. They've
already been spoiled by . . . ??? */
ldfile_output_architecture = cmdline_output_architecture;
ldfile_output_machine = cmdline_output_machine;
}
/* Now make the output file machine number match the TARGET vector. Keep in
mind that currently we have a one to one correspondence between a target
vector and the corresponding ABI, which is encoded in the machine number.
E.g., ELF32 targets for E2K cannot be used to produce output for the 64-bit
ABI and so on.
This way, the 'OUTPUT_FORMAT ()' directive will SILENTLY (because currently
I don't need a public discussion) take precedence over ABI which a user
might have specified via the 'OUTPUT_ARCH(...:XX)' directive. */
EOF
if test -z "$KPDA"; then
fragment <<EOF
ldfile_output_machine = (ldfile_output_machine / 3) * 3 + addend;
EOF
fi
fragment <<EOF
set_output_arch_default ();
}
EOF
if test -n "$LDEMUL_PLACE_ORPHAN"; then
fragment <<EOF
static lang_output_section_statement_type *
insert_output_section_statement (const char *name)
{
lang_statement_list_type add;
lang_output_section_statement_type *os;
lang_list_init (&add);
os = lang_enter_output_section_statement (name, NULL, 0,
NULL, NULL, NULL, 0, 0);
lang_leave_output_section_statement (0, "*default*", NULL, NULL);
return os;
}
static lang_output_section_statement_type *
place_dsp_section (asection *s, const char *os_name)
{
lang_output_section_statement_type *os;
os = lang_output_section_find (os_name);
if (os == NULL)
{
os = insert_output_section_statement (os_name);
/* 2 ^ 17 == 128 Kb: align a DSP-specific output section in E2K space to
maximal possible alignment at DSP side. This is probably the only way
to ensure that the section and its symbols are aligned appropriately
from the point of view of DSP. */
os->section_alignment = 17;
}
lang_add_section (&os->children, s, NULL, os);
return os;
}
static const char *
dsp_output_section_name (const char *sec_name)
{
int is_text;
int sid;
const char *c;
static char os_name[32];
if (! (is_text = CONST_STRNEQ (sec_name, ".dsp_text"))
&& ! CONST_STRNEQ (sec_name, ".dsp_data")
&& ! CONST_STRNEQ (sec_name, ".dsp_rodata")
&& ! CONST_STRNEQ (sec_name, ".dsp_bss")
&& ! CONST_STRNEQ (sec_name, "DSP_COMMON"))
return NULL;
c = sec_name;
while (*c != '\0' && ! ISDIGIT (*c))
c++;
if (! ISDIGIT (*c) || !ISDIGIT (c[1]) || c[2] != '\0')
return NULL;
sid = 10 * (c[0] - '0') + (c[1] - '0');
if (sid >= 16)
return NULL;
sprintf (os_name, "%s%02d", is_text ? ".dsp_text" : ".dsp_data", sid);
return xstrdup (os_name);
}
static lang_output_section_statement_type *
${LDEMUL_PLACE_ORPHAN} (asection *s, const char *secname, int constraint)
{
struct _bfd_e2k_elf_link_hash_table *htab;
htab = _bfd_e2k_elf_hash_table (&link_info);
if (e2k_dsp_linux_mode && htab->have_dsp_output)
{
const char *os_name = dsp_output_section_name (s->name);
if (os_name)
return place_dsp_section (s, os_name);
}
return gld${EMULATION_NAME}_place_orphan (s, secname, constraint);
}
EOF
fi
if test -n "$LDEMUL_AFTER_ALLOCATION" ; then
fragment <<EOF
static void
define_dsp_symbol (const char *name, asection *section, bfd_vma value)
{
struct bfd_link_hash_entry *h;
h = bfd_link_hash_lookup (link_info.hash, name, TRUE,
TRUE, TRUE);
h->type = bfd_link_hash_defined;
h->u.def.value = value;
h->u.def.section = section;
}
static void
${LDEMUL_AFTER_ALLOCATION} (void)
{
unsigned int i;
struct _bfd_e2k_elf_link_hash_table *htab;
htab = _bfd_e2k_elf_hash_table (&link_info);
/* We don't need any segment map tuning when using a
hand-made linker script for producing an executable to
be loaded with BOOT. */
if (!e2k_dsp_linux_mode || !htab->have_dsp_output)
{
gld${EMULATION_NAME}_after_allocation ();
return;
}
/* The call of this function currently undoes all my attempts to assign VMA
addresses to DSP sections . . . */
gld${EMULATION_NAME}_after_allocation ();
for (i = 0; i < 16; i++)
{
static char os_name[64], sym_name[64];
lang_output_section_statement_type *os;
bfd_vma true_vma;
true_vma = (bfd_get_section_by_name (link_info.output_bfd, ".dsp_mem")->vma
+ 32 * 1024 * i);
sprintf (os_name, ".dsp_text%02d",i);
os = lang_output_section_find (os_name);
if (os && os->bfd_section)
{
os->bfd_section->vma = true_vma;
sprintf (sym_name, "__DSP%02d_CODE_BEGIN_VMA", i);
define_dsp_symbol (sym_name, os->bfd_section, 0);
sprintf (sym_name, "__DSP%02d_CODE_BEGIN_LMA", i);
define_dsp_symbol (sym_name, bfd_abs_section_ptr,
os->bfd_section->lma);
sprintf (sym_name, "__DSP%02d_CODE_END_LMA", i);
define_dsp_symbol (sym_name, bfd_abs_section_ptr,
(os->bfd_section->lma
+ os->bfd_section->size));
}
true_vma = (bfd_get_section_by_name (link_info.output_bfd, ".dsp_mem")->vma
+ (512 + 128 * i) * 1024);
sprintf (os_name, ".dsp_data%02d", i);
os = lang_output_section_find (os_name);
if (os && os->bfd_section)
{
os->bfd_section->vma = true_vma ;
sprintf (sym_name, "__DSP%02d_DATA_BEGIN_VMA", i);
define_dsp_symbol (sym_name, os->bfd_section, 0);
sprintf (sym_name, "__DSP%02d_DATA_BEGIN_LMA", i);
define_dsp_symbol (sym_name, bfd_abs_section_ptr,
os->bfd_section->lma);
sprintf (sym_name, "__DSP%02d_DATA_END_LMA", i);
define_dsp_symbol (sym_name, bfd_abs_section_ptr,
(os->bfd_section->lma + os->bfd_section->size));
}
}
}
EOF
fi
LDEMUL_GET_SCRIPT=e2k_get_script
LDEMUL_AFTER_PARSE=e2k_after_parse
LDEMUL_RECOGNIZED_FILE=e2k_recognized_file
LDEMUL_ALLOW_DYNAMIC_ENTRIES_IN_RELOCATABLE_LINK=\
e2k_allow_dynamic_entries_in_relocatable_link
LDEMUL_AFTER_OPEN=e2k_after_open
LDEMUL_SET_OUTPUT_ARCH=e2k_set_output_arch

View File

@ -1696,7 +1696,14 @@ gld${EMULATION_NAME}_before_allocation (void)
if (is_elf_hash_table (link_info.hash))
{
_bfd_elf_tls_setup (link_info.output_bfd, &link_info);
EOF
if [ -n "$SUPPORT_EIR" ]; then
fragment <<EOF
if (link_mixed_eir == 0)
{
EOF
fi
fragment << EOF
/* Make __ehdr_start hidden if it has been referenced, to
prevent the symbol from being dynamic. */
if (!bfd_link_relocatable (&link_info))
@ -1734,6 +1741,13 @@ gld${EMULATION_NAME}_before_allocation (void)
referred to by dynamic objects. */
lang_for_each_statement (gld${EMULATION_NAME}_find_statement_assignment);
}
EOF
if [ -n "$SUPPORT_EIR" ]; then
fragment <<EOF
}
EOF
fi
fragment <<EOF
/* Let the ELF backend work out the sizes of any sections required
by dynamic linking. */
@ -2819,6 +2833,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
${LDEMUL_RECOGNIZED_FILE-gld${EMULATION_NAME}_load_symbols},
${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
${LDEMUL_NEW_VERS_PATTERN-NULL},
${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL}
${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
${LDEMUL_ALLOW_DYNAMIC_ENTRIES_IN_RELOCATABLE_LINK-NULL}
};
EOF

View File

@ -207,6 +207,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
NULL, /* recognized file */
NULL, /* find_potential_libraries */
NULL, /* new_vers_pattern */
NULL /* extra_map_file_text */
NULL, /* extra_map_file_text */
NULL
};
EOF

View File

@ -1,5 +1,8 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
source_em ${srcdir}/emultempl/sparcelf.em
if [ -z "$MACHINE" ]; then
OUTPUT_ARCH=${ARCH}
else

153
ld/emultempl/sparcelf.em Normal file
View File

@ -0,0 +1,153 @@
# This shell script emits a C file. -*- C -*-
#
LDEMUL_GET_SCRIPT=${EMULATION_NAME}_get_script
LDEMUL_AFTER_PARSE=${EMULATION_NAME}_after_parse
LDEMUL_RECOGNIZED_FILE=${EMULATION_NAME}_recognized_file
LDEMUL_ALLOW_DYNAMIC_ENTRIES_IN_RELOCATABLE_LINK=\
${EMULATION_NAME}_allow_dynamic_entries_in_relocatable_link
fragment <<EOF
#include "elfxx-sparc.h"
static int link_mixed_eir = 0;
static bfd_boolean mark_objects;
static bfd_boolean inside_marked_objects;
static bfd_boolean ignore_pure_eir_files;
static char * gld${EMULATION_NAME}_get_script (int *);
static char *
${LDEMUL_GET_SCRIPT} (int *isfile)
{
if (link_mixed_eir == 2)
{
*isfile = 0;
return ("SECTIONS\n"
"{\n"
"\t.pack_pure_eir : { *(.pack_pure_eir) }\n"
"\t.pack_mixed_eir : { *(.pack_mixed_eir) }\n"
"\t/DISCARD/ : { *(*) }\n"
"}\n");
}
return gld${EMULATION_NAME}_get_script (isfile);
}
static void
${LDEMUL_AFTER_PARSE} (void)
{
_bfd_sparc_elf_after_parse (link_mixed_eir);
gld${EMULATION_NAME}_after_parse ();
}
static bfd_boolean gld${EMULATION_NAME}_load_symbols
(lang_input_statement_type *);
static bfd_boolean
pure_eir_finder (bfd *abfd ATTRIBUTE_UNUSED,
asection *section,
void *ptr ATTRIBUTE_UNUSED)
{
return strcmp (section->name, ".pack_pure_eir") == 0;
}
static bfd_boolean
${LDEMUL_RECOGNIZED_FILE} (lang_input_statement_type *entry)
{
if (link_mixed_eir != 0 && (entry->the_bfd->flags & DYNAMIC) != 0)
return TRUE;
if (ignore_pure_eir_files
&& bfd_sections_find_if (entry->the_bfd, pure_eir_finder, NULL))
return TRUE;
/* Otherwise, the standard implementation from 'elf32.em' will do. */
return gld${EMULATION_NAME}_load_symbols (entry);
}
static bfd_boolean
${LDEMUL_ALLOW_DYNAMIC_ENTRIES_IN_RELOCATABLE_LINK} (void)
{
if (link_mixed_eir != 0)
return TRUE;
return FALSE;
}
EOF
PARSE_AND_LIST_PROLOGUE='
#define OPTION_LINK_MIXED_EIR 301
#define OPTION_BINARY_EIR_OUTPUT 302
#define OPTION_MARK_REGULAR_OBJECTS 303
#define OPTION_START_REGULAR_OBJECTS 304
#define OPTION_END_REGULAR_OBJECTS 305
#define OPTION_IGNORE_PURE_EIR_FILES 306
'
PARSE_AND_LIST_LONGOPTS='
{ "link-mixed-eir", required_argument, NULL, OPTION_LINK_MIXED_EIR },
{ "binary-eir-output", no_argument, NULL, OPTION_BINARY_EIR_OUTPUT},
{ "mark-regular-objects", no_argument, NULL, OPTION_MARK_REGULAR_OBJECTS},
{ "start-regular-objects", no_argument, NULL, OPTION_START_REGULAR_OBJECTS},
{ "end-regular-objects", no_argument, NULL, OPTION_END_REGULAR_OBJECTS},
{ "ignore-pure-eir-files", no_argument, NULL, OPTION_IGNORE_PURE_EIR_FILES},
'
PARSE_AND_LIST_OPTIONS='
fprintf (file, _(" --link-mixed-eir={1,2,3}\n"));
fprintf (file, _("\t\t\tLink mixed EIR\n"));
'
PARSE_AND_LIST_ARGS_CASES='
case OPTION_LINK_MIXED_EIR:
if ((optarg[0] != '\''1'\'' && optarg[0] != '\''2'\'' && optarg[0] != '\''3'\'')
|| optarg[1] != '\''\0'\'')
einfo (_("%P%F: invalid value for `--link-mixed-eir'\'' option: '\''%s'\''\n"), optarg);
link_mixed_eir = optarg[0] - '\''0'\'';
break;
case OPTION_BINARY_EIR_OUTPUT:
break;
case OPTION_MARK_REGULAR_OBJECTS:
mark_objects = TRUE;
break;
case OPTION_START_REGULAR_OBJECTS:
inside_marked_objects = TRUE;
break;
case OPTION_END_REGULAR_OBJECTS:
inside_marked_objects = FALSE;
break;
case OPTION_IGNORE_PURE_EIR_FILES:
ignore_pure_eir_files = TRUE;
break;
case 1:
if (!mark_objects || inside_marked_objects)
return FALSE;
{
bfd_boolean ret = FALSE;
bfd *abfd = bfd_openr (optarg, "default");
if (abfd == NULL)
return FALSE;
if (bfd_check_format (abfd, bfd_object))
ret = TRUE;
bfd_close (abfd);
return ret;
}
break;
'

View File

@ -1036,6 +1036,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
NULL, /* recognized file */
NULL, /* find_potential_libraries */
NULL, /* new_vers_pattern */
NULL /* extra_map_file_text */
NULL, /* extra_map_file_text */
NULL
};
EOF

Some files were not shown because too many files have changed in this diff Show More