return;
}
+#if defined(BFD64) && ARCH_SIZE == 32
+ if (rela_hdr->sh_type == SHT_RELA
+ && ptr->howto->bitsize > 32
+ && ptr->addend - INT32_MIN > UINT32_MAX)
+ {
+ _bfd_error_handler (_("%pB: %pA+%"BFD_VMA_FMT"x: "
+ "relocation addend %"BFD_VMA_FMT"x too large"),
+ abfd, sec, ptr->address, ptr->addend);
+ *failedp = true;
+ bfd_set_error (bfd_error_bad_value);
+ }
+#endif
+
src_rela.r_offset = ptr->address + addr_offset;
src_rela.r_info = ELF_R_INFO (n, ptr->howto->type);
src_rela.r_addend = ptr->addend;
}
run_list_test "reloc64" "--defsym _bad_=1"
+ run_list_test "reloc-2"
set ASFLAGS "$old_ASFLAGS"
}
--- /dev/null
+.*: \.text\+2:.*addend.*too large.*
+.*: \.text\+b:.*addend.*too large.*
+.*: Assembler messages:
+.*: Fatal error: .*
--- /dev/null
+ .text
+_start:
+ movabs $x+0x123456789, %rax
+ movabs x+0x123456789, %eax
+
+ .data
+ .quad x+0x123456789
.*[ ]+R_X86_64_TPOFF32[ ]+xtrn
.*[ ]+R_X86_64_TPOFF32[ ]+xtrn
.*[ ]+R_X86_64_TPOFF32[ ]+xtrn
-.*[ ]+R_X86_64_64[ ]+xtrn\+0x1
+.*[ ]+R_X86_64_64[ ]+xtrn\+0x7fffffff
+.*[ ]+R_X86_64_64[ ]+xtrn\-0x80000000
Disassembly of section \.data:
#...
.*[ ]+R_X86_64_32[ ]+xtrn
.*:175: Error: .*
.*:176: Error: .*
.*:177: Error: .*
-.*:189: Error: .*
-.*:192: Error: .* too large for field of 4 bytes at .*
+.*:190: Error: .*
.*:193: Error: .* too large for field of 4 bytes at .*
.*:194: Error: .* too large for field of 4 bytes at .*
.*:195: Error: .* too large for field of 4 bytes at .*
-.*:196: Error: .* too large for field of 2 bytes at .*
-.*:196: Error: .* too large for field of 1 byte at .*
+.*:196: Error: .* too large for field of 4 bytes at .*
.*:197: Error: .* too large for field of 2 bytes at .*
.*:197: Error: .* too large for field of 1 byte at .*
-.*:200: Error: .* too large for field of 4 bytes at .*
-.*:201: Error: .* too large for field of 2 bytes at .*
+.*:198: Error: .* too large for field of 2 bytes at .*
+.*:198: Error: .* too large for field of 1 byte at .*
+.*:201: Error: .* too large for field of 4 bytes at .*
.*:202: Error: .* too large for field of 2 bytes at .*
-.*:203: Error: .* too large for field of 1 byte at .*
+.*:203: Error: .* too large for field of 2 bytes at .*
.*:204: Error: .* too large for field of 1 byte at .*
+.*:205: Error: .* too large for field of 1 byte at .*
.text
mov xtrn@tpoff (%rbx), %eax
- movabsq $xtrn - 4294967295, %rbp
+ movabsq $xtrn + 0x7fffffff, %rbx
+ movabsq $xtrn - 0x80000000, %rbp
.data
.quad xtrn