mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-28 15:34:31 +00:00
304 lines
8.4 KiB
Diff
304 lines
8.4 KiB
Diff
diff --git a/bfd/config.bfd b/bfd/config.bfd
|
|
index 6553aac1e99..40429e9bf43 100644
|
|
--- a/bfd/config.bfd
|
|
+++ b/bfd/config.bfd
|
|
@@ -1502,6 +1502,20 @@ case "${targ}" in
|
|
;;
|
|
#endif
|
|
|
|
+ i[3-7]86-*-fennix*)
|
|
+ targ_defvec=i386_elf32_vec
|
|
+ targ_selvecs=
|
|
+ targ64_selvecs=x86_64_elf64_vec
|
|
+ ;;
|
|
+
|
|
+#ifdef BFD64
|
|
+ x86_64-*-fennix*)
|
|
+ targ_defvec=x86_64_elf64_vec
|
|
+ targ_selvecs=i386_elf32_vec
|
|
+ want64=true
|
|
+ ;;
|
|
+#endif
|
|
+
|
|
# END OF targmatch.h
|
|
bpf-*-*)
|
|
echo "*** Configuration $targ is not fully supported." >&2
|
|
diff --git a/config.sub b/config.sub
|
|
index 2c6a07ab3c3..d279b50dc8b 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 d58f21873a3..fa4215b9cff 100644
|
|
--- a/gas/configure.tgt
|
|
+++ b/gas/configure.tgt
|
|
@@ -267,6 +267,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/ld/Makefile.am b/ld/Makefile.am
|
|
index 6a9833e5775..fb4f866ef55 100644
|
|
--- a/ld/Makefile.am
|
|
+++ b/ld/Makefile.am
|
|
@@ -279,6 +279,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 \
|
|
@@ -463,6 +464,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/configure.tgt b/ld/configure.tgt
|
|
index f937f78b876..ea5491a1447 100644
|
|
--- a/ld/configure.tgt
|
|
+++ b/ld/configure.tgt
|
|
@@ -409,6 +409,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 +1050,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 +1120,10 @@ case "${target}" in
|
|
NATIVE_LIB_DIRS='/lib /usr/lib /usr/pkg/lib /usr/local/lib'
|
|
;;
|
|
|
|
+*-*-fennix*)
|
|
+ NATIVE_LIB_DIRS='/lib /usr/lib'
|
|
+ ;;
|
|
+
|
|
*-*-freebsd*)
|
|
NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
|
|
;;
|
|
diff --git a/ld/emulparams/elf_i386_fennix.sh b/ld/emulparams/elf_i386_fennix.sh
|
|
new file mode 100644
|
|
index 00000000000..19b75a06cf9
|
|
--- /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=0x400000
|
|
diff --git a/ld/emulparams/elf_x86_64_fennix.sh b/ld/emulparams/elf_x86_64_fennix.sh
|
|
new file mode 100644
|
|
index 00000000000..1509ec7fe53
|
|
--- /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=0x400000
|
|
diff --git a/binutils/readelf.c b/binutils/readelf.c
|
|
index 5d1cf9c3..671a8081 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 (_(" <corrupt GNU_ABI_TAG>\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/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/.gitignore b/.gitignore
|
|
index 0a40764c..9aa17853 100644
|
|
--- a/.gitignore
|
|
+++ b/.gitignore
|
|
@@ -74,3 +74,4 @@ stamp-*
|
|
/gmp*
|
|
/isl*
|
|
/gettext*
|
|
+/__build
|