aboutsummaryrefslogtreecommitdiff
path: root/gold/aarch64.cc
diff options
context:
space:
mode:
authorHan Shen <shenhan@google.com>2016-01-15 09:31:23 -0800
committerHan Shen <shenhan@google.com>2016-01-15 17:10:04 -0800
commit9a472eda40ba686e45bf4922455518ffa3c887e1 (patch)
treede830cbe1ddd44e463e8f23b5335db2d0c3e37ce /gold/aarch64.cc
parentf516a4c20854bacb878c9c89dd95e4673c28494c (diff)
downloadgdb-9a472eda40ba686e45bf4922455518ffa3c887e1.zip
gdb-9a472eda40ba686e45bf4922455518ffa3c887e1.tar.gz
gdb-9a472eda40ba686e45bf4922455518ffa3c887e1.tar.bz2
[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.
Diffstat (limited to 'gold/aarch64.cc')
-rw-r--r--gold/aarch64.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/gold/aarch64.cc b/gold/aarch64.cc
index 5ad061b..6cd6f12 100644
--- a/gold/aarch64.cc
+++ b/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;
}