ladybird/Toolchain/Patches/binutils.patch
Philip Herron c73aa662bb Update toolchain to binutils-2.33.1 gcc-9.2.0
Toolchain build makes git repo out of toolchain to allow patching
Fix Makefiles to use new libstdc++
Parameterize BuildIt with default TARGET of i686 but arm is experimental
2019-12-19 18:35:03 +01:00

149 lines
4.3 KiB
Diff

diff --git a/bfd/config.bfd b/bfd/config.bfd
index 13d678e1..782ad689 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -220,6 +220,26 @@ esac
case "${targ}" in
# START OF targmatch.h
#ifdef BFD64
+
+ i[3-7]86-*-serenity*)
+ targ_defvec=i386_elf32_vec
+ targ_selvecs=
+ targ64_selvecs=x86_64_elf64_vec
+ ;;
+#ifdef BFD64
+ x86_64-*-serenity*)
+ targ_defvec=x86_64_elf64_vec
+ targ_selvecs=i386_elf32_vec
+ want64=true
+ ;;
+#endif
+
+ arm-*-serenity*)
+ targ_defvec=arm_elf32_le_vec
+ targ_selvecs=
+ targ64_selvecs=
+ ;;
+
aarch64-*-darwin*)
targ_defvec=aarch64_mach_o_vec
targ_selvecs="arm_mach_o_vec mach_o_le_vec mach_o_be_vec mach_o_fat_vec"
diff --git a/config.sub b/config.sub
index 5b158ac4..49f05c37 100755
--- a/config.sub
+++ b/config.sub
@@ -1342,6 +1342,7 @@ case $os in
# Each alternative MUST end in a * to match a version number.
# sysv* is not here because it comes later, after sysvr4.
gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
+ | serenity* \
| *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\
| hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
| sym* | kopensolaris* | plan9* \
diff --git a/gas/configure.tgt b/gas/configure.tgt
index a4828c4c..4d75ca56 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -121,6 +121,8 @@ esac
generic_target=${cpu_type}-$vendor-$os
# Note: This table is alpha-sorted, please try to keep it that way.
case ${generic_target} in
+ i386-*-serenity*) fmt=elf;;
+ arm-*-serenity*) fmt=elf;;
aarch64*-*-elf*) fmt=elf;;
aarch64*-*-fuchsia*) fmt=elf;;
aarch64*-*-linux*) fmt=elf em=linux
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 0509c2e5..b1adc7c6 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -178,6 +178,7 @@ ALL_EMULATION_SOURCES = \
earmelf_nbsd.c \
earmelf_phoenix.c \
earmelf_vxworks.c \
+ earmelf_serenity.c \
earmelfb.c \
earmelfb_fbsd.c \
earmelfb_fuchsia.c \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 9898392a..9357b539 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -665,6 +665,7 @@ ALL_EMULATION_SOURCES = \
earmelf_nbsd.c \
earmelf_phoenix.c \
earmelf_vxworks.c \
+ earmelf_serenity.c \
earmelfb.c \
earmelfb_fbsd.c \
earmelfb_fuchsia.c \
@@ -779,6 +780,7 @@ ALL_EMULATION_SOURCES = \
eelf_i386_vxworks.c \
eelf_iamcu.c \
eelf_s390.c \
+ eelf_i386_serenity.c \
eh8300elf.c \
eh8300elf_linux.c \
eh8300helf.c \
@@ -945,6 +947,7 @@ ALL_64_EMULATION_SOURCES = \
eelf_x86_64_fbsd.c \
eelf_x86_64_nacl.c \
eelf_x86_64_sol2.c \
+ eelf_x86_64_serenity.c \
ehppa64linux.c \
ei386pep.c \
emmo.c
diff --git a/ld/configure.tgt b/ld/configure.tgt
index c81bc8a7..a93a04c6 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -45,6 +45,19 @@ targ64_extra_libpath=
# architecture variants should be kept together even if their names
# break the alpha sorting.
case "${targ}" in
+i[3-7]86-*-serenity*)
+ targ_emul=elf_i386_serenity
+ targ_extra_emuls=elf_i386
+ targ64_extra_emuls="elf_x86_64_serenity elf_x86_64"
+ ;;
+x86_64-*-serenity*)
+ targ_emul=elf_x86_64_serenity
+ targ_extra_emuls="elf_i386_serenity elf_x86_64 elf_i386"
+ ;;
+arm-*-serenity*)
+ targ_emul=armelf_serenity
+ targ_extra_emuls="armelf_serenity armelf"
+ ;;
aarch64_be-*-elf) targ_emul=aarch64elfb
targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf" ;;
aarch64-*-elf | aarch64-*-rtems*)
diff --git a/ld/emulparams/armelf_serenity.sh b/ld/emulparams/armelf_serenity.sh
new file mode 100644
index 00000000..517cd626
--- /dev/null
+++ b/ld/emulparams/armelf_serenity.sh
@@ -0,0 +1,7 @@
+. ${srcdir}/emulparams/armelf.sh
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+TEXT_START_ADDR=0x00008000
+TARGET2_TYPE=got-rel
+
+unset STACK_ADDR
+unset EMBEDDED
diff --git a/ld/emulparams/elf_i386_serenity.sh b/ld/emulparams/elf_i386_serenity.sh
new file mode 100644
index 00000000..342d5298
--- /dev/null
+++ b/ld/emulparams/elf_i386_serenity.sh
@@ -0,0 +1,3 @@
+. ${srcdir}/emulparams/elf_i386.sh
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
diff --git a/ld/emulparams/elf_x86_64_serenity.sh b/ld/emulparams/elf_x86_64_serenity.sh
new file mode 100644
index 00000000..a2af90a6
--- /dev/null
+++ b/ld/emulparams/elf_x86_64_serenity.sh
@@ -0,0 +1 @@
+. ${srcdir}/emulparams/elf_x86_64.sh