mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
85780fafcd
This version comes with general fixes and, more importantly, introduces support for the packed RELR relocation format.
151 lines
4.8 KiB
Diff
151 lines
4.8 KiB
Diff
From e80a89e9446501bcaf42dc8ade8ff8a1cd0458bb Mon Sep 17 00:00:00 2001
|
|
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.
|
|
|
|
On x86_64, we override the default base address of non-PIE executables,
|
|
because the default (0x400000) is too close to the beginning of the
|
|
address space, and DynamicLoader often ends up allocating internal data
|
|
at that address. See commit 292398b5857d0104f7c33fdb5d79f45fe8b395dd.
|
|
---
|
|
bfd/config.bfd | 15 +++++++++++++++
|
|
gas/configure.tgt | 2 ++
|
|
ld/Makefile.am | 1 +
|
|
ld/Makefile.in | 1 +
|
|
ld/configure.tgt | 9 +++++++++
|
|
ld/emulparams/elf_x86_64_serenity.sh | 2 ++
|
|
6 files changed, 30 insertions(+)
|
|
create mode 100644 ld/emulparams/elf_x86_64_serenity.sh
|
|
|
|
diff --git a/bfd/config.bfd b/bfd/config.bfd
|
|
index cfe58247..9a10e011 100644
|
|
--- a/bfd/config.bfd
|
|
+++ b/bfd/config.bfd
|
|
@@ -277,6 +277,11 @@ case "${targ}" in
|
|
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"
|
|
@@ -656,6 +661,11 @@ case "${targ}" in
|
|
targ_selvecs=
|
|
targ64_selvecs=x86_64_elf64_vec
|
|
;;
|
|
+ i[3-7]86-*-serenity*)
|
|
+ targ_defvec=i386_elf32_vec
|
|
+ targ_selvecs=
|
|
+ targ64_selvecs=x86_64_elf64_vec
|
|
+ ;;
|
|
#ifdef BFD64
|
|
x86_64-*-cloudabi*)
|
|
targ_defvec=x86_64_elf64_cloudabi_vec
|
|
@@ -721,6 +731,11 @@ case "${targ}" in
|
|
targ_selvecs=i386_elf32_vec
|
|
want64=true
|
|
;;
|
|
+ x86_64-*-serenity*)
|
|
+ targ_defvec=x86_64_elf64_vec
|
|
+ targ_selvecs=i386_elf32_vec
|
|
+ want64=true
|
|
+ ;;
|
|
#endif
|
|
i[3-7]86-*-lynxos*)
|
|
targ_defvec=i386_elf32_vec
|
|
diff --git a/gas/configure.tgt b/gas/configure.tgt
|
|
index 62f806bd..cfc93df9 100644
|
|
--- a/gas/configure.tgt
|
|
+++ b/gas/configure.tgt
|
|
@@ -134,6 +134,7 @@ case ${generic_target} in
|
|
aarch64*-linux-gnu_ilp32) arch=aarch64:32 ;;
|
|
esac ;;
|
|
aarch64*-*-netbsd*) fmt=elf em=nbsd;;
|
|
+ aarch64*-*-serenity*) fmt=elf ;;
|
|
|
|
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 ;;
|
|
+ i386-*-serenity) fmt=elf ;;
|
|
|
|
ia16-*-elf*) fmt=elf ;;
|
|
|
|
diff --git a/ld/Makefile.am b/ld/Makefile.am
|
|
index b55a873d..760f328a 100644
|
|
--- a/ld/Makefile.am
|
|
+++ b/ld/Makefile.am
|
|
@@ -463,6 +463,7 @@ ALL_64_EMULATION_SOURCES = \
|
|
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 \
|
|
diff --git a/ld/Makefile.in b/ld/Makefile.in
|
|
index 61e93eea..8b9ee2cf 100644
|
|
--- a/ld/Makefile.in
|
|
+++ b/ld/Makefile.in
|
|
@@ -953,6 +953,7 @@ ALL_64_EMULATION_SOURCES = \
|
|
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 \
|
|
diff --git a/ld/configure.tgt b/ld/configure.tgt
|
|
index c7acf3f1..19982e51 100644
|
|
--- a/ld/configure.tgt
|
|
+++ b/ld/configure.tgt
|
|
@@ -59,6 +59,9 @@ aarch64-*-freebsd*) targ_emul=aarch64fbsd
|
|
aarch64-*-fuchsia*) targ_emul=aarch64elf
|
|
targ_extra_emuls="aarch64elfb armelf armelfb"
|
|
;;
|
|
+aarch64-*-serenity*) targ_emul=aarch64elf
|
|
+ targ_extra_emuls=
|
|
+ ;;
|
|
aarch64_be-*-linux-gnu_ilp32)
|
|
targ_emul=aarch64linux32b
|
|
targ_extra_libpath="aarch64linuxb aarch64linux aarch64linux32 armelfb_linux_eabi armelf_linux_eabi"
|
|
@@ -332,6 +335,9 @@ i[3-7]86-*-linux-*) targ_emul=elf_i386
|
|
i[3-7]86-*-redox*) targ_emul=elf_i386
|
|
targ_extra_emuls=elf_x86_64
|
|
;;
|
|
+i[3-7]86-*-serenity*) targ_emul=elf_i386
|
|
+ targ64_extra_emuls="elf_x86_64_serenity elf_x86_64"
|
|
+ ;;
|
|
i[3-7]86-*-sysv[45]*) targ_emul=elf_i386
|
|
targ_extra_emuls=elf_iamcu
|
|
;;
|
|
@@ -970,6 +976,9 @@ x86_64-*-linux-*) targ_emul=elf_x86_64
|
|
x86_64-*-redox*) targ_emul=elf_x86_64
|
|
targ_extra_emuls=elf_i386
|
|
;;
|
|
+x86_64-*-serenity*) targ_emul=elf_x86_64_serenity
|
|
+ targ_extra_emuls="elf_x86_64 elf_i386"
|
|
+ ;;
|
|
x86_64-*-solaris2*) targ_emul=elf_x86_64_sol2
|
|
targ_extra_emuls="elf_x86_64 elf_i386_sol2 elf_i386_ldso elf_i386 elf_iamcu elf_l1om elf_k1om"
|
|
targ_extra_libpath=$targ_extra_emuls
|
|
diff --git a/ld/emulparams/elf_x86_64_serenity.sh b/ld/emulparams/elf_x86_64_serenity.sh
|
|
new file mode 100644
|
|
index 00000000..973b3b2a
|
|
--- /dev/null
|
|
+++ b/ld/emulparams/elf_x86_64_serenity.sh
|
|
@@ -0,0 +1,2 @@
|
|
+. ${srcdir}/emulparams/elf_x86_64.sh
|
|
+TEXT_START_ADDR=0x08200000
|
|
--
|
|
2.35.1
|
|
|