summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-04-04 15:42:35 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-04-04 21:56:30 +0200
commit00c0d2012f2e8d977bad5487ab6f3b8ca46c8572 (patch)
tree5265d39f5954a356abeee1e7368bbd85e3b6c9f6
parent74ab8d14904041023bd0b66e05b6560110fc71be (diff)
downloadrockbox-00c0d2012f2e8d977bad5487ab6f3b8ca46c8572.tar.gz
rockbox-00c0d2012f2e8d977bad5487ab6f3b8ca46c8572.zip
rockboxdev: Store toolchain patches in-tree, instead of downloading them
This frees us from having to keep the web site in sync. Note that only currently-referenced patches were kept. Change-Id: I50da1b75baeac214cf142c8b76a05a8c56b4c1d4
-rwxr-xr-xtools/rockboxdev.sh14
-rw-r--r--tools/toolchain-patches/binutils-2.16.1-texinfo-fix.diff30
-rw-r--r--tools/toolchain-patches/binutils-2.20.1-ld-thumb-interwork-long-call.diff569
-rw-r--r--tools/toolchain-patches/binutils-2.20.1-texinfo-fix.diff21
-rw-r--r--tools/toolchain-patches/crosstool-ng-1.13.2.diff13
-rw-r--r--tools/toolchain-patches/gcc-4.0.3-rockbox-1.diff75
-rw-r--r--tools/toolchain-patches/rockbox-multilibs-noexceptions-arm-elf-eabi-gcc-4.4.2_1.diff64
7 files changed, 778 insertions, 8 deletions
diff --git a/tools/rockboxdev.sh b/tools/rockboxdev.sh
index 822a76da9f..e81915e20b 100755
--- a/tools/rockboxdev.sh
+++ b/tools/rockboxdev.sh
@@ -29,6 +29,9 @@ else
29 make="make" 29 make="make"
30fi 30fi
31 31
32# This is the absolute path to where the script resides.
33rockboxdevdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
34
32parallel=`nproc` 35parallel=`nproc`
33if [ $parallel -gt 1 ] ; then 36if [ $parallel -gt 1 ] ; then
34 make_parallel=-j$parallel 37 make_parallel=-j$parallel
@@ -349,8 +352,6 @@ build() {
349 configure_params="$5" 352 configure_params="$5"
350 needs_libs="$6" 353 needs_libs="$6"
351 354
352 patch_url="http://www.rockbox.org/gcc"
353
354 # create build directory 355 # create build directory
355 if test -d $builddir; then 356 if test -d $builddir; then
356 if test ! -w $builddir; then 357 if test ! -w $builddir; then
@@ -361,15 +362,12 @@ build() {
361 mkdir -p $builddir 362 mkdir -p $builddir
362 fi 363 fi
363 364
365 patch_dir="$rockboxdevdir/toolchain-patches"
366
364 # download source tarball 367 # download source tarball
365 gettool "$toolname" "$version" 368 gettool "$toolname" "$version"
366 file="$toolname-$version" 369 file="$toolname-$version"
367 370
368 # download patch
369 for p in $patch; do
370 getfile "$p" "$patch_url"
371 done
372
373 cd $builddir 371 cd $builddir
374 372
375 extract "$toolname-$version" 373 extract "$toolname-$version"
@@ -379,7 +377,7 @@ build() {
379 echo "ROCKBOXDEV: applying patch $p" 377 echo "ROCKBOXDEV: applying patch $p"
380 378
381 # apply the patch 379 # apply the patch
382 (cd $builddir/$toolname-$version && patch -p1 < "$dlwhere/$p") 380 (cd $builddir/$toolname-$version && patch -p1 < "$patch_dir/$p")
383 381
384 # check if the patch applied cleanly 382 # check if the patch applied cleanly
385 if [ $? -gt 0 ]; then 383 if [ $? -gt 0 ]; then
diff --git a/tools/toolchain-patches/binutils-2.16.1-texinfo-fix.diff b/tools/toolchain-patches/binutils-2.16.1-texinfo-fix.diff
new file mode 100644
index 0000000000..ae0a79399b
--- /dev/null
+++ b/tools/toolchain-patches/binutils-2.16.1-texinfo-fix.diff
@@ -0,0 +1,30 @@
1diff -ru binutils-2.16.1-orig/ld/ld.texinfo binutils-2.16.1/ld/ld.texinfo
2--- binutils-2.16.1-orig/ld/ld.texinfo 2005-06-12 20:35:45.000000000 +0200
3+++ binutils-2.16.1/ld/ld.texinfo 2013-06-04 22:31:37.833372351 +0200
4@@ -1589,7 +1589,7 @@
5
6 @kindex --version-script=@var{version-scriptfile}
7 @cindex version script, symbol versions
8-@itemx --version-script=@var{version-scriptfile}
9+@item --version-script=@var{version-scriptfile}
10 Specify the name of a version script to the linker. This is typically
11 used when creating shared libraries to specify additional information
12 about the version hierarchy for the library being created. This option
13@@ -6256,7 +6256,7 @@
14 @printindex cp
15
16 @tex
17-% I think something like @colophon should be in texinfo. In the
18+% I think something like @@colophon should be in texinfo. In the
19 % meantime:
20 \long\def\colophon{\hbox to0pt{}\vfill
21 \centerline{The body of this manual is set in}
22@@ -6267,7 +6267,7 @@
23 \centerline{{\sl\fontname\tensl\/}}
24 \centerline{are used for emphasis.}\vfill}
25 \page\colophon
26-% Blame: doc@cygnus.com, 28mar91.
27+% Blame: doc@@cygnus.com, 28mar91.
28 @end tex
29
30
diff --git a/tools/toolchain-patches/binutils-2.20.1-ld-thumb-interwork-long-call.diff b/tools/toolchain-patches/binutils-2.20.1-ld-thumb-interwork-long-call.diff
new file mode 100644
index 0000000000..5eb5debfbf
--- /dev/null
+++ b/tools/toolchain-patches/binutils-2.20.1-ld-thumb-interwork-long-call.diff
@@ -0,0 +1,569 @@
1http://sourceware.org/ml/binutils/2010-02/msg00460.html
2
3Drop this patch when binutils 2.21 is out
4diff -ur binutils-2.20.1.orig/bfd/elf32-arm.c binutils-2.20.1/bfd/elf32-arm.c
5--- binutils-2.20.1.orig/bfd/elf32-arm.c 2010-06-11 18:48:06.000000000 +0200
6+++ binutils-2.20.1/bfd/elf32-arm.c 2010-06-11 18:51:00.000000000 +0200
7@@ -2401,6 +2401,7 @@
8 unsigned long orig_insn;
9 char *stub_name;
10 enum elf32_arm_stub_type stub_type;
11+ int st_type;
12 };
13
14 /* A table of relocs applied to branches which might trigger Cortex-A8
15@@ -2647,6 +2648,9 @@
16 asection *stub_sec;
17 } *stub_group;
18
19+ /* Number of elements in stub_group. */
20+ int top_id;
21+
22 /* Assorted information used by elf32_arm_size_stubs. */
23 unsigned int bfd_count;
24 int top_index;
25@@ -2933,6 +2937,7 @@
26 ret->add_stub_section = NULL;
27 ret->layout_sections_again = NULL;
28 ret->stub_group = NULL;
29+ ret->top_id = 0;
30 ret->bfd_count = 0;
31 ret->top_index = 0;
32 ret->input_list = NULL;
33@@ -3033,7 +3038,7 @@
34 arm_type_of_stub (struct bfd_link_info *info,
35 asection *input_sec,
36 const Elf_Internal_Rela *rel,
37- unsigned char st_type,
38+ int *actual_st_type,
39 struct elf32_arm_link_hash_entry *hash,
40 bfd_vma destination,
41 asection *sym_sec,
42@@ -3048,6 +3053,7 @@
43 int thumb_only;
44 enum elf32_arm_stub_type stub_type = arm_stub_none;
45 int use_plt = 0;
46+ int st_type = *actual_st_type;
47
48 /* We don't know the actual type of destination in case it is of
49 type STT_SECTION: give up. */
50@@ -3065,14 +3071,15 @@
51 + input_sec->output_section->vma
52 + rel->r_offset);
53
54- branch_offset = (bfd_signed_vma)(destination - location);
55-
56 r_type = ELF32_R_TYPE (rel->r_info);
57
58 /* Keep a simpler condition, for the sake of clarity. */
59- if (globals->splt != NULL && hash != NULL && hash->root.plt.offset != (bfd_vma) -1)
60+ if (globals->splt != NULL
61+ && hash != NULL
62+ && hash->root.plt.offset != (bfd_vma) -1)
63 {
64 use_plt = 1;
65+
66 /* Note when dealing with PLT entries: the main PLT stub is in
67 ARM mode, so if the branch is in Thumb mode, another
68 Thumb->ARM stub will be inserted later just before the ARM
69@@ -3081,8 +3088,15 @@
70 Thumb->Arm one and branch directly to the ARM PLT entry
71 because it avoids spreading offset corrections in several
72 places. */
73+
74+ destination = (globals->splt->output_section->vma
75+ + globals->splt->output_offset
76+ + hash->root.plt.offset);
77+ st_type = STT_FUNC;
78 }
79
80+ branch_offset = (bfd_signed_vma)(destination - location);
81+
82 if (r_type == R_ARM_THM_CALL || r_type == R_ARM_THM_JUMP24)
83 {
84 /* Handle cases where:
85@@ -3176,7 +3190,9 @@
86 }
87 }
88 }
89- else if (r_type == R_ARM_CALL || r_type == R_ARM_JUMP24 || r_type == R_ARM_PLT32)
90+ else if (r_type == R_ARM_CALL
91+ || r_type == R_ARM_JUMP24
92+ || r_type == R_ARM_PLT32)
93 {
94 if (st_type == STT_ARM_TFUNC)
95 {
96@@ -3231,6 +3247,12 @@
97 }
98 }
99
100+ /* If a stub is needed, record the actual destination type. */
101+ if (stub_type != arm_stub_none)
102+ {
103+ *actual_st_type = st_type;
104+ }
105+
106 return stub_type;
107 }
108
109@@ -3240,31 +3262,35 @@
110 elf32_arm_stub_name (const asection *input_section,
111 const asection *sym_sec,
112 const struct elf32_arm_link_hash_entry *hash,
113- const Elf_Internal_Rela *rel)
114+ const Elf_Internal_Rela *rel,
115+ enum elf32_arm_stub_type stub_type)
116+
117 {
118 char *stub_name;
119 bfd_size_type len;
120
121 if (hash)
122 {
123- len = 8 + 1 + strlen (hash->root.root.root.string) + 1 + 8 + 1;
124+ len = 8 + 1 + strlen (hash->root.root.root.string) + 1 + 8 + 1 + 2 + 1;
125 stub_name = bfd_malloc (len);
126 if (stub_name != NULL)
127- sprintf (stub_name, "%08x_%s+%x",
128+ sprintf (stub_name, "%08x_%s+%x_%d",
129 input_section->id & 0xffffffff,
130 hash->root.root.root.string,
131- (int) rel->r_addend & 0xffffffff);
132+ (int) rel->r_addend & 0xffffffff,
133+ (int) stub_type);
134 }
135 else
136 {
137- len = 8 + 1 + 8 + 1 + 8 + 1 + 8 + 1;
138+ len = 8 + 1 + 8 + 1 + 8 + 1 + 8 + 1 + 2 + 1;
139 stub_name = bfd_malloc (len);
140 if (stub_name != NULL)
141- sprintf (stub_name, "%08x_%x:%x+%x",
142+ sprintf (stub_name, "%08x_%x:%x+%x_%d",
143 input_section->id & 0xffffffff,
144 sym_sec->id & 0xffffffff,
145 (int) ELF32_R_SYM (rel->r_info) & 0xffffffff,
146- (int) rel->r_addend & 0xffffffff);
147+ (int) rel->r_addend & 0xffffffff,
148+ (int) stub_type);
149 }
150
151 return stub_name;
152@@ -3278,7 +3304,8 @@
153 const asection *sym_sec,
154 struct elf_link_hash_entry *hash,
155 const Elf_Internal_Rela *rel,
156- struct elf32_arm_link_hash_table *htab)
157+ struct elf32_arm_link_hash_table *htab,
158+ enum elf32_arm_stub_type stub_type)
159 {
160 struct elf32_arm_stub_hash_entry *stub_entry;
161 struct elf32_arm_link_hash_entry *h = (struct elf32_arm_link_hash_entry *) hash;
162@@ -3296,7 +3323,8 @@
163
164 if (h != NULL && h->stub_cache != NULL
165 && h->stub_cache->h == h
166- && h->stub_cache->id_sec == id_sec)
167+ && h->stub_cache->id_sec == id_sec
168+ && h->stub_cache->stub_type == stub_type)
169 {
170 stub_entry = h->stub_cache;
171 }
172@@ -3304,7 +3332,7 @@
173 {
174 char *stub_name;
175
176- stub_name = elf32_arm_stub_name (id_sec, sym_sec, h, rel);
177+ stub_name = elf32_arm_stub_name (id_sec, sym_sec, h, rel, stub_type);
178 if (stub_name == NULL)
179 return NULL;
180
181@@ -3464,7 +3492,7 @@
182 /* We have to do the a8 fixes last, as they are less aligned than
183 the other veneers. */
184 return TRUE;
185-
186+
187 /* Make a note of the offset within the stubs for this entry. */
188 stub_entry->stub_offset = stub_sec->size;
189 loc = stub_sec->contents + stub_entry->stub_offset;
190@@ -3499,17 +3527,17 @@
191 BFD_ASSERT ((data & 0xff00) == 0xd000);
192 data |= ((stub_entry->orig_insn >> 22) & 0xf) << 8;
193 }
194- put_thumb_insn (globals, stub_bfd, data, loc + size);
195+ bfd_put_16 (stub_bfd, data, loc + size);
196 size += 2;
197 }
198 break;
199
200 case THUMB32_TYPE:
201- put_thumb_insn (globals, stub_bfd,
202- (template_sequence[i].data >> 16) & 0xffff,
203- loc + size);
204- put_thumb_insn (globals, stub_bfd, template_sequence[i].data & 0xffff,
205- loc + size + 2);
206+ bfd_put_16 (stub_bfd,
207+ (template_sequence[i].data >> 16) & 0xffff,
208+ loc + size);
209+ bfd_put_16 (stub_bfd, template_sequence[i].data & 0xffff,
210+ loc + size + 2);
211 if (template_sequence[i].r_type != R_ARM_NONE)
212 {
213 stub_reloc_idx[nrelocs] = i;
214@@ -3519,8 +3547,8 @@
215 break;
216
217 case ARM_TYPE:
218- put_arm_insn (globals, stub_bfd, template_sequence[i].data,
219- loc + size);
220+ bfd_put_32 (stub_bfd, template_sequence[i].data,
221+ loc + size);
222 /* Handle cases where the target is encoded within the
223 instruction. */
224 if (template_sequence[i].r_type == R_ARM_JUMP24)
225@@ -3599,11 +3627,23 @@
226 }
227 else
228 {
229- _bfd_final_link_relocate (elf32_arm_howto_from_type
230- (template_sequence[stub_reloc_idx[i]].r_type), stub_bfd, stub_sec,
231- stub_sec->contents, stub_entry->stub_offset + stub_reloc_offset[i],
232- sym_value + stub_entry->target_addend,
233- template_sequence[stub_reloc_idx[i]].reloc_addend);
234+ Elf_Internal_Rela rel;
235+ bfd_boolean unresolved_reloc;
236+ char *error_message;
237+ bfd_vma points_to = sym_value + stub_entry->target_addend
238+ + template_sequence[stub_reloc_idx[i]].reloc_addend;
239+
240+ rel.r_offset = stub_entry->stub_offset + stub_reloc_offset[i];
241+ rel.r_info = ELF32_R_INFO (0,
242+ template_sequence[stub_reloc_idx[i]].r_type);
243+ rel.r_addend = 0;
244+
245+ elf32_arm_final_link_relocate (elf32_arm_howto_from_type
246+ (template_sequence[stub_reloc_idx[i]].r_type),
247+ stub_bfd, info->output_bfd, stub_sec, stub_sec->contents, &rel,
248+ points_to, info, stub_entry->target_section, "", stub_entry->st_type,
249+ (struct elf_link_hash_entry *) stub_entry->h, &unresolved_reloc,
250+ &error_message);
251 }
252
253 return TRUE;
254@@ -3728,6 +3768,7 @@
255 htab->stub_group = bfd_zmalloc (amt);
256 if (htab->stub_group == NULL)
257 return -1;
258+ htab->top_id = top_id;
259
260 /* We can't use output_bfd->section_count here to find the top output
261 section index as some sections may have been removed, and
262@@ -4009,7 +4050,7 @@
263 }
264
265 is_32bit_branch = is_b || is_bl || is_blx || is_bcc;
266-
267+
268 if (((base_vma + i) & 0xfff) == 0xffe
269 && insn_32bit
270 && is_32bit_branch
271@@ -4178,6 +4219,8 @@
272 a8_fixes[num_a8_fixes].orig_insn = insn;
273 a8_fixes[num_a8_fixes].stub_name = stub_name;
274 a8_fixes[num_a8_fixes].stub_type = stub_type;
275+ a8_fixes[num_a8_fixes].st_type =
276+ is_blx ? STT_FUNC : STT_ARM_TFUNC;
277
278 num_a8_fixes++;
279 }
280@@ -4193,11 +4236,11 @@
281 if (elf_section_data (section)->this_hdr.contents == NULL)
282 free (contents);
283 }
284-
285+
286 *a8_fixes_p = a8_fixes;
287 *num_a8_fixes_p = num_a8_fixes;
288 *a8_fix_table_size_p = a8_fix_table_size;
289-
290+
291 return FALSE;
292 }
293
294@@ -4345,7 +4388,7 @@
295 const char *sym_name;
296 char *stub_name;
297 const asection *id_sec;
298- unsigned char st_type;
299+ int st_type;
300 bfd_boolean created_stub = FALSE;
301
302 r_type = ELF32_R_TYPE (irela->r_info);
303@@ -4403,7 +4446,7 @@
304 /* This is an undefined symbol. It can never
305 be resolved. */
306 continue;
307-
308+
309 if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
310 sym_value = sym->st_value;
311 destination = (sym_value + irela->r_addend
312@@ -4493,7 +4536,7 @@
313 {
314 /* Determine what (if any) linker stub is needed. */
315 stub_type = arm_type_of_stub (info, section, irela,
316- st_type, hash,
317+ &st_type, hash,
318 destination, sym_sec,
319 input_bfd, sym_name);
320 if (stub_type == arm_stub_none)
321@@ -4504,7 +4547,7 @@
322
323 /* Get the name of this stub. */
324 stub_name = elf32_arm_stub_name (id_sec, sym_sec, hash,
325- irela);
326+ irela, stub_type);
327 if (!stub_name)
328 goto error_ret_free_internal;
329
330@@ -4703,7 +4746,7 @@
331 stub_entry->target_value = a8_fixes[i].offset;
332 stub_entry->target_addend = a8_fixes[i].addend;
333 stub_entry->orig_insn = a8_fixes[i].orig_insn;
334- stub_entry->st_type = STT_ARM_TFUNC;
335+ stub_entry->st_type = a8_fixes[i].st_type;
336
337 size = find_stub_size_and_template (a8_fixes[i].stub_type,
338 &template_sequence,
339@@ -6866,6 +6909,7 @@
340 ".tls_vars") == 0)
341 && ((r_type != R_ARM_REL32 && r_type != R_ARM_REL32_NOI)
342 || !SYMBOL_CALLS_LOCAL (info, h))
343+ && (!strstr (input_section->name, STUB_SUFFIX))
344 && (h == NULL
345 || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
346 || h->root.type != bfd_link_hash_undefweak)
347@@ -6990,7 +7034,6 @@
348 case R_ARM_PC24: /* Arm B/BL instruction. */
349 case R_ARM_PLT32:
350 {
351- bfd_signed_vma branch_offset;
352 struct elf32_arm_stub_hash_entry *stub_entry = NULL;
353
354 if (r_type == R_ARM_XPC25)
355@@ -7026,45 +7069,46 @@
356 || r_type == R_ARM_JUMP24
357 || r_type == R_ARM_PLT32)
358 {
359- bfd_vma from;
360-
361- /* If the call goes through a PLT entry, make sure to
362- check distance to the right destination address. */
363- if (h != NULL && splt != NULL && h->plt.offset != (bfd_vma) -1)
364- {
365- value = (splt->output_section->vma
366- + splt->output_offset
367- + h->plt.offset);
368- *unresolved_reloc_p = FALSE;
369- /* The PLT entry is in ARM mode, regardless of the
370- target function. */
371- sym_flags = STT_FUNC;
372- }
373+ enum elf32_arm_stub_type stub_type = arm_stub_none;
374+ struct elf32_arm_link_hash_entry *hash;
375
376- from = (input_section->output_section->vma
377- + input_section->output_offset
378- + rel->r_offset);
379- branch_offset = (bfd_signed_vma)(value - from);
380-
381- if (branch_offset > ARM_MAX_FWD_BRANCH_OFFSET
382- || branch_offset < ARM_MAX_BWD_BRANCH_OFFSET
383- || ((sym_flags == STT_ARM_TFUNC)
384- && (((r_type == R_ARM_CALL) && !globals->use_blx)
385- || (r_type == R_ARM_JUMP24)
386- || (r_type == R_ARM_PLT32) ))
387- )
388+ hash = (struct elf32_arm_link_hash_entry *) h;
389+ stub_type = arm_type_of_stub (info, input_section, rel,
390+ &sym_flags, hash,
391+ value, sym_sec,
392+ input_bfd, sym_name);
393+
394+ if (stub_type != arm_stub_none)
395 {
396 /* The target is out of reach, so redirect the
397 branch to the local stub for this function. */
398
399 stub_entry = elf32_arm_get_stub_entry (input_section,
400 sym_sec, h,
401- rel, globals);
402+ rel, globals,
403+ stub_type);
404 if (stub_entry != NULL)
405 value = (stub_entry->stub_offset
406 + stub_entry->stub_sec->output_offset
407 + stub_entry->stub_sec->output_section->vma);
408 }
409+ else
410+ {
411+ /* If the call goes through a PLT entry, make sure to
412+ check distance to the right destination address. */
413+ if (h != NULL
414+ && splt != NULL
415+ && h->plt.offset != (bfd_vma) -1)
416+ {
417+ value = (splt->output_section->vma
418+ + splt->output_offset
419+ + h->plt.offset);
420+ *unresolved_reloc_p = FALSE;
421+ /* The PLT entry is in ARM mode, regardless of the
422+ target function. */
423+ sym_flags = STT_FUNC;
424+ }
425+ }
426 }
427
428 /* The ARM ELF ABI says that this reloc is computed as: S - P + A
429@@ -7444,58 +7488,29 @@
430 }
431 }
432
433- /* Handle calls via the PLT. */
434- if (h != NULL && splt != NULL && h->plt.offset != (bfd_vma) -1)
435- {
436- value = (splt->output_section->vma
437- + splt->output_offset
438- + h->plt.offset);
439- if (globals->use_blx && r_type == R_ARM_THM_CALL)
440- {
441- /* If the Thumb BLX instruction is available, convert the
442- BL to a BLX instruction to call the ARM-mode PLT entry. */
443- lower_insn = (lower_insn & ~0x1000) | 0x0800;
444- sym_flags = STT_FUNC;
445- }
446- else
447- {
448- /* Target the Thumb stub before the ARM PLT entry. */
449- value -= PLT_THUMB_STUB_SIZE;
450- sym_flags = STT_ARM_TFUNC;
451- }
452- *unresolved_reloc_p = FALSE;
453- }
454-
455+ enum elf32_arm_stub_type stub_type = arm_stub_none;
456 if (r_type == R_ARM_THM_CALL || r_type == R_ARM_THM_JUMP24)
457 {
458 /* Check if a stub has to be inserted because the destination
459 is too far. */
460- bfd_vma from;
461- bfd_signed_vma branch_offset;
462- struct elf32_arm_stub_hash_entry *stub_entry = NULL;
463-
464- from = (input_section->output_section->vma
465- + input_section->output_offset
466- + rel->r_offset);
467- branch_offset = (bfd_signed_vma)(value - from);
468-
469- if ((!thumb2
470- && (branch_offset > THM_MAX_FWD_BRANCH_OFFSET
471- || (branch_offset < THM_MAX_BWD_BRANCH_OFFSET)))
472- ||
473- (thumb2
474- && (branch_offset > THM2_MAX_FWD_BRANCH_OFFSET
475- || (branch_offset < THM2_MAX_BWD_BRANCH_OFFSET)))
476- || ((sym_flags != STT_ARM_TFUNC)
477- && (((r_type == R_ARM_THM_CALL) && !globals->use_blx)
478- || r_type == R_ARM_THM_JUMP24)))
479+ struct elf32_arm_stub_hash_entry *stub_entry;
480+ struct elf32_arm_link_hash_entry *hash;
481+
482+ hash = (struct elf32_arm_link_hash_entry *) h;
483+
484+ stub_type = arm_type_of_stub (info, input_section, rel,
485+ &sym_flags, hash, value, sym_sec,
486+ input_bfd, sym_name);
487+
488+ if (stub_type != arm_stub_none)
489 {
490 /* The target is out of reach or we are changing modes, so
491 redirect the branch to the local stub for this
492 function. */
493 stub_entry = elf32_arm_get_stub_entry (input_section,
494 sym_sec, h,
495- rel, globals);
496+ rel, globals,
497+ stub_type);
498 if (stub_entry != NULL)
499 value = (stub_entry->stub_offset
500 + stub_entry->stub_sec->output_offset
501@@ -7512,6 +7527,33 @@
502 }
503 }
504
505+ /* Handle calls via the PLT. */
506+ if (stub_type == arm_stub_none
507+ && h != NULL
508+ && splt != NULL
509+ && h->plt.offset != (bfd_vma) -1)
510+ {
511+ value = (splt->output_section->vma
512+ + splt->output_offset
513+ + h->plt.offset);
514+
515+ if (globals->use_blx && r_type == R_ARM_THM_CALL)
516+ {
517+ /* If the Thumb BLX instruction is available, convert
518+ the BL to a BLX instruction to call the ARM-mode
519+ PLT entry. */
520+ lower_insn = (lower_insn & ~0x1000) | 0x0800;
521+ sym_flags = STT_FUNC;
522+ }
523+ else
524+ {
525+ /* Target the Thumb stub before the ARM PLT entry. */
526+ value -= PLT_THUMB_STUB_SIZE;
527+ sym_flags = STT_ARM_TFUNC;
528+ }
529+ *unresolved_reloc_p = FALSE;
530+ }
531+
532 relocation = value + signed_addend;
533
534 relocation -= (input_section->output_section->vma
535@@ -9298,11 +9340,26 @@
536 elf32_arm_final_link (bfd *abfd, struct bfd_link_info *info)
537 {
538 struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (info);
539+ asection *sec, *osec;
540
541 /* Invoke the regular ELF backend linker to do all the work. */
542 if (!bfd_elf_final_link (abfd, info))
543 return FALSE;
544
545+ /* Process stub sections (eg BE8 encoding, ...). */
546+ struct elf32_arm_link_hash_table *htab = elf32_arm_hash_table (info);
547+ int i;
548+ for(i=0; i<htab->top_id; i++) {
549+ sec = htab->stub_group[i].stub_sec;
550+ if (sec) {
551+ osec = sec->output_section;
552+ elf32_arm_write_section (abfd, info, sec, sec->contents);
553+ if (! bfd_set_section_contents (abfd, osec, sec->contents,
554+ sec->output_offset, sec->size))
555+ return FALSE;
556+ }
557+ }
558+
559 /* Write out any glue sections now that we have created all the
560 stubs. */
561 if (globals->bfd_of_glue_owner != NULL)
562@@ -12875,6 +12932,7 @@
563 sym.st_other = 0;
564 sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_NOTYPE);
565 sym.st_shndx = osi->sec_shndx;
566+ elf32_arm_section_map_add (osi->sec, names[type][1], offset);
567 return osi->func (osi->finfo, names[type], &sym, osi->sec, NULL) == 1;
568 }
569
diff --git a/tools/toolchain-patches/binutils-2.20.1-texinfo-fix.diff b/tools/toolchain-patches/binutils-2.20.1-texinfo-fix.diff
new file mode 100644
index 0000000000..cca0861eef
--- /dev/null
+++ b/tools/toolchain-patches/binutils-2.20.1-texinfo-fix.diff
@@ -0,0 +1,21 @@
1diff -ru binutils-2.20.1-orig/bfd/doc/bfd.texinfo binutils-2.20.1/bfd/doc/bfd.texinfo
2--- binutils-2.20.1-orig/bfd/doc/bfd.texinfo 2013-05-12 17:28:30.461074959 +0200
3+++ binutils-2.20.1/bfd/doc/bfd.texinfo 2013-05-12 17:26:54.175902524 +0200
4@@ -323,7 +323,7 @@
5 @printindex cp
6
7 @tex
8-% I think something like @colophon should be in texinfo. In the
9+% I think something like @@colophon should be in texinfo. In the
10 % meantime:
11 \long\def\colophon{\hbox to0pt{}\vfill
12 \centerline{The body of this manual is set in}
13@@ -334,7 +334,7 @@
14 \centerline{{\sl\fontname\tensl\/}}
15 \centerline{are used for emphasis.}\vfill}
16 \page\colophon
17-% Blame: doc@cygnus.com, 28mar91.
18+% Blame: doc@@cygnus.com, 28mar91.
19 @end tex
20
21 @bye
diff --git a/tools/toolchain-patches/crosstool-ng-1.13.2.diff b/tools/toolchain-patches/crosstool-ng-1.13.2.diff
new file mode 100644
index 0000000000..f8b13a2794
--- /dev/null
+++ b/tools/toolchain-patches/crosstool-ng-1.13.2.diff
@@ -0,0 +1,13 @@
1--- a/Makefile.in 2014-07-30 14:16:57.989859205 +0200
2+++ b/Makefile.in 2014-07-30 14:16:52.133836316 +0200
3@@ -26,7 +26,11 @@
4 # '-Rr' to MAKEFLAGS adds it literaly ( and does not add 'Rr' )
5 ifeq ($(filter Rr,$(MAKEFLAGS)),)
6 ifeq ($(filter -Rr,$(MAKEFLAGS)),)
7+ifeq ($(filter -rR,$(MAKEFLAGS)),)
8+ifeq ($(filter rR,$(MAKEFLAGS)),)
9 CT_MAKEFLAGS += -Rr
10+endif # No rR
11+endif # No -rR
12 endif # No -Rr
13 endif # No Rr
diff --git a/tools/toolchain-patches/gcc-4.0.3-rockbox-1.diff b/tools/toolchain-patches/gcc-4.0.3-rockbox-1.diff
new file mode 100644
index 0000000000..abd0f44be3
--- /dev/null
+++ b/tools/toolchain-patches/gcc-4.0.3-rockbox-1.diff
@@ -0,0 +1,75 @@
1diff -ru gcc-4.0.3-orig/gcc/config/sh/sh.h gcc-4.0.3/gcc/config/sh/sh.h
2--- gcc-4.0.3-orig/gcc/config/sh/sh.h 2006-03-06 23:40:49.000000000 +0100
3+++ gcc-4.0.3/gcc/config/sh/sh.h 2006-04-28 03:03:18.000000000 +0200
4@@ -2809,12 +2809,15 @@
5 #define CASE_VECTOR_MODE ((! optimize || TARGET_BIGTABLE) ? SImode : HImode)
6
7 #define CASE_VECTOR_SHORTEN_MODE(MIN_OFFSET, MAX_OFFSET, BODY) \
8-((MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 127 \
9+((MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 126 \
10 ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 0, QImode) \
11- : (MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 255 \
12+ : (MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 254 \
13 ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 1, QImode) \
14 : (MIN_OFFSET) >= -32768 && (MAX_OFFSET) <= 32767 ? HImode \
15 : SImode)
16+/* Note: The maximum range for byte-sized offsets was reduced by 1 to work
17+ around a bug in final.c I don't know how to fix properly (jump table
18+ length calculation should take alignment into account). -- Jens Arnold */
19
20 /* Define as C expression which evaluates to nonzero if the tablejump
21 instruction expects the table to contain offsets from the address of the
22diff -ru gcc-4.0.3-orig/gcc/version.c gcc-4.0.3/gcc/version.c
23--- gcc-4.0.3-orig/gcc/version.c 2006-03-09 21:46:18.000000000 +0100
24+++ gcc-4.0.3/gcc/version.c 2006-04-29 23:52:22.000000000 +0200
25@@ -5,7 +5,7 @@
26 please modify this string to indicate that, e.g. by putting your
27 organization's name in parentheses at the end of the string. */
28
29-const char version_string[] = "4.0.3";
30+const char version_string[] = "4.0.3 (rockbox patch #1)";
31
32 /* This is the location of the online document giving instructions for
33 reporting bugs. If you distribute a modified version of GCC,
34diff -ru gcc-4.0.3-orig/gcc/config.gcc gcc-4.0.3/gcc/config.gcc
35--- gcc-4.0.3-orig/gcc/config.gcc So Mrz 7 23:08:24 2010
36+++ gcc-4.0.3/gcc/config.gcc Mo Mrz 8 01:36:54 2010
37@@ -1867,7 +1867,7 @@
38 sh2*) sh_cpu_target=sh2 ;;
39 *) sh_cpu_target=sh1 ;;
40 esac
41- sh_cpu_default="`echo $with_cpu|sed s/^m/sh/|tr A-Z_ a-z-`"
42+ sh_cpu_default="`echo $with_cpu|sed s/^m/sh/|tr [A-Z]_ [a-z]-`"
43 case $sh_cpu_default in
44 sh5-64media-nofpu | sh5-64media | \
45 sh5-32media-nofpu | sh5-32media | sh5-compact-nofpu | sh5-compact | \
46@@ -1889,9 +1889,9 @@
47 *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;;
48 esac
49 fi
50- target_cpu_default=SELECT_`echo ${sh_cpu_default}|tr a-z- A-Z_`
51+ target_cpu_default=SELECT_`echo ${sh_cpu_default}|tr [a-z]- [A-Z]_`
52 tm_defines=${tm_defines}' SH_MULTILIB_CPU_DEFAULT=\"'`echo $sh_cpu_default|sed s/sh/m/`'\"'
53- sh_multilibs=`echo $sh_multilibs,$sh_cpu_default | sed -e 's/[ ,/][ ,]*/ /g' -e 's/ $//' -e s/^m/sh/ -e 's/ m/ sh/g' | tr A-Z_ a-z-`
54+ sh_multilibs=`echo $sh_multilibs,$sh_cpu_default | sed -e 's/[ ,/][ ,]*/ /g' -e 's/ $//' -e s/^m/sh/ -e 's/ m/ sh/g' | tr [A-Z]_ [a-z]-`
55 for sh_multilib in ${sh_multilibs}; do
56 case ${sh_multilib} in
57 sh1 | sh2 | sh2e | sh3 | sh3e | \
58@@ -1902,7 +1902,7 @@
59 sh5-32media | sh5-32media-nofpu | \
60 sh5-compact | sh5-compact-nofpu)
61 tmake_file="${tmake_file} sh/t-mlib-${sh_multilib}"
62- tm_defines="$tm_defines SUPPORT_`echo $sh_multilib|tr a-z- A-Z_`"
63+ tm_defines="$tm_defines SUPPORT_`echo $sh_multilib|tr [a-z]- [A-Z]_`"
64 ;;
65 *)
66 echo "with_multilib_list=${sh_multilib} not supported."
67@@ -2631,7 +2631,7 @@
68
69 sh[123456ble]-*-* | sh-*-*)
70 supported_defaults="cpu"
71- case "`echo $with_cpu | tr A-Z_ a-z- | sed s/sh/m/`" in
72+ case "`echo $with_cpu | tr [A-Z]_ [a-z]- | sed s/sh/m/`" in
73 "" | m1 | m2 | m2e | m3 | m3e | m4 | m4-single | m4-single-only | m4-nofpu )
74 # OK
75 ;;
diff --git a/tools/toolchain-patches/rockbox-multilibs-noexceptions-arm-elf-eabi-gcc-4.4.2_1.diff b/tools/toolchain-patches/rockbox-multilibs-noexceptions-arm-elf-eabi-gcc-4.4.2_1.diff
new file mode 100644
index 0000000000..3397153495
--- /dev/null
+++ b/tools/toolchain-patches/rockbox-multilibs-noexceptions-arm-elf-eabi-gcc-4.4.2_1.diff
@@ -0,0 +1,64 @@
1diff -ur gcc-4.4.2-orig/gcc/config/arm/t-arm-elf gcc-4.4.2/gcc/config/arm/t-arm-elf
2--- gcc-4.4.2-orig/gcc/config/arm/t-arm-elf 2008-06-12 13:29:47.000000000 -0400
3+++ gcc-4.4.2/gcc/config/arm/t-arm-elf 2009-11-05 20:14:57.000000000 -0500
4@@ -28,6 +28,11 @@
5 #MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4
6 #MULTILIB_MATCHES += march?armv7=mcpu?cortex-m3
7
8+# We build a lib for each specific CPU Rockbox targets. If anyone knows a better
9+# way to do this, please let us know.
10+MULTILIB_OPTIONS += mcpu=arm7tdmi/mcpu=arm9tdmi/mcpu=arm9e/mcpu=arm926ej-s/mcpu=arm1136jf-s
11+MULTILIB_DIRNAMES += arm7tdmi arm9tdmi arm9e arm926ej-s arm1136jf-s
12+
13 # MULTILIB_OPTIONS += mcpu=ep9312
14 # MULTILIB_DIRNAMES += ep9312
15 # MULTILIB_EXCEPTIONS += *mthumb/*mcpu=ep9312*
16@@ -40,8 +50,8 @@
17 # MULTILIB_DIRNAMES += fpu soft
18 # MULTILIB_EXCEPTIONS += *mthumb/*mhard-float*
19 #
20-# MULTILIB_OPTIONS += mno-thumb-interwork/mthumb-interwork
21-# MULTILIB_DIRNAMES += normal interwork
22+MULTILIB_OPTIONS += mno-thumb-interwork/mthumb-interwork
23+MULTILIB_DIRNAMES += normal interwork
24 #
25 # MULTILIB_OPTIONS += fno-leading-underscore/fleading-underscore
26 # MULTILIB_DIRNAMES += elf under
27diff -ur gcc-4.4.2-orig/libgcc/Makefile.in gcc-4.4.2/libgcc/Makefile.in
28--- gcc-4.4.2-orig/libgcc/Makefile.in 2009-04-09 19:23:07.000000000 -0400
29+++ gcc-4.4.2/libgcc/Makefile.in 2009-11-05 03:59:37.000000000 -0500
30@@ -393,14 +393,14 @@
31 lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
32 $(lib2-divmod-o): %$(objext): $(gcc_srcdir)/libgcc2.c
33 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
34- -fexceptions -fnon-call-exceptions $(vis_hide)
35+ -fno-exceptions -fno-non-call-exceptions $(vis_hide)
36 libgcc-objects += $(lib2-divmod-o)
37
38 ifeq ($(enable_shared),yes)
39 lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
40 $(lib2-divmod-s-o): %_s$(objext): $(gcc_srcdir)/libgcc2.c
41 $(gcc_s_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
42- -fexceptions -fnon-call-exceptions
43+ -fno-exceptions -fno-non-call-exceptions
44 libgcc-s-objects += $(lib2-divmod-s-o)
45 endif
46
47@@ -688,7 +688,7 @@
48 # libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
49 # LIB2ADDEHSHARED matter. (Usually all three are identical.)
50
51-c_flags := -fexceptions
52+c_flags := -fno-exceptions
53
54 ifeq ($(enable_shared),yes)
55
56@@ -710,7 +710,7 @@
57
58 # Build LIBUNWIND.
59
60-c_flags := -fexceptions
61+c_flags := -fno-exceptions
62
63 libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))
64