2007-07-03 13:01:12 +02:00
|
|
|
|
/* tc-pj.c -- Assemble code for Pico Java
|
* config/obj-evax.h (S_SET_OTHER, S_SET_TYPE, S_SET_DESC): Don't define.
* config/tc-crx.c (gettrap): Constify arg.
(handle_LoadStor, get_cinv_parameters): Likewise.
(getreg_image): Fix enum warning
(md_assemble): Restore input line char.
* config/tc-hppa.c (tc_gen_reloc): Fix enum warning.
* config/tc-i960.c (mem_fmt): Rename var to fix shadow warning.
* config/tc-sh.c (sh_fdpic): Only define when OBJ_ELF.
(build_Mytes): Fix build failure for non-elf targets.
* config/tc-tic4x.c (tic4x_eval): Restore terminator char.
* config/tc-xtensa.c (xtensa_end_directive): Fix switch enum warning.
* cgen.c (gas_cgen_md_apply_fix): Avoid set but unused warning.
* ecoff.c (add_ecoff_symbol): Likewise.
* itbl-ops.c (append_insns_as_macros): Likewise.
* listing.c (debugging_pseudo): Likewise.
* read.c (s_mri_common, stringer): Likewise.
* config/obj-coff.c (coff_frob_section): Likewise.
* config/tc-alpha.c (emit_ldgp, s_alpha_proc): Likewise.
* config/tc-arm.c (my_get_expression): Likewise.
* config/tc-hppa.c (process_exit, pa_type_args): Likewise.
* config/tc-m32c.c (md_assemble): Likewise.
* config/tc-microblaze.c (md_convert_frag): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-mt.c (mt_fix_adjustable): Likewise.
* config/tc-xtensa.c (xtensa_literal_pseudo): Likewise.
* config/obj-aout.c (obj_aout_frob_symbol): Delete set but otherwise
unused vars.
* config/tc-alpha.c (load_expression): Likewise.
(s_alpha_rdata, s_alpha_section, s_alpha_prologue): Likewise.
* config/tc-arm.c (parse_neon_el_struct_list): Likewise.
* config/tc-avr.c (extract_word): Likewise.
* config/tc-cris.c (cris_get_expression): Likewise.
* config/tc-d30v.c (build_insn, find_format): Likewise.
* config/tc-dlx.c (machine_ip): Likewise.
* config/tc-hppa.c (pa_get_absolute_expression): Likewise.
* config/tc-i370.c (md_assemble): Likewise.
* config/tc-i960.c (brtab_emit): Likewise.
* config/tc-iq2000.c (s_iq2000_ent): Likewise.
* config/tc-m32c.c (md_convert_frag): Likewise.
* config/tc-m68hc11.c (fixup24, build_jump_insn): Likewise.
(md_estimate_size_before_relax, md_apply_fix): Likewise.
* config/tc-m68k.c (md_show_usage): Likewise.
* config/tc-microblaze.c (microblaze_s_lcomm): Likewise.
* config/tc-mips.c (s_mips_end): Likewise.
* config/tc-mmix.c (mmix_byte, mmix_cons): Likewise.
* config/tc-mn10300.c (md_assemble): Likewise.
* config/tc-msp430.c (extract_word): Likewise.
* config/tc-mt.c (md_assemble): Likewise.
* config/tc-or32.c (machine_ip): Likewise.
* config/tc-pj.c (md_apply_fix): Likewise.
* config/tc-s390.c (md_gather_operands): Likewise.
* config/tc-sh.c (sh_cons_align): Likewise.
* config/tc-sparc.c (sparc_cons_align): Likewise.
* config/tc-tic4x.c (tic4x_sect): Likewise.
* config/tc-tic54x.c (tic54x_stringer): Likewise.
* config/tc-vax.c (vip_op): Likewise.
* config/tc-xstormy16.c (xstormy16_cons_fix_new): Likewise.
* config/tc-xtensa.c (md_assemble): Likewise.
(xtensa_fix_short_loop_frags, convert_frag_immed): Likewise.
(xtensa_move_literals): Likewise.
2010-06-28 16:06:57 +02:00
|
|
|
|
Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2009, 2010
|
2005-03-03 12:52:12 +01:00
|
|
|
|
Free Software Foundation, Inc.
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
This file is part of GAS, the GNU Assembler.
|
|
|
|
|
|
|
|
|
|
GAS is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-07-03 13:01:12 +02:00
|
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
|
|
GAS is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with GAS; see the file COPYING. If not, write to
|
2005-05-05 11:13:19 +02:00
|
|
|
|
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
|
|
|
|
|
Boston, MA 02110-1301, USA. */
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
2000-07-17 23:24:35 +02:00
|
|
|
|
/* Contributed by Steve Chamberlain of Transmeta <sac@pobox.com>. */
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
#include "as.h"
|
2001-09-19 07:33:36 +02:00
|
|
|
|
#include "safe-ctype.h"
|
1999-09-04 19:29:22 +02:00
|
|
|
|
#include "opcode/pj.h"
|
|
|
|
|
|
|
|
|
|
extern const pj_opc_info_t pj_opc_info[512];
|
|
|
|
|
|
2005-03-24 21:40:28 +01:00
|
|
|
|
const char comment_chars[] = "!/";
|
1999-09-04 19:29:22 +02:00
|
|
|
|
const char line_separator_chars[] = ";";
|
2005-03-24 21:40:28 +01:00
|
|
|
|
const char line_comment_chars[] = "/!#";
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
static int pending_reloc;
|
|
|
|
|
static struct hash_control *opcode_hash_control;
|
|
|
|
|
|
|
|
|
|
static void
|
2005-03-24 21:40:28 +01:00
|
|
|
|
little (int ignore ATTRIBUTE_UNUSED)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
|
|
|
|
target_big_endian = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2005-03-24 21:40:28 +01:00
|
|
|
|
big (int ignore ATTRIBUTE_UNUSED)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
|
|
|
|
target_big_endian = 1;
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-24 21:40:28 +01:00
|
|
|
|
const pseudo_typeS md_pseudo_table[] =
|
|
|
|
|
{
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{"ml", little, 0},
|
|
|
|
|
{"mb", big, 0},
|
|
|
|
|
{0, 0, 0}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const char FLT_CHARS[] = "rRsSfFdDxXpP";
|
|
|
|
|
const char EXP_CHARS[] = "eE";
|
|
|
|
|
|
|
|
|
|
void
|
2005-03-24 21:40:28 +01:00
|
|
|
|
md_operand (expressionS *op)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
|
|
|
|
if (strncmp (input_line_pointer, "%hi16", 5) == 0)
|
|
|
|
|
{
|
|
|
|
|
if (pending_reloc)
|
2000-07-17 23:24:35 +02:00
|
|
|
|
as_bad (_("confusing relocation expressions"));
|
1999-09-04 19:29:22 +02:00
|
|
|
|
pending_reloc = BFD_RELOC_PJ_CODE_HI16;
|
|
|
|
|
input_line_pointer += 5;
|
|
|
|
|
expression (op);
|
|
|
|
|
}
|
2005-03-24 21:40:28 +01:00
|
|
|
|
|
1999-09-04 19:29:22 +02:00
|
|
|
|
if (strncmp (input_line_pointer, "%lo16", 5) == 0)
|
|
|
|
|
{
|
|
|
|
|
if (pending_reloc)
|
2000-07-17 23:24:35 +02:00
|
|
|
|
as_bad (_("confusing relocation expressions"));
|
1999-09-04 19:29:22 +02:00
|
|
|
|
pending_reloc = BFD_RELOC_PJ_CODE_LO16;
|
|
|
|
|
input_line_pointer += 5;
|
|
|
|
|
expression (op);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-07-17 23:24:35 +02:00
|
|
|
|
/* Parse an expression and then restore the input line pointer. */
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
static char *
|
2005-03-24 21:40:28 +01:00
|
|
|
|
parse_exp_save_ilp (char *s, expressionS *op)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
|
|
|
|
char *save = input_line_pointer;
|
2005-03-24 21:40:28 +01:00
|
|
|
|
|
1999-09-04 19:29:22 +02:00
|
|
|
|
input_line_pointer = s;
|
|
|
|
|
expression (op);
|
|
|
|
|
s = input_line_pointer;
|
|
|
|
|
input_line_pointer = save;
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This is called by emit_expr via TC_CONS_FIX_NEW when creating a
|
|
|
|
|
reloc for a cons. We could use the definition there, except that
|
|
|
|
|
we want to handle magic pending reloc expressions specially. */
|
|
|
|
|
|
|
|
|
|
void
|
2005-03-24 21:40:28 +01:00
|
|
|
|
pj_cons_fix_new_pj (fragS *frag, int where, int nbytes, expressionS *exp)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
2000-07-17 23:24:35 +02:00
|
|
|
|
static int rv[5][2] =
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{ { 0, 0 },
|
|
|
|
|
{ BFD_RELOC_8, BFD_RELOC_8 },
|
|
|
|
|
{ BFD_RELOC_PJ_CODE_DIR16, BFD_RELOC_16 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ BFD_RELOC_PJ_CODE_DIR32, BFD_RELOC_32 }};
|
|
|
|
|
|
2000-07-17 23:24:35 +02:00
|
|
|
|
fix_new_exp (frag, where, nbytes, exp, 0,
|
1999-09-04 19:29:22 +02:00
|
|
|
|
pending_reloc ? pending_reloc
|
2000-07-17 23:24:35 +02:00
|
|
|
|
: rv[nbytes][(now_seg->flags & SEC_CODE) ? 0 : 1]);
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
pending_reloc = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Turn a reloc description character from the pj-opc.h table into
|
2000-07-17 23:24:35 +02:00
|
|
|
|
code which BFD can handle. */
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
static int
|
2005-03-24 21:40:28 +01:00
|
|
|
|
c_to_r (int x)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
|
|
|
|
switch (x)
|
|
|
|
|
{
|
|
|
|
|
case O_R8:
|
|
|
|
|
return BFD_RELOC_8_PCREL;
|
|
|
|
|
case O_U8:
|
|
|
|
|
case O_8:
|
|
|
|
|
return BFD_RELOC_8;
|
|
|
|
|
case O_R16:
|
|
|
|
|
return BFD_RELOC_PJ_CODE_REL16;
|
|
|
|
|
case O_U16:
|
|
|
|
|
case O_16:
|
|
|
|
|
return BFD_RELOC_PJ_CODE_DIR16;
|
|
|
|
|
case O_R32:
|
|
|
|
|
return BFD_RELOC_PJ_CODE_REL32;
|
|
|
|
|
case O_32:
|
|
|
|
|
return BFD_RELOC_PJ_CODE_DIR32;
|
|
|
|
|
}
|
|
|
|
|
abort ();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Handler for the ipush fake opcode,
|
2000-07-17 23:24:35 +02:00
|
|
|
|
turns ipush <foo> into sipush lo16<foo>, sethi hi16<foo>. */
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2005-03-24 21:40:28 +01:00
|
|
|
|
ipush_code (pj_opc_info_t *opcode ATTRIBUTE_UNUSED, char *str)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
|
|
|
|
char *b = frag_more (6);
|
|
|
|
|
expressionS arg;
|
2000-07-17 23:24:35 +02:00
|
|
|
|
|
1999-09-04 19:29:22 +02:00
|
|
|
|
b[0] = 0x11;
|
|
|
|
|
b[3] = 0xed;
|
2002-12-12 22:52:06 +01:00
|
|
|
|
parse_exp_save_ilp (str + 1, &arg);
|
|
|
|
|
if (pending_reloc)
|
|
|
|
|
{
|
|
|
|
|
as_bad (_("can't have relocation for ipush"));
|
|
|
|
|
pending_reloc = 0;
|
|
|
|
|
}
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
2000-07-17 23:24:35 +02:00
|
|
|
|
fix_new_exp (frag_now, b - frag_now->fr_literal + 1, 2,
|
|
|
|
|
&arg, 0, BFD_RELOC_PJ_CODE_DIR16);
|
1999-09-04 19:29:22 +02:00
|
|
|
|
fix_new_exp (frag_now, b - frag_now->fr_literal + 4, 2,
|
2000-07-17 23:24:35 +02:00
|
|
|
|
&arg, 0, BFD_RELOC_PJ_CODE_HI16);
|
1999-09-04 19:29:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Insert names into the opcode table which are really mini macros,
|
2003-11-22 03:35:31 +01:00
|
|
|
|
not opcodes. The fakeness is indicated with an opcode of -1. */
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2005-03-24 21:40:28 +01:00
|
|
|
|
fake_opcode (const char *name,
|
|
|
|
|
void (*func) (struct pj_opc_info_t *, char *))
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
2005-03-24 21:40:28 +01:00
|
|
|
|
pj_opc_info_t * fake = xmalloc (sizeof (pj_opc_info_t));
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
fake->opcode = -1;
|
|
|
|
|
fake->opcode_next = -1;
|
2002-12-12 22:52:06 +01:00
|
|
|
|
fake->u.func = func;
|
1999-09-04 19:29:22 +02:00
|
|
|
|
hash_insert (opcode_hash_control, name, (char *) fake);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Enter another entry into the opcode hash table so the same opcode
|
2000-07-17 23:24:35 +02:00
|
|
|
|
can have another name. */
|
|
|
|
|
|
1999-09-04 19:29:22 +02:00
|
|
|
|
static void
|
Updated sources to avoid using the identifier name "new", which is a
keyword in c++.
* bfd/aoutx.h (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol.
* bfd/coffgen.c (coff_make_empty_symbol)
(coff_bfd_make_debug_symbol): Rename variable new to new_symbol.
* bfd/cpu-ia64-opc.c (ext_reg, ins_imms_scaled): Rename variable
new to new_insn.
* bfd/doc/chew.c (newentry, add_intrinsic): Rename variable new to
new_d.
* bfd/ecoff.c (_bfd_ecoff_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/elf32-m68k.c (elf_m68k_get_got_entry_type): Rename argument
new to new_reloc.
* bfd/hash.c (bfd_hash_lookup): Rename variable new to new_string.
* bfd/ieee.c (ieee_make_empty_symbol): Rename variable new to
new_symbol.
* bfd/linker.c (bfd_new_link_order): Rename variable new to
new_lo.
* bfd/mach-o.c (bfd_mach_o_sizeof_headers): Rename variable new to
symbol.
* bfd/oasys.c (oasys_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/pdp11.c (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol_type.
* bfd/plugin.c (bfd_plugin_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/rs6000-core.c (CoreHdr, VmInfo): Rename union member new to
new_dump.
(read_hdr, rs6000coff_core_p)
(rs6000coff_core_file_matches_executable_p)
(rs6000coff_core_file_failing_command)
(rs6000coff_core_file_failing_signal): Updated function to use new
union member name.
* bfd/som.c (som_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/syms.c (_bfd_generic_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/tekhex.c (first_phase, tekhex_make_empty_symbol): Rename
variable new to new_symbol.
* binutils/nlmconv.c (main): Rename variable new to new_name.
* gas/config/tc-arm.c (insert_reg_alias): Rename variable new to
new_reg.
* gas/config/tc-dlx.c (parse_operand): Rename variable new to
new_pos.
* gas/config/tc-ia64.c (ia64_gen_real_reloc_type): Rename variable
new to newr.
* gas/config/tc-mcore.c (parse_exp, parse_imm): Rename variable
new to new_pointer.
* gas/config/tc-microblaze.c (parse_exp, parse_imm, check_got):
Change name from new to new_pointer.
* gas/config/tc-or32.c (parse_operand): Rename variable new to
new_pointer.
* gas/config/tc-pdp11.c (md_assemble): Rename variable new to
new_pointer.
* gas/config/tc-pj.c (alias): Change argument new to new_name.
* gas/config/tc-score.c (s3_build_score_ops_hsh): Rename variable
new to new_opcode. (s3_build_dependency_insn_hsh) Rename variable
new to new_i2n. (s3_convert): Rename variables old and new to
r_old and r_new.
* gas/config/tc-score7.c (s7_build_score_ops_hsh): Rename variable
new to new_opcode. (s7_build_dependency_insn_hsh): Rename variable
new to new_i2d. (s7_b32_relax_to_b16, s7_convert_frag): Rename
variables old and new to r_old and r_new.
* gas/config/tc-sh.c (parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-sh64.c (shmedia_parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-tic4x.c (tic4x_operand_parse): Rename variable new
to new_pointer.
* gas/config/tc-z8k.c (parse_exp): Rename variable new to
new_pointer.
* gas/listing.c (listing_newline): Rename variable new to new_i.
* ld/ldexp.c (exp_intop, exp_bigintop, exp_relop, exp_binop)
(exp_trinop, exp_unop, exp_nameop, exp_assop): Rename variable new
to new_e.
* ld/ldfile.c (ldfile_add_library_path): Rename variable new to
new_dirs. (ldfile_add_arch): Rename variable new to new_arch.
* ld/ldlang.c (new_statement, lang_final, lang_add_wild)
(lang_target, lang_add_fill, lang_add_data, lang_add_assignment)
(lang_add_insert): Rename variable new to new_stmt. (new_afile):
Added missing cast. (lang_memory_region_lookup): Rename variable
new to new_region. (init_os): Rename variable new to
new_userdata. (lang_add_section): Rename variable new to
new_section. (ldlang_add_undef): Rename variable new to
new_undef. (realsymbol): Rename variable new to new_name.
* opcodes/z8kgen.c (internal, gas): Rename variable new to new_op.
Updated sources to avoid using the identifier name "template",
which is a keyword in c++.
* bfd/elf32-arm.c (struct stub_def): Rename member template to
template_sequence. (arm_build_one_stub,
find_stub_size_and_template, arm_size_one_stub, arm_map_one_stub):
Rename variable template to template_sequence.
* bfd/elfxx-ia64.c (elfNN_ia64_relax_br, elfNN_ia64_relax_brl):
Rename variable template to template_val.
* gas/config/tc-arm.c (struct asm_cond, struct asm_psr, struct
asm_barrier_opt): Change member template to
template_name. (md_begin): Update code to reflect new member
names.
* gas/config/tc-i386.c (struct templates, struct _i386_insn)
(match_template, cpu_flags_match, match_reg_size, match_mem_size)
(operand_size_match, md_begin, i386_print_statistics, pi)
(build_vex_prefix, md_assemble, parse_insn, optimize_imm)
(optimize_disp): Updated code to use new names. (parse_insn):
Added casts.
* gas/config/tc-ia64.c (dot_template, emit_one_bundle): Updated
code to use new names.
* gas/config/tc-score.c (struct s3_asm_opcode): Renamed member
template to template_name. (s3_parse_16_32_inst, s3_parse_48_inst,
s3_do_macro_ldst_label, s3_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-score7.c (struct s7_asm_opcode): Renamed member
template to template_name. (s7_parse_16_32_inst,
s7_do_macro_ldst_label, s7_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-tic30.c (md_begin, struct tic30_insn)
(md_assemble): Update code to use new names.
* gas/config/tc-tic54x.c (struct _tic54x_insn, md_begin)
(optimize_insn, tic54x_parse_insn, next_line_shows_parallel):
Update code to use new names.
* include/opcode/tic30.h (template): Rename type template to
insn_template. Updated code to use new name.
* include/opcode/tic54x.h (template): Rename type template to
insn_template.
* opcodes/cris-dis.c (bytes_to_skip): Update code to use new name.
* opcodes/i386-dis.c (putop): Update code to use new name.
* opcodes/i386-gen.c (process_i386_opcodes): Update code to use
new name.
* opcodes/i386-opc.h (struct template): Rename struct template to
insn_template. Update code accordingly.
* opcodes/i386-tbl.h (i386_optab): Update type to use new name.
* opcodes/ia64-dis.c (print_insn_ia64): Rename variable template
to template_val.
* opcodes/tic30-dis.c (struct instruction, get_tic30_instruction):
Update code to use new name.
* opcodes/tic54x-dis.c (has_lkaddr, get_insn_size)
(print_parallel_instruction, print_insn_tic54x, tic54x_get_insn):
Update code to use new name.
* opcodes/tic54x-opc.c (tic54x_unknown_opcode, tic54x_optab):
Update type to new name.
2009-08-30 00:11:02 +02:00
|
|
|
|
alias (const char *new_name, const char *old)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
Updated sources to avoid using the identifier name "new", which is a
keyword in c++.
* bfd/aoutx.h (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol.
* bfd/coffgen.c (coff_make_empty_symbol)
(coff_bfd_make_debug_symbol): Rename variable new to new_symbol.
* bfd/cpu-ia64-opc.c (ext_reg, ins_imms_scaled): Rename variable
new to new_insn.
* bfd/doc/chew.c (newentry, add_intrinsic): Rename variable new to
new_d.
* bfd/ecoff.c (_bfd_ecoff_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/elf32-m68k.c (elf_m68k_get_got_entry_type): Rename argument
new to new_reloc.
* bfd/hash.c (bfd_hash_lookup): Rename variable new to new_string.
* bfd/ieee.c (ieee_make_empty_symbol): Rename variable new to
new_symbol.
* bfd/linker.c (bfd_new_link_order): Rename variable new to
new_lo.
* bfd/mach-o.c (bfd_mach_o_sizeof_headers): Rename variable new to
symbol.
* bfd/oasys.c (oasys_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/pdp11.c (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol_type.
* bfd/plugin.c (bfd_plugin_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/rs6000-core.c (CoreHdr, VmInfo): Rename union member new to
new_dump.
(read_hdr, rs6000coff_core_p)
(rs6000coff_core_file_matches_executable_p)
(rs6000coff_core_file_failing_command)
(rs6000coff_core_file_failing_signal): Updated function to use new
union member name.
* bfd/som.c (som_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/syms.c (_bfd_generic_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/tekhex.c (first_phase, tekhex_make_empty_symbol): Rename
variable new to new_symbol.
* binutils/nlmconv.c (main): Rename variable new to new_name.
* gas/config/tc-arm.c (insert_reg_alias): Rename variable new to
new_reg.
* gas/config/tc-dlx.c (parse_operand): Rename variable new to
new_pos.
* gas/config/tc-ia64.c (ia64_gen_real_reloc_type): Rename variable
new to newr.
* gas/config/tc-mcore.c (parse_exp, parse_imm): Rename variable
new to new_pointer.
* gas/config/tc-microblaze.c (parse_exp, parse_imm, check_got):
Change name from new to new_pointer.
* gas/config/tc-or32.c (parse_operand): Rename variable new to
new_pointer.
* gas/config/tc-pdp11.c (md_assemble): Rename variable new to
new_pointer.
* gas/config/tc-pj.c (alias): Change argument new to new_name.
* gas/config/tc-score.c (s3_build_score_ops_hsh): Rename variable
new to new_opcode. (s3_build_dependency_insn_hsh) Rename variable
new to new_i2n. (s3_convert): Rename variables old and new to
r_old and r_new.
* gas/config/tc-score7.c (s7_build_score_ops_hsh): Rename variable
new to new_opcode. (s7_build_dependency_insn_hsh): Rename variable
new to new_i2d. (s7_b32_relax_to_b16, s7_convert_frag): Rename
variables old and new to r_old and r_new.
* gas/config/tc-sh.c (parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-sh64.c (shmedia_parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-tic4x.c (tic4x_operand_parse): Rename variable new
to new_pointer.
* gas/config/tc-z8k.c (parse_exp): Rename variable new to
new_pointer.
* gas/listing.c (listing_newline): Rename variable new to new_i.
* ld/ldexp.c (exp_intop, exp_bigintop, exp_relop, exp_binop)
(exp_trinop, exp_unop, exp_nameop, exp_assop): Rename variable new
to new_e.
* ld/ldfile.c (ldfile_add_library_path): Rename variable new to
new_dirs. (ldfile_add_arch): Rename variable new to new_arch.
* ld/ldlang.c (new_statement, lang_final, lang_add_wild)
(lang_target, lang_add_fill, lang_add_data, lang_add_assignment)
(lang_add_insert): Rename variable new to new_stmt. (new_afile):
Added missing cast. (lang_memory_region_lookup): Rename variable
new to new_region. (init_os): Rename variable new to
new_userdata. (lang_add_section): Rename variable new to
new_section. (ldlang_add_undef): Rename variable new to
new_undef. (realsymbol): Rename variable new to new_name.
* opcodes/z8kgen.c (internal, gas): Rename variable new to new_op.
Updated sources to avoid using the identifier name "template",
which is a keyword in c++.
* bfd/elf32-arm.c (struct stub_def): Rename member template to
template_sequence. (arm_build_one_stub,
find_stub_size_and_template, arm_size_one_stub, arm_map_one_stub):
Rename variable template to template_sequence.
* bfd/elfxx-ia64.c (elfNN_ia64_relax_br, elfNN_ia64_relax_brl):
Rename variable template to template_val.
* gas/config/tc-arm.c (struct asm_cond, struct asm_psr, struct
asm_barrier_opt): Change member template to
template_name. (md_begin): Update code to reflect new member
names.
* gas/config/tc-i386.c (struct templates, struct _i386_insn)
(match_template, cpu_flags_match, match_reg_size, match_mem_size)
(operand_size_match, md_begin, i386_print_statistics, pi)
(build_vex_prefix, md_assemble, parse_insn, optimize_imm)
(optimize_disp): Updated code to use new names. (parse_insn):
Added casts.
* gas/config/tc-ia64.c (dot_template, emit_one_bundle): Updated
code to use new names.
* gas/config/tc-score.c (struct s3_asm_opcode): Renamed member
template to template_name. (s3_parse_16_32_inst, s3_parse_48_inst,
s3_do_macro_ldst_label, s3_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-score7.c (struct s7_asm_opcode): Renamed member
template to template_name. (s7_parse_16_32_inst,
s7_do_macro_ldst_label, s7_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-tic30.c (md_begin, struct tic30_insn)
(md_assemble): Update code to use new names.
* gas/config/tc-tic54x.c (struct _tic54x_insn, md_begin)
(optimize_insn, tic54x_parse_insn, next_line_shows_parallel):
Update code to use new names.
* include/opcode/tic30.h (template): Rename type template to
insn_template. Updated code to use new name.
* include/opcode/tic54x.h (template): Rename type template to
insn_template.
* opcodes/cris-dis.c (bytes_to_skip): Update code to use new name.
* opcodes/i386-dis.c (putop): Update code to use new name.
* opcodes/i386-gen.c (process_i386_opcodes): Update code to use
new name.
* opcodes/i386-opc.h (struct template): Rename struct template to
insn_template. Update code accordingly.
* opcodes/i386-tbl.h (i386_optab): Update type to use new name.
* opcodes/ia64-dis.c (print_insn_ia64): Rename variable template
to template_val.
* opcodes/tic30-dis.c (struct instruction, get_tic30_instruction):
Update code to use new name.
* opcodes/tic54x-dis.c (has_lkaddr, get_insn_size)
(print_parallel_instruction, print_insn_tic54x, tic54x_get_insn):
Update code to use new name.
* opcodes/tic54x-opc.c (tic54x_unknown_opcode, tic54x_optab):
Update type to new name.
2009-08-30 00:11:02 +02:00
|
|
|
|
hash_insert (opcode_hash_control, new_name,
|
1999-09-04 19:29:22 +02:00
|
|
|
|
(char *) hash_find (opcode_hash_control, old));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This function is called once, at assembler startup time. It sets
|
|
|
|
|
up the hash table with all the opcodes in it, and also initializes
|
2000-07-17 23:24:35 +02:00
|
|
|
|
some aliases for compatibility with other assemblers. */
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
void
|
2005-03-24 21:40:28 +01:00
|
|
|
|
md_begin (void)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
|
|
|
|
const pj_opc_info_t *opcode;
|
|
|
|
|
opcode_hash_control = hash_new ();
|
|
|
|
|
|
2000-07-17 23:24:35 +02:00
|
|
|
|
/* Insert names into hash table. */
|
2002-12-12 22:52:06 +01:00
|
|
|
|
for (opcode = pj_opc_info; opcode->u.name; opcode++)
|
|
|
|
|
hash_insert (opcode_hash_control, opcode->u.name, (char *) opcode);
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
2000-07-17 23:24:35 +02:00
|
|
|
|
/* Insert the only fake opcode. */
|
1999-09-04 19:29:22 +02:00
|
|
|
|
fake_opcode ("ipush", ipush_code);
|
|
|
|
|
|
2000-07-17 23:24:35 +02:00
|
|
|
|
/* Add some aliases for opcode names. */
|
1999-09-04 19:29:22 +02:00
|
|
|
|
alias ("ifeq_s", "ifeq");
|
|
|
|
|
alias ("ifne_s", "ifne");
|
|
|
|
|
alias ("if_icmpge_s", "if_icmpge");
|
|
|
|
|
alias ("if_icmpne_s", "if_icmpne");
|
|
|
|
|
alias ("if_icmpeq_s", "if_icmpeq");
|
|
|
|
|
alias ("if_icmpgt_s", "if_icmpgt");
|
|
|
|
|
alias ("goto_s", "goto");
|
|
|
|
|
|
|
|
|
|
bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2000-07-17 23:24:35 +02:00
|
|
|
|
/* This is the guts of the machine-dependent assembler. STR points to
|
|
|
|
|
a machine dependent instruction. This function is supposed to emit
|
|
|
|
|
the frags/bytes it assembles to. */
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
void
|
2005-03-24 21:40:28 +01:00
|
|
|
|
md_assemble (char *str)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
2005-02-23 13:28:06 +01:00
|
|
|
|
char *op_start;
|
|
|
|
|
char *op_end;
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
pj_opc_info_t *opcode;
|
|
|
|
|
char *output;
|
|
|
|
|
int idx = 0;
|
|
|
|
|
char pend;
|
|
|
|
|
|
|
|
|
|
int nlen = 0;
|
|
|
|
|
|
2000-07-17 23:24:35 +02:00
|
|
|
|
/* Drop leading whitespace. */
|
1999-09-04 19:29:22 +02:00
|
|
|
|
while (*str == ' ')
|
|
|
|
|
str++;
|
|
|
|
|
|
2000-07-17 23:24:35 +02:00
|
|
|
|
/* Find the op code end. */
|
2005-02-23 13:28:06 +01:00
|
|
|
|
op_start = str;
|
|
|
|
|
for (op_end = str;
|
|
|
|
|
*op_end && !is_end_of_line[*op_end & 0xff] && *op_end != ' ';
|
2000-07-17 23:24:35 +02:00
|
|
|
|
op_end++)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
nlen++;
|
|
|
|
|
|
|
|
|
|
pend = *op_end;
|
|
|
|
|
*op_end = 0;
|
|
|
|
|
|
|
|
|
|
if (nlen == 0)
|
2000-07-17 23:24:35 +02:00
|
|
|
|
as_bad (_("can't find opcode "));
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
opcode = (pj_opc_info_t *) hash_find (opcode_hash_control, op_start);
|
|
|
|
|
*op_end = pend;
|
|
|
|
|
|
|
|
|
|
if (opcode == NULL)
|
|
|
|
|
{
|
2000-07-17 23:24:35 +02:00
|
|
|
|
as_bad (_("unknown opcode %s"), op_start);
|
1999-09-04 19:29:22 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-08 12:36:39 +02:00
|
|
|
|
dwarf2_emit_insn (0);
|
1999-09-04 19:29:22 +02:00
|
|
|
|
if (opcode->opcode == -1)
|
|
|
|
|
{
|
2000-07-17 23:24:35 +02:00
|
|
|
|
/* It's a fake opcode. Dig out the args and pretend that was
|
|
|
|
|
what we were passed. */
|
2002-12-12 22:52:06 +01:00
|
|
|
|
(*opcode->u.func) (opcode, op_end);
|
1999-09-04 19:29:22 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int an;
|
|
|
|
|
|
|
|
|
|
output = frag_more (opcode->len);
|
|
|
|
|
output[idx++] = opcode->opcode;
|
|
|
|
|
|
|
|
|
|
if (opcode->opcode_next != -1)
|
|
|
|
|
output[idx++] = opcode->opcode_next;
|
|
|
|
|
|
|
|
|
|
for (an = 0; opcode->arg[an]; an++)
|
|
|
|
|
{
|
|
|
|
|
expressionS arg;
|
|
|
|
|
|
|
|
|
|
if (*op_end == ',' && an != 0)
|
|
|
|
|
op_end++;
|
|
|
|
|
|
|
|
|
|
if (*op_end == 0)
|
2009-07-24 13:45:01 +02:00
|
|
|
|
as_bad (_("expected expresssion"));
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
op_end = parse_exp_save_ilp (op_end, &arg);
|
|
|
|
|
|
2000-07-17 23:24:35 +02:00
|
|
|
|
fix_new_exp (frag_now,
|
1999-09-04 19:29:22 +02:00
|
|
|
|
output - frag_now->fr_literal + idx,
|
|
|
|
|
ASIZE (opcode->arg[an]),
|
|
|
|
|
&arg,
|
2000-07-17 23:24:35 +02:00
|
|
|
|
PCREL (opcode->arg[an]),
|
1999-09-04 19:29:22 +02:00
|
|
|
|
pending_reloc ? pending_reloc : c_to_r (opcode->arg[an]));
|
|
|
|
|
|
|
|
|
|
idx += ASIZE (opcode->arg[an]);
|
|
|
|
|
pending_reloc = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-09-19 07:33:36 +02:00
|
|
|
|
while (ISSPACE (*op_end))
|
1999-09-04 19:29:22 +02:00
|
|
|
|
op_end++;
|
|
|
|
|
|
|
|
|
|
if (*op_end != 0)
|
2009-07-24 13:45:01 +02:00
|
|
|
|
as_warn (_("extra stuff on line ignored"));
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pending_reloc)
|
2009-07-24 13:45:01 +02:00
|
|
|
|
as_bad (_("Something forgot to clean up\n"));
|
1999-09-04 19:29:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *
|
2005-03-24 21:40:28 +01:00
|
|
|
|
md_atof (int type, char *litP, int *sizeP)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
2007-10-17 18:45:56 +02:00
|
|
|
|
return ieee_md_atof (type, litP, sizeP, target_big_endian);
|
1999-09-04 19:29:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-06-08 09:37:16 +02:00
|
|
|
|
const char *md_shortopts = "";
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
2005-03-24 21:40:28 +01:00
|
|
|
|
struct option md_longopts[] =
|
|
|
|
|
{
|
1999-09-04 19:29:22 +02:00
|
|
|
|
#define OPTION_LITTLE (OPTION_MD_BASE)
|
|
|
|
|
#define OPTION_BIG (OPTION_LITTLE + 1)
|
|
|
|
|
|
|
|
|
|
{"little", no_argument, NULL, OPTION_LITTLE},
|
|
|
|
|
{"big", no_argument, NULL, OPTION_BIG},
|
|
|
|
|
{NULL, no_argument, NULL, 0}
|
|
|
|
|
};
|
|
|
|
|
size_t md_longopts_size = sizeof (md_longopts);
|
|
|
|
|
|
|
|
|
|
int
|
2005-03-24 21:40:28 +01:00
|
|
|
|
md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
|
|
|
|
switch (c)
|
|
|
|
|
{
|
|
|
|
|
case OPTION_LITTLE:
|
2002-12-12 22:52:06 +01:00
|
|
|
|
little (0);
|
1999-09-04 19:29:22 +02:00
|
|
|
|
break;
|
|
|
|
|
case OPTION_BIG:
|
2002-12-12 22:52:06 +01:00
|
|
|
|
big (0);
|
1999-09-04 19:29:22 +02:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2005-03-24 21:40:28 +01:00
|
|
|
|
md_show_usage (FILE *stream)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
2000-07-17 23:24:35 +02:00
|
|
|
|
fprintf (stream, _("\
|
1999-09-04 19:29:22 +02:00
|
|
|
|
PJ options:\n\
|
|
|
|
|
-little generate little endian code\n\
|
|
|
|
|
-big generate big endian code\n"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Apply a fixup to the object file. */
|
|
|
|
|
|
2001-11-15 22:29:00 +01:00
|
|
|
|
void
|
gas:
* cgen.c, cgen.h, tc.h, write.c, config/obj-coff.c
* config/tc-a29k.c, config/tc-alpha.c, config/tc-alpha.h
* config/tc-arc.c, config/tc-arc.h, config/tc-arm.c
* config/tc-arm.h, config/tc-avr.c, config/tc-avr.h
* config/tc-cris.c, config/tc-crx.c, config/tc-d10v.c
* config/tc-d10v.h, config/tc-d30v.c, config/tc-d30v.h
* config/tc-dlx.c, config/tc-dlx.h, config/tc-fr30.h
* config/tc-frv.c, config/tc-frv.h, config/tc-h8300.c
* config/tc-h8500.c, config/tc-hppa.c, config/tc-hppa.h
* config/tc-i370.c, config/tc-i370.h, config/tc-i386.c
* config/tc-i386.h, config/tc-i860.c, config/tc-i860.h
* config/tc-i960.c, config/tc-i960.h, config/tc-ia64.c
* config/tc-ip2k.c, config/tc-ip2k.h, config/tc-iq2000.c
* config/tc-iq2000.h, config/tc-m32r.c, config/tc-m32r.h
* config/tc-m68hc11.c, config/tc-m68hc11.h, config/tc-m68k.c
* config/tc-m68k.h, config/tc-m88k.c, config/tc-maxq.c
* config/tc-mcore.c, config/tc-mcore.h, config/tc-mips.c
* config/tc-mips.h, config/tc-mmix.c, config/tc-mn10200.c
* config/tc-mn10300.c, config/tc-msp430.c, config/tc-ns32k.c
* config/tc-openrisc.h, config/tc-or32.c, config/tc-or32.h
* config/tc-pdp11.c, config/tc-pj.c, config/tc-pj.h
* config/tc-ppc.c, config/tc-ppc.h, config/tc-s390.c
* config/tc-s390.h, config/tc-sh64.c, config/tc-sh.c
* config/tc-sh.h, config/tc-sparc.c, config/tc-sparc.h
* config/tc-tahoe.c, config/tc-tic30.c, config/tc-tic4x.c
* config/tc-tic54x.c, config/tc-tic80.c, config/tc-v850.c
* config/tc-v850.h, config/tc-vax.c, config/tc-vax.h
* config/tc-w65.c, config/tc-xstormy16.c, config/tc-xstormy16.h
* config/tc-xtensa.c, config/tc-z8k.c:
Replace all instances of the string "_apply_fix3" with
"_apply_fix".
* po/POTFILES.in, po/gas.pot: Regenerate.
bfd:
* coff-i386.c: Change md_apply_fix3 to md_apply_fix in comment.
cgen:
* doc/porting.texi: Change all mention of md_apply_fix3 and
gas_cgen_md_apply_fix3 to md_apply_fix and gas_cgen_md_apply_fix
respectively.
2005-06-07 19:54:22 +02:00
|
|
|
|
md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
|
|
|
|
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
|
2002-09-05 02:01:18 +02:00
|
|
|
|
long val = *valP;
|
1999-09-04 19:29:22 +02:00
|
|
|
|
long max, min;
|
|
|
|
|
|
|
|
|
|
max = min = 0;
|
|
|
|
|
switch (fixP->fx_r_type)
|
|
|
|
|
{
|
|
|
|
|
case BFD_RELOC_VTABLE_INHERIT:
|
|
|
|
|
case BFD_RELOC_VTABLE_ENTRY:
|
|
|
|
|
fixP->fx_done = 0;
|
2001-11-15 22:29:00 +01:00
|
|
|
|
return;
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
case BFD_RELOC_PJ_CODE_REL16:
|
|
|
|
|
if (val < -0x8000 || val >= 0x7fff)
|
2000-07-17 23:24:35 +02:00
|
|
|
|
as_bad_where (fixP->fx_file, fixP->fx_line, _("pcrel too far"));
|
1999-09-04 19:29:22 +02:00
|
|
|
|
buf[0] |= (val >> 8) & 0xff;
|
|
|
|
|
buf[1] = val & 0xff;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BFD_RELOC_PJ_CODE_HI16:
|
|
|
|
|
*buf++ = val >> 24;
|
|
|
|
|
*buf++ = val >> 16;
|
|
|
|
|
fixP->fx_addnumber = val & 0xffff;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BFD_RELOC_PJ_CODE_DIR16:
|
|
|
|
|
case BFD_RELOC_PJ_CODE_LO16:
|
|
|
|
|
*buf++ = val >> 8;
|
|
|
|
|
*buf++ = val >> 0;
|
|
|
|
|
|
|
|
|
|
max = 0xffff;
|
|
|
|
|
min = -0xffff;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BFD_RELOC_8:
|
|
|
|
|
max = 0xff;
|
|
|
|
|
min = -0xff;
|
|
|
|
|
*buf++ = val;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BFD_RELOC_PJ_CODE_DIR32:
|
|
|
|
|
*buf++ = val >> 24;
|
|
|
|
|
*buf++ = val >> 16;
|
|
|
|
|
*buf++ = val >> 8;
|
|
|
|
|
*buf++ = val >> 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BFD_RELOC_32:
|
|
|
|
|
if (target_big_endian)
|
|
|
|
|
{
|
|
|
|
|
*buf++ = val >> 24;
|
|
|
|
|
*buf++ = val >> 16;
|
|
|
|
|
*buf++ = val >> 8;
|
|
|
|
|
*buf++ = val >> 0;
|
|
|
|
|
}
|
2000-07-17 23:24:35 +02:00
|
|
|
|
else
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
|
|
|
|
*buf++ = val >> 0;
|
|
|
|
|
*buf++ = val >> 8;
|
|
|
|
|
*buf++ = val >> 16;
|
|
|
|
|
*buf++ = val >> 24;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BFD_RELOC_16:
|
|
|
|
|
if (target_big_endian)
|
|
|
|
|
{
|
|
|
|
|
*buf++ = val >> 8;
|
|
|
|
|
*buf++ = val >> 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
*buf++ = val >> 0;
|
|
|
|
|
*buf++ = val >> 8;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (max != 0 && (val < min || val > max))
|
2000-07-17 23:24:35 +02:00
|
|
|
|
as_bad_where (fixP->fx_file, fixP->fx_line, _("offset out of range"));
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
2001-11-15 22:29:00 +01:00
|
|
|
|
if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
|
|
|
|
|
fixP->fx_done = 1;
|
1999-09-04 19:29:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Put number into target byte order. Always put values in an
|
2000-07-17 23:24:35 +02:00
|
|
|
|
executable section into big endian order. */
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
void
|
2005-03-24 21:40:28 +01:00
|
|
|
|
md_number_to_chars (char *ptr, valueT use, int nbytes)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
|
|
|
|
if (target_big_endian || now_seg->flags & SEC_CODE)
|
|
|
|
|
number_to_chars_bigendian (ptr, use, nbytes);
|
|
|
|
|
else
|
|
|
|
|
number_to_chars_littleendian (ptr, use, nbytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Translate internal representation of relocation info to BFD target
|
2000-07-17 23:24:35 +02:00
|
|
|
|
format. */
|
1999-09-04 19:29:22 +02:00
|
|
|
|
|
|
|
|
|
arelent *
|
2005-03-24 21:40:28 +01:00
|
|
|
|
tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
|
1999-09-04 19:29:22 +02:00
|
|
|
|
{
|
|
|
|
|
arelent *rel;
|
|
|
|
|
bfd_reloc_code_real_type r_type;
|
|
|
|
|
|
2005-03-24 21:40:28 +01:00
|
|
|
|
rel = xmalloc (sizeof (arelent));
|
|
|
|
|
rel->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
|
1999-09-04 19:29:22 +02:00
|
|
|
|
*rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
|
|
|
|
|
rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
|
|
|
|
|
|
|
|
|
|
r_type = fixp->fx_r_type;
|
|
|
|
|
rel->addend = fixp->fx_addnumber;
|
|
|
|
|
rel->howto = bfd_reloc_type_lookup (stdoutput, r_type);
|
|
|
|
|
|
|
|
|
|
if (rel->howto == NULL)
|
|
|
|
|
{
|
|
|
|
|
as_bad_where (fixp->fx_file, fixp->fx_line,
|
2000-07-17 23:24:35 +02:00
|
|
|
|
_("Cannot represent relocation type %s"),
|
1999-09-04 19:29:22 +02:00
|
|
|
|
bfd_get_reloc_code_name (r_type));
|
|
|
|
|
/* Set howto to a garbage value so that we can keep going. */
|
|
|
|
|
rel->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32);
|
* gas/app, gas/as.c, gas/as.h, gas/atof-generic.c, gas/cgen.c,
gas/config/atof-ieee.c, gas/config/obj-aout.c,
gas/config/obj-coff.c, gas/config/obj-ecoff.c,
gas/config/obj-elf.c, gas/config/obj-som.c, gas/config/tc-alpha.c,
gas/config/tc-arc.c, gas/config/tc-arm.c, gas/config/tc-cr16.c,
gas/config/tc-cris.c, gas/config/tc-crx.c, gas/config/tc-d30v.c,
gas/config/tc-dlx.c, gas/config/tc-hppa.c, gas/config/tc-i370.c,
gas/config/tc-i386-intel.c, gas/config/tc-i386.c,
gas/config/tc-i860.c, gas/config/tc-i960.c, gas/config/tc-ia64.c,
gas/config/tc-iq2000.c, gas/config/tc-m32c.c,
gas/config/tc-m32r.c, gas/config/tc-m68hc11.c,
gas/config/tc-m68k.c, gas/config/tc-maxq.c, gas/config/tc-mcore.c,
gas/config/tc-mep.c, gas/config/tc-mips.c, gas/config/tc-mmix.c,
gas/config/tc-mn10300.c, gas/config/tc-moxie.c,
gas/config/tc-ns32k.c, gas/config/tc-pj.c, gas/config/tc-ppc.c,
gas/config/tc-s390.c, gas/config/tc-score.c,
gas/config/tc-score7.c, gas/config/tc-sh.c, gas/config/tc-sparc.c,
gas/config/tc-spu.c, gas/config/tc-tic30.c, gas/config/tc-vax.c,
gas/config/tc-xtensa.c, gas/config/xtensa-relax.c,
gas/dw2gencfi.c, gas/dwarf2dbg.c, gas/ehopt.c, gas/expr.c,
gas/frags.c, gas/input-file.c, gas/read.c, gas/sb.c,
gas/subsegs.c, gas/symbols.c, gas/write.c: Change the name of the
gas macro `assert' to `gas_assert'.
2009-06-22 19:56:02 +02:00
|
|
|
|
gas_assert (rel->howto != NULL);
|
1999-09-04 19:29:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rel;
|
|
|
|
|
}
|