2022-06-24 22:58:04 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2022-02-10 19:43:21 +00:00
|
|
|
From: Daniel Bertalan <dani@danielbertalan.dev>
|
|
|
|
Date: Thu, 10 Feb 2022 17:49:12 +0100
|
|
|
|
Subject: [PATCH] Add support for SerenityOS
|
|
|
|
|
|
|
|
Teaches the assembler, BFD, and the linker about the SerenityOS target
|
|
|
|
triple.
|
|
|
|
---
|
2022-06-24 22:58:04 +00:00
|
|
|
bfd/config.bfd | 15 +++++++++++++++
|
|
|
|
gas/config/tc-i386.c | 3 ++-
|
|
|
|
gas/config/te-serenity.h | 3 +++
|
|
|
|
gas/configure.tgt | 2 ++
|
|
|
|
ld/Makefile.am | 1 +
|
|
|
|
ld/Makefile.in | 1 +
|
|
|
|
ld/configure.tgt | 9 +++++++++
|
|
|
|
7 files changed, 33 insertions(+), 1 deletion(-)
|
|
|
|
create mode 100644 gas/config/te-serenity.h
|
2022-02-10 19:43:21 +00:00
|
|
|
|
2021-08-28 02:07:21 +00:00
|
|
|
diff --git a/bfd/config.bfd b/bfd/config.bfd
|
2022-09-16 19:21:19 +00:00
|
|
|
index a4c6c8e8854f1e3841827150a900b2ce6aa0c88e..87c41563e201a75bba80a2d9f5057250b0aebcdd 100644
|
2021-08-28 02:07:21 +00:00
|
|
|
--- a/bfd/config.bfd
|
|
|
|
+++ b/bfd/config.bfd
|
2022-09-16 19:21:19 +00:00
|
|
|
@@ -274,6 +274,11 @@ case "${targ}" in
|
2022-02-10 19:43:21 +00:00
|
|
|
targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec"
|
|
|
|
want64=true
|
|
|
|
;;
|
|
|
|
+ aarch64-*-serenity*)
|
|
|
|
+ targ_defvec=aarch64_elf64_le_vec
|
|
|
|
+ targ_selvecs=
|
|
|
|
+ want64=true
|
|
|
|
+ ;;
|
|
|
|
aarch64-*-linux* | aarch64-*-netbsd*)
|
|
|
|
targ_defvec=aarch64_elf64_le_vec
|
|
|
|
targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec aarch64_pei_vec"
|
2022-09-16 19:21:19 +00:00
|
|
|
@@ -655,6 +660,11 @@ case "${targ}" in
|
2022-02-10 19:43:21 +00:00
|
|
|
targ_selvecs=
|
|
|
|
targ64_selvecs=x86_64_elf64_vec
|
|
|
|
;;
|
2019-04-05 01:02:52 +00:00
|
|
|
+ i[3-7]86-*-serenity*)
|
|
|
|
+ targ_defvec=i386_elf32_vec
|
|
|
|
+ targ_selvecs=
|
2022-02-10 19:43:21 +00:00
|
|
|
+ targ64_selvecs=x86_64_elf64_vec
|
2019-04-05 01:02:52 +00:00
|
|
|
+ ;;
|
2021-04-27 18:32:13 +00:00
|
|
|
#ifdef BFD64
|
2022-02-10 19:43:21 +00:00
|
|
|
x86_64-*-cloudabi*)
|
|
|
|
targ_defvec=x86_64_elf64_cloudabi_vec
|
2022-09-16 19:21:19 +00:00
|
|
|
@@ -720,6 +730,11 @@ case "${targ}" in
|
2022-02-10 19:43:21 +00:00
|
|
|
targ_selvecs=i386_elf32_vec
|
|
|
|
want64=true
|
|
|
|
;;
|
2019-04-05 01:02:52 +00:00
|
|
|
+ x86_64-*-serenity*)
|
|
|
|
+ targ_defvec=x86_64_elf64_vec
|
|
|
|
+ targ_selvecs=i386_elf32_vec
|
|
|
|
+ want64=true
|
|
|
|
+ ;;
|
2022-02-10 19:43:21 +00:00
|
|
|
#endif
|
|
|
|
i[3-7]86-*-lynxos*)
|
|
|
|
targ_defvec=i386_elf32_vec
|
2022-06-24 22:58:04 +00:00
|
|
|
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
|
2022-09-16 19:21:19 +00:00
|
|
|
index 9cd33a91660695cfedad2a027434d44fb515e5b5..f2a02726b6d2b561b4cdaa2106c3a9fb6c3df750 100644
|
2022-06-24 22:58:04 +00:00
|
|
|
--- a/gas/config/tc-i386.c
|
|
|
|
+++ b/gas/config/tc-i386.c
|
2022-09-16 19:21:19 +00:00
|
|
|
@@ -474,7 +474,8 @@ const char extra_symbol_chars[] = "*%-([{}"
|
2022-06-24 22:58:04 +00:00
|
|
|
&& !defined (TE_Haiku) \
|
|
|
|
&& !defined (TE_FreeBSD) \
|
|
|
|
&& !defined (TE_DragonFly) \
|
|
|
|
- && !defined (TE_NetBSD))
|
|
|
|
+ && !defined (TE_NetBSD) \
|
|
|
|
+ && !defined (TE_SerenityOS))
|
|
|
|
/* This array holds the chars that always start a comment. If the
|
|
|
|
pre-processor is disabled, these aren't very useful. The option
|
|
|
|
--divide will remove '/' from this list. */
|
|
|
|
diff --git a/gas/config/te-serenity.h b/gas/config/te-serenity.h
|
|
|
|
new file mode 100644
|
2022-09-16 19:21:19 +00:00
|
|
|
index 0000000000000000000000000000000000000000..f38faf598cba7f561ed9528ee37328228ee55bdc
|
2022-06-24 22:58:04 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/gas/config/te-serenity.h
|
|
|
|
@@ -0,0 +1,3 @@
|
|
|
|
+#include "te-generic.h"
|
|
|
|
+
|
|
|
|
+#define TE_SerenityOS 1
|
2021-08-28 02:07:21 +00:00
|
|
|
diff --git a/gas/configure.tgt b/gas/configure.tgt
|
2022-09-16 19:21:19 +00:00
|
|
|
index 62f806bdfe8e9f281ab0d1f19e216c7662fcf8b1..67ca244530b87c981569053cc91e9171ec1796fb 100644
|
2021-08-28 02:07:21 +00:00
|
|
|
--- a/gas/configure.tgt
|
|
|
|
+++ b/gas/configure.tgt
|
2022-02-10 19:43:21 +00:00
|
|
|
@@ -134,6 +134,7 @@ case ${generic_target} in
|
|
|
|
aarch64*-linux-gnu_ilp32) arch=aarch64:32 ;;
|
|
|
|
esac ;;
|
|
|
|
aarch64*-*-netbsd*) fmt=elf em=nbsd;;
|
2022-06-24 22:58:04 +00:00
|
|
|
+ aarch64*-*-serenity*) fmt=elf em=serenity ;;
|
2022-02-10 19:43:21 +00:00
|
|
|
|
|
|
|
alpha-*-*vms*) fmt=evax ;;
|
|
|
|
alpha-*-osf*) fmt=ecoff ;;
|
|
|
|
@@ -263,6 +264,7 @@ case ${generic_target} in
|
|
|
|
i386-*-*nt*) fmt=coff em=pe ;;
|
|
|
|
i386-*-rdos*) fmt=elf ;;
|
|
|
|
i386-*-darwin*) fmt=macho ;;
|
2022-06-24 22:58:04 +00:00
|
|
|
+ i386-*-serenity) fmt=elf em=serenity ;;
|
2022-02-10 19:43:21 +00:00
|
|
|
|
|
|
|
ia16-*-elf*) fmt=elf ;;
|
|
|
|
|
2021-08-28 02:07:21 +00:00
|
|
|
diff --git a/ld/Makefile.am b/ld/Makefile.am
|
2022-09-16 19:21:19 +00:00
|
|
|
index d31021c13e2e342cc82c2d49ac9c178f3a723d38..5f6f4d9a4c612691b7ea3d974cfe995a5ed80515 100644
|
2021-08-28 02:07:21 +00:00
|
|
|
--- a/ld/Makefile.am
|
|
|
|
+++ b/ld/Makefile.am
|
2022-09-16 19:21:19 +00:00
|
|
|
@@ -456,6 +456,7 @@ ALL_64_EMULATION_SOURCES = \
|
2022-02-10 19:43:21 +00:00
|
|
|
eelf_x86_64_cloudabi.c \
|
|
|
|
eelf_x86_64_fbsd.c \
|
|
|
|
eelf_x86_64_haiku.c \
|
|
|
|
+ eelf_x86_64_serenity.c \
|
|
|
|
eelf_x86_64_sol2.c \
|
|
|
|
ehppa64linux.c \
|
|
|
|
ei386pep.c \
|
2021-08-28 02:07:21 +00:00
|
|
|
diff --git a/ld/Makefile.in b/ld/Makefile.in
|
2022-09-16 19:21:19 +00:00
|
|
|
index ee0c98f65b0ff2dc9a1d4e8118e5bc8bea22ff68..170d9f090797d57814e701eb5089912bb000bd0d 100644
|
2021-08-28 02:07:21 +00:00
|
|
|
--- a/ld/Makefile.in
|
|
|
|
+++ b/ld/Makefile.in
|
2022-09-16 19:21:19 +00:00
|
|
|
@@ -952,6 +952,7 @@ ALL_64_EMULATION_SOURCES = \
|
2021-08-28 02:07:21 +00:00
|
|
|
eelf_x86_64_cloudabi.c \
|
|
|
|
eelf_x86_64_fbsd.c \
|
2022-02-10 19:43:21 +00:00
|
|
|
eelf_x86_64_haiku.c \
|
2021-08-28 02:07:21 +00:00
|
|
|
+ eelf_x86_64_serenity.c \
|
2022-02-10 19:43:21 +00:00
|
|
|
eelf_x86_64_sol2.c \
|
2021-08-28 02:07:21 +00:00
|
|
|
ehppa64linux.c \
|
|
|
|
ei386pep.c \
|
|
|
|
diff --git a/ld/configure.tgt b/ld/configure.tgt
|
2022-09-16 19:21:19 +00:00
|
|
|
index 2bae9099b6aae1f23afa5be74e84aeb7626d1058..b96ae9d69f51141780510e3a366e0f4fcd93d5c5 100644
|
2021-08-28 02:07:21 +00:00
|
|
|
--- a/ld/configure.tgt
|
|
|
|
+++ b/ld/configure.tgt
|
2022-09-16 19:21:19 +00:00
|
|
|
@@ -96,6 +96,9 @@ aarch64-*-freebsd*) targ_emul=aarch64fbsd
|
2022-02-10 19:43:21 +00:00
|
|
|
aarch64-*-fuchsia*) targ_emul=aarch64elf
|
|
|
|
targ_extra_emuls="aarch64elfb armelf armelfb"
|
|
|
|
;;
|
|
|
|
+aarch64-*-serenity*) targ_emul=aarch64elf
|
2021-08-28 02:36:38 +00:00
|
|
|
+ targ_extra_emuls=
|
2019-04-05 01:02:52 +00:00
|
|
|
+ ;;
|
2022-02-10 19:43:21 +00:00
|
|
|
aarch64_be-*-linux-gnu_ilp32)
|
|
|
|
targ_emul=aarch64linux32b
|
|
|
|
targ_extra_libpath="aarch64linuxb aarch64linux aarch64linux32 armelfb_linux_eabi armelf_linux_eabi"
|
2022-09-16 19:21:19 +00:00
|
|
|
@@ -369,6 +372,9 @@ i[3-7]86-*-linux-*) targ_emul=elf_i386
|
2022-02-10 19:43:21 +00:00
|
|
|
i[3-7]86-*-redox*) targ_emul=elf_i386
|
|
|
|
targ_extra_emuls=elf_x86_64
|
2021-04-11 04:22:15 +00:00
|
|
|
;;
|
2022-02-10 19:43:21 +00:00
|
|
|
+i[3-7]86-*-serenity*) targ_emul=elf_i386
|
2021-12-22 12:32:09 +00:00
|
|
|
+ targ64_extra_emuls="elf_x86_64"
|
2022-02-10 19:43:21 +00:00
|
|
|
+ ;;
|
|
|
|
i[3-7]86-*-sysv[45]*) targ_emul=elf_i386
|
|
|
|
targ_extra_emuls=elf_iamcu
|
|
|
|
;;
|
2022-09-16 19:21:19 +00:00
|
|
|
@@ -1007,6 +1013,9 @@ x86_64-*-linux-*) targ_emul=elf_x86_64
|
2022-02-10 19:43:21 +00:00
|
|
|
x86_64-*-redox*) targ_emul=elf_x86_64
|
|
|
|
targ_extra_emuls=elf_i386
|
|
|
|
;;
|
2021-12-22 12:32:09 +00:00
|
|
|
+x86_64-*-serenity*) targ_emul=elf_x86_64
|
|
|
|
+ targ_extra_emuls="elf_i386"
|
2022-02-10 19:43:21 +00:00
|
|
|
+ ;;
|
|
|
|
x86_64-*-solaris2*) targ_emul=elf_x86_64_sol2
|
2022-09-16 19:21:19 +00:00
|
|
|
targ_extra_emuls="elf_x86_64 elf_i386_sol2 elf_i386_ldso elf_i386 elf_iamcu"
|
2022-02-10 19:43:21 +00:00
|
|
|
targ_extra_libpath=$targ_extra_emuls
|