[gold][aarch64] PR gold/19472 - DSOs need pc-relative stubs.
authorHan Shen <shenhan@google.com>
Fri, 15 Jan 2016 17:31:23 +0000 (09:31 -0800)
committerHan Shen <shenhan@google.com>
Sat, 16 Jan 2016 01:10:04 +0000 (17:10 -0800)
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.

gold/ChangeLog
gold/aarch64.cc

index 3560e2f8afc4a9c4bc20be680cc8f3d63c2fcbaa..06cafb05a5a2d1218527cf45ebc8f95cc2338aab 100644 (file)
@@ -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.
+
 2016-01-12  H.J. Lu  <hongjiu.lu@intel.com>
 
        * i386.cc (Target_i386::Classify_reloc::get_r_addend): Remove
index 5ad061b8979e3528346bc91c38bb5bbdd7240ada..6cd6f12abb1f2ceef4fca956b38dc81f39b6b210 100644 (file)
@@ -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;
 }
 
This page took 0.028781 seconds and 4 git commands to generate.