diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2011-08-01 23:04:23 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2011-08-01 23:04:23 +0000 |
commit | d7921315bafbc6419613771c6ad075e3cf160a0e (patch) | |
tree | 6584835bb8a8d456e85f2b491657a2934aa16032 /gas/config/tc-i386.c | |
parent | c3f7b0e5a192ae55613bed418690637a3ebbc2c5 (diff) | |
download | gdb-d7921315bafbc6419613771c6ad075e3cf160a0e.zip gdb-d7921315bafbc6419613771c6ad075e3cf160a0e.tar.gz gdb-d7921315bafbc6419613771c6ad075e3cf160a0e.tar.bz2 |
Check R_X86_64_32 overflow and allow R_X86_64_64 for x32.
bfd/
2011-08-01 H.J. Lu <hongjiu.lu@intel.com>
PR ld/13048
* archures.c (bfd_mach_i386_intel_syntax): New.
(bfd_mach_i386_i8086): Updated.
(bfd_mach_i386_i386): Likewise.
(bfd_mach_x86_64): Likewise.
(bfd_mach_x64_32): Likewise.
(bfd_mach_i386_i386_intel_syntax): Likewise.
(bfd_mach_x86_64_intel_syntax): Likewise.
(bfd_mach_x64_32_intel_syntax): Likewise.
(bfd_mach_l1om): Likewise.
(bfd_mach_l1om_intel_syntax): Likewise.
(bfd_mach_k1om): Likewise.
(bfd_mach_k1om_intel_syntax): Likewise.
* bfd-in2.h: Regenerated.
* cpu-i386.c (bfd_i386_compatible): Check mach instead of
bits_per_address.
(bfd_x64_32_arch_intel_syntax): Set bits_per_address to 64.
(bfd_x64_32_arch): Likewise.
* elf64-x86-64.c: Include "libiberty.h".
(x86_64_elf_howto_table): Append x32 R_X86_64_32.
(elf_x86_64_rtype_to_howto): Support x32 R_X86_64_32.
(elf_x86_64_reloc_type_lookup): Likewise.
(elf_x86_64_reloc_name_lookup): Likewise.
(elf_x86_64_relocate_section): Likewise.
(elf_x86_64_check_relocs): Allow R_X86_64_64 relocations for x32.
gas/
2011-08-01 H.J. Lu <hongjiu.lu@intel.com>
PR ld/13048
* config/tc-i386.c (handle_quad): Removed.
(md_pseudo_table): Remove "quad".
(tc_gen_reloc): Don't check BFD_RELOC_64 for disallow_64bit_reloc.
(x86_dwarf2_addr_size): New.
* config/tc-i386.h (x86_dwarf2_addr_size): New.
(DWARF2_ADDR_SIZE): Likewise.
gas/testsuite/
2011-08-01 H.J. Lu <hongjiu.lu@intel.com>
PR ld/13048
* gas/i386/ilp32/ilp32.exp: Don't run inval.
* gas/i386/ilp32/inval.l: Removed.
* gas/i386/ilp32/inval.s: Likewise.
* gas/i386/ilp32/quad.d: Expect R_X86_64_64 instead of
R_X86_64_32.
* gas/i386/ilp32/x86-64-pcrel.s: Add tests for movabs.
* gas/i386/ilp32/x86-64-pcrel.d: Updated.
ld/testsuite/
2011-08-01 H.J. Lu <hongjiu.lu@intel.com>
PR ld/13048
* ld-x86-64/ilp32-6.d: New.
* ld-x86-64/ilp32-6.s: Likewise.
* ld-x86-64/ilp32-7.d: Likewise.
* ld-x86-64/ilp32-7.s: Likewise.
* ld-x86-64/ilp32-8.d: Likewise.
* ld-x86-64/ilp32-8.s: Likewise.
* ld-x86-64/ilp32-9.d: Likewise.
* ld-x86-64/ilp32-9.s: Likewise.
* ld-x86-64/x86-64.exp: Run ilp32-6, ilp32-7, ilp32-8 and ilp32-9.
opcodes/
2011-08-01 H.J. Lu <hongjiu.lu@intel.com>
PR ld/13048
* i386-dis.c (print_insn): Optimize info->mach check.
Diffstat (limited to 'gas/config/tc-i386.c')
-rw-r--r-- | gas/config/tc-i386.c | 59 |
1 files changed, 10 insertions, 49 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 1159572..59182bb 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -182,7 +182,6 @@ static void s_bss (int); #endif #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) static void handle_large_common (int small ATTRIBUTE_UNUSED); -static void handle_quad (int); #endif static const char *default_arch = DEFAULT_ARCH; @@ -828,7 +827,6 @@ const pseudo_typeS md_pseudo_table[] = {"sse_check", set_sse_check, 0}, #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) {"largecomm", handle_large_common, 0}, - {"quad", handle_quad, 8}, #else {"file", (void (*) (int)) dwarf2_directive_file, 0}, {"loc", dwarf2_directive_loc, 0}, @@ -9059,7 +9057,6 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp) if (disallow_64bit_reloc) switch (code) { - case BFD_RELOC_64: case BFD_RELOC_X86_64_DTPOFF64: case BFD_RELOC_X86_64_TPOFF64: case BFD_RELOC_64_PCREL: @@ -9169,6 +9166,16 @@ tc_x86_frame_initial_instructions (void) } int +x86_dwarf2_addr_size (void) +{ +#if defined (OBJ_MAYBE_ELF) || defined (OBJ_ELF) + if (x86_elf_abi == X86_64_X32_ABI) + return 4; +#endif + return bfd_arch_bits_per_address (stdoutput) / 8; +} + +int i386_elf_section_type (const char *str, size_t len) { if (flag_code == CODE_64BIT @@ -9267,50 +9274,4 @@ handle_large_common (int small ATTRIBUTE_UNUSED) bss_section = saved_bss_section; } } - -static void -handle_quad (int nbytes) -{ - expressionS exp; - - if (x86_elf_abi != X86_64_X32_ABI) - { - cons (nbytes); - return; - } - - if (is_it_end_of_statement ()) - { - demand_empty_rest_of_line (); - return; - } - - do - { - if (*input_line_pointer == '"') - { - as_bad (_("unexpected `\"' in expression")); - ignore_rest_of_line (); - return; - } - x86_cons (&exp, nbytes); - /* Output 4 bytes if not constant. */ - if (exp.X_op != O_constant) - nbytes = 4; - emit_expr (&exp, (unsigned int) nbytes); - /* Zero-extends to 8 bytes if not constant. */ - if (nbytes == 4) - { - memset (&exp, '\0', sizeof (exp)); - exp.X_op = O_constant; - emit_expr (&exp, nbytes); - } - nbytes = 8; - } - while (*input_line_pointer++ == ','); - - input_line_pointer--; /* Put terminator back into stream. */ - - demand_empty_rest_of_line (); -} #endif /* OBJ_ELF || OBJ_MAYBE_ELF */ |