+2012-05-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (elf_x86_64_relocate_section): Check addend
+ overflow for R_X86_64_RELATIVE64.
+
2012-05-08 Ben Cheng <bccheng@google.com>
* bfd/elf.c: Preserve the original p_align and p_flags if they are
outrel.r_info = htab->r_info (0,
R_X86_64_RELATIVE64);
outrel.r_addend = relocation + rel->r_addend;
+ /* Check addend overflow. */
+ if ((outrel.r_addend & 0x80000000)
+ != (rel->r_addend & 0x80000000))
+ {
+ const char *name;
+ if (h && h->root.root.string)
+ name = h->root.root.string;
+ else
+ name = bfd_elf_sym_name (input_bfd, symtab_hdr,
+ sym, NULL);
+ (*_bfd_error_handler)
+ (_("%B: addend %ld in relocation %s against "
+ "symbol `%s' at 0x%lx in section `%A' is "
+ "out of range"),
+ input_bfd, input_section,
+ (long) rel->r_addend,
+ x86_64_elf_howto_table[r_type].name,
+ name, (unsigned long) rel->r_offset);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
}
else
{
+2012-05-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/tc-i386.c (tc_gen_reloc): Check x32 addend overflow
+ for BFD_RELOC_64.
+
2012-05-08 Alan Modra <amodra@gmail.com>
* Makefile.am (check_DEJAGNU): Export LC_ALL=C in place of other
if (disallow_64bit_reloc)
switch (code)
{
+ case BFD_RELOC_64:
+ /* Check addend overflow. */
+ if ((long long) fixp->fx_offset > 0x7fffffffLL
+ || (long long) fixp->fx_offset < -0x80000000LL)
+ {
+ as_bad_where (fixp->fx_file, fixp->fx_line,
+ _("cannot represent relocation %s with addend %lld in x32 mode"),
+ bfd_get_reloc_code_name (code),
+ (long long) fixp->fx_offset);
+ }
+ break;
case BFD_RELOC_X86_64_DTPOFF64:
case BFD_RELOC_X86_64_TPOFF64:
case BFD_RELOC_64_PCREL:
+2012-05-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gas/i386/ilp32/ilp32.exp: Run reloc64-inval.
+
+ * gas/i386/ilp32/reloc64.s: Add tests for ".quad".
+ * gas/i386/ilp32/reloc64.d: Updated.
+
+ * gas/i386/ilp32/reloc64-inval.l: New file.
+ * gas/i386/ilp32/reloc64-inval.s: Likewise.
+
2012-05-08 Alan Modra <amodra@gmail.com>
* lib/gas-defs.exp (run_dump_test): Don't set LC_ALL here.
}
run_list_test "reloc64" "--defsym _bad_=1"
+ run_list_test "reloc64-inval"
set ASFLAGS "$old_ASFLAGS"
}
--- /dev/null
+.*: Assembler messages:
+.*:2: Error: .*
+.*:3: Error: .*
--- /dev/null
+ .data
+ .quad xtrn + 0x80000000
+ .quad xtrn - 0x80000001
.*[ ]+R_X86_64_PC16[ ]+xtrn
.*[ ]+R_X86_64_8[ ]+xtrn
.*[ ]+R_X86_64_PC8[ ]+xtrn
+.*[ ]+R_X86_64_64[ ]+xtrn
+.*[ ]+R_X86_64_64[ ]+xtrn\+0x7fffffff
+.*[ ]+R_X86_64_64[ ]+xtrn\+0x80000000
.text
mov xtrn@tpoff (%rbx), %eax
+
+ .data
+ .quad xtrn
+ .quad xtrn + 0x7fffffff
+ .quad xtrn - 0x80000000
+2012-05-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-x86-64/ilp32-11.d: New file.
+ * ld-x86-64/ilp32-11.s: Likewise.
+
+ * ld-x86-64/x86-64.exp: Run ilp32-11.
+
2012-05-05 H.J. Lu <hongjiu.lu@intel.com>
PR ld/14052
--- /dev/null
+#as: --x32
+#ld: -shared -melf32_x86_64
+#error: .*addend 2147483647 in relocation R_X86_64_64 against symbol `.text' at 0x0 in section `.data.rel.local' is out of range
--- /dev/null
+ .section .data.rel.local,"aw",@progbits
+ .align 8
+.Ljmp:
+ .quad func + 0x7fffffff
+
+ .text
+ .type func, @function
+func:
+ ret
run_dump_test "ilp32-8"
run_dump_test "ilp32-9"
run_dump_test "ilp32-10"
+run_dump_test "ilp32-11"
run_dump_test "ia32-1"
run_dump_test "ia32-2"
run_dump_test "ia32-3"