summaryrefslogtreecommitdiff
path: root/Toolchain/Patches/binutils.patch
blob: 7454911fe1e5e8c9a4847e79c65cbd84b837e566 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
diff -Nru ../binutils-2.32/bfd/config.bfd binutils-2.32-serenity/bfd/config.bfd
--- ../binutils-2.32/bfd/config.bfd	2019-01-19 17:01:32.000000000 +0100
+++ binutils-2.32-serenity/bfd/config.bfd	2019-04-04 17:41:07.000000000 +0200
@@ -223,6 +223,20 @@
     ;;
 
 # START OF targmatch.h
+
+  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
+    
 #ifdef BFD64
   aarch64-*-darwin*)
     targ_defvec=aarch64_mach_o_vec
diff -Nru ../binutils-2.32/config.sub binutils-2.32-serenity/config.sub
--- ../binutils-2.32/config.sub	2019-01-19 17:01:33.000000000 +0100
+++ binutils-2.32-serenity/config.sub	2019-04-04 17:39:29.000000000 +0200
@@ -1337,6 +1337,7 @@
 	# 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 -Nru ../binutils-2.32/gas/configure.tgt binutils-2.32-serenity/gas/configure.tgt
--- ../binutils-2.32/gas/configure.tgt	2019-01-19 17:01:33.000000000 +0100
+++ binutils-2.32-serenity/gas/configure.tgt	2019-04-04 17:41:40.000000000 +0200
@@ -121,6 +121,7 @@
 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;;
   aarch64*-*-elf*)			fmt=elf;;
   aarch64*-*-fuchsia*)			fmt=elf;;
   aarch64*-*-linux*)			fmt=elf em=linux
diff -Nru ../binutils-2.32/ld/Makefile.am binutils-2.32-serenity/ld/Makefile.am
--- ../binutils-2.32/ld/Makefile.am	2019-01-19 17:01:33.000000000 +0100
+++ binutils-2.32-serenity/ld/Makefile.am	2019-04-04 17:50:13.000000000 +0200
@@ -1289,6 +1289,10 @@
 eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
   $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 
+eelf_i386_serenity.c: $(srcdir)/emulparams/elf_i386_serenity.sh \
+  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf_i386_serenity "$(tdir_elf_i386_serenity)"
+
 eelf_i386_be.c: $(srcdir)/emulparams/elf_i386_be.sh \
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 
@@ -1849,6 +1853,10 @@
 eelf_x86_64.c: $(srcdir)/emulparams/elf_x86_64.sh \
   $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 
+eelf_x86_64_serenity.c: $(srcdir)/emulparams/elf_x86_64_serenity.sh \
+  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf_x86_64_serenity "$(tdir_elf_x86_64_serenity)"
+
 eelf_x86_64_cloudabi.c: $(srcdir)/emulparams/elf_x86_64_cloudabi.sh \
   $(srcdir)/emulparams/elf_x86_64.sh \
   $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
diff -Nru ../binutils-2.32/ld/Makefile.in binutils-2.32-serenity/ld/Makefile.in
--- ../binutils-2.32/ld/Makefile.in	2019-02-02 16:54:43.000000000 +0100
+++ binutils-2.32-serenity/ld/Makefile.in	2019-04-04 17:50:55.000000000 +0200
@@ -2893,6 +2893,10 @@
 eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
   $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 
+eelf_i386_serenity.c: $(srcdir)/emulparams/elf_i386_serenity.sh \
+  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf_i386_serenity "$(tdir_elf_i386_serenity)"
+
 eelf_i386_be.c: $(srcdir)/emulparams/elf_i386_be.sh \
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 
@@ -3453,6 +3457,10 @@
 eelf_x86_64.c: $(srcdir)/emulparams/elf_x86_64.sh \
   $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 
+eelf_x86_64_serenity.c: $(srcdir)/emulparams/elf_x86_64_serenity.sh \
+  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf_x86_64_serenity "$(tdir_elf_x86_64_serenity)"
+
 eelf_x86_64_cloudabi.c: $(srcdir)/emulparams/elf_x86_64_cloudabi.sh \
   $(srcdir)/emulparams/elf_x86_64.sh \
   $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
diff -Nru ../binutils-2.32/ld/configure.tgt binutils-2.32-serenity/ld/configure.tgt
--- ../binutils-2.32/ld/configure.tgt	2019-01-19 17:01:33.000000000 +0100
+++ binutils-2.32-serenity/ld/configure.tgt	2019-04-04 17:42:40.000000000 +0200
@@ -45,6 +45,15 @@
 # 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"
+			;;
 aarch64_be-*-elf)	targ_emul=aarch64elfb
 			targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf" ;;
 aarch64-*-elf | aarch64-*-rtems*)
diff -Nru ../binutils-2.32/ld/emulparams/elf_i386_serenity.sh binutils-2.32-serenity/ld/emulparams/elf_i386_serenity.sh
--- ../binutils-2.32/ld/emulparams/elf_i386_serenity.sh	1970-01-01 01:00:00.000000000 +0100
+++ binutils-2.32-serenity/ld/emulparams/elf_i386_serenity.sh	2019-04-04 17:43:12.000000000 +0200
@@ -0,0 +1,3 @@
+. ${srcdir}/emulparams/elf_i386.sh
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
diff -Nru ../binutils-2.32/ld/emulparams/elf_x86_64_serenity.sh binutils-2.32-serenity/ld/emulparams/elf_x86_64_serenity.sh
--- ../binutils-2.32/ld/emulparams/elf_x86_64_serenity.sh	1970-01-01 01:00:00.000000000 +0100
+++ binutils-2.32-serenity/ld/emulparams/elf_x86_64_serenity.sh	2019-04-04 17:43:34.000000000 +0200
@@ -0,0 +1 @@
+. ${srcdir}/emulparams/elf_x86_64.sh