diff --git a/gold/aarch64.cc b/gold/aarch64.cc index 5ad061b..6cd6f12 100644 --- a/gold/aarch64.cc +++ b/gold/aarch64.cc @@ -1325,14 +1325,16 @@ Reloc_stub::stub_type_for_reloc( return ST_NONE; 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; } // A class to hold stubs for the ARM target.