source: scripts/patch/binutils/2.19.1/20-relaxed_ld_powerpc.patch@ 3ed95a3

clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 3ed95a3 was b2d50f5, checked in by Jim Gifford <clfs@…>, 15 years ago

Added: Binutils Patch to Fix PPC

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[b2d50f5]1This aims to make life a little easier for people building large
2PowerPC binaries where the PLT is out of reach for 24-bit branches.
3
4 * emultempl/ppc32elf.em (ppc_before_allocation): Turn on
5 linker relaxation if it might be necessary.
6
7diff -Naur binutils-2.19.1.orig/ld/emultempl/ppc32elf.em binutils-2.19.1/ld/emultempl/ppc32elf.em
8--- binutils-2.19.1.orig/ld/emultempl/ppc32elf.em 2008-02-15 01:03:02.000000000 -0800
9+++ binutils-2.19.1/ld/emultempl/ppc32elf.em 2009-07-19 20:22:20.000000000 -0700
10@@ -112,7 +112,40 @@
11 }
12 }
13 }
14+
15 gld${EMULATION_NAME}_before_allocation ();
16+
17+ /* Turn on relaxation if executable sections have addresses that
18+ might make branches overflow. */
19+ if (!command_line.relax)
20+ {
21+ bfd_vma low = (bfd_vma) -1;
22+ bfd_vma high = 0;
23+ asection *o;
24+
25+ /* Run lang_size_sections (if not already done). */
26+ if (expld.phase != lang_mark_phase_enum)
27+ {
28+ expld.phase = lang_mark_phase_enum;
29+ expld.dataseg.phase = exp_dataseg_none;
30+ one_lang_size_sections_pass (NULL, FALSE);
31+ lang_reset_memory_regions ();
32+ }
33+
34+ for (o = link_info.output_bfd->sections; o != NULL; o = o->next)
35+ {
36+ if ((o->flags & (SEC_ALLOC | SEC_CODE)) != (SEC_ALLOC | SEC_CODE))
37+ continue;
38+ if (o->size == 0)
39+ continue;
40+ if (low > o->vma)
41+ low = o->vma;
42+ if (high < o->vma + o->size - 1)
43+ high = o->vma + o->size - 1;
44+ }
45+ if (high > low && high - low > (1 << 25) - 1)
46+ command_line.relax = TRUE;
47+ }
48 }
49
50 EOF
Note: See TracBrowser for help on using the repository browser.