aboutsummaryrefslogtreecommitdiff
path: root/gas
AgeCommit message (Collapse)AuthorFilesLines
2016-06-01ns32k: remove dupplicate definition of input_line_pointerTrevor Saunders2-1/+4
gas/ChangeLog: 2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-ns32k.c: Remove definition of input_line_pointer.
2016-06-01avr: replace sentinal with iteration from 0 to ARRAY_SIZETrevor Saunders2-4/+8
This seems a little easier to understand than using a sentinal, and will hopefully let the compiler optimize the loop better. It also has the effect that we stop initializing a field of the sentinal that is an enum with zero. gas/ChangeLog: 2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-avr.c (avr_parse_cons_expression): Replace iteration to sentinal with iteration to array size.
2016-06-01xtensa: typedef enums when defining themTrevor Saunders2-10/+11
I think this is the more typical way to do this. Its also slightly shorter and less repeditive. gas/ChangeLog: 2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/xtensa-relax.h: Move typedefs of enums to the enums definition.
2016-06-01ns32k: use XOBNEW in another spotTrevor Saunders2-1/+6
gas/ChangeLog: 2016-06-01 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-ns32k.c (bit_fix_new): Replace obstack-alloc with XOBNEW macro.
2016-06-01Add support for some variants of the ARC nps400 rflt instruction.Graham Markall3-50/+62
gas * testsuite/gas/arc/nps-400-1.s: Add rflt variants with operands of types a,b,u6, 0,b,u6, and 0,b,limm. * testsuite/gas/arc/nps-400-1.d: Likewise. opcodes * arc-nps400-tbl.h: Add operands a,b,u6, 0,b,u6, and 0,b,limm to the rflt instruction.
2016-05-29Add missing ChangeLog entriesH.J. Lu1-0/+15
2016-05-29Add .noavx512XX directives to x86 assemblerH.J. Lu7-0/+801
Add .noavx512f, .noavx512cd, .noavx512er, .noavx512pf, .noavx512dq, .noavx512bw, .noavx512vl, .noavx512ifma, .noavx512vbmi directives to x86 assembler. gas/ PR gas/20145 * config/tc-i386.c (cpu_noarch): Add noavx512f, noavx512cd, noavx512er, noavx512pf, noavx512dq, noavx512bw, noavx512vl, noavx512ifma and noavx512vbmi. * doc/c-i386.texi: Mention noavx512f, noavx512cd, noavx512er, noavx512pf, noavx512dq, noavx512bw, noavx512vl, noavx512ifma and noavx512vbmi. * testsuite/gas/i386/i386.exp: Run noavx512-1 and noavx512-2. * testsuite/gas/i386/noavx512-1.l: New file. * testsuite/gas/i386/noavx512-1.s: Likewise. * testsuite/gas/i386/noavx512-2.l: Likewise. * testsuite/gas/i386/noavx512-2.s: Likewise. opcodes/ PR gas/20145 * i386-gen.c (cpu_flag_init): Add CPU_ANY_AVX512F_FLAGS, CPU_ANY_AVX512CD_FLAGS, CPU_ANY_AVX512ER_FLAGS, CPU_ANY_AVX512PF_FLAGS, CPU_ANY_AVX512DQ_FLAGS, CPU_ANY_AVX512BW_FLAGS, CPU_ANY_AVX512VL_FLAGS, CPU_ANY_AVX512IFMA_FLAGS and CPU_ANY_AVX512VBMI_FLAGS. * i386-init.h: Regenerated.
2016-05-27Update x86 CPU_XXX_FLAGS handlingH.J. Lu17-10/+482
Support defining CPU_XXX_FLAGS with other CPU_XXX_FLAGS. Update CPU_XXX_FLAGS to enable more bits like x87 and SYSCALL. Don't enable MMX when enabling SSE, AVX or AVX512. Don't disable AVX nor AVX512 when disabling SSE. Don't disable AVX512 when disabling AVX. Disable F16C, FMA, FMA4 and XOP when disabling AVX. Add 87, no287, no387, no687, nosse2, nosse3, nossse3, nosse4.1, nosse4.2, nosse4 and noavx2 directives to x86 assembler. TODO: Add more .noXXX, like .noavx512f, directives to x86 assembler. gas/ PR gas/20145 * config/tc-i386.c (cpu_arch): Add 687. (cpu_noarch): Add no287, no387, no687, nosse2, nosse3, nossse3, nosse4.1, nosse4.2, nosse4 and noavx2. (parse_real_register): Check cpuregmmx instead of cpummx for MMX register. Check cpuregxmm instead of cpusse for XMM register. Check cpuregymm instead of cpuavx for YMM register. Check cpuregzmm/cpuregmask instead of cpuavx512f for ZMMM/mask register. * doc/c-i386.texi: Mention 687, no287, no387, no687, nosse2, nosse3, nossse3, nosse4.1, nosse4.2, nosse4 and noavx2. * testsuite/gas/i386/arch-10-prefetchw.d (as): Add mmx. * testsuite/gas/i386/arch-10.d (as): Likewise. * testsuite/gas/i386/arch-11.s: Add ".arch .mmx". * testsuite/gas/i386/i386.exp: Pass mmx to assembler for arch-10-3 and arch-10-4. Run no87-3, nosse-4, nosse-5, noavx-3 and noavx-4. * testsuite/gas/i386/no87-3.l: New file. * testsuite/gas/i386/no87-3.s: Likewise. * testsuite/gas/i386/noavx-3.l: Likewise. * testsuite/gas/i386/noavx-3.s: Likewise. * testsuite/gas/i386/noavx-4.d: Likewise. * testsuite/gas/i386/noavx-4.s: Likewise. * testsuite/gas/i386/nosse-4.l: Likewise. * testsuite/gas/i386/nosse-4.s: Likewise. * testsuite/gas/i386/nosse-5.d: Likewise. * testsuite/gas/i386/nosse-5.s: Likewise. opcodes/ PR gas/20145 * i386-gen.c (cpu_flag_init): Update CPU_XXX_FLAGS. Remove CpuMMX from CPU_SSE_FLAGS. Remove AVX and AVX512 bits from CPU_ANY_SSE_FLAGS. Remove AVX512 bits from CPU_ANY_AVX_FLAGS. Add CPU_XSAVE_FLAGS to CPU_XSAVEOPT_FLAGS, CPU_XSAVE_FLAGS and CpuXSAVEC. Add CPU_AVX_FLAGS to CpuF16C. Remove CpuMMX from CPU_AVX512F_FLAGS, CPU_AVX512CD_FLAGS, CPU_AVX512ER_FLAGS, CPU_AVX512PF_FLAGS, CPU_AVX512DQ_FLAGS and CPU_AVX512BW_FLAGS. Add CPU_SSE2_FLAGS to CPU_SHA_FLAGS. Add CPU_ANY_287_FLAGS, CPU_ANY_387_FLAGS, CPU_ANY_687_FLAGS, CPU_ANY_SSE2_FLAGS, CPU_ANY_SSE3_FLAGS, CPU_ANY_SSSE3_FLAGS, CPU_ANY_SSE4_1_FLAGS, CPU_ANY_SSE4_2_FLAGS and CPU_ANY_AVX2_FLAGS. Enable CpuRegMMX for MMX. Enable CpuRegXMM for SSE, AVX and AVX512. Enable CpuRegYMM for AVX and AVX512VL, Enable CpuRegZMM and CpuRegMask for AVX512. (cpu_flags): Add CpuRegMMX, CpuRegXMM, CpuRegYMM, CpuRegZMM and CpuRegMask. (set_bitfield_from_cpu_flag_init): New function. (set_bitfield): Remove const on f. Call set_bitfield_from_cpu_flag_init to handle CPU_XXX_FLAGS. * i386-opc.h (CpuRegMMX): New. (CpuRegXMM): Likewise. (CpuRegYMM): Likewise. (CpuRegZMM): Likewise. (CpuRegMask): Likewise. (i386_cpu_flags): Add cpuregmmx, cpuregxmm, cpuregymm, cpuregzmm and cpuregmask. * i386-init.h: Regenerated. * i386-tbl.h: Likewise.
2016-05-27Replace CpuAMD64/CpuIntel64 with AMD64/Intel64H.J. Lu2-7/+11
AMD64 vs CpuIntel64 ISA should be handled similar as AT&T vs Intel syntax. Since cpu_flags isn't sorted by position, we need to check the whole cpu_flags array for the maximum position when verifying CpuMax. gas/ PR gas/20154 * config/tc-i386.c (cpu_flags_match): Don't set cpuamd64 nor cpuintel64. (match_template): Check Intel64/AMD64 ISA. opcodes/ PR gas/20154 * i386-gen.c (cpu_flags): Remove CpuAMD64 and CpuIntel64. (opcode_modifiers): Add AMD64 and Intel64. (main): Properly verify CpuMax. * i386-opc.h (CpuAMD64): Removed. (CpuIntel64): Likewise. (CpuMax): Set to CpuNo64. (i386_cpu_flags): Remove cpuamd64 and cpuintel64. (AMD64): New. (Intel64): Likewise. (i386_opcode_modifier): Add amd64 and intel64. (i386-opc.tbl): Replace CpuAMD64/CpuIntel64 with AMD64/Intel64 on call and jmp. * i386-init.h: Regenerated. * i386-tbl.h: Likewise.
2016-05-27Correct CpuMax in i386-opc.hH.J. Lu2-8/+19
CpuMax should be CpuIntel64, not CpuNo64. i386-gen.c is updated to verify that CpuMax is correct. X86 assembler is updated to properly set cpuamd64 and cpuintel64. gas/ PR gas/20154 * config/tc-i386.c (intel64): New. (cpu_flags_match): Set cpuamd64 and cpuintel64. (md_parse_option): Set intel64 instead of cpuamd64 and cpuintel64. opcodes/ PR gas/20154 * i386-gen.c (main): Fail if CpuMax is incorrect. * i386-opc.h (CpuMax): Set to CpuIntel64. * i386-tbl.h: Regenerated.
2016-05-27Don't clear cpu64 nor cpuno64H.J. Lu2-2/+5
No need to clear cpu64 nor cpuno64 since they will be cleared by cpu_flags_and. * config/tc-i386.c (cpu_flags_match): Don't clear cpu64 nor cpuno64.
2016-05-26Add support for new POWER ISA 3.0 instructions.Peter Bergner5-0/+27
opcodes/ * ppc-opc.c (CY): New define. Document it. (powerpc_opcodes) <addex[.], lwzmx, vmsumudm>: New mnemonics. gas/ * testsuite/gas/ppc/altivec3.d <vmsumudm>: Add test. * testsuite/gas/ppc/altivec3.s: Likewise. * testsuite/gas/ppc/power9.d <addex[.], lwzmx, vmsumudm>: Add tests. * testsuite/gas/ppc/power9.s: Likewise.
2016-05-26Append ".p2align 4" to some x86 directive testsH.J. Lu11-0/+23
Append ".p2align 4" to some x86 directive tests for explicit paddings for section alignment to avoid implicit section alignment in assembler listings. * testsuite/gas/i386/avx512vl-2.l: Append "#pass". * testsuite/gas/i386/noavx-1.l: Likewise. * testsuite/gas/i386/nommx-1.l: Likewise. * testsuite/gas/i386/nosse-1.l: Likewise. * testsuite/gas/i386/x86-64-avx512vl-2.l: Likewise. * testsuite/gas/i386/avx512vl-2.s: Append ".p2align 4". * testsuite/gas/i386/noavx-1.s: Likewise. * testsuite/gas/i386/nommx-1.s: Likewise. * testsuite/gas/i386/nosse-1.s: Likewise. * testsuite/gas/i386/x86-64-avx512vl-2.s: Likewise.
2016-05-26metag: make an array's type unsigned char[]Trevor Saunders2-1/+6
It contains values between 128 and 256 which fit in an unsigned char, but not a signed char, so we should explicitly use unsigned char to not rely on how these values are converted to signed char. gas/ChangeLog: 2016-05-26 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-metag.c (metag_handle_align): Make the type of noop unsigned char.
2016-05-26rx: make the type of a variable bfd_reloc_code_real_typeTrevor Saunders2-1/+9
gas/ChangeLog: 2016-05-26 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-rx.c (md_convert_frag): Make the type of reloc_type bfd_reloc_code_real_type.
2016-05-25Require another match for AVX512VLH.J. Lu11-0/+245
The AVX512VL bit alone isn't sufficient to select a 128-bit or 256-bit AVX512 instruction. We must match another AVX512 bit. PR gas/20140 * config/tc-i386.c (cpu_flags_match): Require another match for AVX512VL. * testsuite/gas/i386/i386.exp: Run avx512vl-1, avx512vl-2, x86-64-avx512vl-1 and x86-64-avx512vl-2. * testsuite/gas/i386/avx512vl-1.l: New file. * testsuite/gas/i386/avx512vl-1.s: Likewise. * testsuite/gas/i386/avx512vl-2.l: Likewise. * testsuite/gas/i386/avx512vl-2.s: Likewise. * testsuite/gas/i386/x86-64-avx512vl-1.l: Likewise. * testsuite/gas/i386/x86-64-avx512vl-1.s: Likewise. * testsuite/gas/i386/x86-64-avx512vl-2.l: Likewise. * testsuite/gas/i386/x86-64-avx512vl-2.s: Likewise.
2016-05-25Enable VREX for AVX512 directivesH.J. Lu4-0/+23
Enable VREX for AVX512 instructions with upper 16 vector registers. gas/ PR gas/20141 * testsuite/gas/i386/i386.exp: Run x86-64-pr20141. * testsuite/gas/i386/x86-64-pr20141.d: New file. * testsuite/gas/i386/x86-64-pr20141.s: Likewise. opcodes/ PR gas/20141 * i386-gen.c (cpu_flag_init): Add CpuVREX to CPU_AVX512F_FLAGS, CPU_AVX512CD_FLAGS, CPU_AVX512ER_FLAGS and CPU_AVX512PF_FLAGS. * i386-init.h: Regenerated.
2016-05-25Reimplement .no87/.nommx/.nosse/.noavx directivesH.J. Lu19-163/+418
Move all .noXXX directives to cpu_noarch. gas/ * config/tc-i386.c (arch_entry): Remove negated. (noarch_entry): New struct. (cpu_arch): Updated. Remove .no87, .nommx, .nosse and .noavx. (cpu_noarch): New. (set_cpu_arch): Check cpu_noarch after cpu_arch. (md_parse_option): Allow -march=+nosse. Check cpu_noarch after cpu_arch. (output_message): New function. (show_arch): Use it. Handle cpu_noarch. * testsuite/gas/i386/i386.exp: Run nommx-1, nommx-2, nommx-3, nosse-1, nosse-2, nosse-3, noavx-1 and noavx-2. * testsuite/gas/i386/noavx-1.l: New file. * testsuite/gas/i386/noavx-1.s: Likewise. * testsuite/gas/i386/noavx-2.s: Likewise. * testsuite/gas/i386/noavx-2.l: Likewise. * testsuite/gas/i386/nommx-1.s: Likewise. * testsuite/gas/i386/nommx-1.l: Likewise. * testsuite/gas/i386/nommx-2.s: Likewise. * testsuite/gas/i386/nommx-2.l: Likewise. * testsuite/gas/i386/nommx-3.s: Likewise. * testsuite/gas/i386/nommx-3.l: Likewise. * testsuite/gas/i386/nosse-1.s: Likewise. * testsuite/gas/i386/nosse-1.l: Likewise. * testsuite/gas/i386/nosse-2.s: Likewise. * testsuite/gas/i386/nosse-2.l: Likewise. * testsuite/gas/i386/nosse-3.s: Likewise. * testsuite/gas/i386/nosse-3.l: Likewise. opcodes/ * i386-gen.c (cpu_flag_init): Rename CPU_ANY87_FLAGS to CPU_ANY_X87_FLAGS. Add CPU_ANY_MMX_FLAGS. * i386-init.h: Regenerated.
2016-05-25Fix typo in changelog entryNick Clifton1-1/+1
2016-05-25Only generate VMOV.I64 instructions for loading constant floating point ↵Chua Zheng Leong4-3/+14
values if this instruction is supported by the currently selected fpu. PR target/2006764 * config/tc-arm.c (move_or_literal_pool): Only generate a VMOV.I64 instruction if supported by the currently selected fpu variant. * testsuite/gas/arm/vfpv3-ldr_immediate.s: Add test of this PR. * testsuite/gas/arm/vfpv3-ldr_immediate.d: Update expected disassembly.
2016-05-24MIPS/GAS: Treat local jump relocs the same no matter if REL or RELAMaciej W. Rozycki7-7/+147
Do not convert jump relocs against local MIPS16 or microMIPS symbols to refer to a section symbol instead even on RELA targets, as it makes it impossible for the linker to make a JAL to JALX conversion based on ISA symbol annotation, breaking regular and compressed MIPS interlinking. gas/ * config/tc-mips.c (mips_fix_adjustable): Also return 0 for jump relocations against MIPS16 or microMIPS symbols on RELA targets. * testsuite/gas/mips/jalx-local.d: New test. * testsuite/gas/mips/jalx-local-n32.d: New test. * testsuite/gas/mips/jalx-local-n64.d: New test. * testsuite/gas/mips/jalx-local.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests. ld/ * testsuite/ld-mips-elf/jalx-local.d: New test. * testsuite/ld-mips-elf/jalx-local-n32.d: New test. * testsuite/ld-mips-elf/jalx-local-n64.d: New test. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2016-05-24MIPS/GAS: Cut TLS reloc dead code path in `md_apply_fix'Maciej W. Rozycki2-8/+12
With code refactoring made in commit b886a2ab0d52 and the addition of `calculate_reloc' and a separate test for TLS relocs against constants made there the preexisting fall-through from the TLS reloc switch case has effectively become a dead execution path. This is because the call to `calculate_reloc' present there is only made if `fixP->fx_done' is true, which can only be the case if `fixP->fx_addsy' is NULL, which in turn has already triggered the TLS reloc test and made execution break out of the switch statement. Remove the fall-through then and reshape code accordingly. gas/ * config/tc-mips.c (md_apply_fix) <BFD_RELOC_MIPS16_TLS_TPREL_LO16>: Remove fall-through, adjust code accordingly.
2016-05-24xtensa: make map_suffix_reloc_to_operator return operatorTTrevor Saunders2-4/+10
It always returns an element of the enum operatorT, so it should be clearer to make that the return type. gas/ChangeLog: 2016-05-24 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-xtensa.c (struct suffix_reloc_map): Change type of field operator to operatorT. (map_suffix_reloc_to_operator): Change return type to operatorT.
2016-05-24d30v: make var type operatorTTrevor Saunders2-1/+5
gas/ChangeLog: 2016-05-24 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-d30v.c (find_format): Change type of X_op to operatorT.
2016-05-24mmix: constify handler_charpTrevor Saunders2-1/+6
gas/ChangeLog: 2016-05-24 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-mmix.c (mmix_parse_predefined_name): Change type of handler_charp to const char *.
2016-05-24ft32: fixup TARGET_FORMATTrevor Saunders2-3/+7
Nothing ever assigns to ft32_target_format, so its always null, which means the bfd target arch is the default one. It looks like ft32 only has one target format, so we can just define TARGET_FORMAT to be that literal string. gas/ChangeLog: 2016-05-24 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-ft32.h (DEFAULT_TARGET_FORMAT): Remove. (ft32_target_format): Likewise. (TARGET_FORMAT): Adjust.
2016-05-24ia64: use XOBNEW and XOBNEWVECTrevor Saunders2-4/+9
gas/ChangeLog: 2016-05-24 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-ia64.c (dot_rot): simplify allocations from obstacks. (ia64_frob_label): Likewise.
2016-05-24change some variable's type to op_errTrevor Saunders3-2/+7
They only hold values from the op_err enum, so it should be clearer to give them the enum type. gas/ChangeLog: 2016-05-24 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-cr16.c (check_range): Make type of retval op_err. * config/tc-crx.c: Likewise.
2016-05-23[ARC] Add XY registers, update neg instruction.Claudiu Zissulescu2-1/+32
gas/ 2016-05-23 Claudiu Zissulescu <claziss@synopsys.com> * config/tc-arc.c (md_begin): Add XY registers. (cpu_types): Code density is default off for ARC EM. opcodes/ 2016-05-23 Claudiu Zissulescu <claziss@synopsys.com> * arc-tbl.h (neg): New instruction variant.
2016-05-23[ARC] Rename "class" named attributes.Claudiu Zissulescu2-12/+18
gas/ 2016-05-23 Cupertino Miranda <cmiranda@synopsys.com> * config/tc-arc.c (attributes_t): Renamed attribute class to attr_class. (find_opcode_match, assemble_insn, tokenize_extinsn): Changed. opcode/ 2016-05-23 Cupertino Miranda <cmiranda@synopsys.com> * arc-dis.c (find_format, find_format, get_auxreg) (print_insn_arc): Changed. * arc-ext.h (INSERT_XOP): Likewise. include/ 2016-05-23 Cupertino Miranda <cmiranda@synopsys.com> * opcode/arc.h (struct arc_opcode): Renamed attribute class to insn_class. (struct arc_flag_class): Renamed attribute class to flag_class.
2016-05-23oops - omitted from previous deltaNick Clifton1-0/+4
2016-05-23Add support for configuring for the ARM Phoenix target.Kuba Sejdak1-0/+1
bfd * config.bfd: Add entry for arm-phoenix. gas * configuse.tgt: Add entry for arm-phoenix. ld * Makefile.am: Add earmelf_phoenix.c. * Makefile.in: Regenerate. * configure.tgt: Add entry for arm-phoenix. * emulparams/armelf_phoenix.sh: New file.
2016-05-23tic54x: use concat moreTrevor Saunders2-6/+9
gas/ChangeLog: 2016-05-23 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-tic54x.c (tic54x_sect): simplify string creation.
2016-05-23spu: make some constants unsignedTrevor Saunders2-1/+5
The field in spu_opcode is unsigned, and for some values of opcode we can end up shifting into the high bit. So avoid possibly creating a negative number and then assigning it to a unsigned field by shifting an unsigned constant. gas/ChangeLog: 2016-05-23 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-spu.c (APUOP): Use OPCODE as an unsigned constant.
2016-05-23tic54x: rename typedef of struct symbol_Trevor Saunders2-23/+34
generic gas code has a struct symbol, and tic54x typedefs a struct to symbol. This seems at least rather confusing, and it seems like target specific headers shouldn't put such generic names in the global namespace preventing other generic code from using them. opcodes/ChangeLog: 2016-05-23 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * tic54x-dis.c (sprint_mmr): Adjust. * tic54x-opc.c: Likewise. gas/ChangeLog: 2016-05-23 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-tic54x.c (tic54x_mmregs): Adjust. (md_begin): Likewise. (encode_condition): Likewise. (encode_cc3): Likewise. (encode_cc2): Likewise. (encode_operand): Likewise. (tic54x_undefined_symbol): Likewise. include/ChangeLog: 2016-05-23 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * opcode/tic54x.h (struct symbol_): typedef to tic54x_symbol instead of plain symbol.
2016-05-20MIPS: Add support for P6600Matthew Fortune3-1/+9
gas/ * config/tc-mips.c (mips_cpu_info_table): Update comment. Add p6600 entry. * doc/c-mips.texi: Document p6600 -march option.
2016-05-20Preserve addend for R_386_GOT32 and R_X86_64_GOT32H.J. Lu8-5/+64
We should preserve addend for R_386_GOT32 and R_X86_64_GOT32 as in "movl $foo@GOT + 4, %eax" and "movq $foo@GOT + 4, %rax". PR gas/19600 * config/tc-i386.c (md_apply_fix): Preserve addend for BFD_RELOC_386_GOT32 and BFD_RELOC_X86_64_GOT32. * testsuite/gas/i386/addend.d: New file. * testsuite/gas/i386/addend.s: Likewise. * testsuite/gas/i386/x86-64-addend.d: Likewise. * testsuite/gas/i386/x86-64-addend.s: Likewise. * testsuite/gas/i386/i386.exp: Run addend and x86-64-addend. * testsuite/gas/i386/reloc32.d: Updated.
2016-05-20MIPS: Fix the encoding of immediates with microMIPS JALXMaciej W. Rozycki11-1/+234
The microMIPS JALX instruction shares the R_MICROMIPS_26_S1 relocation with microMIPS J/JAL/JALS instructions, however unlike the latters its encoded immediate argument is unusually shifted left by 2 rather than 1 in calculating the value used for the operation requested. We already handle this exception in `mips_elf_calculate_relocation' in LD, in a scenario where JALX is produced as a result of relaxing JAL for the purpose of making a cross-mode jump. We also get it right in the disassembler in `decode_micromips_operand'. What we don't correctly do however is processing microMIPS JALX produced by GAS from an assembly source, where a non-zero constant argument or a symbol reference with a non-zero in-place addend has been used. In this case the same calculation is made as for microMIPS J/JAL/JALS, causing the wrong encoding to be produced by GAS on making an object file, and then again by LD in the final link. The latter in particular causes the calculation, where the addend fits in the relocatable field, to produce different final addresses for the same source code depending on whether REL or RELA relocations are used. Correct these issues by special-casing microMIPS JALX in the places that have been previously missed. bfd/ * elfxx-mips.c (mips_elf_read_rel_addend): Adjust the addend for microMIPS JALX. gas/ * config/tc-mips.c (append_insn): Correct the encoding of a constant argument for microMIPS JALX. (tc_gen_reloc): Correct the encoding of an in-place addend for microMIPS JALX. * testsuite/gas/mips/jalx-addend.d: New test. * testsuite/gas/mips/jalx-addend-n32.d: New test. * testsuite/gas/mips/jalx-addend-n64.d: New test. * testsuite/gas/mips/jalx-imm.d: New test. * testsuite/gas/mips/jalx-imm-n32.d: New test. * testsuite/gas/mips/jalx-imm-n64.d: New test. * testsuite/gas/mips/jalx-addend.s: New test source. * testsuite/gas/mips/jalx-imm.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests. ld/ * testsuite/ld-mips-elf/jalx-addend.d: New test. * testsuite/ld-mips-elf/jalx-addend-n32.d: New test. * testsuite/ld-mips-elf/jalx-addend-n64.d: New test. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2016-05-20MIPS/GAS: Correct tab-after-space formatting mistakesMaciej W. Rozycki2-11/+16
* config/tc-mips.c: Correct tab-after-space formatting mistakes throughout.
2016-05-18gas/arc: Make member of arc_flags constAndrew Burgess3-2/+8
By making the flgp field of struct arc_flags constant we can remove a place where we cast away the const-ness of a variable. Also, given that the value assigned to this field almost always comes from compile-time constant data, having the field non-constant is probably a bad thing. gas/ChangeLog: * config/tc-arc.c (find_opcode_match): Remove casting away of const. * config/tc-arc.h (struct arc_flags): Make flgp field const.
2016-05-18gas/arc: Use BFD_VMA_FMT for printf format specifierAndrew Burgess2-2/+10
Some debug code has the wrong printf format specifier for some types that are (ultimately) bfd_vma. Fixed by using BFD_VMA_FMT string. This only becomes an issue when building the tc-arc.c file with -DDEBUG=1 to build in the debug code. gas/ChangeLog: * config/tc-arc.c (md_pcrel_from_section): Use BFD_VMA_FMT where appropriate. (md_convert_frag): Likewise.
2016-05-18gas/arc: Fix array overrun when checking opcode arrayAndrew Burgess5-2/+16
The opcode array iterator mechanism can, in some situations, result in reading memory outside of the opcode array. When using the iterator-next mechanism to find the next possible arc_opcode, if we find an opcode where the name field is NULL, or the name does not match, then the cached opcode pointer is not set to NULL. The result is that another call to iterator-next will again increment the opcode pointer (which might now point outside the opcode array) and attempt to access the name field of this undefined opcode. Fixed in this commit by clearing the cached opcode pointer. I've added a test case, which currently shows the bug, however, this will only expose this bug while the opcode used (dsp_fp_cmp) is the last opcode in the table. gas/ChangeLog: * config/tc-arc.c (arc_opcode_hash_entry_iterator_next): Set cached opcode to NULL when we reach a non-matching opcode. * testsuite/gas/arc/asm-errors-2.d: New file. * testsuite/gas/arc/asm-errors-2.err: New file. * testsuite/gas/arc/asm-errors-2.s: New file.
2016-05-18gas/arc: Add guard against operand array overflow.Andrew Burgess4-5/+17
Currently supplying an input file with too many operands to an instruction will cause the assembler to overflow and array and trigger undefined behaviour. This change checks that we don't access outside the limits of the operand array. gas/ChangeLog: * config/tc-arc.c (tokenize_arguments): Add checks for array overflow. * testsuite/gas/arc/asm-errors.s: Addition test line added. * testsuite/gas/arc/asm-errors.err: Update expected results.
2016-05-18rx: make field type enumTrevor Saunders2-1/+6
gas/ChangeLog: 2016-05-18 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-rx.c (struct cpu_type): Change the type of a field from int to enum rx_cpu_types.
2016-05-18change the type of some fields to bfd_reloc_code_real_typeTrevor Saunders3-2/+9
gas/ChangeLog: 2016-05-18 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-dlx.c (struct machine_it): change the type of a field from int to bfd_reloc_code_real_type. * config/tc-tic4x.c: Likewise.
2016-05-18commit ChangeLog for previous commitTrevor Saunders1-0/+6
2016-05-18Change type of v850_target_arch to enum bfd_architectureTrevor Saunders2-2/+2
gas/ChangeLog: 2016-05-18 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-v850.c (v850_target_arch): change type to enum bfd_architecture. * config/tc-v850.h (v850_target_arch): Likewise.
2016-05-18PPC_OPERAND_SIGNOPT range.Alan Modra4-9/+14
Commit b84bf58a accidentally extended the range of allowed negative numbers. * config/tc-ppc.c (ppc_insert_operand): Trim PPC_OPERAND_SIGNOPT allowed negative range. * testsuite/gas/ppc/power9.s: Test xxspltib of -128, not -256. * testsuite/gas/ppc/power9.d: Update.
2016-05-17Make ARMv8-M GAS tests pass on non ELF targetsThomas Preud'homme16-22/+43
2016-05-17 Thomas Preud'homme <thomas.preudhomme@arm.com> gas/ * testsuite/gas/arm/archv8m-cmse-msr-base.d: Force Thumb when disassembling and stop skipping targets. * testsuite/gas/arm/archv8m-cmse-msr-main.d: Likewise. * testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise. * testsuite/gas/arm/archv8m-base.d: Also allow nops after the last instruction for targets that have stronger alignment requirement. * testsuite/gas/arm/archv8m-cmse-base.d: Likewise. * testsuite/gas/arm/archv8m-cmse-main-1.d: Likewise. * testsuite/gas/arm/archv8m-cmse-main-2.d: Likewise. * testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise. * testsuite/gas/arm/archv8m-main-dsp-2.d: Likewise. * testsuite/gas/arm/archv8m-main-dsp-3.d: Likewise. * testsuite/gas/arm/archv8m-main.d: Likewise. * testsuite/gas/arm/archv8m.s: Add label. * testsuite/gas/arm/archv8m-cmse.s: Likewise. * testsuite/gas/arm/archv8m-cmse-msr.s: Likewise. * testsuite/gas/arm/archv8m-cmse-main.s: Likewise.
2016-05-16m32r: make mach_table static and constTrevor Saunders2-1/+5
It is only read in tc-m32r.c, so it might as well be static and const, and that should help the compiler slightly. gas/ChangeLog: 2016-05-16 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/tc-m32r.c (mach_table): Make static and const.