|
1 |
| -From e80a89e9446501bcaf42dc8ade8ff8a1cd0458bb Mon Sep 17 00:00:00 2001 |
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | 2 | From: Daniel Bertalan <dani@danielbertalan.dev>
|
3 | 3 | Date: Thu, 10 Feb 2022 17:49:12 +0100
|
4 | 4 | Subject: [PATCH] Add support for SerenityOS
|
5 | 5 |
|
6 | 6 | Teaches the assembler, BFD, and the linker about the SerenityOS target
|
7 | 7 | triple.
|
8 |
| - |
9 |
| -On x86_64, we override the default base address of non-PIE executables, |
10 |
| -because the default (0x400000) is too close to the beginning of the |
11 |
| -address space, and DynamicLoader often ends up allocating internal data |
12 |
| -at that address. See commit 292398b5857d0104f7c33fdb5d79f45fe8b395dd. |
13 | 8 | ---
|
14 |
| - bfd/config.bfd | 15 +++++++++++++++ |
15 |
| - gas/configure.tgt | 2 ++ |
16 |
| - ld/Makefile.am | 1 + |
17 |
| - ld/Makefile.in | 1 + |
18 |
| - ld/configure.tgt | 9 +++++++++ |
19 |
| - ld/emulparams/elf_x86_64_serenity.sh | 2 ++ |
20 |
| - 6 files changed, 30 insertions(+) |
21 |
| - create mode 100644 ld/emulparams/elf_x86_64_serenity.sh |
| 9 | + bfd/config.bfd | 15 +++++++++++++++ |
| 10 | + gas/config/tc-i386.c | 3 ++- |
| 11 | + gas/config/te-serenity.h | 3 +++ |
| 12 | + gas/configure.tgt | 2 ++ |
| 13 | + ld/Makefile.am | 1 + |
| 14 | + ld/Makefile.in | 1 + |
| 15 | + ld/configure.tgt | 9 +++++++++ |
| 16 | + 7 files changed, 33 insertions(+), 1 deletion(-) |
| 17 | + create mode 100644 gas/config/te-serenity.h |
22 | 18 |
|
23 | 19 | diff --git a/bfd/config.bfd b/bfd/config.bfd
|
24 | 20 | index cfe58247..9a10e011 100644
|
@@ -60,23 +56,46 @@ index cfe58247..9a10e011 100644
|
60 | 56 | #endif
|
61 | 57 | i[3-7]86-*-lynxos*)
|
62 | 58 | targ_defvec=i386_elf32_vec
|
| 59 | +diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c |
| 60 | +index e0632681..4e9ba9fd 100644 |
| 61 | +--- a/gas/config/tc-i386.c |
| 62 | ++++ b/gas/config/tc-i386.c |
| 63 | +@@ -481,7 +481,8 @@ const char extra_symbol_chars[] = "*%-([{}" |
| 64 | + && !defined (TE_Haiku) \ |
| 65 | + && !defined (TE_FreeBSD) \ |
| 66 | + && !defined (TE_DragonFly) \ |
| 67 | +- && !defined (TE_NetBSD)) |
| 68 | ++ && !defined (TE_NetBSD) \ |
| 69 | ++ && !defined (TE_SerenityOS)) |
| 70 | + /* This array holds the chars that always start a comment. If the |
| 71 | + pre-processor is disabled, these aren't very useful. The option |
| 72 | + --divide will remove '/' from this list. */ |
| 73 | +diff --git a/gas/config/te-serenity.h b/gas/config/te-serenity.h |
| 74 | +new file mode 100644 |
| 75 | +index 00000000..f38faf59 |
| 76 | +--- /dev/null |
| 77 | ++++ b/gas/config/te-serenity.h |
| 78 | +@@ -0,0 +1,3 @@ |
| 79 | ++#include "te-generic.h" |
| 80 | ++ |
| 81 | ++#define TE_SerenityOS 1 |
63 | 82 | diff --git a/gas/configure.tgt b/gas/configure.tgt
|
64 |
| -index 62f806bd..cfc93df9 100644 |
| 83 | +index 62f806bd..67ca2445 100644 |
65 | 84 | --- a/gas/configure.tgt
|
66 | 85 | +++ b/gas/configure.tgt
|
67 | 86 | @@ -134,6 +134,7 @@ case ${generic_target} in
|
68 | 87 | aarch64*-linux-gnu_ilp32) arch=aarch64:32 ;;
|
69 | 88 | esac ;;
|
70 | 89 | aarch64*-*-netbsd*) fmt=elf em=nbsd;;
|
71 |
| -+ aarch64*-*-serenity*) fmt=elf ;; |
| 90 | ++ aarch64*-*-serenity*) fmt=elf em=serenity ;; |
72 | 91 |
|
73 | 92 | alpha-*-*vms*) fmt=evax ;;
|
74 | 93 | alpha-*-osf*) fmt=ecoff ;;
|
75 | 94 | @@ -263,6 +264,7 @@ case ${generic_target} in
|
76 | 95 | i386-*-*nt*) fmt=coff em=pe ;;
|
77 | 96 | i386-*-rdos*) fmt=elf ;;
|
78 | 97 | i386-*-darwin*) fmt=macho ;;
|
79 |
| -+ i386-*-serenity) fmt=elf ;; |
| 98 | ++ i386-*-serenity) fmt=elf em=serenity ;; |
80 | 99 |
|
81 | 100 | ia16-*-elf*) fmt=elf ;;
|
82 | 101 |
|
@@ -105,7 +124,7 @@ index 61e93eea..8b9ee2cf 100644
|
105 | 124 | ehppa64linux.c \
|
106 | 125 | ei386pep.c \
|
107 | 126 | diff --git a/ld/configure.tgt b/ld/configure.tgt
|
108 |
| -index c7acf3f1..19982e51 100644 |
| 127 | +index c7acf3f1..d34b9ea3 100644 |
109 | 128 | --- a/ld/configure.tgt
|
110 | 129 | +++ b/ld/configure.tgt
|
111 | 130 | @@ -59,6 +59,9 @@ aarch64-*-freebsd*) targ_emul=aarch64fbsd
|
|
0 commit comments