diff --git a/.gitignore b/.gitignore index 0a40764c..9aa17853 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,4 @@ stamp-* /gmp* /isl* /gettext* +/__build diff --git a/bfd/config.bfd b/bfd/config.bfd index 6553aac1..39008568 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -1502,6 +1502,31 @@ case "${targ}" in ;; #endif + i[3-7]86-*-fennix*) + targ_defvec=i386_elf32_vec + targ_selvecs= + targ64_selvecs=x86_64_elf64_vec + ;; + + arm*-*-fennix*) + targ_defvec=arm_elf32_le_vec + targ_selvecs="arm_elf32_fdpic_le_vec arm_elf32_be_vec arm_elf32_fdpic_be_vec" + ;; + +#ifdef BFD64 + x86_64-*-fennix*) + targ_defvec=x86_64_elf64_vec + targ_selvecs=i386_elf32_vec + want64=true + ;; + + aarch64-*-fennix*) + targ_defvec=aarch64_elf64_le_vec + targ_selvecs="aarch64_elf64_be_vec arm_elf32_le_vec arm_elf32_be_vec" + want64=true + ;; +#endif + # END OF targmatch.h bpf-*-*) echo "*** Configuration $targ is not fully supported." >&2 diff --git a/binutils/readelf.c b/binutils/readelf.c index 5d1cf9c3..f09b448f 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -20909,6 +20909,30 @@ get_gnu_elf_note_type (unsigned e_type) } } +static const char * +get_fnx_elf_note_type (unsigned e_type) +{ + /* NB/ Keep this switch statement in sync with print_gnu_note (). */ + switch (e_type) + { + case NT_FNX_ABI_TAG: + return _("NT_FNX_ABI_TAG (ABI version tag)"); + case NT_FNX_VERSION: + return _("NT_FNX_VERSION (version)"); + case NT_FNX_BUILD_ID: + return _("NT_FNX_BUILD_ID (unique build ID bitstring)"); + case NT_FNX_ARCH: + return _("NT_FNX_ARCH (architecture)"); + default: + { + static char buff[64]; + + snprintf (buff, sizeof (buff), _("Unknown note type: (0x%08x)"), e_type); + return buff; + } + } +} + static void decode_x86_compat_isa (unsigned int bitmask) { @@ -21646,6 +21670,91 @@ print_gnu_note (Filedata * filedata, Elf_Internal_Note *pnote) return true; } +static bool +print_fnx_note (Filedata * filedata, Elf_Internal_Note *pnote) +{ + /* NB/ Keep this switch statement in sync with get_fnx_elf_note_type (). */ + switch (pnote->type) + { + case NT_FNX_ABI_TAG: + { + unsigned int os, major, minor, subminor; + const char *osname; + + /* PR 17531: file: 030-599401-0.004. */ + if (pnote->descsz < 16) + { + printf (_(" \n")); + break; + } + + os = byte_get ((unsigned char *) pnote->descdata, 4); + major = byte_get ((unsigned char *) pnote->descdata + 4, 4); + minor = byte_get ((unsigned char *) pnote->descdata + 8, 4); + subminor = byte_get ((unsigned char *) pnote->descdata + 12, 4); + + switch (os) + { + case FNX_ABI_TAG_FENNIX: + osname = "Fennix"; + break; + default: + osname = "Unknown"; + break; + } + + printf (_(" OS: %s, ABI: %d.%d.%d\n"), osname, + major, minor, subminor); + } + break; + + case NT_FNX_VERSION: + { + size_t i; + + printf (_(" Version: ")); + for (i = 0; i < pnote->descsz && pnote->descdata[i] != '\0'; ++i) + printf ("%c", pnote->descdata[i]); + printf ("\n"); + } + break; + + case NT_FNX_BUILD_ID: + { + size_t i; + + printf (_(" Build ID: ")); + for (i = 0; i < pnote->descsz; ++i) + printf ("%02x", pnote->descdata[i] & 0xff); + printf ("\n"); + } + break; + + case NT_FNX_ARCH: + { + /* TODO */ + printf (_(" Unimplemented NT_FNX_ARCH note\n")); + } + break; + + default: + /* Handle unrecognised types. An error message should have already been + created by get_gnu_elf_note_type(), so all that we need to do is to + display the data. */ + { + size_t i; + + printf (_(" Description data: ")); + for (i = 0; i < pnote->descsz; ++i) + printf ("%02x ", pnote->descdata[i] & 0xff); + printf ("\n"); + } + break; + } + + return true; +} + static const char * get_v850_elf_note_type (enum v850_notes n_type) { @@ -22925,6 +23034,10 @@ process_note (Elf_Internal_Note * pnote, /* GNU-specific object file notes. */ nt = get_gnu_elf_note_type (pnote->type); + else if (startswith (pnote->namedata, "FNX")) + /* FNX-specific object file notes. */ + nt = get_fnx_elf_note_type (pnote->type); + else if (startswith (pnote->namedata, "AMDGPU")) /* AMDGPU-specific object file notes. */ nt = get_amdgpu_elf_note_type (pnote->type); @@ -22992,6 +23105,8 @@ process_note (Elf_Internal_Note * pnote, return print_ia64_vms_note (pnote); else if (startswith (pnote->namedata, "GNU")) return print_gnu_note (filedata, pnote); + else if (startswith (pnote->namedata, "FNX")) + return print_fnx_note (filedata, pnote); else if (startswith (pnote->namedata, "stapsdt")) return print_stapsdt_note (pnote); else if (startswith (pnote->namedata, "CORE")) diff --git a/config.sub b/config.sub index 2c6a07ab..d279b50d 100755 --- a/config.sub +++ b/config.sub @@ -1768,7 +1768,7 @@ case $os in | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ - | fiwix* | mlibc* | cos* | mbr* | ironclad* ) + | fiwix* | mlibc* | cos* | mbr* | ironclad* | fennix* ) ;; # This one is extra strict with allowed versions sco3.2v2 | sco3.2v[4-9]* | sco5v6*) diff --git a/gas/configure.tgt b/gas/configure.tgt index d58f2187..bd76e187 100644 --- a/gas/configure.tgt +++ b/gas/configure.tgt @@ -127,6 +127,7 @@ generic_target=${cpu_type}-$vendor-$os # Note: This table is alpha-sorted, please try to keep it that way. case ${generic_target} in aarch64*-*-elf*) fmt=elf;; + aarch64*-*-fennix*) fmt=elf em=gnu ;; aarch64*-*-fuchsia*) fmt=elf;; aarch64*-*-haiku*) fmt=elf em=haiku ;; aarch64*-*-genode*) fmt=elf;; @@ -167,6 +168,7 @@ case ${generic_target} in arm-wince-pe | arm-*-wince | arm*-*-mingw32ce* | arm*-*-cegcc*) fmt=coff em=wince-pe ;; arm-*-pe) fmt=coff em=pe ;; + arm*-*-fennix*) fmt=elf em=gnu ;; arm-*-fuchsia*) fmt=elf ;; arm-*-haiku*) fmt=elf em=haiku ;; @@ -267,6 +269,7 @@ case ${generic_target} in i386-*-*nt*) fmt=coff em=pe ;; i386-*-rdos*) fmt=elf ;; i386-*-darwin*) fmt=macho ;; + i386-*-fennix*) fmt=elf em=gnu ;; ia16-*-elf*) fmt=elf ;; diff --git a/include/elf/common.h b/include/elf/common.h index c9920e77..a714bb2a 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -859,6 +859,15 @@ #define NT_ARCH 2 /* Contains an architecture string. */ #define NT_GO_BUILDID 4 /* Contains GO buildid data. */ +/* Values for notes in non-core files using name "FNX". */ +#define NT_FNX_ABI_TAG 1 +#define NT_FNX_VERSION 2 +#define NT_FNX_BUILD_ID 3 +#define NT_FNX_ARCH 4 + +/* Values used in FNX .note.ABI-tag notes (NT_FNX_ABI_TAG). */ +#define FNX_ABI_TAG_FENNIX 0 + /* Values for notes in non-core files using name "GNU". */ #define NT_GNU_ABI_TAG 1 diff --git a/ld/Makefile.am b/ld/Makefile.am index 6a9833e5..bf4c134d 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -165,6 +165,7 @@ ALL_EMULATION_SOURCES = \ earcv2elfx.c \ earm_wince_pe.c \ earmelf.c \ + earmelf_fennix.c \ earmelf_fbsd.c \ earmelf_fuchsia.c \ earmelf_haiku.c \ @@ -279,6 +280,7 @@ ALL_EMULATION_SOURCES = \ eelf_i386.c \ eelf_i386_be.c \ eelf_i386_fbsd.c \ + eelf_i386_fennix.c \ eelf_i386_haiku.c \ eelf_i386_ldso.c \ eelf_i386_sol2.c \ @@ -383,6 +385,7 @@ ALL_64_EMULATION_SOURCES = \ eaarch64elf32.c \ eaarch64elf32b.c \ eaarch64elfb.c \ + eaarch64fennix.c \ eaarch64fbsd.c \ eaarch64fbsdb.c \ eaarch64haiku.c \ @@ -463,6 +466,7 @@ ALL_64_EMULATION_SOURCES = \ eelf_x86_64.c \ eelf_x86_64_cloudabi.c \ eelf_x86_64_fbsd.c \ + eelf_x86_64_fennix.c \ eelf_x86_64_haiku.c \ eelf_x86_64_sol2.c \ ehppa64linux.c \ diff --git a/ld/Makefile.in b/ld/Makefile.in index 8639e782..f82ec216 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -543,6 +543,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -676,6 +677,7 @@ ALL_EMULATION_SOURCES = \ earcv2elfx.c \ earm_wince_pe.c \ earmelf.c \ + earmelf_fennix.c \ earmelf_fbsd.c \ earmelf_fuchsia.c \ earmelf_haiku.c \ @@ -790,6 +792,7 @@ ALL_EMULATION_SOURCES = \ eelf_i386.c \ eelf_i386_be.c \ eelf_i386_fbsd.c \ + eelf_i386_fennix.c \ eelf_i386_haiku.c \ eelf_i386_ldso.c \ eelf_i386_sol2.c \ @@ -893,6 +896,7 @@ ALL_64_EMULATION_SOURCES = \ eaarch64elf32.c \ eaarch64elf32b.c \ eaarch64elfb.c \ + eaarch64fennix.c \ eaarch64fbsd.c \ eaarch64fbsdb.c \ eaarch64haiku.c \ @@ -973,6 +977,7 @@ ALL_64_EMULATION_SOURCES = \ eelf_x86_64.c \ eelf_x86_64_cloudabi.c \ eelf_x86_64_fbsd.c \ + eelf_x86_64_fennix.c \ eelf_x86_64_haiku.c \ eelf_x86_64_sol2.c \ ehppa64linux.c \ @@ -1279,6 +1284,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elfb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64fbsd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64fbsdb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64fennix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64haiku.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux32.Po@am__quote@ @@ -1301,6 +1307,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earm_wince_pe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_fbsd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_fennix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_fuchsia.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_haiku.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux.Po@am__quote@ @@ -1480,6 +1487,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_be.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_fbsd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_fennix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_haiku.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_ldso.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_sol2.Po@am__quote@ @@ -1490,6 +1498,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fennix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_sol2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eh8300elf.Po@am__quote@ diff --git a/ld/configure.tgt b/ld/configure.tgt index f937f78b..57858cc8 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -92,6 +92,9 @@ aarch64-*-elf | aarch64-*-rtems* | aarch64-*-genode*) aarch64-*-cloudabi*) targ_emul=aarch64cloudabi targ_extra_emuls=aarch64cloudabib ;; +aarch64-*-fennix*) targ_emul=aarch64fennix + targ_extra_emuls="aarch64fennixb aarch64elf" + ;; aarch64-*-freebsd*) targ_emul=aarch64fbsd targ_extra_emuls="aarch64fbsdb aarch64elf" ;; @@ -183,6 +186,10 @@ arm-wince-pe | arm-*-wince | arm*-*-mingw32ce*) arm-*-pe) targ_emul=armpe targ_extra_ofiles="deffilep.o pe-dll.o" ;; +arm*-*-fennix*) + targ_emul=armelf_fennix + targ_extra_emuls="armelfb_fennix armelf" + ;; arm*b-*-freebsd*) targ_emul=armelfb_fbsd targ_extra_emuls="armelf_fbsd armelf" ;; @@ -409,6 +416,11 @@ i[3-7]86-*-elf* | i[3-7]86-*-rtems* | i[3-7]86-*-genode*) i[3-7]86-*-dragonfly*) targ_emul=elf_i386 targ_extra_emuls="elf_iamcu i386bsd" ;; +i[3-7]86-*-fennix*) + targ_emul=elf_i386_fennix + targ_extra_emuls=elf_i386 + targ64_extra_emuls="elf_x86_64_fennix elf_x86_64" + ;; i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu) targ_emul=elf_i386_fbsd targ_extra_emuls="elf_i386 elf_iamcu i386bsd" @@ -1045,6 +1057,9 @@ x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia* | x86_64-*-genode*) x86_64-*-dragonfly*) targ_emul=elf_x86_64 targ_extra_emuls="elf_i386 elf_iamcu" ;; +x86_64-*-fennix*) targ_emul=elf_x86_64_fennix + targ_extra_emuls="elf_i386_fennix elf_x86_64 elf_i386" + ;; x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) targ_emul=elf_x86_64_fbsd targ_extra_emuls="elf_i386_fbsd elf_x86_64 elf_i386 elf_iamcu" @@ -1112,6 +1127,10 @@ case "${target}" in NATIVE_LIB_DIRS='/lib /usr/lib /usr/pkg/lib /usr/local/lib' ;; +*-*-fennix*) + NATIVE_LIB_DIRS='/sys/lib /usr/lib' + ;; + *-*-freebsd*) NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib' ;; diff --git a/ld/emulparams/aarch64fennix.sh b/ld/emulparams/aarch64fennix.sh new file mode 100644 index 00000000..ff5d1e20 --- /dev/null +++ b/ld/emulparams/aarch64fennix.sh @@ -0,0 +1,4 @@ +source_sh ${srcdir}/emulparams/aarch64elf.sh + +COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" +TEXT_START_ADDR=0x00400000 diff --git a/ld/emulparams/armelf_fennix.sh b/ld/emulparams/armelf_fennix.sh new file mode 100644 index 00000000..694377d8 --- /dev/null +++ b/ld/emulparams/armelf_fennix.sh @@ -0,0 +1,4 @@ +source_sh ${srcdir}/emulparams/armelf.sh + +GENERATE_SHLIB_SCRIPT=yes +GENERATE_PIE_SCRIPT=yes diff --git a/ld/emulparams/armelfb_fennix.sh b/ld/emulparams/armelfb_fennix.sh new file mode 100644 index 00000000..694377d8 --- /dev/null +++ b/ld/emulparams/armelfb_fennix.sh @@ -0,0 +1,4 @@ +source_sh ${srcdir}/emulparams/armelf.sh + +GENERATE_SHLIB_SCRIPT=yes +GENERATE_PIE_SCRIPT=yes diff --git a/ld/emulparams/elf_i386_fennix.sh b/ld/emulparams/elf_i386_fennix.sh new file mode 100644 index 00000000..a7210cc0 --- /dev/null +++ b/ld/emulparams/elf_i386_fennix.sh @@ -0,0 +1,4 @@ +source_sh ${srcdir}/emulparams/elf_i386.sh +GENERATE_SHLIB_SCRIPT=yes +GENERATE_PIE_SCRIPT=yes +TEXT_START_ADDR=0x00400000 diff --git a/ld/emulparams/elf_x86_64_fennix.sh b/ld/emulparams/elf_x86_64_fennix.sh new file mode 100644 index 00000000..6612131d --- /dev/null +++ b/ld/emulparams/elf_x86_64_fennix.sh @@ -0,0 +1,4 @@ +source_sh ${srcdir}/emulparams/elf_x86_64.sh +GENERATE_SHLIB_SCRIPT=yes +GENERATE_PIE_SCRIPT=yes +TEXT_START_ADDR=0x00400000