diff options
author | dim <dim@FreeBSD.org> | 2012-05-07 17:13:36 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-05-07 17:13:36 +0000 |
commit | 66daa7f73f48d38f5311353ab936d0395de10047 (patch) | |
tree | a8b0d57b53904abb37a3559feeea81ad73622fce /contrib/binutils | |
parent | 6837ff0b32489b2f513213151aa1afc7057d83af (diff) | |
download | FreeBSD-src-66daa7f73f48d38f5311353ab936d0395de10047.zip FreeBSD-src-66daa7f73f48d38f5311353ab936d0395de10047.tar.gz |
Revert r234656, and apply a proper fix for binutils PR 10474, which
caused linking clang on 32-bit PowerPC to fail with "relocation
truncated to fit: R_PPC_REL24" errors.
Original diffs (relicensed under GPLv2 with permission from author):
http://sourceware.org/git/?p=binutils.git;a=commit;h=1fd262ff7d7ea5adf4894c6b960e092e7e43e3cd
http://sourceware.org/git/?p=binutils.git;a=commit;h=053c49fbff58bd33bd0d12200ea61302f92caceb
Tested by: andreast
MFC after: 1 week
Diffstat (limited to 'contrib/binutils')
-rw-r--r-- | contrib/binutils/ld/emultempl/ppc32elf.em | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/contrib/binutils/ld/emultempl/ppc32elf.em b/contrib/binutils/ld/emultempl/ppc32elf.em index b0239e0..49a8eff 100644 --- a/contrib/binutils/ld/emultempl/ppc32elf.em +++ b/contrib/binutils/ld/emultempl/ppc32elf.em @@ -119,7 +119,40 @@ ppc_before_allocation (void) } } } + gld${EMULATION_NAME}_before_allocation (); + + /* Turn on relaxation if executable sections have addresses that + might make branches overflow. */ + if (!command_line.relax) + { + bfd_vma low = (bfd_vma) -1; + bfd_vma high = 0; + asection *o; + + /* Run lang_size_sections (if not already done). */ + if (expld.phase != lang_mark_phase_enum) + { + expld.phase = lang_mark_phase_enum; + expld.dataseg.phase = exp_dataseg_none; + one_lang_size_sections_pass (NULL, FALSE); + lang_reset_memory_regions (); + } + + for (o = output_bfd->sections; o != NULL; o = o->next) + { + if ((o->flags & (SEC_ALLOC | SEC_CODE)) != (SEC_ALLOC | SEC_CODE)) + continue; + if (o->rawsize == 0) + continue; + if (low > o->vma) + low = o->vma; + if (high < o->vma + o->rawsize - 1) + high = o->vma + o->rawsize - 1; + } + if (high > low && high - low > (1 << 25) - 1) + command_line.relax = TRUE; + } } EOF |