diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 86ab4cb5e013..15165cd4669d 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -3982,7 +3982,7 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, rtx sym, off; split_const (imm, &sym, &off); /* Negative offsets don't work, whether by intention is TBD. */ - if (INTVAL (off) < 0) + if (INTVAL (off) < 0 || INTVAL (off) > 8 * 1024 * 1024) { emit_move_insn (tmp_reg, gen_rtx_HIGH (mode, sym)); emit_insn (gen_add_losym (dest, tmp_reg, sym)); @@ -3990,7 +3990,7 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, emit_insn (gen_adddi3 (dest, dest, off)); return; } - /* else positive offset is OK. */ + /* else small enough positive offset is OK. */ } emit_move_insn (tmp_reg, gen_rtx_HIGH (mode, imm)); emit_insn (gen_add_losym (dest, tmp_reg, imm));