aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Khmelevsky <och95@yandex.ru>2022-11-10 16:46:23 -0800
committerCary Coutant <ccoutant@gmail.com>2022-11-10 16:49:05 -0800
commitcde010e1a866e67b7e895cbcb95dedd3de0a1e56 (patch)
treefe5aea8afbca9835420b73967892c355c228919c
parenta686428a8bb4cc6a32a976e36f1ec59aa5a9f58e (diff)
downloadgdb-cde010e1a866e67b7e895cbcb95dedd3de0a1e56.zip
gdb-cde010e1a866e67b7e895cbcb95dedd3de0a1e56.tar.gz
gdb-cde010e1a866e67b7e895cbcb95dedd3de0a1e56.tar.bz2
Fix adrp distance check
gold/ * aarch64.cc (aarch64_valid_for_adrp_p): Shift offset as a signed number.
-rw-r--r--gold/aarch64.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gold/aarch64.cc b/gold/aarch64.cc
index d1f5c32..c5aa2c7 100644
--- a/gold/aarch64.cc
+++ b/gold/aarch64.cc
@@ -1182,7 +1182,8 @@ class Reloc_stub : public Stub_base<size, big_endian>
aarch64_valid_for_adrp_p(AArch64_address location, AArch64_address dest)
{
typedef AArch64_relocate_functions<size, big_endian> Reloc;
- int64_t adrp_imm = (Reloc::Page(dest) - Reloc::Page(location)) >> 12;
+ int64_t adrp_imm = Reloc::Page (dest) - Reloc::Page (location);
+ adrp_imm = adrp_imm < 0 ? ~(~adrp_imm >> 12) : adrp_imm >> 12;
return adrp_imm >= MIN_ADRP_IMM && adrp_imm <= MAX_ADRP_IMM;
}