Magellan Linux

Contents of /trunk/syslinux/patches/syslinux-6.04_pre1-0002-Force-the-linker-to-put-all-sections-into-a-single-P.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3783 - (show annotations) (download)
Wed Sep 27 14:04:48 2023 UTC (7 months, 2 weeks ago) by niro
File size: 4873 byte(s)
-syslinux-6.04_pre1 patches
1 From 0c646f067a6b766a5ce0434e5e4e7b839b511331 Mon Sep 17 00:00:00 2001
2 From: Lukas Schwaighofer <lukas@schwaighofer.name>
3 Date: Sat, 18 Aug 2018 16:56:35 +0200
4 Subject: [PATCH 2/5] Force the linker to put all sections into a single
5 PT_LOAD segment
6
7 This is required when using binutils >= 2.31 which writes two PT_LOAD segments
8 by default. This is not supported by the wrapper.c script used to convert the
9 shared object into an elf binary.
10
11 Forwarded: https://www.syslinux.org/archives/2018-August/026167.html
12 ---
13 efi/i386/syslinux.ld | 37 +++++++++++++++++++++----------------
14 efi/x86_64/syslinux.ld | 37 +++++++++++++++++++++----------------
15 2 files changed, 42 insertions(+), 32 deletions(-)
16
17 diff --git a/efi/i386/syslinux.ld b/efi/i386/syslinux.ld
18 index bab3fc74..19c16479 100644
19 --- a/efi/i386/syslinux.ld
20 +++ b/efi/i386/syslinux.ld
21 @@ -19,6 +19,11 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
22 OUTPUT_ARCH(i386)
23 ENTRY(_start)
24
25 +PHDRS
26 +{
27 + all PT_LOAD ;
28 +}
29 +
30 SECTIONS
31 {
32 . = 0;
33 @@ -31,7 +36,7 @@ SECTIONS
34 *(.text)
35 *(.text.*)
36 __text_end = .;
37 - }
38 + } :all
39
40 . = ALIGN(16);
41
42 @@ -40,7 +45,7 @@ SECTIONS
43 *(.rodata)
44 *(.rodata.*)
45 __rodata_end = .;
46 - }
47 + } :all
48
49 . = ALIGN(4);
50
51 @@ -49,14 +54,14 @@ SECTIONS
52 KEEP (*(SORT(.ctors.*)))
53 KEEP (*(.ctors))
54 __ctors_end = .;
55 - }
56 + } :all
57
58 .dtors : {
59 __dtors_start = .;
60 KEEP (*(SORT(.dtors.*)))
61 KEEP (*(.dtors))
62 __dtors_end = .;
63 - }
64 + } :all
65
66 . = ALIGN(4096);
67 .rel : {
68 @@ -64,7 +69,7 @@ SECTIONS
69 *(.rel.data)
70 *(.rel.data.*)
71 *(.rel.ctors)
72 - }
73 + } :all
74
75 . = ALIGN(4);
76
77 @@ -72,14 +77,14 @@ SECTIONS
78 __gnu_hash_start = .;
79 *(.gnu.hash)
80 __gnu_hash_end = .;
81 - }
82 + } :all
83
84
85 .dynsym : {
86 __dynsym_start = .;
87 *(.dynsym)
88 __dynsym_end = .;
89 - }
90 + } :all
91
92 . = ALIGN(4);
93
94 @@ -87,7 +92,7 @@ SECTIONS
95 __dynstr_start = .;
96 *(.dynstr)
97 __dynstr_end = .;
98 - }
99 + } :all
100
101 . = ALIGN(4);
102
103 @@ -104,7 +109,7 @@ SECTIONS
104 KEEP (*(.got.plt))
105 KEEP (*(.got))
106 __got_end = .;
107 - }
108 + } :all
109
110 . = ALIGN(4);
111
112 @@ -112,7 +117,7 @@ SECTIONS
113 __dynamic_start = .;
114 *(.dynamic)
115 __dynamic_end = .;
116 - }
117 + } :all
118
119 . = ALIGN(16);
120
121 @@ -122,19 +127,19 @@ SECTIONS
122 *(.data.*)
123 *(.lowmem)
124 __data_end = .;
125 - }
126 + } :all
127
128 .reloc : {
129 *(.reloc)
130 - }
131 + } :all
132
133 .symtab : {
134 *(.symtab)
135 - }
136 + } :all
137
138 .strtab : {
139 *(.strtab)
140 - }
141 + } :all
142
143 .bss (NOLOAD) : {
144 /* the EFI loader doesn't seem to like a .bss section,
145 @@ -148,7 +153,7 @@ SECTIONS
146 __bss_end = .;
147 *(.sbss)
148 *(.scommon)
149 - }
150 + } :all
151 __bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start);
152 __bss_dwords = (__bss_len + 3) >> 2;
153
154 @@ -161,7 +166,7 @@ SECTIONS
155 *(.hugebss)
156 *(.hugebss.*)
157 __hugebss_end = .;
158 - }
159 + } :all
160
161 _end = .;
162
163 diff --git a/efi/x86_64/syslinux.ld b/efi/x86_64/syslinux.ld
164 index 450641c6..a2c124fd 100644
165 --- a/efi/x86_64/syslinux.ld
166 +++ b/efi/x86_64/syslinux.ld
167 @@ -19,6 +19,11 @@ OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
168 OUTPUT_ARCH(i386:x86-64)
169 ENTRY(_start)
170
171 +PHDRS
172 +{
173 + all PT_LOAD ;
174 +}
175 +
176 SECTIONS
177 {
178 . = 0;
179 @@ -31,7 +36,7 @@ SECTIONS
180 *(.text)
181 *(.text.*)
182 __text_end = .;
183 - }
184 + } :all
185
186 . = ALIGN(16);
187
188 @@ -40,7 +45,7 @@ SECTIONS
189 *(.rodata)
190 *(.rodata.*)
191 __rodata_end = .;
192 - }
193 + } :all
194
195 . = ALIGN(4);
196
197 @@ -49,14 +54,14 @@ SECTIONS
198 KEEP (*(SORT(.ctors.*)))
199 KEEP (*(.ctors))
200 __ctors_end = .;
201 - }
202 + } :all
203
204 .dtors : {
205 __dtors_start = .;
206 KEEP (*(SORT(.dtors.*)))
207 KEEP (*(.dtors))
208 __dtors_end = .;
209 - }
210 + } :all
211
212 . = ALIGN(4096);
213 .rel : {
214 @@ -64,7 +69,7 @@ SECTIONS
215 *(.rel.data)
216 *(.rel.data.*)
217 *(.rel.ctors)
218 - }
219 + } :all
220
221 . = ALIGN(4);
222
223 @@ -72,14 +77,14 @@ SECTIONS
224 __gnu_hash_start = .;
225 *(.gnu.hash)
226 __gnu_hash_end = .;
227 - }
228 + } :all
229
230
231 .dynsym : {
232 __dynsym_start = .;
233 *(.dynsym)
234 __dynsym_end = .;
235 - }
236 + } :all
237
238 . = ALIGN(4);
239
240 @@ -87,7 +92,7 @@ SECTIONS
241 __dynstr_start = .;
242 *(.dynstr)
243 __dynstr_end = .;
244 - }
245 + } :all
246
247 . = ALIGN(4);
248
249 @@ -104,7 +109,7 @@ SECTIONS
250 KEEP (*(.got.plt))
251 KEEP (*(.got))
252 __got_end = .;
253 - }
254 + } :all
255
256 . = ALIGN(4);
257
258 @@ -112,7 +117,7 @@ SECTIONS
259 __dynamic_start = .;
260 *(.dynamic)
261 __dynamic_end = .;
262 - }
263 + } :all
264
265 . = ALIGN(16);
266
267 @@ -122,19 +127,19 @@ SECTIONS
268 *(.data.*)
269 *(.lowmem)
270 __data_end = .;
271 - }
272 + } :all
273
274 .reloc : {
275 *(.reloc)
276 - }
277 + } :all
278
279 .symtab : {
280 *(.symtab)
281 - }
282 + } :all
283
284 .strtab : {
285 *(.strtab)
286 - }
287 + } :all
288
289 .bss (NOLOAD) : {
290 /* the EFI loader doesn't seem to like a .bss section,
291 @@ -148,7 +153,7 @@ SECTIONS
292 __bss_end = .;
293 *(.sbss)
294 *(.scommon)
295 - }
296 + } :all
297 __bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start);
298 __bss_dwords = (__bss_len + 3) >> 2;
299
300 @@ -161,7 +166,7 @@ SECTIONS
301 *(.hugebss)
302 *(.hugebss.*)
303 __hugebss_end = .;
304 - }
305 + } :all
306
307 _end = .;
308
309 --
310 2.35.1
311