diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-05-10 03:25:17 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-05-10 03:25:17 +0000 |
commit | 8cf0d2dd210b73dff4a2d63d60c49e42b86565a7 (patch) | |
tree | c73a06cc9dcf7ab583730ab2273ced526febf4cd /gas/config/tc-i386.c | |
parent | 968bf8f19d1668f5ad2b6cd6c7c251e72ed09756 (diff) | |
download | fsf-binutils-gdb-8cf0d2dd210b73dff4a2d63d60c49e42b86565a7.zip fsf-binutils-gdb-8cf0d2dd210b73dff4a2d63d60c49e42b86565a7.tar.gz fsf-binutils-gdb-8cf0d2dd210b73dff4a2d63d60c49e42b86565a7.tar.bz2 |
Check 64-bit relocation addend overflow for x32
bfd/
* elf64-x86-64.c (elf_x86_64_relocate_section): Check addend
overflow for R_X86_64_RELATIVE64.
gas/
* config/tc-i386.c (tc_gen_reloc): Check x32 addend overflow
for BFD_RELOC_64.
gas/testsuite/
* 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.
ld/testsuite/
* ld-x86-64/ilp32-11.d: New file.
* ld-x86-64/ilp32-11.s: Likewise.
* ld-x86-64/x86-64.exp: Run ilp32-11.
Diffstat (limited to 'gas/config/tc-i386.c')
-rw-r--r-- | gas/config/tc-i386.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index ccf54bc..06f9764 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -9173,6 +9173,17 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp) 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: |