summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHan Shen <shenhan@google.com>2016-01-21 00:36:53 (GMT)
committerHan Shen <shenhan@google.com>2016-01-21 00:36:53 (GMT)
commitc327c9c1bcffd231fcaa05f3fd8c047d1fe0afcc (patch)
tree65aa8ce1c362a4bb9177d23bfcab6114300de20d
parent6579e31a8757a1df50ca408dd1b3cd3fe59bb4b6 (diff)
downloadtoolchain_binutils-c327c9c1bcffd231fcaa05f3fd8c047d1fe0afcc.zip
toolchain_binutils-c327c9c1bcffd231fcaa05f3fd8c047d1fe0afcc.tar.gz
toolchain_binutils-c327c9c1bcffd231fcaa05f3fd8c047d1fe0afcc.tar.bz2
Backport trunk patch wrt wrong stub generated for aarch64 large DSOs.
Tested by build.py for linux aarch64 toolchains. The upstream patch is: commit 9a472eda40ba686e45bf4922455518ffa3c887e1 Author: Han Shen <shenhan@google.com> Date: Fri Jan 15 09:31:23 2016 -0800 [gold][aarch64] PR gold/19472 - DSOs need pc-relative stubs. The stub generated during relaxation uses absolute addressing mode for shared libraries, which is not correct. Use pc-relative addressing instead. gold/ChangeLog: 2016-01-15 Han Shen <shenhan@google.com> PR gold/19472 - DSOs need pc-relative stubs. * aarch64.cc (Reloc_stub::stub_type_for_reloc): Return PC-relative stub type for DSOs and pie executables. Change-Id: Id0022975cf93600117ff5bf300b9d736d6ad1f80
-rw-r--r--binutils-2.25/gold/ChangeLog7
-rw-r--r--binutils-2.25/gold/aarch64.cc6
2 files changed, 11 insertions, 2 deletions
diff --git a/binutils-2.25/gold/ChangeLog b/binutils-2.25/gold/ChangeLog
index bf9cc55..2ba3b2b 100644
--- a/binutils-2.25/gold/ChangeLog
+++ b/binutils-2.25/gold/ChangeLog
@@ -1,3 +1,10 @@
+2016-01-15 Han Shen <shenhan@google.com>
+
+ PR gold/19472 - need pc-relative stubs.
+
+ * aarch64.cc (Reloc_stub::stub_type_for_reloc): Return PC-relative
+ stub type for DSOs and pie executables.
+
2015-11-05 Cary Coutant <ccoutant@gmail.com>
PR gold/19163
diff --git a/binutils-2.25/gold/aarch64.cc b/binutils-2.25/gold/aarch64.cc
index 1cc68d1..445f324 100644
--- a/binutils-2.25/gold/aarch64.cc
+++ b/binutils-2.25/gold/aarch64.cc
@@ -1327,10 +1327,12 @@ Reloc_stub<size, big_endian>::stub_type_for_reloc(
if (aarch64_valid_for_adrp_p(location, dest))
return ST_ADRP_BRANCH;
- if (parameters->options().output_is_position_independent()
- && parameters->options().output_is_executable())
+ // Always use PC-relative addressing in case of -shared or -pie.
+ if (parameters->options().output_is_position_independent())
return ST_LONG_BRANCH_PCREL;
+ // This saves 2 insns per stub, compared to ST_LONG_BRANCH_PCREL.
+ // But is only applicable to non-shared or non-pie.
return ST_LONG_BRANCH_ABS;
}