summaryrefslogtreecommitdiffstats
path: root/binutils-2.25/gold/aarch64.cc
diff options
context:
space:
mode:
authorHan Shen <shenhan@google.com>2016-01-14 14:26:29 -0800
committerHan Shen <shenhan@google.com>2016-01-14 17:09:13 -0800
commit6579e31a8757a1df50ca408dd1b3cd3fe59bb4b6 (patch)
tree3747b2de9900c9278020f903fceaecc1186e5d55 /binutils-2.25/gold/aarch64.cc
parenta95c2e5c5e5338f535c730b2333e797adf2872c0 (diff)
downloadtoolchain_binutils-6579e31a8757a1df50ca408dd1b3cd3fe59bb4b6.tar.gz
toolchain_binutils-6579e31a8757a1df50ca408dd1b3cd3fe59bb4b6.tar.bz2
toolchain_binutils-6579e31a8757a1df50ca408dd1b3cd3fe59bb4b6.zip
Backport trunk patch for not applying dynamic relocs.
Note, there is a small change from the origin patch - while in the upstream patch, the option --no-apply-dynamic is default off, it is on by default in this CL. This should not bring any changes to android or chromeos, because the relocation value this CL changes is not used by chromeos, and is not used by android either (after the fix in bionic months ago). The backported patch is - commit 0eccf19f96d6218dd7c2f8d13f0546c2b942cc08 Author: Cary Coutant <ccoutant@gmail.com> Date: Thu Nov 5 12:24:14 2015 -0800 Add aarch64-specific --no-apply-dynamic-relocs option. With --no-apply-dynamic-relocs on aarch64 targets, gold will not apply link-time values for absolute relocations that become dynamic relocations. This provides a workaround for broken Android dynamic linkers that use the link-time value as an extra addend to the relocation. gold/ PR gold/19163 * aarch64.cc (Target_aarch64::Relocate::relocate): Don't apply certain relocations if --no-apply-dynamic-relocs is set. * options.h (--apply-dynamic-relocs): New aarch64-specific option. Tested - build whole toolchain and built android N9 image. Change-Id: Ida524bbee2a83574cd9e78ffdad9270787327c78
Diffstat (limited to 'binutils-2.25/gold/aarch64.cc')
-rw-r--r--binutils-2.25/gold/aarch64.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/binutils-2.25/gold/aarch64.cc b/binutils-2.25/gold/aarch64.cc
index 1148bf7f..1cc68d1e 100644
--- a/binutils-2.25/gold/aarch64.cc
+++ b/binutils-2.25/gold/aarch64.cc
@@ -6907,16 +6907,41 @@ Target_aarch64<size, big_endian>::Relocate::relocate(
break;
case elfcpp::R_AARCH64_ABS64:
+ if (!parameters->options().apply_dynamic_relocs()
+ && parameters->options().output_is_position_independent()
+ && gsym != NULL
+ && gsym->needs_dynamic_reloc(reloc_property->reference_flags())
+ && !gsym->can_use_relative_reloc(false))
+ // We have generated an absolute dynamic relocation, so do not
+ // apply the relocation statically. (Works around bugs in older
+ // Android dynamic linkers.)
+ break;
reloc_status = Reloc::template rela_ua<64>(
view, object, psymval, addend, reloc_property);
break;
case elfcpp::R_AARCH64_ABS32:
+ if (!parameters->options().apply_dynamic_relocs()
+ && parameters->options().output_is_position_independent()
+ && gsym != NULL
+ && gsym->needs_dynamic_reloc(reloc_property->reference_flags()))
+ // We have generated an absolute dynamic relocation, so do not
+ // apply the relocation statically. (Works around bugs in older
+ // Android dynamic linkers.)
+ break;
reloc_status = Reloc::template rela_ua<32>(
view, object, psymval, addend, reloc_property);
break;
case elfcpp::R_AARCH64_ABS16:
+ if (!parameters->options().apply_dynamic_relocs()
+ && parameters->options().output_is_position_independent()
+ && gsym != NULL
+ && gsym->needs_dynamic_reloc(reloc_property->reference_flags()))
+ // We have generated an absolute dynamic relocation, so do not
+ // apply the relocation statically. (Works around bugs in older
+ // Android dynamic linkers.)
+ break;
reloc_status = Reloc::template rela_ua<16>(
view, object, psymval, addend, reloc_property);
break;