2006-09-17 07:51:50 +08:00
|
|
|
/* tc-score.c -- Assembler for Score
|
2020-01-01 15:57:01 +08:00
|
|
|
Copyright (C) 2006-2020 Free Software Foundation, Inc.
|
2006-09-17 07:51:50 +08:00
|
|
|
Contributed by:
|
2009-03-02 18:33:08 +08:00
|
|
|
Brain.lin (brain.lin@sunplusct.com)
|
2006-09-17 07:51:50 +08:00
|
|
|
Mei Ligang (ligang@sunnorth.com.cn)
|
|
|
|
Pei-Lin Tsai (pltsai@sunplus.com)
|
|
|
|
|
|
|
|
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 19:01:12 +08:00
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
2006-09-17 07:51:50 +08: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 the Free
|
|
|
|
Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
|
|
|
02110-1301, USA. */
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
#include "tc-score7.c"
|
|
|
|
|
|
|
|
static void s3_s_score_bss (int ignore ATTRIBUTE_UNUSED);
|
|
|
|
static void s3_s_score_text (int ignore);
|
|
|
|
static void s3_score_s_section (int ignore);
|
|
|
|
static void s3_s_change_sec (int sec);
|
|
|
|
static void s3_s_score_mask (int reg_type ATTRIBUTE_UNUSED);
|
|
|
|
static void s3_s_score_ent (int aent);
|
|
|
|
static void s3_s_score_frame (int ignore ATTRIBUTE_UNUSED);
|
|
|
|
static void s3_s_score_end (int x ATTRIBUTE_UNUSED);
|
|
|
|
static void s3_s_score_set (int x ATTRIBUTE_UNUSED);
|
|
|
|
static void s3_s_score_cpload (int ignore ATTRIBUTE_UNUSED);
|
|
|
|
static void s3_s_score_cprestore (int ignore ATTRIBUTE_UNUSED);
|
|
|
|
static void s3_s_score_gpword (int ignore ATTRIBUTE_UNUSED);
|
|
|
|
static void s3_s_score_cpadd (int ignore ATTRIBUTE_UNUSED);
|
|
|
|
static void s3_s_score_lcomm (int bytes_p);
|
|
|
|
|
|
|
|
static void s_score_bss (int ignore ATTRIBUTE_UNUSED);
|
|
|
|
static void s_score_text (int ignore);
|
|
|
|
static void s_section (int ignore);
|
|
|
|
static void s_change_sec (int sec);
|
|
|
|
static void s_score_mask (int reg_type ATTRIBUTE_UNUSED);
|
|
|
|
static void s_score_ent (int aent);
|
|
|
|
static void s_score_frame (int ignore ATTRIBUTE_UNUSED);
|
|
|
|
static void s_score_end (int x ATTRIBUTE_UNUSED);
|
|
|
|
static void s_score_set (int x ATTRIBUTE_UNUSED);
|
|
|
|
static void s_score_cpload (int ignore ATTRIBUTE_UNUSED);
|
|
|
|
static void s_score_cprestore (int ignore ATTRIBUTE_UNUSED);
|
|
|
|
static void s_score_gpword (int ignore ATTRIBUTE_UNUSED);
|
|
|
|
static void s_score_cpadd (int ignore ATTRIBUTE_UNUSED);
|
|
|
|
static void s_score_lcomm (int bytes_p);
|
|
|
|
|
|
|
|
/* s3: hooks. */
|
|
|
|
static void s3_md_number_to_chars (char *buf, valueT val, int n);
|
|
|
|
static valueT s3_md_chars_to_number (char *buf, int n);
|
|
|
|
static void s3_assemble (char *str);
|
2009-12-11 21:42:17 +08:00
|
|
|
static void s3_operand (expressionS *);
|
2009-03-02 18:33:08 +08:00
|
|
|
static void s3_begin (void);
|
|
|
|
static void s3_number_to_chars (char *buf, valueT val, int n);
|
2016-04-01 20:07:50 +08:00
|
|
|
static const char *s3_atof (int type, char *litP, int *sizeP);
|
2009-03-02 18:33:08 +08:00
|
|
|
static void s3_frag_check (fragS * fragp ATTRIBUTE_UNUSED);
|
|
|
|
static void s3_validate_fix (fixS *fixP);
|
|
|
|
static int s3_force_relocation (struct fix *fixp);
|
|
|
|
static bfd_boolean s3_fix_adjustable (fixS * fixP);
|
|
|
|
static void s3_elf_final_processing (void);
|
|
|
|
static int s3_estimate_size_before_relax (fragS * fragp, asection * sec ATTRIBUTE_UNUSED);
|
|
|
|
static int s3_relax_frag (asection * sec ATTRIBUTE_UNUSED, fragS * fragp, long stretch ATTRIBUTE_UNUSED);
|
|
|
|
static void s3_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED, fragS * fragp);
|
|
|
|
static long s3_pcrel_from (fixS * fixP);
|
|
|
|
static valueT s3_section_align (segT segment ATTRIBUTE_UNUSED, valueT size);
|
|
|
|
static void s3_apply_fix (fixS *fixP, valueT *valP, segT seg);
|
|
|
|
static arelent **s3_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp);
|
|
|
|
|
|
|
|
/* s3: utils. */
|
|
|
|
static void s3_do_ldst_insn (char *);
|
|
|
|
static void s3_do_crdcrscrsimm5 (char *);
|
|
|
|
static void s3_do_ldst_unalign (char *);
|
|
|
|
static void s3_do_ldst_atomic (char *);
|
|
|
|
static void s3_do_ldst_cop (char *);
|
|
|
|
static void s3_do_macro_li_rdi32 (char *);
|
|
|
|
static void s3_do_macro_la_rdi32 (char *);
|
|
|
|
static void s3_do_macro_rdi32hi (char *);
|
|
|
|
static void s3_do_macro_rdi32lo (char *);
|
|
|
|
static void s3_do_macro_mul_rdrsrs (char *);
|
|
|
|
static void s3_do_macro_bcmp (char *);
|
|
|
|
static void s3_do_macro_bcmpz (char *);
|
|
|
|
static void s3_do_macro_ldst_label (char *);
|
|
|
|
static void s3_do_branch (char *);
|
|
|
|
static void s3_do_jump (char *);
|
|
|
|
static void s3_do_empty (char *);
|
|
|
|
static void s3_do16_int (char *);
|
|
|
|
static void s3_do_rdrsrs (char *);
|
|
|
|
static void s3_do_rdsi16 (char *);
|
|
|
|
static void s3_do_rdrssi14 (char *);
|
|
|
|
static void s3_do_sub_rdsi16 (char *);
|
|
|
|
static void s3_do_sub_rdi16 (char *);
|
|
|
|
static void s3_do_sub_rdrssi14 (char *);
|
|
|
|
static void s3_do_rdrsi5 (char *);
|
|
|
|
static void s3_do_rdrsi14 (char *);
|
|
|
|
static void s3_do_rdi16 (char *);
|
|
|
|
static void s3_do_ldis (char *);
|
|
|
|
static void s3_do_xrsi5 (char *);
|
|
|
|
static void s3_do_rdrs (char *);
|
|
|
|
static void s3_do_rdxrs (char *);
|
|
|
|
static void s3_do_rsrs (char *);
|
|
|
|
static void s3_do_rdcrs (char *);
|
|
|
|
static void s3_do_rdsrs (char *);
|
|
|
|
static void s3_do_rd (char *);
|
|
|
|
static void s3_do16_dsp (char *);
|
|
|
|
static void s3_do16_dsp2 (char *);
|
|
|
|
static void s3_do_dsp (char *);
|
|
|
|
static void s3_do_dsp2 (char *);
|
|
|
|
static void s3_do_dsp3 (char *);
|
|
|
|
static void s3_do_rs (char *);
|
|
|
|
static void s3_do_i15 (char *);
|
|
|
|
static void s3_do_xi5x (char *);
|
|
|
|
static void s3_do_ceinst (char *);
|
|
|
|
static void s3_do_cache (char *);
|
|
|
|
static void s3_do16_rdrs2 (char *);
|
|
|
|
static void s3_do16_br (char *);
|
|
|
|
static void s3_do16_brr (char *);
|
|
|
|
static void s3_do_ltb (char *);
|
|
|
|
static void s3_do16_mv_cmp (char *);
|
|
|
|
static void s3_do16_addi (char *);
|
|
|
|
static void s3_do16_cmpi (char *);
|
|
|
|
static void s3_do16_rdi5 (char *);
|
|
|
|
static void s3_do16_xi5 (char *);
|
|
|
|
static void s3_do16_ldst_insn (char *);
|
2011-06-13 17:45:28 +08:00
|
|
|
static void s3_do16_slli_srli (char *);
|
|
|
|
static void s3_do16_ldiu (char *);
|
2009-03-02 18:33:08 +08:00
|
|
|
static void s3_do16_push_pop (char *);
|
|
|
|
static void s3_do16_rpush (char *);
|
|
|
|
static void s3_do16_rpop (char *);
|
|
|
|
static void s3_do16_branch (char *);
|
|
|
|
static void s3_do_lw48 (char *);
|
|
|
|
static void s3_do_sw48 (char *);
|
|
|
|
static void s3_do_ldi48 (char *);
|
|
|
|
static void s3_do_sdbbp48 (char *);
|
|
|
|
static void s3_do_and48 (char *);
|
|
|
|
static void s3_do_or48 (char *);
|
|
|
|
static void s3_do_mbitclr (char *);
|
|
|
|
static void s3_do_mbitset (char *);
|
|
|
|
static void s3_do_rdi16_pic (char *);
|
|
|
|
static void s3_do_addi_s_pic (char *);
|
|
|
|
static void s3_do_addi_u_pic (char *);
|
|
|
|
static void s3_do_lw_pic (char *);
|
|
|
|
|
|
|
|
#define MARCH_SCORE3 "score3"
|
|
|
|
#define MARCH_SCORE3D "score3d"
|
|
|
|
#define MARCH_SCORE7 "score7"
|
|
|
|
#define MARCH_SCORE7D "score7d"
|
|
|
|
#define MARCH_SCORE5 "score5"
|
|
|
|
#define MARCH_SCORE5U "score5u"
|
|
|
|
|
|
|
|
#define SCORE_BI_ENDIAN
|
|
|
|
|
|
|
|
#ifdef SCORE_BI_ENDIAN
|
|
|
|
#define OPTION_EB (OPTION_MD_BASE + 0)
|
|
|
|
#define OPTION_EL (OPTION_MD_BASE + 1)
|
|
|
|
#else
|
|
|
|
#if TARGET_BYTES_BIG_ENDIAN
|
|
|
|
#define OPTION_EB (OPTION_MD_BASE + 0)
|
|
|
|
#else
|
|
|
|
#define OPTION_EL (OPTION_MD_BASE + 1)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#define OPTION_FIXDD (OPTION_MD_BASE + 2)
|
|
|
|
#define OPTION_NWARN (OPTION_MD_BASE + 3)
|
|
|
|
#define OPTION_SCORE5 (OPTION_MD_BASE + 4)
|
|
|
|
#define OPTION_SCORE5U (OPTION_MD_BASE + 5)
|
|
|
|
#define OPTION_SCORE7 (OPTION_MD_BASE + 6)
|
|
|
|
#define OPTION_R1 (OPTION_MD_BASE + 7)
|
|
|
|
#define OPTION_O0 (OPTION_MD_BASE + 8)
|
|
|
|
#define OPTION_SCORE_VERSION (OPTION_MD_BASE + 9)
|
|
|
|
#define OPTION_PIC (OPTION_MD_BASE + 10)
|
|
|
|
#define OPTION_MARCH (OPTION_MD_BASE + 11)
|
|
|
|
#define OPTION_SCORE3 (OPTION_MD_BASE + 12)
|
|
|
|
|
|
|
|
/* This array holds the chars that always start a comment. If the
|
|
|
|
pre-processor is disabled, these aren't very useful. */
|
|
|
|
const char comment_chars[] = "#";
|
|
|
|
const char line_comment_chars[] = "#";
|
|
|
|
const char line_separator_chars[] = ";";
|
|
|
|
/* Chars that can be used to separate mant from exp in floating point numbers. */
|
|
|
|
const char EXP_CHARS[] = "eE";
|
|
|
|
const char FLT_CHARS[] = "rRsSfFdDxXeEpP";
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
#ifdef OBJ_ELF
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Pre-defined "_GLOBAL_OFFSET_TABLE_" */
|
|
|
|
symbolS *GOT_symbol;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
const pseudo_typeS md_pseudo_table[] =
|
|
|
|
{
|
|
|
|
{"bss", s_score_bss, 0},
|
|
|
|
{"text", s_score_text, 0},
|
|
|
|
{"word", cons, 4},
|
|
|
|
{"long", cons, 4},
|
|
|
|
{"extend", float_cons, 'x'},
|
|
|
|
{"ldouble", float_cons, 'x'},
|
|
|
|
{"packed", float_cons, 'p'},
|
|
|
|
{"end", s_score_end, 0},
|
|
|
|
{"ent", s_score_ent, 0},
|
|
|
|
{"frame", s_score_frame, 0},
|
|
|
|
{"rdata", s_change_sec, 'r'},
|
|
|
|
{"sdata", s_change_sec, 's'},
|
|
|
|
{"set", s_score_set, 0},
|
|
|
|
{"mask", s_score_mask, 'R'},
|
|
|
|
{"dword", cons, 8},
|
|
|
|
{"lcomm", s_score_lcomm, 1},
|
|
|
|
{"section", s_section, 0},
|
|
|
|
{"cpload", s_score_cpload, 0},
|
|
|
|
{"cprestore", s_score_cprestore, 0},
|
|
|
|
{"gpword", s_score_gpword, 0},
|
|
|
|
{"cpadd", s_score_cpadd, 0},
|
|
|
|
{0, 0, 0}
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *md_shortopts = "nO::g::G:";
|
|
|
|
struct option md_longopts[] =
|
|
|
|
{
|
|
|
|
#ifdef OPTION_EB
|
|
|
|
{"EB" , no_argument, NULL, OPTION_EB},
|
|
|
|
#endif
|
|
|
|
#ifdef OPTION_EL
|
|
|
|
{"EL" , no_argument, NULL, OPTION_EL},
|
2006-09-17 07:51:50 +08:00
|
|
|
#endif
|
2009-03-02 18:33:08 +08:00
|
|
|
{"FIXDD" , no_argument, NULL, OPTION_FIXDD},
|
|
|
|
{"NWARN" , no_argument, NULL, OPTION_NWARN},
|
|
|
|
{"SCORE5" , no_argument, NULL, OPTION_SCORE5},
|
|
|
|
{"SCORE5U", no_argument, NULL, OPTION_SCORE5U},
|
|
|
|
{"SCORE7" , no_argument, NULL, OPTION_SCORE7},
|
|
|
|
{"USE_R1" , no_argument, NULL, OPTION_R1},
|
|
|
|
{"O0" , no_argument, NULL, OPTION_O0},
|
|
|
|
{"V" , no_argument, NULL, OPTION_SCORE_VERSION},
|
|
|
|
{"KPIC" , no_argument, NULL, OPTION_PIC},
|
|
|
|
{"march=" , required_argument, NULL, OPTION_MARCH},
|
|
|
|
{"SCORE3" , no_argument, NULL, OPTION_SCORE3},
|
|
|
|
{NULL , no_argument, NULL, 0}
|
|
|
|
};
|
|
|
|
|
|
|
|
size_t md_longopts_size = sizeof (md_longopts);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
#define s3_GP 28
|
|
|
|
#define s3_PIC_CALL_REG 29
|
|
|
|
#define s3_MAX_LITERAL_POOL_SIZE 1024
|
|
|
|
#define s3_FAIL 0x80000000
|
|
|
|
#define s3_SUCCESS 0
|
|
|
|
#define s3_INSN48_SIZE 6
|
|
|
|
#define s3_INSN_SIZE 4
|
|
|
|
#define s3_INSN16_SIZE 2
|
|
|
|
#define s3_RELAX_INST_NUM 3
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* For score5u : div/mul will pop warning message, mmu/alw/asw will pop error message. */
|
2009-03-02 18:33:08 +08:00
|
|
|
#define s3_BAD_ARGS _("bad arguments to instruction")
|
|
|
|
#define s3_ERR_FOR_SCORE5U_MUL_DIV _("div / mul are reserved instructions")
|
|
|
|
#define s3_ERR_FOR_SCORE5U_MMU _("This architecture doesn't support mmu")
|
|
|
|
#define s3_ERR_FOR_SCORE5U_ATOMIC _("This architecture doesn't support atomic instruction")
|
|
|
|
#define s3_BAD_SKIP_COMMA s3_BAD_ARGS
|
|
|
|
#define s3_BAD_GARBAGE _("garbage following instruction");
|
|
|
|
|
|
|
|
#define s3_skip_whitespace(str) while (*(str) == ' ') ++(str)
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* The name of the readonly data section. */
|
2009-03-02 18:33:08 +08:00
|
|
|
#define s3_RDATA_SECTION_NAME (OUTPUT_FLAVOR == bfd_target_aout_flavour \
|
2006-09-17 07:51:50 +08:00
|
|
|
? ".data" \
|
|
|
|
: OUTPUT_FLAVOR == bfd_target_ecoff_flavour \
|
|
|
|
? ".rdata" \
|
|
|
|
: OUTPUT_FLAVOR == bfd_target_coff_flavour \
|
|
|
|
? ".rdata" \
|
|
|
|
: OUTPUT_FLAVOR == bfd_target_elf_flavour \
|
|
|
|
? ".rodata" \
|
|
|
|
: (abort (), ""))
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
#define s3_RELAX_ENCODE(old, new, type, reloc1, reloc2, opt) \
|
2006-09-17 07:51:50 +08:00
|
|
|
((relax_substateT) \
|
|
|
|
(((old) << 23) \
|
|
|
|
| ((new) << 16) \
|
|
|
|
| ((type) << 9) \
|
|
|
|
| ((reloc1) << 5) \
|
|
|
|
| ((reloc2) << 1) \
|
|
|
|
| ((opt) ? 1 : 0)))
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
#define s3_RELAX_OLD(i) (((i) >> 23) & 0x7f)
|
|
|
|
#define s3_RELAX_NEW(i) (((i) >> 16) & 0x7f)
|
|
|
|
#define s3_RELAX_TYPE(i) (((i) >> 9) & 0x7f)
|
|
|
|
#define s3_RELAX_RELOC1(i) ((valueT) ((i) >> 5) & 0xf)
|
|
|
|
#define s3_RELAX_RELOC2(i) ((valueT) ((i) >> 1) & 0xf)
|
|
|
|
#define s3_RELAX_OPT(i) ((i) & 1)
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
#define s3_SET_INSN_ERROR(s) (s3_inst.error = (s))
|
|
|
|
#define s3_INSN_IS_PCE_P(s) (strstr (str, "||") != NULL)
|
|
|
|
#define s3_INSN_IS_48_P(s) (strstr (str, "48") != NULL)
|
|
|
|
#define s3_GET_INSN_CLASS(type) (s3_get_insn_class_from_type (type))
|
|
|
|
#define s3_GET_INSN_SIZE(type) ((s3_GET_INSN_CLASS (type) == INSN_CLASS_16) \
|
|
|
|
? s3_INSN16_SIZE : (s3_GET_INSN_CLASS (type) == INSN_CLASS_48) \
|
|
|
|
? s3_INSN48_SIZE : s3_INSN_SIZE)
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
#define s3_INSN_NAME_LEN 16
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Relax will need some padding for alignment. */
|
|
|
|
#define s3_RELAX_PAD_BYTE 3
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
#define s3_USE_GLOBAL_POINTER_OPT 1
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Enumeration matching entries in table above. */
|
|
|
|
enum s3_score_reg_type
|
|
|
|
{
|
|
|
|
s3_REG_TYPE_SCORE = 0,
|
|
|
|
#define s3_REG_TYPE_FIRST s3_REG_TYPE_SCORE
|
|
|
|
s3_REG_TYPE_SCORE_SR = 1,
|
|
|
|
s3_REG_TYPE_SCORE_CR = 2,
|
|
|
|
s3_REG_TYPE_MAX = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
enum s3_score_pic_level
|
|
|
|
{
|
|
|
|
s3_NO_PIC,
|
|
|
|
s3_PIC
|
|
|
|
};
|
|
|
|
static enum s3_score_pic_level s3_score_pic = s3_NO_PIC;
|
2007-01-22 16:55:34 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
enum s3_insn_type_for_dependency
|
|
|
|
{
|
|
|
|
s3_D_mtcr,
|
|
|
|
s3_D_all_insn
|
|
|
|
};
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
struct s3_insn_to_dependency
|
|
|
|
{
|
2016-03-20 13:34:02 +08:00
|
|
|
const char *insn_name;
|
2009-03-02 18:33:08 +08:00
|
|
|
enum s3_insn_type_for_dependency type;
|
|
|
|
};
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
struct s3_data_dependency
|
|
|
|
{
|
|
|
|
enum s3_insn_type_for_dependency pre_insn_type;
|
|
|
|
char pre_reg[6];
|
|
|
|
enum s3_insn_type_for_dependency cur_insn_type;
|
|
|
|
char cur_reg[6];
|
|
|
|
int bubblenum_7;
|
|
|
|
int bubblenum_3;
|
|
|
|
int warn_or_error; /* warning - 0; error - 1 */
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct s3_insn_to_dependency s3_insn_to_dependency_table[] =
|
|
|
|
{
|
2017-01-23 23:23:07 +08:00
|
|
|
/* move special instruction. */
|
2009-03-02 18:33:08 +08:00
|
|
|
{"mtcr", s3_D_mtcr},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct s3_data_dependency s3_data_dependency_table[] =
|
|
|
|
{
|
2017-01-23 23:23:07 +08:00
|
|
|
/* Status register. */
|
2009-03-02 18:33:08 +08:00
|
|
|
{s3_D_mtcr, "cr0", s3_D_all_insn, "", 5, 1, 0},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Used to contain constructed error messages. */
|
|
|
|
static char s3_err_msg[255];
|
|
|
|
|
|
|
|
static int s3_fix_data_dependency = 0;
|
|
|
|
static int s3_warn_fix_data_dependency = 1;
|
|
|
|
|
|
|
|
static int s3_in_my_get_expression = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Default, pop warning message when using r1. */
|
2009-03-02 18:33:08 +08:00
|
|
|
static int s3_nor1 = 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Default will do instruction relax, -O0 will set s3_g_opt = 0. */
|
|
|
|
static unsigned int s3_g_opt = 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* The size of the small data section. */
|
2009-03-02 18:33:08 +08:00
|
|
|
static unsigned int s3_g_switch_value = 8;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static segT s3_pdr_seg;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
struct s3_score_it
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
char name[s3_INSN_NAME_LEN];
|
|
|
|
bfd_vma instruction;
|
|
|
|
bfd_vma relax_inst;
|
2006-09-17 07:51:50 +08:00
|
|
|
int size;
|
|
|
|
int relax_size;
|
|
|
|
enum score_insn_type type;
|
2009-03-02 18:33:08 +08:00
|
|
|
char str[s3_MAX_LITERAL_POOL_SIZE];
|
2006-09-17 07:51:50 +08:00
|
|
|
const char *error;
|
|
|
|
int bwarn;
|
2009-03-02 18:33:08 +08:00
|
|
|
char reg[s3_INSN_NAME_LEN];
|
2006-09-17 07:51:50 +08:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
bfd_reloc_code_real_type type;
|
|
|
|
expressionS exp;
|
|
|
|
int pc_rel;
|
|
|
|
}reloc;
|
|
|
|
};
|
2009-03-02 18:33:08 +08:00
|
|
|
static struct s3_score_it s3_inst;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
typedef struct s3_proc
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
symbolS *isym;
|
|
|
|
unsigned long reg_mask;
|
|
|
|
unsigned long reg_offset;
|
|
|
|
unsigned long fpreg_mask;
|
|
|
|
unsigned long leaf;
|
|
|
|
unsigned long frame_offset;
|
|
|
|
unsigned long frame_reg;
|
|
|
|
unsigned long pc_reg;
|
2009-03-02 18:33:08 +08:00
|
|
|
} s3_procS;
|
|
|
|
static s3_procS s3_cur_proc;
|
|
|
|
static s3_procS *s3_cur_proc_ptr;
|
|
|
|
static int s3_numprocs;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* Structure for a hash table entry for a register. */
|
2009-03-02 18:33:08 +08:00
|
|
|
struct s3_reg_entry
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
int number;
|
|
|
|
};
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static const struct s3_reg_entry s3_score_rn_table[] =
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
{"r0", 0}, {"r1", 1}, {"r2", 2}, {"r3", 3},
|
|
|
|
{"r4", 4}, {"r5", 5}, {"r6", 6}, {"r7", 7},
|
|
|
|
{"r8", 8}, {"r9", 9}, {"r10", 10}, {"r11", 11},
|
|
|
|
{"r12", 12}, {"r13", 13}, {"r14", 14}, {"r15", 15},
|
|
|
|
{"r16", 16}, {"r17", 17}, {"r18", 18}, {"r19", 19},
|
|
|
|
{"r20", 20}, {"r21", 21}, {"r22", 22}, {"r23", 23},
|
|
|
|
{"r24", 24}, {"r25", 25}, {"r26", 26}, {"r27", 27},
|
|
|
|
{"r28", 28}, {"r29", 29}, {"r30", 30}, {"r31", 31},
|
|
|
|
{NULL, 0}
|
|
|
|
};
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static const struct s3_reg_entry s3_score_srn_table[] =
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
{"sr0", 0}, {"sr1", 1}, {"sr2", 2},
|
|
|
|
{NULL, 0}
|
|
|
|
};
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static const struct s3_reg_entry s3_score_crn_table[] =
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
{"cr0", 0}, {"cr1", 1}, {"cr2", 2}, {"cr3", 3},
|
|
|
|
{"cr4", 4}, {"cr5", 5}, {"cr6", 6}, {"cr7", 7},
|
|
|
|
{"cr8", 8}, {"cr9", 9}, {"cr10", 10}, {"cr11", 11},
|
|
|
|
{"cr12", 12}, {"cr13", 13}, {"cr14", 14}, {"cr15", 15},
|
|
|
|
{"cr16", 16}, {"cr17", 17}, {"cr18", 18}, {"cr19", 19},
|
|
|
|
{"cr20", 20}, {"cr21", 21}, {"cr22", 22}, {"cr23", 23},
|
|
|
|
{"cr24", 24}, {"cr25", 25}, {"cr26", 26}, {"cr27", 27},
|
|
|
|
{"cr28", 28}, {"cr29", 29}, {"cr30", 30}, {"cr31", 31},
|
|
|
|
{NULL, 0}
|
|
|
|
};
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
struct s3_reg_map
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
const struct s3_reg_entry *names;
|
2006-09-17 07:51:50 +08:00
|
|
|
int max_regno;
|
|
|
|
struct hash_control *htab;
|
|
|
|
const char *expected;
|
|
|
|
};
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static struct s3_reg_map s3_all_reg_maps[] =
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
{s3_score_rn_table, 31, NULL, N_("S+core register expected")},
|
|
|
|
{s3_score_srn_table, 2, NULL, N_("S+core special-register expected")},
|
|
|
|
{s3_score_crn_table, 31, NULL, N_("S+core co-processor register expected")},
|
2006-09-17 07:51:50 +08:00
|
|
|
};
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static struct hash_control *s3_score_ops_hsh = NULL;
|
|
|
|
static struct hash_control *s3_dependency_insn_hsh = NULL;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
struct s3_datafield_range
|
|
|
|
{
|
|
|
|
int data_type;
|
|
|
|
int bits;
|
|
|
|
int range[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct s3_datafield_range s3_score_df_range[] =
|
|
|
|
{
|
|
|
|
{_IMM4, 4, {0, (1 << 4) - 1}}, /* ( 0 ~ 15 ) */
|
|
|
|
{_IMM5, 5, {0, (1 << 5) - 1}}, /* ( 0 ~ 31 ) */
|
|
|
|
{_IMM8, 8, {0, (1 << 8) - 1}}, /* ( 0 ~ 255 ) */
|
|
|
|
{_IMM14, 14, {0, (1 << 14) - 1}}, /* ( 0 ~ 16383) */
|
|
|
|
{_IMM15, 15, {0, (1 << 15) - 1}}, /* ( 0 ~ 32767) */
|
|
|
|
{_IMM16, 16, {0, (1 << 16) - 1}}, /* ( 0 ~ 65535) */
|
|
|
|
{_SIMM10, 10, {-(1 << 9), (1 << 9) - 1}}, /* ( -512 ~ 511 ) */
|
|
|
|
{_SIMM12, 12, {-(1 << 11), (1 << 11) - 1}}, /* ( -2048 ~ 2047 ) */
|
|
|
|
{_SIMM14, 14, {-(1 << 13), (1 << 13) - 1}}, /* ( -8192 ~ 8191 ) */
|
|
|
|
{_SIMM15, 15, {-(1 << 14), (1 << 14) - 1}}, /* (-16384 ~ 16383) */
|
|
|
|
{_SIMM16, 16, {-(1 << 15), (1 << 15) - 1}}, /* (-32768 ~ 32767) */
|
|
|
|
{_SIMM14_NEG, 14, {-(1 << 13), (1 << 13) - 1}}, /* ( -8191 ~ 8192 ) */
|
|
|
|
{_IMM16_NEG, 16, {0, (1 << 16) - 1}}, /* (-65535 ~ 0 ) */
|
|
|
|
{_SIMM16_NEG, 16, {-(1 << 15), (1 << 15) - 1}}, /* (-32768 ~ 32767) */
|
|
|
|
{_IMM20, 20, {0, (1 << 20) - 1}},
|
|
|
|
{_IMM25, 25, {0, (1 << 25) - 1}},
|
|
|
|
{_DISP8div2, 8, {-(1 << 8), (1 << 8) - 1}}, /* ( -256 ~ 255 ) */
|
|
|
|
{_DISP11div2, 11, {0, 0}},
|
|
|
|
{_DISP19div2, 19, {-(1 << 19), (1 << 19) - 1}}, /* (-524288 ~ 524287) */
|
|
|
|
{_DISP24div2, 24, {0, 0}},
|
|
|
|
{_VALUE, 32, {0, ((unsigned int)1 << 31) - 1}},
|
|
|
|
{_VALUE_HI16, 16, {0, (1 << 16) - 1}},
|
|
|
|
{_VALUE_LO16, 16, {0, (1 << 16) - 1}},
|
|
|
|
{_VALUE_LDST_LO16, 16, {0, (1 << 16) - 1}},
|
|
|
|
{_SIMM16_LA, 16, {-(1 << 15), (1 << 15) - 1}}, /* (-32768 ~ 32767) */
|
|
|
|
{_IMM5_RSHIFT_1, 5, {0, (1 << 6) - 1}}, /* ( 0 ~ 63 ) */
|
|
|
|
{_IMM5_RSHIFT_2, 5, {0, (1 << 7) - 1}}, /* ( 0 ~ 127 ) */
|
|
|
|
{_SIMM16_LA_POS, 16, {0, (1 << 15) - 1}}, /* ( 0 ~ 32767) */
|
|
|
|
{_IMM5_RANGE_8_31, 5, {8, 31}}, /* But for cop0 the valid data : (8 ~ 31). */
|
|
|
|
{_IMM10_RSHIFT_2, 10, {-(1 << 11), (1 << 11) - 1}}, /* For ldc#, stc#. */
|
|
|
|
{_SIMM10, 10, {0, (1 << 10) - 1}}, /* ( -1024 ~ 1023 ) */
|
|
|
|
{_SIMM12, 12, {0, (1 << 12) - 1}}, /* ( -2048 ~ 2047 ) */
|
|
|
|
{_SIMM14, 14, {0, (1 << 14) - 1}}, /* ( -8192 ~ 8191 ) */
|
|
|
|
{_SIMM15, 15, {0, (1 << 15) - 1}}, /* (-16384 ~ 16383) */
|
|
|
|
{_SIMM16, 16, {0, (1 << 16) - 1}}, /* (-65536 ~ 65536) */
|
|
|
|
{_SIMM14_NEG, 14, {0, (1 << 16) - 1}}, /* ( -8191 ~ 8192 ) */
|
|
|
|
{_IMM16_NEG, 16, {0, (1 << 16) - 1}}, /* ( 65535 ~ 0 ) */
|
|
|
|
{_SIMM16_NEG, 16, {0, (1 << 16) - 1}}, /* ( 65535 ~ 0 ) */
|
|
|
|
{_IMM20, 20, {0, (1 << 20) - 1}}, /* (-32768 ~ 32767) */
|
|
|
|
{_IMM25, 25, {0, (1 << 25) - 1}}, /* (-32768 ~ 32767) */
|
|
|
|
{_GP_IMM15, 15, {0, (1 << 15) - 1}}, /* ( 0 ~ 65535) */
|
|
|
|
{_GP_IMM14, 14, {0, (1 << 14) - 1}}, /* ( 0 ~ 65535) */
|
|
|
|
{_SIMM16_pic, 16, {-(1 << 15), (1 << 15) - 1}}, /* (-32768 ~ 32767) */
|
|
|
|
{_IMM16_LO16_pic, 16, {0, (1 << 16) - 1}}, /* ( 65535 ~ 0 ) */
|
|
|
|
{_IMM16_pic, 16, {0, (1 << 16) - 1}}, /* ( 0 ~ 65535) */
|
|
|
|
{_SIMM5, 5, {-(1 << 4), (1 << 4) - 1}}, /* ( -16 ~ 15 ) */
|
|
|
|
{_SIMM6, 6, {-(1 << 5), (1 << 5) - 1}}, /* ( -32 ~ 31 ) */
|
2011-06-13 17:45:28 +08:00
|
|
|
{_IMM32, 32, {0, 0xfffffff}},
|
|
|
|
{_SIMM32, 32, {-0x80000000, 0x7fffffff}},
|
|
|
|
{_IMM11, 11, {0, (1 << 11) - 1}},
|
2009-03-02 18:33:08 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct s3_asm_opcode
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Instruction name. */
|
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 06:11:02 +08:00
|
|
|
const char *template_name;
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
/* Instruction Opcode. */
|
|
|
|
bfd_vma value;
|
|
|
|
|
|
|
|
/* Instruction bit mask. */
|
|
|
|
bfd_vma bitmask;
|
|
|
|
|
|
|
|
/* Relax instruction opcode. 0x8000 imply no relaxation. */
|
|
|
|
bfd_vma relax_value;
|
|
|
|
|
|
|
|
/* Instruction type. */
|
|
|
|
enum score_insn_type type;
|
|
|
|
|
|
|
|
/* Function to call to parse args. */
|
|
|
|
void (*parms) (char *);
|
2006-09-17 07:51:50 +08:00
|
|
|
};
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
static const struct s3_asm_opcode s3_score_ldst_insns[] =
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
|
|
|
{"lw", 0x20000000, 0x3e000000, 0x1000, Rd_rvalueRs_SI15, s3_do_ldst_insn},
|
|
|
|
{"lw", 0x06000000, 0x3e000007, 0x8000, Rd_rvalueRs_preSI12, s3_do_ldst_insn},
|
|
|
|
{"lw", 0x0e000000, 0x3e000007, 0x0040, Rd_rvalueRs_postSI12, s3_do_ldst_insn},
|
|
|
|
{"lh", 0x22000000, 0x3e000000, 0x8000, Rd_rvalueRs_SI15, s3_do_ldst_insn},
|
|
|
|
{"lh", 0x06000001, 0x3e000007, 0x8000, Rd_rvalueRs_preSI12, s3_do_ldst_insn},
|
|
|
|
{"lh", 0x0e000001, 0x3e000007, 0x8000, Rd_rvalueRs_postSI12, s3_do_ldst_insn},
|
|
|
|
{"lhu", 0x24000000, 0x3e000000, 0x8000, Rd_rvalueRs_SI15, s3_do_ldst_insn},
|
|
|
|
{"lhu", 0x06000002, 0x3e000007, 0x8000, Rd_rvalueRs_preSI12, s3_do_ldst_insn},
|
|
|
|
{"lhu", 0x0e000002, 0x3e000007, 0x8000, Rd_rvalueRs_postSI12, s3_do_ldst_insn},
|
|
|
|
{"lb", 0x26000000, 0x3e000000, 0x8000, Rd_rvalueRs_SI15, s3_do_ldst_insn},
|
|
|
|
{"lb", 0x06000003, 0x3e000007, 0x8000, Rd_rvalueRs_preSI12, s3_do_ldst_insn},
|
|
|
|
{"lb", 0x0e000003, 0x3e000007, 0x8000, Rd_rvalueRs_postSI12, s3_do_ldst_insn},
|
|
|
|
{"sw", 0x28000000, 0x3e000000, 0x2000, Rd_lvalueRs_SI15, s3_do_ldst_insn},
|
|
|
|
{"sw", 0x06000004, 0x3e000007, 0x0060, Rd_lvalueRs_preSI12, s3_do_ldst_insn},
|
|
|
|
{"sw", 0x0e000004, 0x3e000007, 0x8000, Rd_lvalueRs_postSI12, s3_do_ldst_insn},
|
|
|
|
{"sh", 0x2a000000, 0x3e000000, 0x8000, Rd_lvalueRs_SI15, s3_do_ldst_insn},
|
|
|
|
{"sh", 0x06000005, 0x3e000007, 0x8000, Rd_lvalueRs_preSI12, s3_do_ldst_insn},
|
|
|
|
{"sh", 0x0e000005, 0x3e000007, 0x8000, Rd_lvalueRs_postSI12, s3_do_ldst_insn},
|
|
|
|
{"lbu", 0x2c000000, 0x3e000000, 0x8000, Rd_rvalueRs_SI15, s3_do_ldst_insn},
|
|
|
|
{"lbu", 0x06000006, 0x3e000007, 0x8000, Rd_rvalueRs_preSI12, s3_do_ldst_insn},
|
|
|
|
{"lbu", 0x0e000006, 0x3e000007, 0x8000, Rd_rvalueRs_postSI12, s3_do_ldst_insn},
|
|
|
|
{"sb", 0x2e000000, 0x3e000000, 0x8000, Rd_lvalueRs_SI15, s3_do_ldst_insn},
|
|
|
|
{"sb", 0x06000007, 0x3e000007, 0x8000, Rd_lvalueRs_preSI12, s3_do_ldst_insn},
|
|
|
|
{"sb", 0x0e000007, 0x3e000007, 0x8000, Rd_lvalueRs_postSI12, s3_do_ldst_insn},
|
2006-09-17 07:51:50 +08:00
|
|
|
};
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
static const struct s3_asm_opcode s3_score_insns[] =
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
|
|
|
{"abs", 0x3800000a, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_dsp3},
|
|
|
|
{"abs.s", 0x3800004b, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_dsp3},
|
|
|
|
{"add", 0x00000010, 0x3e0003ff, 0x4800, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"add.c", 0x00000011, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"add.s", 0x38000048, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_dsp2},
|
|
|
|
{"addc", 0x00000012, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"addc.c", 0x00000013, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"addi", 0x02000000, 0x3e0e0001, 0x5c00, Rd_SI16, s3_do_rdsi16},
|
|
|
|
{"addi.c", 0x02000001, 0x3e0e0001, 0x8000, Rd_SI16, s3_do_rdsi16},
|
|
|
|
{"addis", 0x0a000000, 0x3e0e0001, 0x8000, Rd_SI16, s3_do_rdi16},
|
|
|
|
{"addis.c", 0x0a000001, 0x3e0e0001, 0x8000, Rd_SI16, s3_do_rdi16},
|
|
|
|
{"addi!", 0x5c00, 0x7c00, 0x8000, Rd_SI6, s3_do16_addi},
|
|
|
|
{"addri", 0x10000000, 0x3e000001, 0x8000, Rd_Rs_SI14, s3_do_rdrssi14},
|
|
|
|
{"addri.c", 0x10000001, 0x3e000001, 0x8000, Rd_Rs_SI14, s3_do_rdrssi14},
|
|
|
|
|
|
|
|
/* add.c <-> add!. */
|
|
|
|
{"add!", 0x4800, 0x7f00, 0x8000, Rd_Rs, s3_do16_rdrs2},
|
|
|
|
{"subi", 0x02000000, 0x3e0e0001, 0x8000, Rd_SI16, s3_do_sub_rdsi16},
|
|
|
|
{"subi.c", 0x02000001, 0x3e0e0001, 0x8000, Rd_SI16, s3_do_sub_rdsi16},
|
|
|
|
{"subis", 0x0a000000, 0x3e0e0001, 0x8000, Rd_SI16, s3_do_sub_rdi16},
|
|
|
|
{"subis.c", 0x0a000001, 0x3e0e0001, 0x8000, Rd_SI16, s3_do_sub_rdi16},
|
|
|
|
{"subri", 0x10000000, 0x3e000001, 0x8000, Rd_Rs_SI14, s3_do_sub_rdrssi14},
|
|
|
|
{"subri.c", 0x10000001, 0x3e000001, 0x8000, Rd_Rs_SI14, s3_do_sub_rdrssi14},
|
|
|
|
{"and", 0x00000020, 0x3e0003ff, 0x4b00, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"and.c", 0x00000021, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"andi", 0x02080000, 0x3e0e0001, 0x8000, Rd_I16, s3_do_rdi16},
|
|
|
|
{"andi.c", 0x02080001, 0x3e0e0001, 0x8000, Rd_I16, s3_do_rdi16},
|
|
|
|
{"andis", 0x0a080000, 0x3e0e0001, 0x8000, Rd_I16, s3_do_rdi16},
|
|
|
|
{"andis.c", 0x0a080001, 0x3e0e0001, 0x8000, Rd_I16, s3_do_rdi16},
|
|
|
|
{"andri", 0x18000000, 0x3e000001, 0x8000, Rd_Rs_I14, s3_do_rdrsi14},
|
|
|
|
{"andri.c", 0x18000001, 0x3e000001, 0x8000, Rd_Rs_I14, s3_do_rdrsi14},
|
|
|
|
|
|
|
|
/* and.c <-> and!. */
|
|
|
|
{"and!", 0x4b00, 0x7f00, 0x8000, Rd_Rs, s3_do16_rdrs2},
|
|
|
|
{"bcs", 0x08000000, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bcc", 0x08000400, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bcnz", 0x08003800, 0x3e007c01, 0x3200, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bcsl", 0x08000001, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bccl", 0x08000401, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bcnzl", 0x08003801, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bcnz!", 0x3200, 0x7f00, 0x08003800, PC_DISP8div2, s3_do16_branch},
|
|
|
|
{"beq", 0x08001000, 0x3e007c01, 0x3800, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"beql", 0x08001001, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"beq!", 0x3800, 0x7e00, 0x08001000, PC_DISP8div2, s3_do16_branch},
|
|
|
|
{"bgtu", 0x08000800, 0x3e007c01, 0x3400, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bgt", 0x08001800, 0x3e007c01, 0x3c00, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bge", 0x08002000, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bgtul", 0x08000801, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bgtl", 0x08001801, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bgel", 0x08002001, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bgtu!", 0x3400, 0x7e00, 0x08000800, PC_DISP8div2, s3_do16_branch},
|
|
|
|
{"bgt!", 0x3c00, 0x7e00, 0x08001800, PC_DISP8div2, s3_do16_branch},
|
|
|
|
{"bitclr", 0x00000028, 0x3e0003ff, 0x5000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"bitclr.c", 0x00000029, 0x3e0003ff, 0x8000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
|
|
|
|
{"mbitclr", 0x00000064, 0x3e00007e, 0x8000, Ra_I9_I5, s3_do_mbitclr},
|
|
|
|
{"mbitset", 0x0000006c, 0x3e00007e, 0x8000, Ra_I9_I5, s3_do_mbitset},
|
|
|
|
|
|
|
|
{"bitrev", 0x3800000c, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_dsp2},
|
|
|
|
{"bitset", 0x0000002a, 0x3e0003ff, 0x5200, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"bitset.c", 0x0000002b, 0x3e0003ff, 0x8000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"bittst.c", 0x0000002d, 0x3e0003ff, 0x5400, x_Rs_I5, s3_do_xrsi5},
|
|
|
|
{"bittgl", 0x0000002e, 0x3e0003ff, 0x5600, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"bittgl.c", 0x0000002f, 0x3e0003ff, 0x8000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"bitclr!", 0x5000, 0x7e00, 0x8000, Rd_I5, s3_do16_rdi5},
|
|
|
|
{"bitset!", 0x5200, 0x7e00, 0x8000, Rd_I5, s3_do16_rdi5},
|
|
|
|
{"bittst!", 0x5400, 0x7e00, 0x8000, Rd_I5, s3_do16_rdi5},
|
|
|
|
{"bittgl!", 0x5600, 0x7e00, 0x8000, Rd_I5, s3_do16_rdi5},
|
|
|
|
{"bleu", 0x08000c00, 0x3e007c01, 0x3600, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"ble", 0x08001c00, 0x3e007c01, 0x3e00, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"blt", 0x08002400, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bleul", 0x08000c01, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"blel", 0x08001c01, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bltl", 0x08002401, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bl", 0x08003c01, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bleu!", 0x3600, 0x7e00, 0x08000c00, PC_DISP8div2, s3_do16_branch},
|
|
|
|
{"ble!", 0x3e00, 0x7e00, 0x08001c00, PC_DISP8div2, s3_do16_branch},
|
|
|
|
{"bmi", 0x08002800, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bmil", 0x08002801, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bne", 0x08001400, 0x3e007c01, 0x3a00, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bnel", 0x08001401, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bne!", 0x3a00, 0x7e00, 0x08001400, PC_DISP8div2, s3_do16_branch},
|
|
|
|
{"bpl", 0x08002c00, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bpll", 0x08002c01, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"brcs", 0x00000008, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brcc", 0x00000408, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brgtu", 0x00000808, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brleu", 0x00000c08, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"breq", 0x00001008, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brne", 0x00001408, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brgt", 0x00001808, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brle", 0x00001c08, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brge", 0x00002008, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brlt", 0x00002408, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brmi", 0x00002808, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brpl", 0x00002c08, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brvs", 0x00003008, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brvc", 0x00003408, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brcnz", 0x00003808, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"br", 0x00003c08, 0x3e007fff, 0x0080, x_Rs_x, s3_do_rs},
|
|
|
|
{"brcsl", 0x00000009, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brccl", 0x00000409, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brgtul", 0x00000809, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brleul", 0x00000c09, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
2011-06-13 17:45:28 +08:00
|
|
|
{"breql", 0x00001009, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
2009-03-02 18:33:08 +08:00
|
|
|
{"brnel", 0x00001409, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brgtl", 0x00001809, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brlel", 0x00001c09, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brgel", 0x00002009, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brltl", 0x00002409, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brmil", 0x00002809, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brpll", 0x00002c09, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brvsl", 0x00003009, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brvcl", 0x00003409, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brcnzl", 0x00003809, 0x3e007fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"brl", 0x00003c09, 0x3e007fff, 0x00a0, x_Rs_x, s3_do_rs},
|
|
|
|
{"br!", 0x0080, 0x7fe0, 0x8000, x_Rs, s3_do16_br},
|
|
|
|
{"brl!", 0x00a0, 0x7fe0, 0x8000, x_Rs, s3_do16_br},
|
|
|
|
{"brr!", 0x00c0, 0x7fe0, 0x8000, x_Rs, s3_do16_brr},
|
|
|
|
{"bvs", 0x08003000, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bvc", 0x08003400, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bvsl", 0x08003001, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"bvcl", 0x08003401, 0x3e007c01, 0x8000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"b!", 0x3000, 0x7e00, 0x08003c00, PC_DISP8div2, s3_do16_branch},
|
|
|
|
{"b", 0x08003c00, 0x3e007c01, 0x3000, PC_DISP19div2, s3_do_branch},
|
|
|
|
{"cache", 0x30000000, 0x3ff00000, 0x8000, OP5_rvalueRs_SI15, s3_do_cache},
|
|
|
|
{"ceinst", 0x38000000, 0x3e000000, 0x8000, I5_Rs_Rs_I5_OP5, s3_do_ceinst},
|
|
|
|
{"clz", 0x0000001c, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"cmp.c", 0x00300019, 0x3ff003ff, 0x4400, x_Rs_Rs, s3_do_rsrs},
|
|
|
|
{"cmpz.c", 0x0030001b, 0x3ff07fff, 0x8000, x_Rs_x, s3_do_rs},
|
|
|
|
{"cmpi.c", 0x02040001, 0x3e0e0001, 0x6000, Rd_SI16, s3_do_rdsi16},
|
|
|
|
|
|
|
|
/* cmp.c <-> cmp!. */
|
|
|
|
{"cmp!", 0x4400, 0x7c00, 0x8000, Rd_Rs, s3_do16_mv_cmp},
|
|
|
|
{"cmpi!", 0x6000, 0x7c00, 0x8000, Rd_SI5, s3_do16_cmpi},
|
|
|
|
{"cop1", 0x0c00000c, 0x3e00001f, 0x8000, Rd_Rs_Rs_imm, s3_do_crdcrscrsimm5},
|
|
|
|
{"cop2", 0x0c000014, 0x3e00001f, 0x8000, Rd_Rs_Rs_imm, s3_do_crdcrscrsimm5},
|
|
|
|
{"cop3", 0x0c00001c, 0x3e00001f, 0x8000, Rd_Rs_Rs_imm, s3_do_crdcrscrsimm5},
|
|
|
|
{"drte", 0x0c0000a4, 0x3e0003ff, 0x8000, NO_OPD, s3_do_empty},
|
|
|
|
{"disint!", 0x00e0, 0xffe1, 0x8000, NO16_OPD, s3_do16_int},
|
|
|
|
{"enint!", 0x00e1, 0xffe1, 0x8000, NO16_OPD, s3_do16_int},
|
|
|
|
{"extsb", 0x00000058, 0x3e0003ff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"extsb.c", 0x00000059, 0x3e0003ff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"extsh", 0x0000005a, 0x3e0003ff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"extsh.c", 0x0000005b, 0x3e0003ff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"extzb", 0x0000005c, 0x3e0003ff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"extzb.c", 0x0000005d, 0x3e0003ff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"extzh", 0x0000005e, 0x3e0003ff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"extzh.c", 0x0000005f, 0x3e0003ff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"jl", 0x04000001, 0x3e000001, 0x8000, PC_DISP24div2, s3_do_jump},
|
|
|
|
{"j", 0x04000000, 0x3e000001, 0x8000, PC_DISP24div2, s3_do_jump},
|
|
|
|
{"alw", 0x0000000c, 0x3e0003ff, 0x8000, Rd_rvalue32Rs, s3_do_ldst_atomic},
|
|
|
|
{"lcb", 0x00000060, 0x3e0003ff, 0x8000, x_rvalueRs_post4, s3_do_ldst_unalign},
|
|
|
|
{"lcw", 0x00000062, 0x3e0003ff, 0x8000, Rd_rvalueRs_post4, s3_do_ldst_unalign},
|
|
|
|
{"lce", 0x00000066, 0x3e0003ff, 0x8000, Rd_rvalueRs_post4, s3_do_ldst_unalign},
|
|
|
|
{"ldc1", 0x0c00000a, 0x3e00001f, 0x8000, Rd_rvalueRs_SI10, s3_do_ldst_cop},
|
|
|
|
{"ldc2", 0x0c000012, 0x3e00001f, 0x8000, Rd_rvalueRs_SI10, s3_do_ldst_cop},
|
|
|
|
{"ldc3", 0x0c00001a, 0x3e00001f, 0x8000, Rd_rvalueRs_SI10, s3_do_ldst_cop},
|
|
|
|
|
|
|
|
/* s3_inst.relax */
|
|
|
|
{"ldi", 0x020c0000, 0x3e0e0000, 0x6400, Rd_SI16, s3_do_rdsi16},
|
|
|
|
{"ldis", 0x0a0c0000, 0x3e0e0000, 0x8000, Rd_I16, s3_do_ldis},
|
2011-06-13 17:45:28 +08:00
|
|
|
|
|
|
|
/* ldi <-> ldiu!. */
|
2009-03-02 18:33:08 +08:00
|
|
|
{"ldiu!", 0x6400, 0x7c00, 0x8000, Rd_I5, s3_do16_ldiu},
|
|
|
|
|
|
|
|
/*ltbb! , ltbh! ltbw! */
|
|
|
|
{"ltbw", 0x00000032, 0x03ff, 0x8000, Rd_Rs_Rs, s3_do_ltb},
|
|
|
|
{"ltbh", 0x00000132, 0x03ff, 0x8000, Rd_Rs_Rs, s3_do_ltb},
|
|
|
|
{"ltbb", 0x00000332, 0x03ff, 0x8000, Rd_Rs_Rs, s3_do_ltb},
|
|
|
|
{"lw!", 0x1000, 0x7000, 0x8000, Rd_rvalueRs, s3_do16_ldst_insn},
|
|
|
|
{"mfcel", 0x00000448, 0x3e007fff, 0x8000, Rd_x_x, s3_do_rd},
|
|
|
|
{"mfcel!", 0x7100, 0x7ff0, 0x00000448, x_Rs, s3_do16_dsp},
|
|
|
|
{"mad", 0x38000000, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"mad.f!", 0x7400, 0x7f00, 0x38000080, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"madh", 0x38000203, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"madh.fs", 0x380002c3, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"madh.fs!", 0x7b00, 0x7f00, 0x380002c3, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"madl", 0x38000002, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"madl.fs", 0x380000c2, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"madl.fs!", 0x7a00, 0x7f00, 0x380000c2, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"madu", 0x38000020, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"madu!", 0x7500, 0x7f00, 0x38000020, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"mad.f", 0x38000080, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"max", 0x38000007, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_dsp2},
|
|
|
|
{"mazh", 0x38000303, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"mazh.f", 0x38000383, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"mazh.f!", 0x7900, 0x7f00, 0x3800038c, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"mazl", 0x38000102, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"mazl.f", 0x38000182, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"mazl.f!", 0x7800, 0x7f00, 0x38000182, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"mfceh", 0x00000848, 0x3e007fff, 0x8000, Rd_x_x, s3_do_rd},
|
|
|
|
{"mfceh!", 0x7110, 0x7ff0, 0x00000848, x_Rs, s3_do16_dsp},
|
|
|
|
{"mfcehl", 0x00000c48, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mfsr", 0x00000050, 0x3e0003ff, 0x8000, Rd_x_I5, s3_do_rdsrs},
|
|
|
|
{"mfcr", 0x0c000001, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"mfc1", 0x0c000009, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"mfc2", 0x0c000011, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"mfc3", 0x0c000019, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"mfcc1", 0x0c00000f, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"mfcc2", 0x0c000017, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"mfcc3", 0x0c00001f, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"min", 0x38000006, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_dsp2},
|
|
|
|
{"msb", 0x38000001, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"msb.f!", 0x7600, 0x7f00, 0x38000081, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"msbh", 0x38000205, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"msbh.fs", 0x380002c5, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"msbh.fs!", 0x7f00, 0x7f00, 0x380002c5, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"msbl", 0x38000004, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"msbl.fs", 0x380000c4, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"msbl.fs!", 0x7e00, 0x7f00, 0x380000c4, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"msbu", 0x38000021, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"msbu!", 0x7700, 0x7f00, 0x38000021, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"msb.f", 0x38000081, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"mszh", 0x38000305, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"mszh.f", 0x38000385, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"mszh.f!", 0x7d00, 0x7f00, 0x38000385, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"mszl", 0x38000104, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"mszl.f", 0x38000184, 0x3ff003ff, 0x8000, x_Rs_Rs, s3_do_dsp},
|
|
|
|
{"mszl.f!", 0x7c00, 0x7f00, 0x38000184, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"mtcel!", 0x7000, 0x7ff0, 0x0000044a, x_Rs, s3_do16_dsp},
|
|
|
|
{"mtcel", 0x0000044a, 0x3e007fff, 0x8000, Rd_x_x, s3_do_rd},
|
|
|
|
{"mtceh", 0x0000084a, 0x3e007fff, 0x8000, Rd_x_x, s3_do_rd},
|
|
|
|
{"mtceh!", 0x7010, 0x7ff0, 0x0000084a, x_Rs, s3_do16_dsp},
|
|
|
|
{"mtcehl", 0x00000c4a, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mtsr", 0x00000052, 0x3e0003ff, 0x8000, x_Rs_I5, s3_do_rdsrs},
|
|
|
|
{"mtcr", 0x0c000000, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"mtc1", 0x0c000008, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"mtc2", 0x0c000010, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"mtc3", 0x0c000018, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"mtcc1", 0x0c00000e, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"mtcc2", 0x0c000016, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"mtcc3", 0x0c00001e, 0x3e00001f, 0x8000, Rd_Rs_x, s3_do_rdcrs},
|
|
|
|
{"mul.f!", 0x7200, 0x7f00, 0x00000041, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"mulu!", 0x7300, 0x7f00, 0x00000042, Rd_Rs, s3_do16_dsp2},
|
|
|
|
{"mulr.l", 0x00000140, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"mulr.h", 0x00000240, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"mulr", 0x00000340, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"mulr.lf", 0x00000141, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"mulr.hf", 0x00000241, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"mulr.f", 0x00000341, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"mulur.l", 0x00000142, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"mulur.h", 0x00000242, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"mulur", 0x00000342, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"divr.q", 0x00000144, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"divr.r", 0x00000244, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"divr", 0x00000344, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"divur.q", 0x00000146, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"divur.r", 0x00000246, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"divur", 0x00000346, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_rdrsrs},
|
|
|
|
{"mvcs", 0x00000056, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mvcc", 0x00000456, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mvgtu", 0x00000856, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mvleu", 0x00000c56, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mveq", 0x00001056, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mvne", 0x00001456, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mvgt", 0x00001856, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mvle", 0x00001c56, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mvge", 0x00002056, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mvlt", 0x00002456, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mvmi", 0x00002856, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mvpl", 0x00002c56, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mvvs", 0x00003056, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mvvc", 0x00003456, 0x3e007fff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
|
|
|
|
/* mv <-> mv!. */
|
|
|
|
{"mv", 0x00003c56, 0x3e007fff, 0x4000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"mv!", 0x4000, 0x7c00, 0x8000, Rd_Rs, s3_do16_mv_cmp},
|
|
|
|
{"neg", 0x0000001e, 0x3e0003ff, 0x8000, Rd_x_Rs, s3_do_rdxrs},
|
|
|
|
{"neg.c", 0x0000001f, 0x3e0003ff, 0x8000, Rd_x_Rs, s3_do_rdxrs},
|
|
|
|
{"nop", 0x00000000, 0x3e0003ff, 0x0000, NO_OPD, s3_do_empty},
|
|
|
|
{"not", 0x00000024, 0x3e0003ff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"not.c", 0x00000025, 0x3e0003ff, 0x8000, Rd_Rs_x, s3_do_rdrs},
|
|
|
|
{"nop!", 0x0000, 0x7fff, 0x8000, NO16_OPD, s3_do_empty},
|
|
|
|
{"or", 0x00000022, 0x3e0003ff, 0x4a00, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"or.c", 0x00000023, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"ori", 0x020a0000, 0x3e0e0001, 0x8000, Rd_I16, s3_do_rdi16},
|
|
|
|
{"ori.c", 0x020a0001, 0x3e0e0001, 0x8000, Rd_I16, s3_do_rdi16},
|
|
|
|
{"oris", 0x0a0a0000, 0x3e0e0001, 0x8000, Rd_I16, s3_do_rdi16},
|
|
|
|
{"oris.c", 0x0a0a0001, 0x3e0e0001, 0x8000, Rd_I16, s3_do_rdi16},
|
|
|
|
{"orri", 0x1a000000, 0x3e000001, 0x8000, Rd_Rs_I14, s3_do_rdrsi14},
|
|
|
|
{"orri.c", 0x1a000001, 0x3e000001, 0x8000, Rd_Rs_I14, s3_do_rdrsi14},
|
|
|
|
|
|
|
|
/* or.c <-> or!. */
|
|
|
|
{"or!", 0x4a00, 0x7f00, 0x8000, Rd_Rs, s3_do16_rdrs2},
|
|
|
|
{"pflush", 0x0000000a, 0x3e0003ff, 0x8000, NO_OPD, s3_do_empty},
|
|
|
|
{"pop!", 0x0040, 0x7fe0, 0x8000, Rd_rvalueRs, s3_do16_push_pop},
|
|
|
|
{"push!", 0x0060, 0x7fe0, 0x8000, Rd_lvalueRs, s3_do16_push_pop},
|
|
|
|
|
|
|
|
{"rpop!", 0x6800, 0x7c00, 0x8000, Rd_I5, s3_do16_rpop},
|
|
|
|
{"rpush!", 0x6c00, 0x7c00, 0x8000, Rd_I5, s3_do16_rpush},
|
|
|
|
|
|
|
|
{"ror", 0x00000038, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"ror.c", 0x00000039, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"rorc.c", 0x0000003b, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"rol", 0x0000003c, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"rol.c", 0x0000003d, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"rolc.c", 0x0000003f, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"rori", 0x00000078, 0x3e0003ff, 0x8000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"rori.c", 0x00000079, 0x3e0003ff, 0x8000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"roric.c", 0x0000007b, 0x3e0003ff, 0x8000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"roli", 0x0000007c, 0x3e0003ff, 0x8000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"roli.c", 0x0000007d, 0x3e0003ff, 0x8000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"rolic.c", 0x0000007f, 0x3e0003ff, 0x8000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"rte", 0x0c000084, 0x3e0003ff, 0x8000, NO_OPD, s3_do_empty},
|
|
|
|
{"asw", 0x0000000e, 0x3e0003ff, 0x8000, Rd_lvalue32Rs, s3_do_ldst_atomic},
|
|
|
|
{"scb", 0x00000068, 0x3e0003ff, 0x8000, Rd_lvalueRs_post4, s3_do_ldst_unalign},
|
|
|
|
{"scw", 0x0000006a, 0x3e0003ff, 0x8000, Rd_lvalueRs_post4, s3_do_ldst_unalign},
|
|
|
|
{"sce", 0x0000006e, 0x3e0003ff, 0x8000, x_lvalueRs_post4, s3_do_ldst_unalign},
|
|
|
|
{"sdbbp", 0x00000006, 0x3e0003ff, 0x0020, x_I5_x, s3_do_xi5x},
|
|
|
|
{"sdbbp!", 0x0020, 0x7fe0, 0x8000, Rd_I5, s3_do16_xi5},
|
|
|
|
{"sleep", 0x0c0000c4, 0x3e0003ff, 0x8000, NO_OPD, s3_do_empty},
|
|
|
|
{"rti", 0x0c0000e4, 0x3e0003ff, 0x8000, NO_OPD, s3_do_empty},
|
|
|
|
{"sll", 0x00000030, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"sll.c", 0x00000031, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"sll.s", 0x3800004e, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_dsp2},
|
|
|
|
{"slli", 0x00000070, 0x3e0003ff, 0x5800, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"slli.c", 0x00000071, 0x3e0003ff, 0x8000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
|
|
|
|
/* slli.c <-> slli!. */
|
|
|
|
{"slli!", 0x5800, 0x7e00, 0x8000, Rd_I5, s3_do16_slli_srli},
|
|
|
|
{"srl", 0x00000034, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"srl.c", 0x00000035, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"sra", 0x00000036, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"sra.c", 0x00000037, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"srli", 0x00000074, 0x3e0003ff, 0x5a00, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"srli.c", 0x00000075, 0x3e0003ff, 0x8000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"srai", 0x00000076, 0x3e0003ff, 0x8000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
{"srai.c", 0x00000077, 0x3e0003ff, 0x8000, Rd_Rs_I5, s3_do_rdrsi5},
|
|
|
|
|
|
|
|
/* srli.c <-> srli!. */
|
|
|
|
{"srli!", 0x5a00, 0x7e00, 0x8000, Rd_Rs, s3_do16_slli_srli},
|
|
|
|
{"stc1", 0x0c00000b, 0x3e00001f, 0x8000, Rd_lvalueRs_SI10, s3_do_ldst_cop},
|
|
|
|
{"stc2", 0x0c000013, 0x3e00001f, 0x8000, Rd_lvalueRs_SI10, s3_do_ldst_cop},
|
|
|
|
{"stc3", 0x0c00001b, 0x3e00001f, 0x8000, Rd_lvalueRs_SI10, s3_do_ldst_cop},
|
|
|
|
{"sub", 0x00000014, 0x3e0003ff, 0x4900, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"sub.c", 0x00000015, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"sub.s", 0x38000049, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_dsp2},
|
|
|
|
{"subc", 0x00000016, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"subc.c", 0x00000017, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
|
|
|
|
/* sub.c <-> sub!. */
|
|
|
|
{"sub!", 0x4900, 0x7f00, 0x8000, Rd_Rs, s3_do16_rdrs2},
|
|
|
|
{"sw!", 0x2000, 0x7000, 0x8000, Rd_lvalueRs, s3_do16_ldst_insn},
|
|
|
|
{"syscall", 0x00000002, 0x3e0003ff, 0x8000, I15, s3_do_i15},
|
|
|
|
{"trapcs", 0x00000004, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"trapcc", 0x00000404, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"trapgtu", 0x00000804, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"trapleu", 0x00000c04, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"trapeq", 0x00001004, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"trapne", 0x00001404, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"trapgt", 0x00001804, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"traple", 0x00001c04, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"trapge", 0x00002004, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"traplt", 0x00002404, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"trapmi", 0x00002804, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"trappl", 0x00002c04, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"trapvs", 0x00003004, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"trapvc", 0x00003404, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"trap", 0x00003c04, 0x3e007fff, 0x8000, x_I5_x, s3_do_xi5x},
|
|
|
|
{"xor", 0x00000026, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
{"xor.c", 0x00000027, 0x3e0003ff, 0x8000, Rd_Rs_Rs, s3_do_rdrsrs},
|
|
|
|
|
2006-09-17 07:51:50 +08:00
|
|
|
/* Macro instruction. */
|
2009-03-02 18:33:08 +08:00
|
|
|
{"li", 0x020c0000, 0x3e0e0000, 0x8000, Insn_Type_SYN, s3_do_macro_li_rdi32},
|
|
|
|
|
2006-09-17 07:51:50 +08:00
|
|
|
/* la reg, imm32 -->(1) ldi reg, simm16
|
2011-06-13 17:45:28 +08:00
|
|
|
(2) ldis reg, %HI(imm32)
|
|
|
|
ori reg, %LO(imm32)
|
|
|
|
|
2006-09-17 07:51:50 +08:00
|
|
|
la reg, symbol -->(1) lis reg, %HI(imm32)
|
|
|
|
ori reg, %LO(imm32) */
|
2009-03-02 18:33:08 +08:00
|
|
|
{"la", 0x020c0000, 0x3e0e0000, 0x8000, Insn_Type_SYN, s3_do_macro_la_rdi32},
|
|
|
|
{"bcmpeqz", 0x0000004c, 0x3e00007e, 0x8000, Insn_BCMP, s3_do_macro_bcmpz},
|
|
|
|
{"bcmpeq", 0x0000004c, 0x3e00007e, 0x8000, Insn_BCMP, s3_do_macro_bcmp},
|
|
|
|
{"bcmpnez", 0x0000004e, 0x3e00007e, 0x8000, Insn_BCMP, s3_do_macro_bcmpz},
|
|
|
|
{"bcmpne", 0x0000004e, 0x3e00007e, 0x8000, Insn_BCMP, s3_do_macro_bcmp},
|
|
|
|
{"div", 0x00000044, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_macro_mul_rdrsrs},
|
|
|
|
{"divu", 0x00000046, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_macro_mul_rdrsrs},
|
|
|
|
{"rem", 0x00000044, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_macro_mul_rdrsrs},
|
|
|
|
{"remu", 0x00000046, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_macro_mul_rdrsrs},
|
|
|
|
{"mul", 0x00000040, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_macro_mul_rdrsrs},
|
|
|
|
{"mulu", 0x00000042, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_macro_mul_rdrsrs},
|
|
|
|
{"maz", 0x00000040, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_macro_mul_rdrsrs},
|
|
|
|
{"mazu", 0x00000042, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_macro_mul_rdrsrs},
|
|
|
|
{"mul.f", 0x00000041, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_macro_mul_rdrsrs},
|
|
|
|
{"maz.f", 0x00000041, 0x3e0003ff, 0x8000, Insn_Type_SYN, s3_do_macro_mul_rdrsrs},
|
|
|
|
{"lb", INSN_LB, 0x00000000, 0x8000, Insn_Type_SYN, s3_do_macro_ldst_label},
|
|
|
|
{"lbu", INSN_LBU, 0x00000000, 0x8000, Insn_Type_SYN, s3_do_macro_ldst_label},
|
|
|
|
{"lh", INSN_LH, 0x00000000, 0x8000, Insn_Type_SYN, s3_do_macro_ldst_label},
|
|
|
|
{"lhu", INSN_LHU, 0x00000000, 0x8000, Insn_Type_SYN, s3_do_macro_ldst_label},
|
|
|
|
{"lw", INSN_LW, 0x00000000, 0x1000, Insn_Type_SYN, s3_do_macro_ldst_label},
|
|
|
|
{"sb", INSN_SB, 0x00000000, 0x8000, Insn_Type_SYN, s3_do_macro_ldst_label},
|
|
|
|
{"sh", INSN_SH, 0x00000000, 0x8000, Insn_Type_SYN, s3_do_macro_ldst_label},
|
|
|
|
{"sw", INSN_SW, 0x00000000, 0x2000, Insn_Type_SYN, s3_do_macro_ldst_label},
|
|
|
|
|
2006-09-17 07:51:50 +08:00
|
|
|
/* Assembler use internal. */
|
2009-03-02 18:33:08 +08:00
|
|
|
{"ld_i32hi", 0x0a0c0000, 0x3e0e0000, 0x8000, Insn_internal, s3_do_macro_rdi32hi},
|
|
|
|
{"ld_i32lo", 0x020a0000, 0x3e0e0001, 0x8000, Insn_internal, s3_do_macro_rdi32lo},
|
|
|
|
{"ldis_pic", 0x0a0c0000, 0x3e0e0000, 0x8000, Insn_internal, s3_do_rdi16_pic},
|
|
|
|
{"addi_s_pic",0x02000000, 0x3e0e0001, 0x8000, Insn_internal, s3_do_addi_s_pic},
|
|
|
|
{"addi_u_pic",0x02000000, 0x3e0e0001, 0x8000, Insn_internal, s3_do_addi_u_pic},
|
|
|
|
{"lw_pic", 0x20000000, 0x3e000000, 0x8000, Insn_internal, s3_do_lw_pic},
|
|
|
|
|
|
|
|
/* 48-bit instructions. */
|
|
|
|
{"sdbbp48", 0x000000000000LL, 0x1c000000001fLL, 0x8000, Rd_I32, s3_do_sdbbp48},
|
|
|
|
{"ldi48", 0x000000000001LL, 0x1c000000001fLL, 0x8000, Rd_I32, s3_do_ldi48},
|
|
|
|
{"lw48", 0x000000000002LL, 0x1c000000001fLL, 0x8000, Rd_I30, s3_do_lw48},
|
|
|
|
{"sw48", 0x000000000003LL, 0x1c000000001fLL, 0x8000, Rd_I30, s3_do_sw48},
|
|
|
|
{"andri48", 0x040000000000LL, 0x1c0000000003LL, 0x8000, Rd_I32, s3_do_and48},
|
|
|
|
{"andri48.c", 0x040000000001LL, 0x1c0000000003LL, 0x8000, Rd_I32, s3_do_and48},
|
|
|
|
{"orri48", 0x040000000002LL, 0x1c0000000003LL, 0x8000, Rd_I32, s3_do_or48},
|
|
|
|
{"orri48.c", 0x040000000003LL, 0x1c0000000003LL, 0x8000, Rd_I32, s3_do_or48},
|
2006-09-17 07:51:50 +08:00
|
|
|
};
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
#define s3_SCORE3_PIPELINE 3
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static int s3_university_version = 0;
|
|
|
|
static int s3_vector_size = s3_SCORE3_PIPELINE;
|
|
|
|
static struct s3_score_it s3_dependency_vector[s3_SCORE3_PIPELINE];
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static int s3_score3d = 1;
|
2007-05-14 18:06:32 +08:00
|
|
|
|
2006-09-17 07:51:50 +08:00
|
|
|
static int
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_end_of_line (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
int retval = s3_SUCCESS;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
if (*str != '\0')
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
retval = (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (!s3_inst.error)
|
|
|
|
s3_inst.error = s3_BAD_GARBAGE;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_score_reg_parse (char **ccp, struct hash_control *htab)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
char *start = *ccp;
|
|
|
|
char c;
|
|
|
|
char *p;
|
2009-03-02 18:33:08 +08:00
|
|
|
struct s3_reg_entry *reg;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
p = start;
|
|
|
|
if (!ISALPHA (*p) || !is_name_beginner (*p))
|
2009-03-02 18:33:08 +08:00
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
c = *p++;
|
|
|
|
|
|
|
|
while (ISALPHA (c) || ISDIGIT (c) || c == '_')
|
|
|
|
c = *p++;
|
|
|
|
|
|
|
|
*--p = 0;
|
2009-03-02 18:33:08 +08:00
|
|
|
reg = (struct s3_reg_entry *) hash_find (htab, start);
|
2006-09-17 07:51:50 +08:00
|
|
|
*p = c;
|
|
|
|
|
|
|
|
if (reg)
|
|
|
|
{
|
|
|
|
*ccp = p;
|
|
|
|
return reg->number;
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If shift <= 0, only return reg. */
|
|
|
|
|
|
|
|
static int
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_reg_required_here (char **str, int shift, enum s3_score_reg_type reg_type)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
static char buff[s3_MAX_LITERAL_POOL_SIZE];
|
|
|
|
int reg = (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
char *start = *str;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((reg = s3_score_reg_parse (str, s3_all_reg_maps[reg_type].htab)) != (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (reg_type == s3_REG_TYPE_SCORE)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((reg == 1) && (s3_nor1 == 1) && (s3_inst.bwarn == 0))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2017-01-23 23:23:07 +08:00
|
|
|
as_warn (_("Using temp register (r1)"));
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.bwarn = 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (shift >= 0)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (reg_type == s3_REG_TYPE_SCORE_CR)
|
|
|
|
strcpy (s3_inst.reg, s3_score_crn_table[reg].name);
|
|
|
|
else if (reg_type == s3_REG_TYPE_SCORE_SR)
|
|
|
|
strcpy (s3_inst.reg, s3_score_srn_table[reg].name);
|
2006-09-17 07:51:50 +08:00
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
strcpy (s3_inst.reg, "");
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.instruction |= (bfd_vma) reg << shift;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*str = start;
|
|
|
|
sprintf (buff, _("register expected, not '%.100s'"), start);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = buff;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return reg;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_past_comma (char **str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
char *p = *str;
|
|
|
|
char c;
|
|
|
|
int comma = 0;
|
|
|
|
|
|
|
|
while ((c = *p) == ' ' || c == ',')
|
|
|
|
{
|
|
|
|
p++;
|
|
|
|
if (c == ',' && comma++)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_BAD_SKIP_COMMA;
|
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((c == '\0') || (comma == 0))
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_BAD_SKIP_COMMA;
|
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
*str = p;
|
2009-03-02 18:33:08 +08:00
|
|
|
return comma ? s3_SUCCESS : (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_rdrsrs (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
int reg;
|
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Check mulr, mulur rd is even number. */
|
|
|
|
if (((s3_inst.instruction & 0x3e0003ff) == 0x00000340
|
2011-06-13 17:45:28 +08:00
|
|
|
|| (s3_inst.instruction & 0x3e0003ff) == 0x00000342)
|
2009-03-02 18:33:08 +08:00
|
|
|
&& (reg % 2))
|
|
|
|
{
|
|
|
|
s3_inst.error = _("rd must be even number.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((((s3_inst.instruction >> 15) & 0x10) == 0)
|
|
|
|
&& (((s3_inst.instruction >> 10) & 0x10) == 0)
|
|
|
|
&& (((s3_inst.instruction >> 20) & 0x10) == 0)
|
|
|
|
&& (s3_inst.relax_inst != 0x8000)
|
|
|
|
&& (((s3_inst.instruction >> 20) & 0xf) == ((s3_inst.instruction >> 15) & 0xf)))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 10) & 0xf) )
|
|
|
|
| (((s3_inst.instruction >> 15) & 0xf) << 4);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_walk_no_bignums (symbolS * sp)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
if (symbol_get_value_expression (sp)->X_op == O_big)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (symbol_get_value_expression (sp)->X_add_symbol)
|
2009-03-02 18:33:08 +08:00
|
|
|
return (s3_walk_no_bignums (symbol_get_value_expression (sp)->X_add_symbol)
|
2006-09-17 07:51:50 +08:00
|
|
|
|| (symbol_get_value_expression (sp)->X_op_symbol
|
2011-06-13 17:45:28 +08:00
|
|
|
&& s3_walk_no_bignums (symbol_get_value_expression (sp)->X_op_symbol)));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_my_get_expression (expressionS * ep, char **str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
char *save_in;
|
|
|
|
|
|
|
|
save_in = input_line_pointer;
|
|
|
|
input_line_pointer = *str;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_in_my_get_expression = 1;
|
2011-06-13 17:45:28 +08:00
|
|
|
(void) expression (ep);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_in_my_get_expression = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
if (ep->X_op == O_illegal)
|
|
|
|
{
|
|
|
|
*str = input_line_pointer;
|
|
|
|
input_line_pointer = save_in;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("illegal expression");
|
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
/* Get rid of any bignums now, so that we don't generate an error for which
|
|
|
|
we can't establish a line number later on. Big numbers are never valid
|
|
|
|
in instructions, which is where this routine is always called. */
|
|
|
|
if (ep->X_op == O_big
|
|
|
|
|| (ep->X_add_symbol
|
2009-03-02 18:33:08 +08:00
|
|
|
&& (s3_walk_no_bignums (ep->X_add_symbol)
|
|
|
|
|| (ep->X_op_symbol && s3_walk_no_bignums (ep->X_op_symbol)))))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("invalid constant");
|
2006-09-17 07:51:50 +08:00
|
|
|
*str = input_line_pointer;
|
|
|
|
input_line_pointer = save_in;
|
2009-03-02 18:33:08 +08:00
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2006-10-31 17:54:41 +08:00
|
|
|
if ((ep->X_add_symbol != NULL)
|
2009-03-02 18:33:08 +08:00
|
|
|
&& (s3_inst.type != PC_DISP19div2)
|
|
|
|
&& (s3_inst.type != PC_DISP8div2)
|
|
|
|
&& (s3_inst.type != PC_DISP24div2)
|
|
|
|
&& (s3_inst.type != PC_DISP11div2)
|
|
|
|
&& (s3_inst.type != Insn_Type_SYN)
|
|
|
|
&& (s3_inst.type != Rd_rvalueRs_SI15)
|
|
|
|
&& (s3_inst.type != Rd_lvalueRs_SI15)
|
|
|
|
&& (s3_inst.type != Insn_internal)
|
|
|
|
&& (s3_inst.type != Rd_I30)
|
|
|
|
&& (s3_inst.type != Rd_I32)
|
|
|
|
&& (s3_inst.type != Insn_BCMP))
|
|
|
|
{
|
|
|
|
s3_inst.error = s3_BAD_ARGS;
|
2006-10-31 17:54:41 +08:00
|
|
|
*str = input_line_pointer;
|
|
|
|
input_line_pointer = save_in;
|
2009-03-02 18:33:08 +08:00
|
|
|
return (int) s3_FAIL;
|
2006-10-31 17:54:41 +08:00
|
|
|
}
|
|
|
|
|
2006-09-17 07:51:50 +08:00
|
|
|
*str = input_line_pointer;
|
|
|
|
input_line_pointer = save_in;
|
2009-03-02 18:33:08 +08:00
|
|
|
return s3_SUCCESS;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if an immediate is valid. If so, convert it to the right format. */
|
2009-03-02 18:33:08 +08:00
|
|
|
static bfd_signed_vma
|
|
|
|
s3_validate_immediate (bfd_signed_vma val, unsigned int data_type, int hex_p)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
switch (data_type)
|
|
|
|
{
|
|
|
|
case _VALUE_HI16:
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
bfd_signed_vma val_hi = ((val & 0xffff0000) >> 16);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_score_df_range[data_type].range[0] <= val_hi
|
|
|
|
&& val_hi <= s3_score_df_range[data_type].range[1])
|
2006-09-17 07:51:50 +08:00
|
|
|
return val_hi;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case _VALUE_LO16:
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
bfd_signed_vma val_lo = (val & 0xffff);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_score_df_range[data_type].range[0] <= val_lo
|
|
|
|
&& val_lo <= s3_score_df_range[data_type].range[1])
|
2006-09-17 07:51:50 +08:00
|
|
|
return val_lo;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2007-05-14 18:06:32 +08:00
|
|
|
case _SIMM14:
|
|
|
|
if (hex_p == 1)
|
|
|
|
{
|
|
|
|
if (!(val >= -0x2000 && val <= 0x3fff))
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
return (int) s3_FAIL;
|
2007-05-14 18:06:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!(val >= -8192 && val <= 8191))
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
return (int) s3_FAIL;
|
2007-05-14 18:06:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case _SIMM16_NEG:
|
|
|
|
if (hex_p == 1)
|
|
|
|
{
|
|
|
|
if (!(val >= -0x7fff && val <= 0xffff && val != 0x8000))
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
return (int) s3_FAIL;
|
2007-05-14 18:06:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!(val >= -32767 && val <= 32768))
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
return (int) s3_FAIL;
|
2007-05-14 18:06:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
val = -val;
|
|
|
|
return val;
|
|
|
|
break;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
case _IMM5_MULTI_LOAD:
|
|
|
|
if (val >= 2 && val <= 32)
|
2011-06-13 17:45:28 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (val == 32)
|
2011-06-13 17:45:28 +08:00
|
|
|
val = 0;
|
2009-03-02 18:33:08 +08:00
|
|
|
return val;
|
2011-06-13 17:45:28 +08:00
|
|
|
}
|
|
|
|
return (int) s3_FAIL;
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
case _IMM32:
|
|
|
|
if (val >= 0 && val <= 0xffffffff)
|
|
|
|
{
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return (int) s3_FAIL;
|
|
|
|
}
|
|
|
|
|
2006-09-17 07:51:50 +08:00
|
|
|
default:
|
2007-05-14 18:06:32 +08:00
|
|
|
if (data_type == _SIMM14_NEG || data_type == _IMM16_NEG)
|
2006-09-17 07:51:50 +08:00
|
|
|
val = -val;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_score_df_range[data_type].range[0] <= val
|
|
|
|
&& val <= s3_score_df_range[data_type].range[1])
|
2006-09-17 07:51:50 +08:00
|
|
|
return val;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_data_op2 (char **str, int shift, enum score_data_type data_type)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
bfd_signed_vma value;
|
|
|
|
char data_exp[s3_MAX_LITERAL_POOL_SIZE];
|
2006-09-17 07:51:50 +08:00
|
|
|
char *dataptr;
|
|
|
|
int cnt = 0;
|
|
|
|
char *pp = NULL;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (*str);
|
|
|
|
s3_inst.error = NULL;
|
2006-09-17 07:51:50 +08:00
|
|
|
dataptr = * str;
|
|
|
|
|
2007-05-14 18:06:32 +08:00
|
|
|
/* Set hex_p to zero. */
|
|
|
|
int hex_p = 0;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
while ((*dataptr != '\0') && (*dataptr != '|') && (cnt <= s3_MAX_LITERAL_POOL_SIZE)) /* 0x7c = ='|' */
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
data_exp[cnt] = *dataptr;
|
|
|
|
dataptr++;
|
|
|
|
cnt++;
|
|
|
|
}
|
|
|
|
|
|
|
|
data_exp[cnt] = '\0';
|
|
|
|
pp = (char *)&data_exp;
|
|
|
|
|
|
|
|
if (*dataptr == '|') /* process PCE */
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, &pp) == (int) s3_FAIL)
|
|
|
|
return (int) s3_FAIL;
|
|
|
|
s3_end_of_line (pp);
|
|
|
|
if (s3_inst.error != 0)
|
|
|
|
return (int) s3_FAIL; /* to ouptut_inst to printf out the error */
|
2006-09-17 07:51:50 +08:00
|
|
|
*str = dataptr;
|
|
|
|
}
|
|
|
|
else /* process 16 bit */
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
dataptr = (char *)data_exp;
|
|
|
|
for (; *dataptr != '\0'; dataptr++)
|
|
|
|
{
|
|
|
|
*dataptr = TOLOWER (*dataptr);
|
|
|
|
if (*dataptr == '!' || *dataptr == ' ')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
dataptr = (char *)data_exp;
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
if ((dataptr != NULL)
|
2007-05-14 18:06:32 +08:00
|
|
|
&& (((strstr (dataptr, "0x")) != NULL)
|
|
|
|
|| ((strstr (dataptr, "0X")) != NULL)))
|
2011-06-13 17:45:28 +08:00
|
|
|
{
|
2007-05-14 18:06:32 +08:00
|
|
|
hex_p = 1;
|
|
|
|
if ((data_type != _SIMM16_LA)
|
|
|
|
&& (data_type != _VALUE_HI16)
|
|
|
|
&& (data_type != _VALUE_LO16)
|
|
|
|
&& (data_type != _IMM16)
|
|
|
|
&& (data_type != _IMM15)
|
|
|
|
&& (data_type != _IMM14)
|
|
|
|
&& (data_type != _IMM4)
|
|
|
|
&& (data_type != _IMM5)
|
2009-03-02 18:33:08 +08:00
|
|
|
&& (data_type != _IMM5_MULTI_LOAD)
|
|
|
|
&& (data_type != _IMM11)
|
2007-05-14 18:06:32 +08:00
|
|
|
&& (data_type != _IMM8)
|
|
|
|
&& (data_type != _IMM5_RSHIFT_1)
|
|
|
|
&& (data_type != _IMM5_RSHIFT_2)
|
|
|
|
&& (data_type != _SIMM14)
|
|
|
|
&& (data_type != _SIMM14_NEG)
|
|
|
|
&& (data_type != _SIMM16_NEG)
|
|
|
|
&& (data_type != _IMM10_RSHIFT_2)
|
2009-03-02 18:33:08 +08:00
|
|
|
&& (data_type != _GP_IMM15)
|
|
|
|
&& (data_type != _SIMM5)
|
|
|
|
&& (data_type != _SIMM6)
|
|
|
|
&& (data_type != _IMM32)
|
|
|
|
&& (data_type != _SIMM32))
|
2007-05-14 18:06:32 +08:00
|
|
|
{
|
|
|
|
data_type += 24;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2006-10-31 17:54:41 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_inst.reloc.exp.X_add_number == 0)
|
|
|
|
&& (s3_inst.type != Insn_Type_SYN)
|
|
|
|
&& (s3_inst.type != Rd_rvalueRs_SI15)
|
|
|
|
&& (s3_inst.type != Rd_lvalueRs_SI15)
|
|
|
|
&& (s3_inst.type != Insn_internal)
|
2006-10-31 17:54:41 +08:00
|
|
|
&& (((*dataptr >= 'a') && (*dataptr <= 'z'))
|
2011-06-13 17:45:28 +08:00
|
|
|
|| ((*dataptr == '0') && (*(dataptr + 1) == 'x') && (*(dataptr + 2) != '0'))
|
|
|
|
|| ((*dataptr == '+') && (*(dataptr + 1) != '0'))
|
|
|
|
|| ((*dataptr == '-') && (*(dataptr + 1) != '0'))))
|
2006-10-31 17:54:41 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_BAD_ARGS;
|
|
|
|
return (int) s3_FAIL;
|
2006-10-31 17:54:41 +08:00
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_inst.reloc.exp.X_add_symbol)
|
2006-09-17 07:51:50 +08:00
|
|
|
&& ((data_type == _SIMM16)
|
|
|
|
|| (data_type == _SIMM16_NEG)
|
|
|
|
|| (data_type == _IMM16_NEG)
|
|
|
|
|| (data_type == _SIMM14)
|
|
|
|
|| (data_type == _SIMM14_NEG)
|
|
|
|
|| (data_type == _IMM5)
|
2009-03-02 18:33:08 +08:00
|
|
|
|| (data_type == _IMM5_MULTI_LOAD)
|
|
|
|
|| (data_type == _IMM11)
|
2006-09-17 07:51:50 +08:00
|
|
|
|| (data_type == _IMM14)
|
|
|
|
|| (data_type == _IMM20)
|
|
|
|
|| (data_type == _IMM16)
|
|
|
|
|| (data_type == _IMM15)
|
|
|
|
|| (data_type == _IMM4)))
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_BAD_ARGS;
|
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.reloc.exp.X_add_symbol)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
switch (data_type)
|
|
|
|
{
|
|
|
|
case _SIMM16_LA:
|
2009-03-02 18:33:08 +08:00
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
case _VALUE_HI16:
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.reloc.type = BFD_RELOC_HI16_S;
|
|
|
|
s3_inst.reloc.pc_rel = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
break;
|
|
|
|
case _VALUE_LO16:
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.reloc.type = BFD_RELOC_LO16;
|
|
|
|
s3_inst.reloc.pc_rel = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
break;
|
|
|
|
case _GP_IMM15:
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_GPREL15;
|
|
|
|
s3_inst.reloc.pc_rel = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
break;
|
|
|
|
case _SIMM16_pic:
|
|
|
|
case _IMM16_LO16_pic:
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_GOT_LO16;
|
|
|
|
s3_inst.reloc.pc_rel = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
break;
|
|
|
|
default:
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.reloc.type = BFD_RELOC_32;
|
|
|
|
s3_inst.reloc.pc_rel = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (data_type == _IMM16_pic)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_DUMMY_HI16;
|
|
|
|
s3_inst.reloc.pc_rel = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (data_type == _SIMM16_LA && s3_inst.reloc.exp.X_unsigned == 1)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _SIMM16_LA_POS, hex_p);
|
|
|
|
if (value == (int) s3_FAIL) /* for advance to check if this is ldis */
|
|
|
|
if ((s3_inst.reloc.exp.X_add_number & 0xffff) == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.instruction |= 0x8000000;
|
|
|
|
s3_inst.instruction |= ((s3_inst.reloc.exp.X_add_number >> 16) << 1) & 0x1fffe;
|
|
|
|
return s3_SUCCESS;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, data_type, hex_p);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (value == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (data_type == _IMM32)
|
|
|
|
{
|
|
|
|
sprintf (s3_err_msg,
|
|
|
|
_("invalid constant: %d bit expression not in range %u..%u"),
|
|
|
|
s3_score_df_range[data_type].bits,
|
|
|
|
0, (unsigned)0xffffffff);
|
|
|
|
}
|
|
|
|
else if (data_type == _IMM5_MULTI_LOAD)
|
|
|
|
{
|
|
|
|
sprintf (s3_err_msg,
|
|
|
|
_("invalid constant: %d bit expression not in range %u..%u"),
|
|
|
|
5, 2, 32);
|
|
|
|
}
|
|
|
|
else if ((data_type != _SIMM14_NEG) && (data_type != _SIMM16_NEG) && (data_type != _IMM16_NEG))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
sprintf (s3_err_msg,
|
2007-01-18 18:33:49 +08:00
|
|
|
_("invalid constant: %d bit expression not in range %d..%d"),
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_score_df_range[data_type].bits,
|
|
|
|
s3_score_df_range[data_type].range[0], s3_score_df_range[data_type].range[1]);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
sprintf (s3_err_msg,
|
2007-01-18 18:33:49 +08:00
|
|
|
_("invalid constant: %d bit expression not in range %d..%d"),
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_score_df_range[data_type].bits,
|
|
|
|
-s3_score_df_range[data_type].range[1], -s3_score_df_range[data_type].range[0]);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_err_msg;
|
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (((s3_score_df_range[data_type].range[0] != 0) || (data_type == _IMM5_RANGE_8_31))
|
|
|
|
&& data_type != _IMM5_MULTI_LOAD)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
value &= (1 << s3_score_df_range[data_type].bits) - 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.instruction |= value << shift;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((s3_inst.instruction & 0x3e000000) == 0x30000000)
|
|
|
|
{
|
|
|
|
if ((((s3_inst.instruction >> 20) & 0x1F) != 0)
|
|
|
|
&& (((s3_inst.instruction >> 20) & 0x1F) != 1)
|
|
|
|
&& (((s3_inst.instruction >> 20) & 0x1F) != 2)
|
|
|
|
&& (((s3_inst.instruction >> 20) & 0x1F) != 0x10))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("invalid constant: bit expression not defined");
|
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
return s3_SUCCESS;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle addi/addi.c/addis.c/cmpi.c/addis.c/ldi. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_rdsi16 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 1, _SIMM16) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* ldi.->ldiu! only for imm5 */
|
|
|
|
if ((s3_inst.instruction & 0x20c0000) == 0x20c0000)
|
|
|
|
{
|
|
|
|
if ((s3_inst.instruction & 0x1ffc0) != 0)
|
|
|
|
{
|
|
|
|
s3_inst.relax_inst = 0x8000;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s3_inst.relax_inst |= (s3_inst.instruction >> 1) & 0x1f;
|
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 20)& 0x1f) <<5);
|
|
|
|
s3_inst.relax_size = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*cmpi.c */
|
|
|
|
else if ((s3_inst.instruction & 0x02040001) == 0x02040001)
|
|
|
|
{
|
|
|
|
/* imm <=0x3f (5 bit<<1)*/
|
2011-06-13 17:45:28 +08:00
|
|
|
if (((s3_inst.instruction & 0x1ffe0) == 0)
|
|
|
|
|| (((s3_inst.instruction & 0x1ffe0) == 0x1ffe0)
|
|
|
|
&& (s3_inst.instruction & 0x003e) != 0))
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
|
|
|
s3_inst.relax_inst |= (s3_inst.instruction >> 1) & 0x1f;
|
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 20) & 0x1f) << 5);
|
|
|
|
s3_inst.relax_size = 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s3_inst.relax_inst =0x8000;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* addi */
|
2011-06-13 17:45:28 +08:00
|
|
|
else if (((s3_inst.instruction & 0x2000000) == 0x02000000) && (s3_inst.relax_inst!=0x8000))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* rd : 0-16 ; imm <=0x7f (6 bit<<1)*/
|
2011-06-13 17:45:28 +08:00
|
|
|
if ((((s3_inst.instruction >> 20) & 0x10) != 0x10)
|
|
|
|
&& (((s3_inst.instruction & 0x1ffc0) == 0)
|
|
|
|
|| (((s3_inst.instruction & 0x1ffc0) == 0x1ffc0)
|
|
|
|
&& (s3_inst.instruction & 0x007e) != 0)))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (s3_inst.instruction >> 1) & 0x3f;
|
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 20) & 0xf) << 6);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst =0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
else if (((s3_inst.instruction >> 20) & 0x10) == 0x10)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_do_ldis (char *str)
|
|
|
|
{
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
|
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 1, _IMM16) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-09-17 07:51:50 +08:00
|
|
|
/* Handle subi/subi.c. */
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_do_sub_rdsi16 (char *str)
|
|
|
|
{
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
|
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL
|
|
|
|
&& s3_data_op2 (&str, 1, _SIMM16_NEG) != (int) s3_FAIL)
|
|
|
|
s3_end_of_line (str);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Handle subis/subis.c. */
|
2006-09-17 07:51:50 +08:00
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_sub_rdi16 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL
|
|
|
|
&& s3_data_op2 (&str, 1, _IMM16_NEG) != (int) s3_FAIL)
|
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle addri/addri.c. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_rdrssi14 (char *str) /* -(2^13)~((2^13)-1) */
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL
|
|
|
|
&& s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL)
|
|
|
|
s3_data_op2 (&str, 1, _SIMM14);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle subri.c/subri. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_sub_rdrssi14 (char *str) /* -(2^13)~((2^13)-1) */
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL
|
|
|
|
&& s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL
|
|
|
|
&& s3_data_op2 (&str, 1, _SIMM14_NEG) != (int) s3_FAIL)
|
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Handle bitclr.c/bitset.c/bittgl.c/slli.c/srai.c/srli.c/roli.c/rori.c/rolic.c.
|
|
|
|
0~((2^14)-1) */
|
2006-09-17 07:51:50 +08:00
|
|
|
static void
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_do_rdrsi5 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 10, _IMM5) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((((s3_inst.instruction >> 20) & 0x1f) == ((s3_inst.instruction >> 15) & 0x1f))
|
|
|
|
&& (s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 15) & 0x10) == 0))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 10) & 0x1f) ) | (((s3_inst.instruction >> 15) & 0xf) << 5);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Handle andri/orri/andri.c/orri.c.
|
|
|
|
0 ~ ((2^14)-1) */
|
2006-09-17 07:51:50 +08:00
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_rdrsi14 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL
|
|
|
|
&& s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL
|
|
|
|
&& s3_data_op2 (&str, 1, _IMM14) != (int) s3_FAIL)
|
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle bittst.c. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_xrsi5 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 10, _IMM5) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 15) & 0x10) == 0))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= ((s3_inst.instruction >> 10) & 0x1f) | (((s3_inst.instruction >> 15) & 0xf) << 5);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2007-01-18 18:33:49 +08:00
|
|
|
/* Handle addis/andi/ori/andis/oris/ldis. */
|
2006-09-17 07:51:50 +08:00
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_rdi16 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 1, _IMM16) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
/* ldis */
|
|
|
|
if ((s3_inst.instruction & 0x3e0e0000) == 0x0a0c0000)
|
|
|
|
{
|
|
|
|
/* rd : 0-16 ;imm =0 -> can transform to addi!*/
|
|
|
|
if ((((s3_inst.instruction >> 20) & 0x10) != 0x10) && ((s3_inst.instruction & 0x1ffff)==0))
|
|
|
|
{
|
|
|
|
s3_inst.relax_inst =0x5400; /* ldiu! */
|
|
|
|
s3_inst.relax_inst |= (s3_inst.instruction >> 1) & 0x1f;
|
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 20) & 0xf) << 5);
|
|
|
|
s3_inst.relax_size = 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s3_inst.relax_inst =0x8000;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* addis */
|
|
|
|
else if ((s3_inst.instruction & 0x3e0e0001) == 0x0a000000)
|
|
|
|
{
|
|
|
|
/* rd : 0-16 ;imm =0 -> can transform to addi!*/
|
|
|
|
if ((((s3_inst.instruction >> 20) & 0x10) != 0x10) && ((s3_inst.instruction & 0x1ffff)==0))
|
|
|
|
{
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.relax_inst =0x5c00; /* addi! */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (s3_inst.instruction >> 1) & 0x3f;
|
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 20) & 0xf) << 6);
|
|
|
|
s3_inst.relax_size = 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s3_inst.relax_inst =0x8000;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_macro_rdi32hi (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Do not handle s3_end_of_line(). */
|
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL)
|
|
|
|
s3_data_op2 (&str, 1, _VALUE_HI16);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_macro_rdi32lo (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Do not handle s3_end_of_line(). */
|
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL)
|
|
|
|
s3_data_op2 (&str, 1, _VALUE_LO16);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle ldis_pic. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_rdi16_pic (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL
|
|
|
|
&& s3_data_op2 (&str, 1, _IMM16_pic) != (int) s3_FAIL)
|
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle addi_s_pic to generate R_SCORE_GOT_LO16 . */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_addi_s_pic (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL
|
|
|
|
&& s3_data_op2 (&str, 1, _SIMM16_pic) != (int) s3_FAIL)
|
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle addi_u_pic to generate R_SCORE_GOT_LO16 . */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_addi_u_pic (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL
|
|
|
|
&& s3_data_op2 (&str, 1, _IMM16_LO16_pic) != (int) s3_FAIL)
|
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle mfceh/mfcel/mtceh/mtchl. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_rd (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL)
|
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Handle br{cond},cmpzteq.c ,cmpztmi.c ,cmpz.c */
|
2006-09-17 07:51:50 +08:00
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_rs (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_inst.relax_inst != 0x8000) )
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= ((s3_inst.instruction >> 15) &0x1f);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_i15 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_data_op2 (&str, 10, _IMM15) != (int) s3_FAIL)
|
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_xi5x (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_data_op2 (&str, 15, _IMM5) == (int) s3_FAIL || s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.relax_inst != 0x8000)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.relax_inst |= ((s3_inst.instruction >> 15) & 0x1f);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_rdrs (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.relax_inst != 0x8000)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (((s3_inst.instruction & 0x7f) == 0x56)) /* adjust mv -> mv!*/
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* mv! rd : 5bit , ra : 5bit */
|
|
|
|
s3_inst.relax_inst |= ((s3_inst.instruction >> 15) & 0x1f) | (((s3_inst.instruction >> 20) & 0x1f) << 5);
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else if ((((s3_inst.instruction >> 15) & 0x10) == 0x0) && (((s3_inst.instruction >> 20) & 0x10) == 0))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 15) & 0xf) << 4)
|
|
|
|
| (((s3_inst.instruction >> 20) & 0xf) << 8);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle mfcr/mtcr. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_rdcrs (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL
|
|
|
|
&& s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) != (int) s3_FAIL)
|
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle mfsr/mtsr. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_rdsrs (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* mfsr */
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_inst.instruction & 0xff) == 0x50)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL
|
|
|
|
&& s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE_SR) != (int) s3_FAIL)
|
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) != (int) s3_FAIL
|
|
|
|
&& s3_skip_past_comma (&str) != (int) s3_FAIL)
|
|
|
|
s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE_SR);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle neg. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_rdxrs (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 10) & 0x10) == 0)
|
|
|
|
&& (((s3_inst.instruction >> 20) & 0x10) == 0))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 10) & 0xf) << 4) | (((s3_inst.instruction >> 20) & 0xf) << 8);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle cmp.c/cmp<cond>. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_rsrs (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 20) & 0x1f) == 3) )
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 10) & 0x1f)) | (((s3_inst.instruction >> 15) & 0x1f) << 5);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_ceinst (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
char *strbak;
|
|
|
|
|
|
|
|
strbak = str;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
|
|
|
|
|
|
|
if (s3_data_op2 (&str, 20, _IMM5) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 5, _IMM5) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str = strbak;
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_data_op2 (&str, 0, _IMM25) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_reglow_required_here (char **str, int shift)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
static char buff[s3_MAX_LITERAL_POOL_SIZE];
|
2006-09-17 07:51:50 +08:00
|
|
|
int reg;
|
|
|
|
char *start = *str;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((reg = s3_score_reg_parse (str, s3_all_reg_maps[s3_REG_TYPE_SCORE].htab)) != (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((reg == 1) && (s3_nor1 == 1) && (s3_inst.bwarn == 0))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2007-01-18 18:33:49 +08:00
|
|
|
as_warn (_("Using temp register(r1)"));
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.bwarn = 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
if (reg < 16)
|
|
|
|
{
|
|
|
|
if (shift >= 0)
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.instruction |= (bfd_vma) reg << shift;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
return reg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Restore the start point, we may have got a reg of the wrong class. */
|
|
|
|
*str = start;
|
2017-01-23 23:23:07 +08:00
|
|
|
sprintf (buff, _("low register (r0-r15) expected, not '%.100s'"), start);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = buff;
|
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Handle add!/and!/or!/sub!. */
|
2006-09-17 07:51:50 +08:00
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do16_rdrs2 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reglow_required_here (&str, 4) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reglow_required_here (&str, 0) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle br!/brl!. */
|
|
|
|
static void
|
|
|
|
s3_do16_br (char *str)
|
|
|
|
{
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
|
|
|
|
if (s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Handle brr!. */
|
2006-09-17 07:51:50 +08:00
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do16_brr (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
int rd = 0;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((rd = s3_reg_required_here (&str, 0,s3_REG_TYPE_SCORE)) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/*Handle ltbw / ltbh / ltbb */
|
2006-09-17 07:51:50 +08:00
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_ltb (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if (*str++ != '[')
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("missing [");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if (*str++ != ']')
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("missing ]");
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We need to be able to fix up arbitrary expressions in some statements.
|
|
|
|
This is so that we can handle symbols that are an arbitrary distance from
|
|
|
|
the pc. The most common cases are of the form ((+/-sym -/+ . - 8) & mask),
|
|
|
|
which returns part of an address in a form which will be valid for
|
|
|
|
a data instruction. We do this by pushing the expression into a symbol
|
|
|
|
in the expr_section, and creating a fix for that. */
|
|
|
|
static fixS *
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_fix_new_score (fragS * frag, int where, short int size, expressionS * exp, int pc_rel, int reloc)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
fixS *new_fix;
|
|
|
|
|
|
|
|
switch (exp->X_op)
|
|
|
|
{
|
|
|
|
case O_constant:
|
|
|
|
case O_symbol:
|
|
|
|
case O_add:
|
|
|
|
case O_subtract:
|
|
|
|
new_fix = fix_new_exp (frag, where, size, exp, pc_rel, reloc);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
new_fix = fix_new (frag, where, size, make_expr_symbol (exp), 0, pc_rel, reloc);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return new_fix;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_init_dependency_vector (void)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
for (i = 0; i < s3_vector_size; i++)
|
|
|
|
memset (&s3_dependency_vector[i], '\0', sizeof (s3_dependency_vector[i]));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static enum s3_insn_type_for_dependency
|
|
|
|
s3_dependency_type_from_insn (char *insn_name)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
char name[s3_INSN_NAME_LEN];
|
|
|
|
const struct s3_insn_to_dependency *tmp;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
strcpy (name, insn_name);
|
2009-03-02 18:33:08 +08:00
|
|
|
tmp = (const struct s3_insn_to_dependency *) hash_find (s3_dependency_insn_hsh, name);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
if (tmp)
|
|
|
|
return tmp->type;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
return s3_D_all_insn;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_check_dependency (char *pre_insn, char *pre_reg,
|
2011-06-13 17:45:28 +08:00
|
|
|
char *cur_insn, char *cur_reg, int *warn_or_error)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
int bubbles = 0;
|
|
|
|
unsigned int i;
|
2009-03-02 18:33:08 +08:00
|
|
|
enum s3_insn_type_for_dependency pre_insn_type;
|
|
|
|
enum s3_insn_type_for_dependency cur_insn_type;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
pre_insn_type = s3_dependency_type_from_insn (pre_insn);
|
|
|
|
cur_insn_type = s3_dependency_type_from_insn (cur_insn);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
for (i = 0; i < sizeof (s3_data_dependency_table) / sizeof (s3_data_dependency_table[0]); i++)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((pre_insn_type == s3_data_dependency_table[i].pre_insn_type)
|
|
|
|
&& (s3_D_all_insn == s3_data_dependency_table[i].cur_insn_type
|
|
|
|
|| cur_insn_type == s3_data_dependency_table[i].cur_insn_type)
|
|
|
|
&& (strcmp (s3_data_dependency_table[i].pre_reg, "") == 0
|
|
|
|
|| strcmp (s3_data_dependency_table[i].pre_reg, pre_reg) == 0)
|
|
|
|
&& (strcmp (s3_data_dependency_table[i].cur_reg, "") == 0
|
|
|
|
|| strcmp (s3_data_dependency_table[i].cur_reg, cur_reg) == 0))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
bubbles = s3_data_dependency_table[i].bubblenum_3;
|
|
|
|
*warn_or_error = s3_data_dependency_table[i].warn_or_error;
|
2006-09-17 07:51:50 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bubbles;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_build_one_frag (struct s3_score_it one_inst)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
char *p;
|
2009-03-02 18:33:08 +08:00
|
|
|
int relaxable_p = s3_g_opt;
|
2006-09-17 07:51:50 +08:00
|
|
|
int relax_size = 0;
|
|
|
|
|
|
|
|
/* Start a new frag if frag_now is not empty. */
|
|
|
|
if (frag_now_fix () != 0)
|
|
|
|
{
|
|
|
|
if (!frag_now->tc_frag_data.is_insn)
|
|
|
|
frag_wane (frag_now);
|
|
|
|
|
|
|
|
frag_new (0);
|
|
|
|
}
|
|
|
|
frag_grow (20);
|
|
|
|
|
|
|
|
p = frag_more (one_inst.size);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_md_number_to_chars (p, one_inst.instruction, one_inst.size);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
#ifdef OBJ_ELF
|
|
|
|
dwarf2_emit_insn (one_inst.size);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
relaxable_p &= (one_inst.relax_size != 0);
|
|
|
|
relax_size = relaxable_p ? one_inst.relax_size : 0;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
p = frag_var (rs_machine_dependent, relax_size + s3_RELAX_PAD_BYTE, 0,
|
|
|
|
s3_RELAX_ENCODE (one_inst.size, one_inst.relax_size,
|
2011-06-13 17:45:28 +08:00
|
|
|
one_inst.type, 0, 0, relaxable_p),
|
2006-09-17 07:51:50 +08:00
|
|
|
NULL, 0, NULL);
|
|
|
|
|
|
|
|
if (relaxable_p)
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_md_number_to_chars (p, one_inst.relax_inst, relax_size);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_handle_dependency (struct s3_score_it *theinst)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int warn_or_error = 0; /* warn - 0; error - 1 */
|
|
|
|
int bubbles = 0;
|
|
|
|
int remainder_bubbles = 0;
|
2009-03-02 18:33:08 +08:00
|
|
|
char cur_insn[s3_INSN_NAME_LEN];
|
|
|
|
char pre_insn[s3_INSN_NAME_LEN];
|
|
|
|
struct s3_score_it nop_inst;
|
|
|
|
struct s3_score_it pflush_inst;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
nop_inst.instruction = 0x0000;
|
|
|
|
nop_inst.size = 2;
|
|
|
|
nop_inst.relax_inst = 0x80008000;
|
|
|
|
nop_inst.relax_size = 4;
|
|
|
|
nop_inst.type = NO16_OPD;
|
|
|
|
|
|
|
|
pflush_inst.instruction = 0x8000800a;
|
|
|
|
pflush_inst.size = 4;
|
|
|
|
pflush_inst.relax_inst = 0x8000;
|
|
|
|
pflush_inst.relax_size = 0;
|
|
|
|
pflush_inst.type = NO_OPD;
|
|
|
|
|
|
|
|
/* pflush will clear all data dependency. */
|
|
|
|
if (strcmp (theinst->name, "pflush") == 0)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_init_dependency_vector ();
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Push current instruction to s3_dependency_vector[0]. */
|
|
|
|
for (i = s3_vector_size - 1; i > 0; i--)
|
|
|
|
memcpy (&s3_dependency_vector[i], &s3_dependency_vector[i - 1], sizeof (s3_dependency_vector[i]));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&s3_dependency_vector[0], theinst, sizeof (s3_dependency_vector[i]));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* There is no dependency between nop and any instruction. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (strcmp (s3_dependency_vector[0].name, "nop") == 0
|
|
|
|
|| strcmp (s3_dependency_vector[0].name, "nop!") == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
strcpy (cur_insn, s3_dependency_vector[0].name);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
for (i = 1; i < s3_vector_size; i++)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* The element of s3_dependency_vector is NULL. */
|
|
|
|
if (s3_dependency_vector[i].name[0] == '\0')
|
2006-09-17 07:51:50 +08:00
|
|
|
continue;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
strcpy (pre_insn, s3_dependency_vector[i].name);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
bubbles = s3_check_dependency (pre_insn, s3_dependency_vector[i].reg,
|
2011-06-13 17:45:28 +08:00
|
|
|
cur_insn, s3_dependency_vector[0].reg, &warn_or_error);
|
2006-09-17 07:51:50 +08:00
|
|
|
remainder_bubbles = bubbles - i + 1;
|
|
|
|
|
|
|
|
if (remainder_bubbles > 0)
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_fix_data_dependency == 1)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
if (remainder_bubbles <= 2)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_warn_fix_data_dependency)
|
2017-01-23 23:23:07 +08:00
|
|
|
as_warn (_("Fix data dependency: %s %s -- %s %s (insert %d nop!/%d)"),
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_dependency_vector[i].name, s3_dependency_vector[i].reg,
|
|
|
|
s3_dependency_vector[0].name, s3_dependency_vector[0].reg,
|
2006-09-17 07:51:50 +08:00
|
|
|
remainder_bubbles, bubbles);
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
for (j = (s3_vector_size - 1); (j - remainder_bubbles) > 0; j--)
|
|
|
|
memcpy (&s3_dependency_vector[j], &s3_dependency_vector[j - remainder_bubbles],
|
|
|
|
sizeof (s3_dependency_vector[j]));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
for (j = 1; j <= remainder_bubbles; j++)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
memset (&s3_dependency_vector[j], '\0', sizeof (s3_dependency_vector[j]));
|
2006-09-17 07:51:50 +08:00
|
|
|
/* Insert nop!. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_build_one_frag (nop_inst);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_warn_fix_data_dependency)
|
2017-01-23 23:23:07 +08:00
|
|
|
as_warn (_("Fix data dependency: %s %s -- %s %s (insert 1 pflush/%d)"),
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_dependency_vector[i].name, s3_dependency_vector[i].reg,
|
|
|
|
s3_dependency_vector[0].name, s3_dependency_vector[0].reg,
|
2006-09-17 07:51:50 +08:00
|
|
|
bubbles);
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
for (j = 1; j < s3_vector_size; j++)
|
|
|
|
memset (&s3_dependency_vector[j], '\0', sizeof (s3_dependency_vector[j]));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Insert pflush. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_build_one_frag (pflush_inst);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (warn_or_error)
|
|
|
|
{
|
2017-01-23 23:23:07 +08:00
|
|
|
as_bad (_("data dependency: %s %s -- %s %s (%d/%d bubble)"),
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_dependency_vector[i].name, s3_dependency_vector[i].reg,
|
|
|
|
s3_dependency_vector[0].name, s3_dependency_vector[0].reg,
|
|
|
|
remainder_bubbles, bubbles);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-01-23 23:23:07 +08:00
|
|
|
as_warn (_("data dependency: %s %s -- %s %s (%d/%d bubble)"),
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_dependency_vector[i].name, s3_dependency_vector[i].reg,
|
|
|
|
s3_dependency_vector[0].name, s3_dependency_vector[0].reg,
|
2006-09-17 07:51:50 +08:00
|
|
|
remainder_bubbles, bubbles);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum insn_class
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_get_insn_class_from_type (enum score_insn_type type)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
enum insn_class retval = (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case Rd_I4:
|
|
|
|
case Rd_I5:
|
|
|
|
case Rd_rvalueBP_I5:
|
|
|
|
case Rd_lvalueBP_I5:
|
|
|
|
case Rd_I8:
|
|
|
|
case PC_DISP8div2:
|
|
|
|
case PC_DISP11div2:
|
|
|
|
case Rd_Rs:
|
|
|
|
case Rd_HighRs:
|
|
|
|
case Rd_lvalueRs:
|
|
|
|
case Rd_rvalueRs:
|
|
|
|
case x_Rs:
|
|
|
|
case Rd_LowRs:
|
|
|
|
case NO16_OPD:
|
2009-03-02 18:33:08 +08:00
|
|
|
case Rd_SI5:
|
|
|
|
case Rd_SI6:
|
2006-09-17 07:51:50 +08:00
|
|
|
retval = INSN_CLASS_16;
|
|
|
|
break;
|
|
|
|
case Rd_Rs_I5:
|
|
|
|
case x_Rs_I5:
|
|
|
|
case x_I5_x:
|
|
|
|
case Rd_Rs_I14:
|
|
|
|
case I15:
|
|
|
|
case Rd_I16:
|
|
|
|
case Rd_SI16:
|
|
|
|
case Rd_rvalueRs_SI10:
|
|
|
|
case Rd_lvalueRs_SI10:
|
|
|
|
case Rd_rvalueRs_preSI12:
|
|
|
|
case Rd_rvalueRs_postSI12:
|
|
|
|
case Rd_lvalueRs_preSI12:
|
|
|
|
case Rd_lvalueRs_postSI12:
|
|
|
|
case Rd_Rs_SI14:
|
|
|
|
case Rd_rvalueRs_SI15:
|
|
|
|
case Rd_lvalueRs_SI15:
|
|
|
|
case PC_DISP19div2:
|
|
|
|
case PC_DISP24div2:
|
|
|
|
case Rd_Rs_Rs:
|
|
|
|
case x_Rs_x:
|
|
|
|
case x_Rs_Rs:
|
|
|
|
case Rd_Rs_x:
|
|
|
|
case Rd_x_Rs:
|
|
|
|
case Rd_x_x:
|
|
|
|
case OP5_rvalueRs_SI15:
|
|
|
|
case I5_Rs_Rs_I5_OP5:
|
|
|
|
case x_rvalueRs_post4:
|
|
|
|
case Rd_rvalueRs_post4:
|
|
|
|
case Rd_x_I5:
|
|
|
|
case Rd_lvalueRs_post4:
|
|
|
|
case x_lvalueRs_post4:
|
|
|
|
case Rd_Rs_Rs_imm:
|
|
|
|
case NO_OPD:
|
|
|
|
case Rd_lvalue32Rs:
|
|
|
|
case Rd_rvalue32Rs:
|
|
|
|
case Insn_GP:
|
|
|
|
case Insn_PIC:
|
2006-10-31 17:54:41 +08:00
|
|
|
case Insn_internal:
|
2009-03-02 18:33:08 +08:00
|
|
|
case Insn_BCMP:
|
|
|
|
case Ra_I9_I5:
|
2006-09-17 07:51:50 +08:00
|
|
|
retval = INSN_CLASS_32;
|
|
|
|
break;
|
|
|
|
case Insn_Type_PCE:
|
|
|
|
retval = INSN_CLASS_PCE;
|
|
|
|
break;
|
|
|
|
case Insn_Type_SYN:
|
|
|
|
retval = INSN_CLASS_SYN;
|
|
|
|
break;
|
2009-03-02 18:33:08 +08:00
|
|
|
case Rd_I30:
|
|
|
|
case Rd_I32:
|
|
|
|
retval = INSN_CLASS_48;
|
|
|
|
break;
|
2006-09-17 07:51:50 +08:00
|
|
|
default:
|
|
|
|
abort ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Type of p-bits:
|
|
|
|
48-bit instruction: 1, 1, 0.
|
|
|
|
32-bit instruction: 1, 0.
|
|
|
|
16-bit instruction: 0. */
|
|
|
|
static bfd_vma
|
* bfd/coff-arm.c (coff_arm_relocate_section)
(record_thumb_to_arm_glue, bfd_arm_process_before_allocation):
Change member name class to symbol_class.
* bfd/coff-i960.c (coff_i960_relocate_section) Rename variable
class to class_val. Change member name class to symbol_class.
* bfd/coff-rs6000.c (_bfd_xcoff_swap_aux_in)
(_bfd_xcoff_swap_aux_out): Rename arguments class to in_class.
* bfd/coff-stgo32.c (adjust_aux_in_post)
(adjust_aux_out_pre, adjust_aux_out_post): Rename arguments class
to in_class.
* bfd/coff64-rs6000.c (_bfd_xcoff64_swap_aux_in)
(_bfd_xcoff64_swap_aux_out): Rename arguments class to in_class.
* bfd/coffcode.h (coff_pointerize_aux_hook): Rename variable class
to n_sclass.
* bfd/coffgen.c (coff_write_symbol, coff_pointerize_aux): Rename
variables named class to n_sclass. (coff_write_symbols): Rename
variable class to sym_class. (bfd_coff_set_symbol_class): Rename
argument class to symbol_class.
* bfd/cofflink.c (_bfd_coff_link_hash_newfunc)
(coff_link_add_symbols, _bfd_coff_link_input_bfd)
(_bfd_coff_write_global_sym, _bfd_coff_generic_relocate_section):
Update code to use renamed members.
* bfd/coffswap.h (coff_swap_aux_in, coff_swap_aux_out): Rename
argument class to in_class.
* bfd/libcoff-in.h (struct coff_link_hash_entry, struct
coff_debug_merge_type) Renamed members class to symbol_class and
type_class.
* bfd/libcoff.h Regenerated.
* bfd/peXXigen.c: (_bfd_XXi_swap_aux_in, _bfd_XXi_swap_aux_out):
Rename argument class to in_class.
* bfd/pef.c (bfd_pef_parse_imported_symbol): Update code to use
renamed members.
* bfd/pef.h (struct bfd_pef_imported_symbol): Changed name of
member class to symbol_class.
* binutils/ieee.c (ieee_read_cxx_misc, ieee_read_cxx_class)
(ieee_read_reference): Rename variables named class to cxxclass.
* gas/config/tc-arc.c (struct syntax_classes): Rename member class
to s_class. (arc_extinst): Rename variable class to
s_class. Update code to use renamed members.
* gas/config/tc-mips.c (insn_uses_reg): Rename argument class to
regclass.
* gas/config/tc-ppc.c (ppc_csect, ppc_change_csect, ppc_function)
(ppc_tc, ppc_is_toc_sym, ppc_symbol_new_hook, ppc_frob_label)
(ppc_fix_adjustable, md_apply_fix): Update code to use renamed
members.
* gas/config/tc-ppc.h (struct ppc_tc_sy): Change name of member
from class to symbol_class. (OBJ_COPY_SYMBOL_ATTRIBUTES): Update
code to use renamed members.
* gas/config/tc-score.c (s3_adjust_paritybit): Rename argument
class to i_class.
* gas/config/tc-score7.c (s7_adjust_paritybit): Rename argument
class to i_class.
* gprof/corefile.c (core_create_function_syms): Rename variable
class to cxxclass.
* include/coff/ti.h (GET_LNSZ_SIZE, PUT_LNSZ_SIZE): Updated name
of class variable to in_class to match changes in function that
use this macro.
* include/opcode/ia64.h (struct ia64_operand): Renamed member
class to op_class
* ld/emultempl/elf32.em (gld${EMULATION_NAME}_load_symbols)
(gld${EMULATION_NAME}_try_needed): Rename variable class to
link_class
* opcodes/ia64-dis.c (print_insn_ia64): Update code to use renamed
member.
* opcodes/m88k-dis.c (m88kdis): Rename variable class to in_class.
* opcodes/tic80-opc.c (tic80_symbol_to_value)
(tic80_value_to_symbol): Rename argument class to symbol_class.
2009-09-05 15:56:26 +08:00
|
|
|
s3_adjust_paritybit (bfd_vma m_code, enum insn_class i_class)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
bfd_vma result = 0;
|
|
|
|
bfd_vma m_code_high = 0;
|
|
|
|
unsigned long m_code_middle = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
unsigned long m_code_low = 0;
|
2009-03-02 18:33:08 +08:00
|
|
|
bfd_vma pb_high = 0;
|
|
|
|
unsigned long pb_middle = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
unsigned long pb_low = 0;
|
|
|
|
|
* bfd/coff-arm.c (coff_arm_relocate_section)
(record_thumb_to_arm_glue, bfd_arm_process_before_allocation):
Change member name class to symbol_class.
* bfd/coff-i960.c (coff_i960_relocate_section) Rename variable
class to class_val. Change member name class to symbol_class.
* bfd/coff-rs6000.c (_bfd_xcoff_swap_aux_in)
(_bfd_xcoff_swap_aux_out): Rename arguments class to in_class.
* bfd/coff-stgo32.c (adjust_aux_in_post)
(adjust_aux_out_pre, adjust_aux_out_post): Rename arguments class
to in_class.
* bfd/coff64-rs6000.c (_bfd_xcoff64_swap_aux_in)
(_bfd_xcoff64_swap_aux_out): Rename arguments class to in_class.
* bfd/coffcode.h (coff_pointerize_aux_hook): Rename variable class
to n_sclass.
* bfd/coffgen.c (coff_write_symbol, coff_pointerize_aux): Rename
variables named class to n_sclass. (coff_write_symbols): Rename
variable class to sym_class. (bfd_coff_set_symbol_class): Rename
argument class to symbol_class.
* bfd/cofflink.c (_bfd_coff_link_hash_newfunc)
(coff_link_add_symbols, _bfd_coff_link_input_bfd)
(_bfd_coff_write_global_sym, _bfd_coff_generic_relocate_section):
Update code to use renamed members.
* bfd/coffswap.h (coff_swap_aux_in, coff_swap_aux_out): Rename
argument class to in_class.
* bfd/libcoff-in.h (struct coff_link_hash_entry, struct
coff_debug_merge_type) Renamed members class to symbol_class and
type_class.
* bfd/libcoff.h Regenerated.
* bfd/peXXigen.c: (_bfd_XXi_swap_aux_in, _bfd_XXi_swap_aux_out):
Rename argument class to in_class.
* bfd/pef.c (bfd_pef_parse_imported_symbol): Update code to use
renamed members.
* bfd/pef.h (struct bfd_pef_imported_symbol): Changed name of
member class to symbol_class.
* binutils/ieee.c (ieee_read_cxx_misc, ieee_read_cxx_class)
(ieee_read_reference): Rename variables named class to cxxclass.
* gas/config/tc-arc.c (struct syntax_classes): Rename member class
to s_class. (arc_extinst): Rename variable class to
s_class. Update code to use renamed members.
* gas/config/tc-mips.c (insn_uses_reg): Rename argument class to
regclass.
* gas/config/tc-ppc.c (ppc_csect, ppc_change_csect, ppc_function)
(ppc_tc, ppc_is_toc_sym, ppc_symbol_new_hook, ppc_frob_label)
(ppc_fix_adjustable, md_apply_fix): Update code to use renamed
members.
* gas/config/tc-ppc.h (struct ppc_tc_sy): Change name of member
from class to symbol_class. (OBJ_COPY_SYMBOL_ATTRIBUTES): Update
code to use renamed members.
* gas/config/tc-score.c (s3_adjust_paritybit): Rename argument
class to i_class.
* gas/config/tc-score7.c (s7_adjust_paritybit): Rename argument
class to i_class.
* gprof/corefile.c (core_create_function_syms): Rename variable
class to cxxclass.
* include/coff/ti.h (GET_LNSZ_SIZE, PUT_LNSZ_SIZE): Updated name
of class variable to in_class to match changes in function that
use this macro.
* include/opcode/ia64.h (struct ia64_operand): Renamed member
class to op_class
* ld/emultempl/elf32.em (gld${EMULATION_NAME}_load_symbols)
(gld${EMULATION_NAME}_try_needed): Rename variable class to
link_class
* opcodes/ia64-dis.c (print_insn_ia64): Update code to use renamed
member.
* opcodes/m88k-dis.c (m88kdis): Rename variable class to in_class.
* opcodes/tic80-opc.c (tic80_symbol_to_value)
(tic80_value_to_symbol): Rename argument class to symbol_class.
2009-09-05 15:56:26 +08:00
|
|
|
if (i_class == INSN_CLASS_48)
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
|
|
|
pb_high = 0x800000000000LL;
|
|
|
|
pb_middle = 0x80000000;
|
|
|
|
pb_low = 0x00000000;
|
|
|
|
m_code_high = m_code & 0x1fffc0000000LL;
|
|
|
|
m_code_middle = m_code & 0x3fff8000;
|
|
|
|
m_code_low = m_code & 0x00007fff;
|
|
|
|
result = pb_high | (m_code_high << 2) |
|
2011-06-13 17:45:28 +08:00
|
|
|
pb_middle | (m_code_middle << 1) |
|
|
|
|
pb_low | m_code_low;
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
* bfd/coff-arm.c (coff_arm_relocate_section)
(record_thumb_to_arm_glue, bfd_arm_process_before_allocation):
Change member name class to symbol_class.
* bfd/coff-i960.c (coff_i960_relocate_section) Rename variable
class to class_val. Change member name class to symbol_class.
* bfd/coff-rs6000.c (_bfd_xcoff_swap_aux_in)
(_bfd_xcoff_swap_aux_out): Rename arguments class to in_class.
* bfd/coff-stgo32.c (adjust_aux_in_post)
(adjust_aux_out_pre, adjust_aux_out_post): Rename arguments class
to in_class.
* bfd/coff64-rs6000.c (_bfd_xcoff64_swap_aux_in)
(_bfd_xcoff64_swap_aux_out): Rename arguments class to in_class.
* bfd/coffcode.h (coff_pointerize_aux_hook): Rename variable class
to n_sclass.
* bfd/coffgen.c (coff_write_symbol, coff_pointerize_aux): Rename
variables named class to n_sclass. (coff_write_symbols): Rename
variable class to sym_class. (bfd_coff_set_symbol_class): Rename
argument class to symbol_class.
* bfd/cofflink.c (_bfd_coff_link_hash_newfunc)
(coff_link_add_symbols, _bfd_coff_link_input_bfd)
(_bfd_coff_write_global_sym, _bfd_coff_generic_relocate_section):
Update code to use renamed members.
* bfd/coffswap.h (coff_swap_aux_in, coff_swap_aux_out): Rename
argument class to in_class.
* bfd/libcoff-in.h (struct coff_link_hash_entry, struct
coff_debug_merge_type) Renamed members class to symbol_class and
type_class.
* bfd/libcoff.h Regenerated.
* bfd/peXXigen.c: (_bfd_XXi_swap_aux_in, _bfd_XXi_swap_aux_out):
Rename argument class to in_class.
* bfd/pef.c (bfd_pef_parse_imported_symbol): Update code to use
renamed members.
* bfd/pef.h (struct bfd_pef_imported_symbol): Changed name of
member class to symbol_class.
* binutils/ieee.c (ieee_read_cxx_misc, ieee_read_cxx_class)
(ieee_read_reference): Rename variables named class to cxxclass.
* gas/config/tc-arc.c (struct syntax_classes): Rename member class
to s_class. (arc_extinst): Rename variable class to
s_class. Update code to use renamed members.
* gas/config/tc-mips.c (insn_uses_reg): Rename argument class to
regclass.
* gas/config/tc-ppc.c (ppc_csect, ppc_change_csect, ppc_function)
(ppc_tc, ppc_is_toc_sym, ppc_symbol_new_hook, ppc_frob_label)
(ppc_fix_adjustable, md_apply_fix): Update code to use renamed
members.
* gas/config/tc-ppc.h (struct ppc_tc_sy): Change name of member
from class to symbol_class. (OBJ_COPY_SYMBOL_ATTRIBUTES): Update
code to use renamed members.
* gas/config/tc-score.c (s3_adjust_paritybit): Rename argument
class to i_class.
* gas/config/tc-score7.c (s7_adjust_paritybit): Rename argument
class to i_class.
* gprof/corefile.c (core_create_function_syms): Rename variable
class to cxxclass.
* include/coff/ti.h (GET_LNSZ_SIZE, PUT_LNSZ_SIZE): Updated name
of class variable to in_class to match changes in function that
use this macro.
* include/opcode/ia64.h (struct ia64_operand): Renamed member
class to op_class
* ld/emultempl/elf32.em (gld${EMULATION_NAME}_load_symbols)
(gld${EMULATION_NAME}_try_needed): Rename variable class to
link_class
* opcodes/ia64-dis.c (print_insn_ia64): Update code to use renamed
member.
* opcodes/m88k-dis.c (m88kdis): Rename variable class to in_class.
* opcodes/tic80-opc.c (tic80_symbol_to_value)
(tic80_value_to_symbol): Rename argument class to symbol_class.
2009-09-05 15:56:26 +08:00
|
|
|
else if (i_class == INSN_CLASS_32 || i_class == INSN_CLASS_SYN)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
pb_high = 0x80000000;
|
2009-03-02 18:33:08 +08:00
|
|
|
pb_low = 0x00000000;
|
|
|
|
m_code_high = m_code & 0x3fff8000;
|
|
|
|
m_code_low = m_code & 0x00007fff;
|
|
|
|
result = pb_high | (m_code_high << 1) | pb_low | m_code_low;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
* bfd/coff-arm.c (coff_arm_relocate_section)
(record_thumb_to_arm_glue, bfd_arm_process_before_allocation):
Change member name class to symbol_class.
* bfd/coff-i960.c (coff_i960_relocate_section) Rename variable
class to class_val. Change member name class to symbol_class.
* bfd/coff-rs6000.c (_bfd_xcoff_swap_aux_in)
(_bfd_xcoff_swap_aux_out): Rename arguments class to in_class.
* bfd/coff-stgo32.c (adjust_aux_in_post)
(adjust_aux_out_pre, adjust_aux_out_post): Rename arguments class
to in_class.
* bfd/coff64-rs6000.c (_bfd_xcoff64_swap_aux_in)
(_bfd_xcoff64_swap_aux_out): Rename arguments class to in_class.
* bfd/coffcode.h (coff_pointerize_aux_hook): Rename variable class
to n_sclass.
* bfd/coffgen.c (coff_write_symbol, coff_pointerize_aux): Rename
variables named class to n_sclass. (coff_write_symbols): Rename
variable class to sym_class. (bfd_coff_set_symbol_class): Rename
argument class to symbol_class.
* bfd/cofflink.c (_bfd_coff_link_hash_newfunc)
(coff_link_add_symbols, _bfd_coff_link_input_bfd)
(_bfd_coff_write_global_sym, _bfd_coff_generic_relocate_section):
Update code to use renamed members.
* bfd/coffswap.h (coff_swap_aux_in, coff_swap_aux_out): Rename
argument class to in_class.
* bfd/libcoff-in.h (struct coff_link_hash_entry, struct
coff_debug_merge_type) Renamed members class to symbol_class and
type_class.
* bfd/libcoff.h Regenerated.
* bfd/peXXigen.c: (_bfd_XXi_swap_aux_in, _bfd_XXi_swap_aux_out):
Rename argument class to in_class.
* bfd/pef.c (bfd_pef_parse_imported_symbol): Update code to use
renamed members.
* bfd/pef.h (struct bfd_pef_imported_symbol): Changed name of
member class to symbol_class.
* binutils/ieee.c (ieee_read_cxx_misc, ieee_read_cxx_class)
(ieee_read_reference): Rename variables named class to cxxclass.
* gas/config/tc-arc.c (struct syntax_classes): Rename member class
to s_class. (arc_extinst): Rename variable class to
s_class. Update code to use renamed members.
* gas/config/tc-mips.c (insn_uses_reg): Rename argument class to
regclass.
* gas/config/tc-ppc.c (ppc_csect, ppc_change_csect, ppc_function)
(ppc_tc, ppc_is_toc_sym, ppc_symbol_new_hook, ppc_frob_label)
(ppc_fix_adjustable, md_apply_fix): Update code to use renamed
members.
* gas/config/tc-ppc.h (struct ppc_tc_sy): Change name of member
from class to symbol_class. (OBJ_COPY_SYMBOL_ATTRIBUTES): Update
code to use renamed members.
* gas/config/tc-score.c (s3_adjust_paritybit): Rename argument
class to i_class.
* gas/config/tc-score7.c (s7_adjust_paritybit): Rename argument
class to i_class.
* gprof/corefile.c (core_create_function_syms): Rename variable
class to cxxclass.
* include/coff/ti.h (GET_LNSZ_SIZE, PUT_LNSZ_SIZE): Updated name
of class variable to in_class to match changes in function that
use this macro.
* include/opcode/ia64.h (struct ia64_operand): Renamed member
class to op_class
* ld/emultempl/elf32.em (gld${EMULATION_NAME}_load_symbols)
(gld${EMULATION_NAME}_try_needed): Rename variable class to
link_class
* opcodes/ia64-dis.c (print_insn_ia64): Update code to use renamed
member.
* opcodes/m88k-dis.c (m88kdis): Rename variable class to in_class.
* opcodes/tic80-opc.c (tic80_symbol_to_value)
(tic80_value_to_symbol): Rename argument class to symbol_class.
2009-09-05 15:56:26 +08:00
|
|
|
else if (i_class == INSN_CLASS_16)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
pb_high = 0;
|
|
|
|
pb_low = 0;
|
2009-03-02 18:33:08 +08:00
|
|
|
m_code_high = m_code & 0x3fff8000;
|
|
|
|
m_code_low = m_code & 0x00007fff;
|
|
|
|
result = pb_high | (m_code_high << 1) | pb_low | m_code_low;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
* bfd/coff-arm.c (coff_arm_relocate_section)
(record_thumb_to_arm_glue, bfd_arm_process_before_allocation):
Change member name class to symbol_class.
* bfd/coff-i960.c (coff_i960_relocate_section) Rename variable
class to class_val. Change member name class to symbol_class.
* bfd/coff-rs6000.c (_bfd_xcoff_swap_aux_in)
(_bfd_xcoff_swap_aux_out): Rename arguments class to in_class.
* bfd/coff-stgo32.c (adjust_aux_in_post)
(adjust_aux_out_pre, adjust_aux_out_post): Rename arguments class
to in_class.
* bfd/coff64-rs6000.c (_bfd_xcoff64_swap_aux_in)
(_bfd_xcoff64_swap_aux_out): Rename arguments class to in_class.
* bfd/coffcode.h (coff_pointerize_aux_hook): Rename variable class
to n_sclass.
* bfd/coffgen.c (coff_write_symbol, coff_pointerize_aux): Rename
variables named class to n_sclass. (coff_write_symbols): Rename
variable class to sym_class. (bfd_coff_set_symbol_class): Rename
argument class to symbol_class.
* bfd/cofflink.c (_bfd_coff_link_hash_newfunc)
(coff_link_add_symbols, _bfd_coff_link_input_bfd)
(_bfd_coff_write_global_sym, _bfd_coff_generic_relocate_section):
Update code to use renamed members.
* bfd/coffswap.h (coff_swap_aux_in, coff_swap_aux_out): Rename
argument class to in_class.
* bfd/libcoff-in.h (struct coff_link_hash_entry, struct
coff_debug_merge_type) Renamed members class to symbol_class and
type_class.
* bfd/libcoff.h Regenerated.
* bfd/peXXigen.c: (_bfd_XXi_swap_aux_in, _bfd_XXi_swap_aux_out):
Rename argument class to in_class.
* bfd/pef.c (bfd_pef_parse_imported_symbol): Update code to use
renamed members.
* bfd/pef.h (struct bfd_pef_imported_symbol): Changed name of
member class to symbol_class.
* binutils/ieee.c (ieee_read_cxx_misc, ieee_read_cxx_class)
(ieee_read_reference): Rename variables named class to cxxclass.
* gas/config/tc-arc.c (struct syntax_classes): Rename member class
to s_class. (arc_extinst): Rename variable class to
s_class. Update code to use renamed members.
* gas/config/tc-mips.c (insn_uses_reg): Rename argument class to
regclass.
* gas/config/tc-ppc.c (ppc_csect, ppc_change_csect, ppc_function)
(ppc_tc, ppc_is_toc_sym, ppc_symbol_new_hook, ppc_frob_label)
(ppc_fix_adjustable, md_apply_fix): Update code to use renamed
members.
* gas/config/tc-ppc.h (struct ppc_tc_sy): Change name of member
from class to symbol_class. (OBJ_COPY_SYMBOL_ATTRIBUTES): Update
code to use renamed members.
* gas/config/tc-score.c (s3_adjust_paritybit): Rename argument
class to i_class.
* gas/config/tc-score7.c (s7_adjust_paritybit): Rename argument
class to i_class.
* gprof/corefile.c (core_create_function_syms): Rename variable
class to cxxclass.
* include/coff/ti.h (GET_LNSZ_SIZE, PUT_LNSZ_SIZE): Updated name
of class variable to in_class to match changes in function that
use this macro.
* include/opcode/ia64.h (struct ia64_operand): Renamed member
class to op_class
* ld/emultempl/elf32.em (gld${EMULATION_NAME}_load_symbols)
(gld${EMULATION_NAME}_try_needed): Rename variable class to
link_class
* opcodes/ia64-dis.c (print_insn_ia64): Update code to use renamed
member.
* opcodes/m88k-dis.c (m88kdis): Rename variable class to in_class.
* opcodes/tic80-opc.c (tic80_symbol_to_value)
(tic80_value_to_symbol): Rename argument class to symbol_class.
2009-09-05 15:56:26 +08:00
|
|
|
else if (i_class == INSN_CLASS_PCE)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Keep original. */
|
2006-09-17 07:51:50 +08:00
|
|
|
pb_high = 0;
|
|
|
|
pb_low = 0x00008000;
|
2009-03-02 18:33:08 +08:00
|
|
|
m_code_high = m_code & 0x3fff8000;
|
|
|
|
m_code_low = m_code & 0x00007fff;
|
|
|
|
result = pb_high | (m_code_high << 1) | pb_low | m_code_low;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_gen_insn_frag (struct s3_score_it *part_1, struct s3_score_it *part_2)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
bfd_boolean pce_p = FALSE;
|
2009-03-02 18:33:08 +08:00
|
|
|
int relaxable_p = s3_g_opt;
|
2006-09-17 07:51:50 +08:00
|
|
|
int relax_size = 0;
|
2009-03-02 18:33:08 +08:00
|
|
|
struct s3_score_it *inst1 = part_1;
|
|
|
|
struct s3_score_it *inst2 = part_2;
|
|
|
|
struct s3_score_it backup_inst1;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
pce_p = (inst2) ? TRUE : FALSE;
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&backup_inst1, inst1, sizeof (struct s3_score_it));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Adjust instruction opcode and to be relaxed instruction opcode. */
|
|
|
|
if (pce_p)
|
|
|
|
{
|
|
|
|
backup_inst1.instruction = ((backup_inst1.instruction & 0x7FFF) << 15)
|
2011-06-13 17:45:28 +08:00
|
|
|
| (inst2->instruction & 0x7FFF);
|
2009-03-02 18:33:08 +08:00
|
|
|
backup_inst1.instruction = s3_adjust_paritybit (backup_inst1.instruction, INSN_CLASS_PCE);
|
2006-09-17 07:51:50 +08:00
|
|
|
backup_inst1.relax_inst = 0x8000;
|
2009-03-02 18:33:08 +08:00
|
|
|
backup_inst1.size = s3_INSN_SIZE;
|
2006-09-17 07:51:50 +08:00
|
|
|
backup_inst1.relax_size = 0;
|
|
|
|
backup_inst1.type = Insn_Type_PCE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
backup_inst1.instruction = s3_adjust_paritybit (backup_inst1.instruction,
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_GET_INSN_CLASS (backup_inst1.type));
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (backup_inst1.relax_size != 0)
|
|
|
|
{
|
|
|
|
enum insn_class tmp;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
tmp = (backup_inst1.size == s3_INSN_SIZE) ? INSN_CLASS_16 : INSN_CLASS_32;
|
|
|
|
backup_inst1.relax_inst = s3_adjust_paritybit (backup_inst1.relax_inst, tmp);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check data dependency. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_handle_dependency (&backup_inst1);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Start a new frag if frag_now is not empty and is not instruction frag, maybe it contains
|
|
|
|
data produced by .ascii etc. Doing this is to make one instruction per frag. */
|
|
|
|
if (frag_now_fix () != 0)
|
|
|
|
{
|
|
|
|
if (!frag_now->tc_frag_data.is_insn)
|
|
|
|
frag_wane (frag_now);
|
|
|
|
|
|
|
|
frag_new (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Here, we must call frag_grow in order to keep the instruction frag type is
|
|
|
|
rs_machine_dependent.
|
|
|
|
For, frag_var may change frag_now->fr_type to rs_fill by calling frag_grow which
|
2017-01-23 23:23:07 +08:00
|
|
|
actually will call frag_wane.
|
2006-09-17 07:51:50 +08:00
|
|
|
Calling frag_grow first will create a new frag_now which free size is 20 that is enough
|
|
|
|
for frag_var. */
|
|
|
|
frag_grow (20);
|
|
|
|
|
|
|
|
p = frag_more (backup_inst1.size);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_md_number_to_chars (p, backup_inst1.instruction, backup_inst1.size);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
#ifdef OBJ_ELF
|
|
|
|
dwarf2_emit_insn (backup_inst1.size);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Generate fixup structure. */
|
|
|
|
if (pce_p)
|
|
|
|
{
|
|
|
|
if (inst1->reloc.type != BFD_RELOC_NONE)
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_fix_new_score (frag_now, p - frag_now->fr_literal,
|
2011-06-13 17:45:28 +08:00
|
|
|
inst1->size, &inst1->reloc.exp,
|
|
|
|
inst1->reloc.pc_rel, inst1->reloc.type);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
if (inst2->reloc.type != BFD_RELOC_NONE)
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_fix_new_score (frag_now, p - frag_now->fr_literal + 2,
|
2011-06-13 17:45:28 +08:00
|
|
|
inst2->size, &inst2->reloc.exp, inst2->reloc.pc_rel, inst2->reloc.type);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (backup_inst1.reloc.type != BFD_RELOC_NONE)
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_fix_new_score (frag_now, p - frag_now->fr_literal,
|
2011-06-13 17:45:28 +08:00
|
|
|
backup_inst1.size, &backup_inst1.reloc.exp,
|
|
|
|
backup_inst1.reloc.pc_rel, backup_inst1.reloc.type);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* relax_size may be 2, 4, 12 or 0, 0 indicates no relaxation. */
|
|
|
|
relaxable_p &= (backup_inst1.relax_size != 0);
|
|
|
|
relax_size = relaxable_p ? backup_inst1.relax_size : 0;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
p = frag_var (rs_machine_dependent, relax_size + s3_RELAX_PAD_BYTE, 0,
|
|
|
|
s3_RELAX_ENCODE (backup_inst1.size, backup_inst1.relax_size,
|
2011-06-13 17:45:28 +08:00
|
|
|
backup_inst1.type, 0, 0, relaxable_p),
|
2006-09-17 07:51:50 +08:00
|
|
|
backup_inst1.reloc.exp.X_add_symbol, 0, NULL);
|
|
|
|
|
|
|
|
if (relaxable_p)
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_md_number_to_chars (p, backup_inst1.relax_inst, relax_size);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (inst1, &backup_inst1, sizeof (struct s3_score_it));
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_parse_16_32_inst (char *insnstr, bfd_boolean gen_frag_p)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
char c;
|
|
|
|
char *p;
|
|
|
|
char *operator = insnstr;
|
2009-03-02 18:33:08 +08:00
|
|
|
const struct s3_asm_opcode *opcode;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Parse operator and operands. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (operator);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
for (p = operator; *p != '\0'; p++)
|
|
|
|
if ((*p == ' ') || (*p == '!'))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (*p == '!')
|
|
|
|
p++;
|
|
|
|
|
|
|
|
c = *p;
|
|
|
|
*p = '\0';
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
opcode = (const struct s3_asm_opcode *) hash_find (s3_score_ops_hsh, operator);
|
|
|
|
*p = c;
|
|
|
|
|
|
|
|
memset (&s3_inst, '\0', sizeof (s3_inst));
|
|
|
|
sprintf (s3_inst.str, "%s", insnstr);
|
|
|
|
if (opcode)
|
|
|
|
{
|
|
|
|
s3_inst.instruction = opcode->value;
|
|
|
|
s3_inst.relax_inst = opcode->relax_value;
|
|
|
|
s3_inst.type = opcode->type;
|
|
|
|
s3_inst.size = s3_GET_INSN_SIZE (s3_inst.type);
|
|
|
|
s3_inst.relax_size = 0;
|
|
|
|
s3_inst.bwarn = 0;
|
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 06:11:02 +08:00
|
|
|
sprintf (s3_inst.name, "%s", opcode->template_name);
|
2009-03-02 18:33:08 +08:00
|
|
|
strcpy (s3_inst.reg, "");
|
|
|
|
s3_inst.error = NULL;
|
|
|
|
s3_inst.reloc.type = BFD_RELOC_NONE;
|
|
|
|
|
|
|
|
(*opcode->parms) (p);
|
|
|
|
|
|
|
|
/* It indicates current instruction is a macro instruction if s3_inst.bwarn equals -1. */
|
|
|
|
if ((s3_inst.bwarn != -1) && (!s3_inst.error) && (gen_frag_p))
|
|
|
|
s3_gen_insn_frag (&s3_inst, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
s3_inst.error = _("unrecognized opcode");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_parse_48_inst (char *insnstr, bfd_boolean gen_frag_p)
|
|
|
|
{
|
|
|
|
char c;
|
|
|
|
char *p;
|
|
|
|
char *operator = insnstr;
|
|
|
|
const struct s3_asm_opcode *opcode;
|
|
|
|
|
|
|
|
/* Parse operator and operands. */
|
|
|
|
s3_skip_whitespace (operator);
|
|
|
|
|
|
|
|
for (p = operator; *p != '\0'; p++)
|
|
|
|
if (*p == ' ')
|
|
|
|
break;
|
|
|
|
|
|
|
|
c = *p;
|
|
|
|
*p = '\0';
|
|
|
|
|
|
|
|
opcode = (const struct s3_asm_opcode *) hash_find (s3_score_ops_hsh, operator);
|
2006-09-17 07:51:50 +08:00
|
|
|
*p = c;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memset (&s3_inst, '\0', sizeof (s3_inst));
|
|
|
|
sprintf (s3_inst.str, "%s", insnstr);
|
2006-09-17 07:51:50 +08:00
|
|
|
if (opcode)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.instruction = opcode->value;
|
|
|
|
s3_inst.relax_inst = opcode->relax_value;
|
|
|
|
s3_inst.type = opcode->type;
|
|
|
|
s3_inst.size = s3_GET_INSN_SIZE (s3_inst.type);
|
|
|
|
s3_inst.relax_size = 0;
|
|
|
|
s3_inst.bwarn = 0;
|
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 06:11:02 +08:00
|
|
|
sprintf (s3_inst.name, "%s", opcode->template_name);
|
2009-03-02 18:33:08 +08:00
|
|
|
strcpy (s3_inst.reg, "");
|
|
|
|
s3_inst.error = NULL;
|
|
|
|
s3_inst.reloc.type = BFD_RELOC_NONE;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
(*opcode->parms) (p);
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* It indicates current instruction is a macro instruction if s3_inst.bwarn equals -1. */
|
|
|
|
if ((s3_inst.bwarn != -1) && (!s3_inst.error) && (gen_frag_p))
|
|
|
|
s3_gen_insn_frag (&s3_inst, NULL);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("unrecognized opcode");
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_append_insn (char *str, bfd_boolean gen_frag_p)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
int retval = s3_SUCCESS;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_parse_16_32_inst (str, gen_frag_p);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.error)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
retval = (int) s3_FAIL;
|
|
|
|
as_bad (_("%s -- `%s'"), s3_inst.error, s3_inst.str);
|
|
|
|
s3_inst.error = NULL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do16_mv_cmp (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_do16_cmpi (char *str)
|
|
|
|
{
|
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 0, _SIMM5) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
|
|
|
{
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do16_addi (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reglow_required_here (&str, 6) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 0, _SIMM6) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Handle bitclr! / bitset! / bittst! / bittgl! */
|
2006-09-17 07:51:50 +08:00
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do16_rdi5 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reglow_required_here (&str, 5) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >>5) & 0xf) << 20)
|
|
|
|
| (((s3_inst.instruction >> 5) & 0xf) << 15) | (((s3_inst.instruction ) & 0x1f) << 10);
|
|
|
|
s3_inst.relax_size = 4;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
/* Handle sdbbp!. */
|
2006-09-17 07:51:50 +08:00
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do16_xi5 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL || s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check that an immediate is word alignment or half word alignment.
|
|
|
|
If so, convert it to the right format. */
|
|
|
|
static int
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_validate_immediate_align (int val, unsigned int data_type)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
if (data_type == _IMM5_RSHIFT_1)
|
|
|
|
{
|
|
|
|
if (val % 2)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("address offset must be half word alignment");
|
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((data_type == _IMM5_RSHIFT_2) || (data_type == _IMM10_RSHIFT_2))
|
|
|
|
{
|
|
|
|
if (val % 4)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("address offset must be word alignment");
|
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
return s3_SUCCESS;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_exp_ldst_offset (char **str, int shift, unsigned int data_type)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
char *dataptr;
|
|
|
|
|
|
|
|
dataptr = * str;
|
|
|
|
|
|
|
|
if ((*dataptr == '0') && (*(dataptr + 1) == 'x')
|
|
|
|
&& (data_type != _SIMM16_LA)
|
|
|
|
&& (data_type != _VALUE_HI16)
|
|
|
|
&& (data_type != _VALUE_LO16)
|
|
|
|
&& (data_type != _IMM16)
|
|
|
|
&& (data_type != _IMM15)
|
|
|
|
&& (data_type != _IMM14)
|
|
|
|
&& (data_type != _IMM4)
|
|
|
|
&& (data_type != _IMM5)
|
|
|
|
&& (data_type != _IMM8)
|
|
|
|
&& (data_type != _IMM5_RSHIFT_1)
|
|
|
|
&& (data_type != _IMM5_RSHIFT_2)
|
|
|
|
&& (data_type != _SIMM14_NEG)
|
|
|
|
&& (data_type != _IMM10_RSHIFT_2))
|
|
|
|
{
|
|
|
|
data_type += 24;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, str) == (int) s3_FAIL)
|
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.reloc.exp.X_op == O_constant)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
/* Need to check the immediate align. */
|
2009-03-02 18:33:08 +08:00
|
|
|
int value = s3_validate_immediate_align (s3_inst.reloc.exp.X_add_number, data_type);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (value == (int) s3_FAIL)
|
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, data_type, 0);
|
|
|
|
if (value == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
if (data_type < 30)
|
2009-03-02 18:33:08 +08:00
|
|
|
sprintf (s3_err_msg,
|
2007-01-18 18:33:49 +08:00
|
|
|
_("invalid constant: %d bit expression not in range %d..%d"),
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_score_df_range[data_type].bits,
|
|
|
|
s3_score_df_range[data_type].range[0], s3_score_df_range[data_type].range[1]);
|
2006-09-17 07:51:50 +08:00
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
sprintf (s3_err_msg,
|
2007-01-18 18:33:49 +08:00
|
|
|
_("invalid constant: %d bit expression not in range %d..%d"),
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_score_df_range[data_type - 24].bits,
|
|
|
|
s3_score_df_range[data_type - 24].range[0], s3_score_df_range[data_type - 24].range[1]);
|
|
|
|
s3_inst.error = s3_err_msg;
|
|
|
|
return (int) s3_FAIL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (data_type == _IMM5_RSHIFT_1)
|
|
|
|
{
|
|
|
|
value >>= 1;
|
|
|
|
}
|
|
|
|
else if ((data_type == _IMM5_RSHIFT_2) || (data_type == _IMM10_RSHIFT_2))
|
|
|
|
{
|
|
|
|
value >>= 2;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_score_df_range[data_type].range[0] != 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
value &= (1 << s3_score_df_range[data_type].bits) - 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.instruction |= value << shift;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.reloc.pc_rel = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
return s3_SUCCESS;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_ldst_insn (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
int pre_inc = 0;
|
|
|
|
int conflict_reg;
|
|
|
|
int value;
|
|
|
|
char * temp;
|
|
|
|
char *dataptr;
|
|
|
|
int reg;
|
|
|
|
int ldst_idx = 0;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (((conflict_reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
|
|
|
|
|| (s3_skip_past_comma (&str) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* ld/sw rD, [rA, simm15] ld/sw rD, [rA]+, simm12 ld/sw rD, [rA, simm12]+. */
|
|
|
|
if (*str == '[')
|
|
|
|
{
|
|
|
|
str++;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Conflicts can occur on stores as well as loads. */
|
|
|
|
conflict_reg = (conflict_reg == reg);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
temp = str + 1; /* The latter will process decimal/hex expression. */
|
|
|
|
|
|
|
|
/* ld/sw rD, [rA]+, simm12 ld/sw rD, [rA]+. */
|
|
|
|
if (*str == ']')
|
|
|
|
{
|
|
|
|
str++;
|
|
|
|
if (*str == '+')
|
|
|
|
{
|
|
|
|
str++;
|
|
|
|
/* ld/sw rD, [rA]+, simm12. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_skip_past_comma (&str) == s3_SUCCESS)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_exp_ldst_offset (&str, 3, _SIMM12) == (int) s3_FAIL)
|
|
|
|
|| (s3_end_of_line (str) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (conflict_reg)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
unsigned int ldst_func = s3_inst.instruction & OPC_PSEUDOLDST_MASK;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
if ((ldst_func == INSN_LH)
|
|
|
|
|| (ldst_func == INSN_LHU)
|
|
|
|
|| (ldst_func == INSN_LW)
|
|
|
|
|| (ldst_func == INSN_LB)
|
|
|
|
|| (ldst_func == INSN_LBU))
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("register same as write-back base");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
ldst_idx = s3_inst.instruction & OPC_PSEUDOLDST_MASK;
|
|
|
|
s3_inst.instruction &= ~OPC_PSEUDOLDST_MASK;
|
|
|
|
s3_inst.instruction |= s3_score_ldst_insns[ldst_idx * 3 + LDST_POST].value;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* lw rD, [rA]+, 4 convert to pop rD, [rA]. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_inst.instruction & 0x3e000007) == 0x0e000000)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* rs = r0, offset = 4 */
|
|
|
|
if ((((s3_inst.instruction >> 15) & 0x1f) == 0)
|
|
|
|
&& (((s3_inst.instruction >> 3) & 0xfff) == 4))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Relax to pop!. */
|
|
|
|
s3_inst.relax_inst = 0x0040 | ((s3_inst.instruction >> 20) & 0x1f);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* ld/sw rD, [rA]+ convert to ld/sw rD, [rA, 0]+. */
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_SET_INSN_ERROR (NULL);
|
|
|
|
if (s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pre_inc = 1;
|
2009-03-02 18:33:08 +08:00
|
|
|
value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _SIMM12, 0);
|
|
|
|
value &= (1 << s3_score_df_range[_SIMM12].bits) - 1;
|
|
|
|
ldst_idx = s3_inst.instruction & OPC_PSEUDOLDST_MASK;
|
|
|
|
s3_inst.instruction &= ~OPC_PSEUDOLDST_MASK;
|
|
|
|
s3_inst.instruction |= s3_score_ldst_insns[ldst_idx * 3 + pre_inc].value;
|
|
|
|
s3_inst.instruction |= value << 3;
|
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* ld/sw rD, [rA] convert to ld/sw rD, [rA, simm15]. */
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
ldst_idx = s3_inst.instruction & OPC_PSEUDOLDST_MASK;
|
|
|
|
s3_inst.instruction &= ~OPC_PSEUDOLDST_MASK;
|
|
|
|
s3_inst.instruction |= s3_score_ldst_insns[ldst_idx * 3 + LDST_NOUPDATE].value;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* lbu rd, [rs] -> lbu! rd, [rs] */
|
|
|
|
if (ldst_idx == INSN_LBU)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = INSN16_LBU;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else if (ldst_idx == INSN_LH)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = INSN16_LH;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else if (ldst_idx == INSN_LW)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = INSN16_LW;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else if (ldst_idx == INSN_SB)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = INSN16_SB;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else if (ldst_idx == INSN_SH)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = INSN16_SH;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else if (ldst_idx == INSN_SW)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = INSN16_SW;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* lw/lh/lbu/sw/sh/sb, offset = 0, relax to 16 bit instruction. */
|
2009-03-02 18:33:08 +08:00
|
|
|
/* if ((ldst_idx == INSN_LBU)
|
2011-06-13 17:45:28 +08:00
|
|
|
|| (ldst_idx == INSN_LH)
|
|
|
|
|| (ldst_idx == INSN_LW)
|
|
|
|
|| (ldst_idx == INSN_SB) || (ldst_idx == INSN_SH) || (ldst_idx == INSN_SW))*/
|
2009-03-02 18:33:08 +08:00
|
|
|
if ( (ldst_idx == INSN_LW)|| (ldst_idx == INSN_SW))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* ra only 3 bit , rd only 4 bit for lw! and sw! */
|
|
|
|
if ((((s3_inst.instruction >> 15) & 0x18) == 0) && (((s3_inst.instruction >> 20) & 0x10) == 0))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 20) & 0xf) << 8) |
|
|
|
|
(((s3_inst.instruction >> 15) & 0x7) << 5);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* ld/sw rD, [rA, simm15] ld/sw rD, [rA, simm12]+. */
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_skip_past_comma (&str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("pre-indexed expression expected");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
if (*str++ != ']')
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("missing ]");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
/* ld/sw rD, [rA, simm12]+. */
|
|
|
|
if (*str == '+')
|
|
|
|
{
|
|
|
|
str++;
|
|
|
|
pre_inc = 1;
|
|
|
|
if (conflict_reg)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
unsigned int ldst_func = s3_inst.instruction & OPC_PSEUDOLDST_MASK;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
if ((ldst_func == INSN_LH)
|
|
|
|
|| (ldst_func == INSN_LHU)
|
|
|
|
|| (ldst_func == INSN_LW)
|
|
|
|
|| (ldst_func == INSN_LB)
|
|
|
|
|| (ldst_func == INSN_LBU))
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("register same as write-back base");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.reloc.exp.X_op == O_constant)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
unsigned int data_type;
|
|
|
|
|
|
|
|
if (pre_inc == 1)
|
|
|
|
data_type = _SIMM12;
|
|
|
|
else
|
|
|
|
data_type = _SIMM15;
|
|
|
|
dataptr = temp;
|
|
|
|
|
|
|
|
if ((*dataptr == '0') && (*(dataptr + 1) == 'x')
|
|
|
|
&& (data_type != _SIMM16_LA)
|
|
|
|
&& (data_type != _VALUE_HI16)
|
|
|
|
&& (data_type != _VALUE_LO16)
|
|
|
|
&& (data_type != _IMM16)
|
|
|
|
&& (data_type != _IMM15)
|
|
|
|
&& (data_type != _IMM14)
|
|
|
|
&& (data_type != _IMM4)
|
|
|
|
&& (data_type != _IMM5)
|
|
|
|
&& (data_type != _IMM8)
|
|
|
|
&& (data_type != _IMM5_RSHIFT_1)
|
|
|
|
&& (data_type != _IMM5_RSHIFT_2)
|
|
|
|
&& (data_type != _SIMM14_NEG)
|
|
|
|
&& (data_type != _IMM10_RSHIFT_2))
|
|
|
|
{
|
|
|
|
data_type += 24;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, data_type, 0);
|
|
|
|
if (value == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2006-10-31 17:54:41 +08:00
|
|
|
if (data_type < 30)
|
2009-03-02 18:33:08 +08:00
|
|
|
sprintf (s3_err_msg,
|
2007-01-18 18:33:49 +08:00
|
|
|
_("invalid constant: %d bit expression not in range %d..%d"),
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_score_df_range[data_type].bits,
|
|
|
|
s3_score_df_range[data_type].range[0], s3_score_df_range[data_type].range[1]);
|
2006-09-17 07:51:50 +08:00
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
sprintf (s3_err_msg,
|
2007-01-18 18:33:49 +08:00
|
|
|
_("invalid constant: %d bit expression not in range %d..%d"),
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_score_df_range[data_type - 24].bits,
|
|
|
|
s3_score_df_range[data_type - 24].range[0],
|
|
|
|
s3_score_df_range[data_type - 24].range[1]);
|
|
|
|
s3_inst.error = s3_err_msg;
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
value &= (1 << s3_score_df_range[data_type].bits) - 1;
|
|
|
|
ldst_idx = s3_inst.instruction & OPC_PSEUDOLDST_MASK;
|
|
|
|
s3_inst.instruction &= ~OPC_PSEUDOLDST_MASK;
|
|
|
|
s3_inst.instruction |= s3_score_ldst_insns[ldst_idx * 3 + pre_inc].value;
|
2006-09-17 07:51:50 +08:00
|
|
|
if (pre_inc == 1)
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.instruction |= value << 3;
|
2006-09-17 07:51:50 +08:00
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.instruction |= value;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* lw rD, [rA, simm15] */
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_inst.instruction & 0x3e000000) == 0x20000000)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* rD in [r0 - r15]. , ra in [r0-r7] */
|
|
|
|
if ((((s3_inst.instruction >> 15) & 0x18) == 0)
|
|
|
|
&& (((s3_inst.instruction >> 20) & 0x10) == 0))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* simm = [bit 7], lw -> lw!. */
|
|
|
|
if (((s3_inst.instruction & 0x7f80) == 0)&&((s3_inst.instruction &0x3)==0))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 15) & 0x7) << 5)
|
|
|
|
| (((s3_inst.instruction >> 20) & 0xf) << 8)|(value>>2);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* sw rD, [rA, simm15] */
|
2009-03-02 18:33:08 +08:00
|
|
|
else if ((s3_inst.instruction & 0x3e000000) == 0x28000000)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* rD is in [r0 - r15] and ra in [r0-r7] */
|
|
|
|
if ((((s3_inst.instruction >> 15) & 0x18) == 0) && (((s3_inst.instruction >> 20) & 0x10) == 0))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* simm15 =7 bit , sw -> sw!. */
|
|
|
|
if (((s3_inst.instruction & 0x7f80) == 0)&&((s3_inst.instruction &0x3)==0))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 15) & 0xf) << 5)
|
|
|
|
| (((s3_inst.instruction >> 20) & 0xf) << 8)|(value>>2);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
/* rA = r2, sw -> swp!. */
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* sw rD, [rA, simm15]+ sw pre. */
|
2009-03-02 18:33:08 +08:00
|
|
|
else if ((s3_inst.instruction & 0x3e000007) == 0x06000004)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* simm15 = -4. and ra==r0 */
|
|
|
|
if ((((s3_inst.instruction >> 15) & 0x1f) == 0)
|
|
|
|
&& (((s3_inst.instruction >> 3) & 0xfff) == 0xffc))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
/* sw -> push!. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x0060 | ((s3_inst.instruction >> 20) & 0x1f);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* FIXME: may set error, for there is no ld/sw rD, [rA, label] */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.reloc.pc_rel = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_BAD_ARGS;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle cache. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_cache (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_data_op2 (&str, 20, _IMM5) == (int) s3_FAIL) || (s3_skip_past_comma (&str) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int cache_op;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
cache_op = (s3_inst.instruction >> 20) & 0x1F;
|
|
|
|
sprintf (s3_inst.name, "cache %d", cache_op);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (*str == '[')
|
|
|
|
{
|
|
|
|
str++;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* cache op, [rA] */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_skip_past_comma (&str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_SET_INSN_ERROR (NULL);
|
2006-09-17 07:51:50 +08:00
|
|
|
if (*str != ']')
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("missing ]");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
str++;
|
|
|
|
}
|
|
|
|
/* cache op, [rA, simm15] */
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_exp_ldst_offset (&str, 0, _SIMM15) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
if (*str++ != ']')
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("missing ]");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_BAD_ARGS;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_crdcrscrsimm5 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
char *strbak;
|
|
|
|
|
|
|
|
strbak = str;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE_CR) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE_CR) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
str = strbak;
|
|
|
|
/* cop1 cop_code20. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_data_op2 (&str, 5, _IMM20) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_data_op2 (&str, 5, _IMM5) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle ldc/stc. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_ldst_cop (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE_CR) == (int) s3_FAIL)
|
|
|
|
|| (s3_skip_past_comma (&str) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (*str == '[')
|
|
|
|
{
|
|
|
|
str++;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
if (*str++ != ']')
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_exp_ldst_offset (&str, 5, _IMM10_RSHIFT_2) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
if (*str++ != ']')
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("missing ]");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_BAD_ARGS;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do16_ldst_insn (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2011-06-13 17:45:28 +08:00
|
|
|
int conflict_reg = 0;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_reglow_required_here (&str, 8) == (int) s3_FAIL) || (s3_skip_past_comma (&str) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (*str == '[')
|
|
|
|
{
|
|
|
|
|
|
|
|
str++;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((conflict_reg = s3_reglow_required_here (&str, 5)) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
2009-03-02 18:33:08 +08:00
|
|
|
if (conflict_reg&0x8)
|
|
|
|
{
|
|
|
|
sprintf (s3_err_msg, _("invalid register number: %d is not in [r0--r7]"),conflict_reg);
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.error = s3_err_msg;
|
|
|
|
return;
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2011-06-13 17:45:28 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (*str == ']')
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
str++;
|
|
|
|
if (s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_skip_past_comma (&str) == (int) s3_FAIL)
|
|
|
|
{
|
|
|
|
s3_inst.error = _("comma is expected");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if (*str++ != ']')
|
|
|
|
{
|
|
|
|
s3_inst.error = _("missing ]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (s3_end_of_line (str) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
if (s3_inst.reloc.exp.X_op == O_constant)
|
|
|
|
{
|
|
|
|
int value;
|
|
|
|
unsigned int data_type;
|
|
|
|
data_type = _IMM5_RSHIFT_2;
|
|
|
|
value = s3_validate_immediate (s3_inst.reloc.exp.X_add_number, data_type, 0);
|
|
|
|
if (value == (int) s3_FAIL)
|
2011-06-13 17:45:28 +08:00
|
|
|
{
|
|
|
|
if (data_type < 30)
|
|
|
|
sprintf (s3_err_msg,
|
|
|
|
_("invalid constant: %d bit expression not in range %d..%d"),
|
|
|
|
s3_score_df_range[data_type].bits,
|
|
|
|
s3_score_df_range[data_type].range[0], s3_score_df_range[data_type].range[1]);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_err_msg;
|
|
|
|
return;
|
|
|
|
}
|
2011-06-13 17:45:28 +08:00
|
|
|
if (value & 0x3)
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
|
|
|
sprintf (s3_err_msg, _("invalid constant: %d is not word align integer"),value);
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.error = s3_err_msg;
|
|
|
|
return;
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
value >>= 2;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.instruction |= value;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
sprintf (s3_err_msg, _("missing ["));
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.error = s3_err_msg;
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_lw48 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
bfd_signed_vma val = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
|
|
|
|
|| (s3_skip_past_comma (&str) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Check word align for lw48 rd, value. */
|
|
|
|
if ((s3_inst.reloc.exp.X_add_symbol == NULL)
|
|
|
|
&& ((s3_inst.reloc.exp.X_add_number & 0x3) != 0))
|
|
|
|
{
|
|
|
|
s3_inst.error = _("invalid constant: 32 bit expression not word align");
|
|
|
|
return;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Check and set offset. */
|
|
|
|
val = s3_inst.reloc.exp.X_add_number;
|
|
|
|
if ((s3_inst.reloc.exp.X_add_symbol == NULL)
|
|
|
|
&& (!(val >= 0 && val <= 0xffffffffLL)))
|
|
|
|
{
|
|
|
|
s3_inst.error = _("invalid constant: 32 bit expression not in range [0, 0xffffffff]");
|
|
|
|
return;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
val &= 0xffffffff;
|
|
|
|
val >>= 2;
|
|
|
|
s3_inst.instruction |= (val << 7);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Set reloc type. */
|
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_IMM30;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_sw48 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
bfd_signed_vma val = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
|
|
|
|
|| (s3_skip_past_comma (&str) == (int) s3_FAIL))
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Check word align for lw48 rd, value. */
|
|
|
|
if ((s3_inst.reloc.exp.X_add_symbol == NULL)
|
|
|
|
&& ((s3_inst.reloc.exp.X_add_number & 0x3) != 0))
|
|
|
|
{
|
|
|
|
s3_inst.error = _("invalid constant: 32 bit expression not word align");
|
|
|
|
return;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Check and set offset. */
|
|
|
|
val = s3_inst.reloc.exp.X_add_number;
|
|
|
|
if ((s3_inst.reloc.exp.X_add_symbol == NULL)
|
|
|
|
&& (!(val >= 0 && val <= 0xffffffffLL)))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("invalid constant: 32 bit expression not in range [0, 0xffffffff]");
|
|
|
|
return;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
val &= 0xffffffff;
|
|
|
|
val >>= 2;
|
|
|
|
s3_inst.instruction |= (val << 7);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Set reloc type. */
|
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_IMM30;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_do_ldi48 (char *str)
|
|
|
|
{
|
|
|
|
bfd_signed_vma val;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 37, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
|
|
|
{
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
/* Check and set offset. */
|
|
|
|
val = s3_inst.reloc.exp.X_add_number;
|
|
|
|
if (!(val >= -0xffffffffLL && val <= 0xffffffffLL))
|
|
|
|
{
|
|
|
|
s3_inst.error = _("invalid constant: 32 bit expression not in range [-0x80000000, 0x7fffffff]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
val &= 0xffffffff;
|
|
|
|
s3_inst.instruction |= (val << 5);
|
|
|
|
|
|
|
|
/* Set reloc type. */
|
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_IMM32;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_do_sdbbp48 (char *str)
|
|
|
|
{
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
|
|
|
|
if (s3_data_op2 (&str, 5, _IMM5) == (int) s3_FAIL || s3_end_of_line (str) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_do_and48 (char *str)
|
|
|
|
{
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
|
|
|
|
if (s3_reglow_required_here (&str, 38) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reglow_required_here (&str, 34) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 2, _IMM32) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_do_or48 (char *str)
|
|
|
|
{
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
|
|
|
|
if (s3_reglow_required_here (&str, 38) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reglow_required_here (&str, 34) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 2, _IMM32) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_mbitclr (char *str)
|
|
|
|
{
|
|
|
|
int val;
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
|
|
|
|
if (*str != '[')
|
|
|
|
{
|
|
|
|
sprintf (s3_err_msg, _("missing ["));
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.error = s3_err_msg;
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
str++;
|
|
|
|
|
|
|
|
s3_inst.instruction &= 0x0;
|
|
|
|
|
|
|
|
if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
|
|
|
|
|| (s3_skip_past_comma (&str) == (int) s3_FAIL)
|
|
|
|
|| (s3_data_op2 (&str, 0, _IMM11) == (int) s3_FAIL))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Get imm11 and refill opcode. */
|
|
|
|
val = s3_inst.instruction & 0x7ff;
|
|
|
|
val >>= 2;
|
|
|
|
s3_inst.instruction &= 0x000f8000;
|
|
|
|
s3_inst.instruction |= 0x00000064;
|
|
|
|
|
|
|
|
if (*str != ']')
|
|
|
|
{
|
|
|
|
sprintf (s3_err_msg, _("missing ]"));
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.error = s3_err_msg;
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
str++;
|
|
|
|
|
|
|
|
if ((s3_skip_past_comma (&str) == (int) s3_FAIL)
|
|
|
|
|| (s3_data_op2 (&str, 10, _IMM5) == (int) s3_FAIL))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Set imm11 to opcode. */
|
|
|
|
s3_inst.instruction |= (val & 0x1)
|
2011-06-13 17:45:28 +08:00
|
|
|
| (((val >> 1 ) & 0x7) << 7)
|
|
|
|
| (((val >> 4 ) & 0x1f) << 20);
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_mbitset (char *str)
|
|
|
|
{
|
|
|
|
int val;
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
|
|
|
|
if (*str != '[')
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
sprintf (s3_err_msg, _("missing ["));
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.error = s3_err_msg;
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
str++;
|
|
|
|
|
|
|
|
s3_inst.instruction &= 0x0;
|
|
|
|
|
|
|
|
if ((s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
|
|
|
|
|| (s3_skip_past_comma (&str) == (int) s3_FAIL)
|
|
|
|
|| (s3_data_op2 (&str, 0, _IMM11) == (int) s3_FAIL))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Get imm11 and refill opcode. */
|
|
|
|
val = s3_inst.instruction & 0x7ff;
|
|
|
|
val >>= 2;
|
|
|
|
s3_inst.instruction &= 0x000f8000;
|
|
|
|
s3_inst.instruction |= 0x0000006c;
|
|
|
|
|
|
|
|
if (*str != ']')
|
|
|
|
{
|
|
|
|
sprintf (s3_err_msg, _("missing ]"));
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.error = s3_err_msg;
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
str++;
|
|
|
|
|
|
|
|
if ((s3_skip_past_comma (&str) == (int) s3_FAIL)
|
|
|
|
|| (s3_data_op2 (&str, 10, _IMM5) == (int) s3_FAIL))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Set imm11 to opcode. */
|
|
|
|
s3_inst.instruction |= (val & 0x1)
|
2011-06-13 17:45:28 +08:00
|
|
|
| (((val >> 1 ) & 0x7) << 7)
|
|
|
|
| (((val >> 4 ) & 0x1f) << 20);
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_do16_slli_srli (char *str)
|
|
|
|
{
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
|
|
|
|
if ((s3_reglow_required_here (&str, 5) == (int) s3_FAIL)
|
|
|
|
|| (s3_skip_past_comma (&str) == (int) s3_FAIL)
|
|
|
|
|| s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL
|
2011-06-13 17:45:28 +08:00
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_do16_ldiu (char *str)
|
|
|
|
{
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
|
|
|
|
if ((s3_reg_required_here (&str, 5,s3_REG_TYPE_SCORE) == (int) s3_FAIL)
|
|
|
|
|| (s3_skip_past_comma (&str) == (int) s3_FAIL)
|
|
|
|
|| s3_data_op2 (&str, 0, _IMM5) == (int) s3_FAIL
|
2011-06-13 17:45:28 +08:00
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_do16_push_pop (char *str)
|
|
|
|
{
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if ((s3_reg_required_here (&str, 0, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
|
2011-06-13 17:45:28 +08:00
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_do16_rpush (char *str)
|
|
|
|
{
|
|
|
|
int reg;
|
|
|
|
int val;
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if ((reg = (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE))) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 0, _IMM5_MULTI_LOAD) == (int) s3_FAIL
|
2011-06-13 17:45:28 +08:00
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* 0: indicate 32.
|
2017-01-23 23:23:07 +08:00
|
|
|
1: invalid value.
|
2009-03-02 18:33:08 +08:00
|
|
|
2: to 31: normal value. */
|
2011-06-13 17:45:28 +08:00
|
|
|
val = s3_inst.instruction & 0x1f;
|
2009-03-02 18:33:08 +08:00
|
|
|
if (val == 1)
|
|
|
|
{
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.error = _("imm5 should >= 2");
|
|
|
|
return;
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
if (reg >= 32)
|
|
|
|
{
|
|
|
|
s3_inst.error = _("reg should <= 31");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_do16_rpop (char *str)
|
|
|
|
{
|
|
|
|
int reg;
|
|
|
|
int val;
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if ((reg = (s3_reg_required_here (&str, 5, s3_REG_TYPE_SCORE))) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_data_op2 (&str, 0, _IMM5_MULTI_LOAD) == (int) s3_FAIL
|
2011-06-13 17:45:28 +08:00
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* 0: indicate 32.
|
2017-01-23 23:23:07 +08:00
|
|
|
1: invalid value.
|
2009-03-02 18:33:08 +08:00
|
|
|
2: to 31: normal value. */
|
|
|
|
val = s3_inst.instruction & 0x1f;
|
|
|
|
if (val == 1)
|
|
|
|
{
|
|
|
|
s3_inst.error = _("imm5 should >= 2");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (reg >= 32)
|
|
|
|
{
|
|
|
|
s3_inst.error = _("reg should <= 31");
|
|
|
|
return;
|
|
|
|
}
|
2011-06-13 17:45:28 +08:00
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
|
|
|
if ((reg + val) <= 32)
|
|
|
|
reg = reg + val - 1;
|
|
|
|
else
|
|
|
|
reg = reg + val - 33;
|
|
|
|
s3_inst.instruction &= 0x7c1f;
|
|
|
|
s3_inst.instruction |= (reg << 5);
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle lcb/lcw/lce/scb/scw/sce. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_ldst_unalign (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
int conflict_reg;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_university_version == 1)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_ERR_FOR_SCORE5U_ATOMIC;
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* lcb/scb [rA]+. */
|
|
|
|
if (*str == '[')
|
|
|
|
{
|
|
|
|
str++;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (*str++ == ']')
|
|
|
|
{
|
|
|
|
if (*str++ != '+')
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("missing +");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("missing ]");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* lcw/lce/scb/sce rD, [rA]+. */
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (((conflict_reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
|
|
|
|
|| (s3_skip_past_comma (&str) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
if (*str++ == '[')
|
|
|
|
{
|
|
|
|
int reg;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Conflicts can occur on stores as well as loads. */
|
|
|
|
conflict_reg = (conflict_reg == reg);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
if (*str++ == ']')
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
unsigned int ldst_func = s3_inst.instruction & LDST_UNALIGN_MASK;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
if (*str++ == '+')
|
|
|
|
{
|
|
|
|
if (conflict_reg)
|
|
|
|
{
|
|
|
|
as_warn (_("%s register same as write-back base"),
|
|
|
|
((ldst_func & UA_LCE) || (ldst_func & UA_LCW)
|
|
|
|
? _("destination") : _("source")));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("missing +");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("missing ]");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_BAD_ARGS;
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle alw/asw. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_ldst_atomic (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_university_version == 1)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_ERR_FOR_SCORE5U_ATOMIC;
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL)
|
|
|
|
|| (s3_skip_past_comma (&str) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
if (*str++ == '[')
|
|
|
|
{
|
|
|
|
int reg;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if ((reg = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
if (*str++ != ']')
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("missing ]");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_BAD_ARGS;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_build_relax_frag (struct s3_score_it fix_insts[s3_RELAX_INST_NUM], int fix_num ATTRIBUTE_UNUSED,
|
2011-06-13 17:45:28 +08:00
|
|
|
struct s3_score_it var_insts[s3_RELAX_INST_NUM], int var_num,
|
|
|
|
symbolS *add_symbol)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char *p;
|
|
|
|
fixS *fixp = NULL;
|
2006-10-19 23:47:34 +08:00
|
|
|
fixS *cur_fixp = NULL;
|
2006-09-17 07:51:50 +08:00
|
|
|
long where;
|
2009-03-02 18:33:08 +08:00
|
|
|
struct s3_score_it inst_main;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&inst_main, &fix_insts[0], sizeof (struct s3_score_it));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Adjust instruction opcode and to be relaxed instruction opcode. */
|
2009-03-02 18:33:08 +08:00
|
|
|
inst_main.instruction = s3_adjust_paritybit (inst_main.instruction, s3_GET_INSN_CLASS (inst_main.type));
|
2006-09-17 07:51:50 +08:00
|
|
|
inst_main.type = Insn_PIC;
|
|
|
|
|
|
|
|
for (i = 0; i < var_num; i++)
|
|
|
|
{
|
|
|
|
inst_main.relax_size += var_insts[i].size;
|
2009-03-02 18:33:08 +08:00
|
|
|
var_insts[i].instruction = s3_adjust_paritybit (var_insts[i].instruction,
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_GET_INSN_CLASS (var_insts[i].type));
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check data dependency. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_handle_dependency (&inst_main);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Start a new frag if frag_now is not empty. */
|
|
|
|
if (frag_now_fix () != 0)
|
|
|
|
{
|
|
|
|
if (!frag_now->tc_frag_data.is_insn)
|
|
|
|
{
|
|
|
|
frag_wane (frag_now);
|
|
|
|
}
|
|
|
|
frag_new (0);
|
|
|
|
}
|
|
|
|
frag_grow (20);
|
|
|
|
|
|
|
|
/* Write fr_fix part. */
|
|
|
|
p = frag_more (inst_main.size);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_md_number_to_chars (p, inst_main.instruction, inst_main.size);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
if (inst_main.reloc.type != BFD_RELOC_NONE)
|
2009-03-02 18:33:08 +08:00
|
|
|
fixp = s3_fix_new_score (frag_now, p - frag_now->fr_literal, inst_main.size,
|
2011-06-13 17:45:28 +08:00
|
|
|
&inst_main.reloc.exp, inst_main.reloc.pc_rel, inst_main.reloc.type);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2006-10-19 23:47:34 +08:00
|
|
|
frag_now->tc_frag_data.fixp = fixp;
|
|
|
|
cur_fixp = frag_now->tc_frag_data.fixp;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
#ifdef OBJ_ELF
|
|
|
|
dwarf2_emit_insn (inst_main.size);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
where = p - frag_now->fr_literal + inst_main.size;
|
|
|
|
for (i = 0; i < var_num; i++)
|
|
|
|
{
|
|
|
|
if (i > 0)
|
|
|
|
where += var_insts[i - 1].size;
|
|
|
|
|
|
|
|
if (var_insts[i].reloc.type != BFD_RELOC_NONE)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
fixp = s3_fix_new_score (frag_now, where, var_insts[i].size,
|
2011-06-13 17:45:28 +08:00
|
|
|
&var_insts[i].reloc.exp, var_insts[i].reloc.pc_rel,
|
|
|
|
var_insts[i].reloc.type);
|
2006-09-17 07:51:50 +08:00
|
|
|
if (fixp)
|
|
|
|
{
|
2006-10-19 23:47:34 +08:00
|
|
|
if (cur_fixp)
|
|
|
|
{
|
|
|
|
cur_fixp->fx_next = fixp;
|
|
|
|
cur_fixp = cur_fixp->fx_next;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
frag_now->tc_frag_data.fixp = fixp;
|
|
|
|
cur_fixp = frag_now->tc_frag_data.fixp;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
p = frag_var (rs_machine_dependent, inst_main.relax_size + s3_RELAX_PAD_BYTE, 0,
|
|
|
|
s3_RELAX_ENCODE (inst_main.size, inst_main.relax_size, inst_main.type,
|
2011-06-13 17:45:28 +08:00
|
|
|
0, inst_main.size, 0), add_symbol, 0, NULL);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Write fr_var part.
|
2009-03-02 18:33:08 +08:00
|
|
|
no calling s3_gen_insn_frag, no fixS will be generated. */
|
2006-09-17 07:51:50 +08:00
|
|
|
for (i = 0; i < var_num; i++)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_md_number_to_chars (p, var_insts[i].instruction, var_insts[i].size);
|
2006-09-17 07:51:50 +08:00
|
|
|
p += var_insts[i].size;
|
|
|
|
}
|
|
|
|
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.bwarn = -1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Build a relax frag for la instruction when generating s3_PIC,
|
2006-09-17 07:51:50 +08:00
|
|
|
external symbol first and local symbol second. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_build_la_pic (int reg_rd, expressionS exp)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
symbolS *add_symbol = exp.X_add_symbol;
|
|
|
|
offsetT add_number = exp.X_add_number;
|
2009-03-02 18:33:08 +08:00
|
|
|
struct s3_score_it fix_insts[s3_RELAX_INST_NUM];
|
|
|
|
struct s3_score_it var_insts[s3_RELAX_INST_NUM];
|
2006-09-17 07:51:50 +08:00
|
|
|
int fix_num = 0;
|
|
|
|
int var_num = 0;
|
2009-03-02 18:33:08 +08:00
|
|
|
char tmp[s3_MAX_LITERAL_POOL_SIZE];
|
2006-09-17 07:51:50 +08:00
|
|
|
int r1_bak;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
r1_bak = s3_nor1;
|
|
|
|
s3_nor1 = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
if (add_number == 0)
|
|
|
|
{
|
|
|
|
fix_num = 1;
|
|
|
|
var_num = 2;
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
/* For an external symbol, only one insn is generated;
|
2006-12-25 17:26:22 +08:00
|
|
|
For a local symbol, two insns are generated. */
|
2006-09-17 07:51:50 +08:00
|
|
|
/* Fix part
|
2006-12-25 17:26:22 +08:00
|
|
|
For an external symbol: lw rD, <sym>($gp)
|
2011-06-13 17:45:28 +08:00
|
|
|
(BFD_RELOC_SCORE_GOT15 or BFD_RELOC_SCORE_CALL15) */
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (reg_rd == s3_PIC_CALL_REG)
|
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_CALL15;
|
|
|
|
memcpy (&fix_insts[0], &s3_inst, sizeof (struct s3_score_it));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Var part
|
|
|
|
For a local symbol :
|
|
|
|
lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15)
|
|
|
|
addi rD, <sym> (BFD_RELOC_GOT_LO16) */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_GOT15;
|
|
|
|
memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
sprintf (tmp, "addi_s_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&var_insts[1], &s3_inst, sizeof (struct s3_score_it));
|
|
|
|
s3_build_relax_frag (fix_insts, fix_num, var_insts, var_num, add_symbol);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else if (add_number >= -0x8000 && add_number <= 0x7fff)
|
|
|
|
{
|
|
|
|
/* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (tmp, TRUE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Insn 2 */
|
|
|
|
fix_num = 1;
|
|
|
|
var_num = 1;
|
|
|
|
/* Fix part
|
|
|
|
For an external symbol: addi rD, <constant> */
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (tmp, "addi r%d, %d", reg_rd, (int)add_number);
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&fix_insts[0], &s3_inst, sizeof (struct s3_score_it));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Var part
|
|
|
|
For a local symbol: addi rD, <sym>+<constant> (BFD_RELOC_GOT_LO16) */
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
sprintf (tmp, "addi_s_pic r%d, %s + %d", reg_rd,
|
|
|
|
S_GET_NAME (add_symbol), (int) add_number);
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
|
|
|
|
s3_build_relax_frag (fix_insts, fix_num, var_insts, var_num, add_symbol);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int hi = (add_number >> 16) & 0x0000FFFF;
|
|
|
|
int lo = add_number & 0x0000FFFF;
|
|
|
|
|
|
|
|
/* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (tmp, TRUE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Insn 2 */
|
|
|
|
fix_num = 1;
|
|
|
|
var_num = 1;
|
|
|
|
/* Fix part
|
|
|
|
For an external symbol: ldis r1, HI%<constant> */
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (tmp, "ldis r1, %d", hi);
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&fix_insts[0], &s3_inst, sizeof (struct s3_score_it));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Var part
|
|
|
|
For a local symbol: ldis r1, HI%<constant>
|
2017-01-23 23:23:07 +08:00
|
|
|
but, if lo is out of 16 bit, make hi plus 1 */
|
2006-09-17 07:51:50 +08:00
|
|
|
if ((lo < -0x8000) || (lo > 0x7fff))
|
|
|
|
{
|
|
|
|
hi += 1;
|
|
|
|
}
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (tmp, "ldis_pic r1, %d", hi);
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
|
|
|
|
s3_build_relax_frag (fix_insts, fix_num, var_insts, var_num, add_symbol);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Insn 3 */
|
|
|
|
fix_num = 1;
|
|
|
|
var_num = 1;
|
|
|
|
/* Fix part
|
|
|
|
For an external symbol: ori r1, LO%<constant> */
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (tmp, "ori r1, %d", lo);
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&fix_insts[0], &s3_inst, sizeof (struct s3_score_it));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Var part
|
|
|
|
For a local symbol: addi r1, <sym>+LO%<constant> (BFD_RELOC_GOT_LO16) */
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
sprintf (tmp, "addi_u_pic r1, %s + %d", S_GET_NAME (add_symbol), lo);
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
|
|
|
|
s3_build_relax_frag (fix_insts, fix_num, var_insts, var_num, add_symbol);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Insn 4: add rD, rD, r1 */
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (tmp, "add r%d, r%d, r1", reg_rd, reg_rd);
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (tmp, TRUE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
|
|
|
|
s3_inst.bwarn = -1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_nor1 = r1_bak;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle la. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_macro_la_rdi32 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
int reg_rd;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if ((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Save str. */
|
2006-09-17 07:51:50 +08:00
|
|
|
char *keep_data = str;
|
2009-03-02 18:33:08 +08:00
|
|
|
char append_str[s3_MAX_LITERAL_POOL_SIZE];
|
|
|
|
|
|
|
|
/* Check immediate value. */
|
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL)
|
|
|
|
{
|
|
|
|
s3_inst.error = _("expression error");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if ((s3_inst.reloc.exp.X_add_symbol == NULL)
|
|
|
|
&& (s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _IMM32, 0) == (int) s3_FAIL))
|
|
|
|
{
|
|
|
|
s3_inst.error = _("value not in range [0, 0xffffffff]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Reset str. */
|
|
|
|
str = keep_data;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* la rd, simm16. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_data_op2 (&str, 1, _SIMM16_LA) != (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* la rd, imm32 or la rd, label. */
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_SET_INSN_ERROR (NULL);
|
|
|
|
/* Reset str. */
|
2006-09-17 07:51:50 +08:00
|
|
|
str = keep_data;
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_data_op2 (&str, 1, _VALUE_HI16) == (int) s3_FAIL)
|
|
|
|
|| (s3_end_of_line (str) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_score_pic == s3_NO_PIC) || (!s3_inst.reloc.exp.X_add_symbol))
|
2007-01-18 18:33:49 +08:00
|
|
|
{
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (append_str, "ld_i32hi r%d, %s", reg_rd, keep_data);
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (append_str, "ld_i32lo r%d, %s", reg_rd, keep_data);
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
* 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-23 01:56:02 +08:00
|
|
|
gas_assert (s3_inst.reloc.exp.X_add_symbol);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_build_la_pic (reg_rd, s3_inst.reloc.exp);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.bwarn = -1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle li. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_macro_li_rdi32 (char *str)
|
|
|
|
{
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
int reg_rd;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if ((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Save str. */
|
2006-09-17 07:51:50 +08:00
|
|
|
char *keep_data = str;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Check immediate value. */
|
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL)
|
|
|
|
{
|
|
|
|
s3_inst.error = _("expression error");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (!(s3_inst.reloc.exp.X_add_number >= -0xffffffffLL
|
|
|
|
&& s3_inst.reloc.exp.X_add_number <= 0xffffffffLL))
|
|
|
|
{
|
|
|
|
s3_inst.error = _("value not in range [-0xffffffff, 0xffffffff]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Reset str. */
|
|
|
|
str = keep_data;
|
|
|
|
|
2006-09-17 07:51:50 +08:00
|
|
|
/* li rd, simm16. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_data_op2 (&str, 1, _SIMM16_LA) != (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_end_of_line (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* li rd, imm32. */
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
char append_str[s3_MAX_LITERAL_POOL_SIZE];
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Reset str. */
|
2006-09-17 07:51:50 +08:00
|
|
|
str = keep_data;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_data_op2 (&str, 1, _VALUE_HI16) == (int) s3_FAIL)
|
|
|
|
|| (s3_end_of_line (str) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else if (s3_inst.reloc.exp.X_add_symbol)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("li rd label isn't correct instruction form");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (append_str, "ld_i32hi r%d, %s", reg_rd, keep_data);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
else
|
|
|
|
{
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (append_str, "ld_i32lo r%d, %s", reg_rd, keep_data);
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.bwarn = -1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle mul/mulu/div/divu/rem/remu. */
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_macro_mul_rdrsrs (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
int reg_rd;
|
|
|
|
int reg_rs1;
|
|
|
|
int reg_rs2;
|
|
|
|
char *backupstr;
|
2009-03-02 18:33:08 +08:00
|
|
|
char append_str[s3_MAX_LITERAL_POOL_SIZE];
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_university_version == 1)
|
|
|
|
as_warn ("%s", s3_ERR_FOR_SCORE5U_MUL_DIV);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
strcpy (append_str, str);
|
|
|
|
backupstr = append_str;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (backupstr);
|
|
|
|
if (((reg_rd = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
|
|
|
|
|| (s3_skip_past_comma (&backupstr) == (int) s3_FAIL)
|
|
|
|
|| ((reg_rs1 = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_BAD_ARGS;
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_skip_past_comma (&backupstr) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
/* rem/remu rA, rB is error format. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (strcmp (s3_inst.name, "rem") == 0 || strcmp (s3_inst.name, "remu") == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_SET_INSN_ERROR (s3_BAD_ARGS);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_SET_INSN_ERROR (NULL);
|
|
|
|
s3_do_rsrs (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_SET_INSN_ERROR (NULL);
|
|
|
|
if (((reg_rs2 = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
|
|
|
|
|| (s3_end_of_line (backupstr) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
char append_str1[s3_MAX_LITERAL_POOL_SIZE];
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (strcmp (s3_inst.name, "rem") == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (append_str, "mul r%d, r%d", reg_rs1, reg_rs2);
|
|
|
|
sprintf (append_str1, "mfceh r%d", reg_rd);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else if (strcmp (s3_inst.name, "remu") == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (append_str, "mulu r%d, r%d", reg_rs1, reg_rs2);
|
|
|
|
sprintf (append_str1, "mfceh r%d", reg_rd);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
sprintf (append_str, "%s r%d, r%d", s3_inst.name, reg_rs1, reg_rs2);
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (append_str1, "mfcel r%d", reg_rd);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Output mul/mulu or div/divu or rem/remu. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Output mfcel or mfceh. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (append_str1, TRUE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.bwarn = -1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_exp_macro_ldst_abs (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
int reg_rd;
|
|
|
|
char *backupstr, *tmp;
|
2009-03-02 18:33:08 +08:00
|
|
|
char append_str[s3_MAX_LITERAL_POOL_SIZE];
|
|
|
|
char verifystr[s3_MAX_LITERAL_POOL_SIZE];
|
|
|
|
struct s3_score_it inst_backup;
|
2006-09-17 07:51:50 +08:00
|
|
|
int r1_bak = 0;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
r1_bak = s3_nor1;
|
|
|
|
s3_nor1 = 0;
|
|
|
|
memcpy (&inst_backup, &s3_inst, sizeof (struct s3_score_it));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
strcpy (verifystr, str);
|
|
|
|
backupstr = verifystr;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (backupstr);
|
|
|
|
if ((reg_rd = s3_reg_required_here (&backupstr, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
tmp = backupstr;
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_skip_past_comma (&backupstr) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
backupstr = tmp;
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (append_str, "li r1 %s", backupstr);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_append_insn (append_str, TRUE);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&s3_inst, &inst_backup, sizeof (struct s3_score_it));
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (append_str, " r%d, [r1,0]", reg_rd);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_ldst_insn (append_str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_nor1 = r1_bak;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2011-06-13 17:45:28 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Handle bcmpeq / bcmpne */
|
|
|
|
static void
|
|
|
|
s3_do_macro_bcmp (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
int reg_a , reg_b;
|
2018-05-12 14:51:22 +08:00
|
|
|
char *keep_data;
|
|
|
|
size_t keep_data_size;
|
|
|
|
int i;
|
2009-03-02 18:33:08 +08:00
|
|
|
struct s3_score_it inst_expand[2];
|
2013-10-15 16:32:36 +08:00
|
|
|
struct s3_score_it inst_main;
|
2009-03-02 18:33:08 +08:00
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
memset (inst_expand, 0, sizeof inst_expand);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if (( reg_a = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
||(reg_b = s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL)
|
2011-06-13 17:45:28 +08:00
|
|
|
return;
|
2018-05-12 14:51:22 +08:00
|
|
|
|
|
|
|
keep_data_size = strlen (str) + 1;
|
|
|
|
keep_data = xmalloc (keep_data_size * 2 + 14);
|
|
|
|
memcpy (keep_data, str, keep_data_size);
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
|
|
|
|
||reg_b == 0
|
2009-03-02 18:33:08 +08:00
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2018-05-12 14:51:22 +08:00
|
|
|
goto out;
|
2009-03-02 18:33:08 +08:00
|
|
|
else if (s3_inst.reloc.exp.X_add_symbol == 0)
|
|
|
|
{
|
|
|
|
s3_inst.error = _("lacking label ");
|
2018-05-12 14:51:22 +08:00
|
|
|
goto out;
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
else
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2018-05-12 14:51:22 +08:00
|
|
|
char *append_str = keep_data + keep_data_size;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_SET_INSN_ERROR (NULL);
|
2011-06-13 17:45:28 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_BCMP;
|
|
|
|
s3_inst.reloc.pc_rel = 1;
|
|
|
|
bfd_signed_vma val = s3_inst.reloc.exp.X_add_number;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Branch 32 offset field : 20 bit, 16 bit branch offset field : 8 bit. */
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.instruction |= ((s3_inst.reloc.exp.X_add_number >> 1) & 0x1)
|
|
|
|
| ((s3_inst.reloc.exp.X_add_number >> 2) & 0x7) << 7
|
|
|
|
| ((s3_inst.reloc.exp.X_add_number >> 5) & 0x1f) << 20;
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
/* Check and set offset. */
|
|
|
|
if (((val & 0xfffffe00) != 0)
|
2011-06-13 17:45:28 +08:00
|
|
|
&& ((val & 0xfffffe00) != 0xfffffe00))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* support bcmp --> cmp!+beq (bne) */
|
|
|
|
if (s3_score_pic == s3_NO_PIC)
|
|
|
|
{
|
2018-05-12 14:51:22 +08:00
|
|
|
sprintf (append_str, "cmp! r%d, r%d", reg_a, reg_b);
|
|
|
|
if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
|
|
|
|
goto out;
|
|
|
|
if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
|
|
|
|
sprintf (append_str, "beq %s", keep_data);
|
|
|
|
else
|
|
|
|
sprintf (append_str, "bne %s", keep_data);
|
|
|
|
if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
|
|
|
|
goto out;
|
2011-06-13 17:45:28 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gas_assert (s3_inst.reloc.exp.X_add_symbol);
|
|
|
|
}
|
|
|
|
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
|
|
|
|
s3_inst.bwarn = -1;
|
2018-05-12 14:51:22 +08:00
|
|
|
goto out;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
val >>= 1;
|
|
|
|
s3_inst.instruction |= (val & 0x1)
|
2011-06-13 17:45:28 +08:00
|
|
|
| (((val >> 1) & 0x7) << 7)
|
|
|
|
| (((val >> 4) & 0x1f) << 20);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Backup s3_inst. */
|
|
|
|
memcpy (&inst_main, &s3_inst, sizeof (struct s3_score_it));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
if (s3_score_pic == s3_NO_PIC)
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
2018-05-12 14:51:22 +08:00
|
|
|
sprintf (append_str, "cmp! r%d, r%d", reg_a, reg_b);
|
|
|
|
if (s3_append_insn (append_str, FALSE) == (int) s3_FAIL)
|
|
|
|
goto out;
|
|
|
|
memcpy (&inst_expand[0], &s3_inst, sizeof (struct s3_score_it));
|
2011-06-13 17:45:28 +08:00
|
|
|
|
2018-05-12 14:51:22 +08:00
|
|
|
if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
|
|
|
|
sprintf (append_str, "beq %s", keep_data);
|
|
|
|
else
|
|
|
|
sprintf (append_str, "bne %s", keep_data);
|
|
|
|
if (s3_append_insn (append_str, FALSE) == (int) s3_FAIL)
|
|
|
|
goto out;
|
|
|
|
memcpy (&inst_expand[1], &s3_inst, sizeof (struct s3_score_it));
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
* 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-23 01:56:02 +08:00
|
|
|
gas_assert (s3_inst.reloc.exp.X_add_symbol);
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
inst_main.relax_size = inst_expand[0].size + inst_expand[1].size;
|
|
|
|
inst_main.type = Insn_BCMP;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Adjust instruction opcode and to be relaxed instruction opcode. */
|
|
|
|
inst_main.instruction = s3_adjust_paritybit (inst_main.instruction, s3_GET_INSN_CLASS (inst_main.type));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
for (i = 0; i < 2; i++)
|
2011-06-13 17:45:28 +08:00
|
|
|
inst_expand[i].instruction = s3_adjust_paritybit (inst_expand[i].instruction,
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_GET_INSN_CLASS (inst_expand[i].type));
|
|
|
|
/* Check data dependency. */
|
|
|
|
s3_handle_dependency (&inst_main);
|
|
|
|
/* Start a new frag if frag_now is not empty. */
|
|
|
|
if (frag_now_fix () != 0)
|
2011-06-13 17:45:28 +08:00
|
|
|
{
|
|
|
|
if (!frag_now->tc_frag_data.is_insn)
|
|
|
|
frag_wane (frag_now);
|
|
|
|
frag_new (0);
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
frag_grow (20);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Write fr_fix part. */
|
|
|
|
char *p;
|
|
|
|
p = frag_more (inst_main.size);
|
|
|
|
s3_md_number_to_chars (p, inst_main.instruction, inst_main.size);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (inst_main.reloc.type != BFD_RELOC_NONE)
|
2011-06-13 17:45:28 +08:00
|
|
|
{
|
|
|
|
s3_fix_new_score (frag_now, p - frag_now->fr_literal, inst_main.size,
|
|
|
|
&inst_main.reloc.exp, inst_main.reloc.pc_rel, inst_main.reloc.type);
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
#ifdef OBJ_ELF
|
|
|
|
dwarf2_emit_insn (inst_main.size);
|
|
|
|
#endif
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* s3_GP instruction can not do optimization, only can do relax between
|
|
|
|
1 instruction and 3 instructions. */
|
|
|
|
p = frag_var (rs_machine_dependent, inst_main.relax_size + s3_RELAX_PAD_BYTE, 0,
|
|
|
|
s3_RELAX_ENCODE (inst_main.size, inst_main.relax_size, inst_main.type, 0, 4, 1),
|
|
|
|
inst_main.reloc.exp.X_add_symbol, 0, NULL);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Write fr_var part.
|
|
|
|
no calling s3_gen_insn_frag, no fixS will be generated. */
|
|
|
|
s3_md_number_to_chars (p, inst_expand[0].instruction, inst_expand[0].size);
|
|
|
|
p += inst_expand[0].size;
|
|
|
|
s3_md_number_to_chars (p, inst_expand[1].instruction, inst_expand[1].size);
|
|
|
|
p += inst_expand[1].size;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2006-12-25 17:26:22 +08:00
|
|
|
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.bwarn = -1;
|
2011-06-13 17:45:28 +08:00
|
|
|
}
|
2018-05-12 14:51:22 +08:00
|
|
|
out:
|
|
|
|
free (keep_data);
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle bcmpeqz / bcmpnez */
|
|
|
|
static void
|
|
|
|
s3_do_macro_bcmpz (char *str)
|
|
|
|
{
|
2011-06-13 17:45:28 +08:00
|
|
|
int reg_a;
|
2018-05-12 14:51:22 +08:00
|
|
|
char *keep_data;
|
|
|
|
size_t keep_data_size;
|
|
|
|
int i;
|
2009-03-02 18:33:08 +08:00
|
|
|
struct s3_score_it inst_expand[2];
|
|
|
|
struct s3_score_it inst_main;
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
memset (inst_expand, 0, sizeof inst_expand);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if (( reg_a = s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
|
2011-06-13 17:45:28 +08:00
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL)
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
|
2018-05-12 14:51:22 +08:00
|
|
|
keep_data_size = strlen (str) + 1;
|
|
|
|
keep_data = xmalloc (keep_data_size * 2 + 13);
|
|
|
|
memcpy (keep_data, str, keep_data_size);
|
2011-06-13 17:45:28 +08:00
|
|
|
|
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2018-05-12 14:51:22 +08:00
|
|
|
goto out;
|
2009-03-02 18:33:08 +08:00
|
|
|
else if (s3_inst.reloc.exp.X_add_symbol == 0)
|
|
|
|
{
|
|
|
|
s3_inst.error = _("lacking label ");
|
2018-05-12 14:51:22 +08:00
|
|
|
goto out;
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-05-12 14:51:22 +08:00
|
|
|
char *append_str = keep_data + keep_data_size;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_SET_INSN_ERROR (NULL);
|
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_BCMP;
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.reloc.pc_rel = 1;
|
2009-03-02 18:33:08 +08:00
|
|
|
bfd_signed_vma val = s3_inst.reloc.exp.X_add_number;
|
|
|
|
|
|
|
|
/* Branch 32 offset field : 20 bit, 16 bit branch offset field : 8 bit. */
|
2011-06-13 17:45:28 +08:00
|
|
|
s3_inst.instruction |= ((s3_inst.reloc.exp.X_add_number>>1) & 0x1) | ((s3_inst.reloc.exp.X_add_number>>2) & 0x7)<<7 |((s3_inst.reloc.exp.X_add_number>>5) & 0x1f)<<20;
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
/* Check and set offset. */
|
|
|
|
if (((val & 0xfffffe00) != 0)
|
2011-06-13 17:45:28 +08:00
|
|
|
&& ((val & 0xfffffe00) != 0xfffffe00))
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
|
|
|
if (s3_score_pic == s3_NO_PIC)
|
|
|
|
{
|
2018-05-12 14:51:22 +08:00
|
|
|
sprintf (append_str, "cmpi! r%d, 0", reg_a);
|
|
|
|
if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
|
|
|
|
goto out;
|
|
|
|
if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
|
|
|
|
sprintf (append_str, "beq %s", keep_data);
|
|
|
|
else
|
|
|
|
sprintf (append_str, "bne %s", keep_data);
|
|
|
|
if (s3_append_insn (append_str, TRUE) == (int) s3_FAIL)
|
|
|
|
goto out;
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
* 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-23 01:56:02 +08:00
|
|
|
gas_assert (s3_inst.reloc.exp.X_add_symbol);
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
|
|
|
|
s3_inst.bwarn = -1;
|
2018-05-12 14:51:22 +08:00
|
|
|
goto out;
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
val >>= 1;
|
|
|
|
s3_inst.instruction |= (val & 0x1)
|
2011-06-13 17:45:28 +08:00
|
|
|
| (((val >> 1) & 0x7) << 7)
|
|
|
|
| (((val >> 4) & 0x1f) << 20);
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Backup s3_inst. */
|
|
|
|
memcpy (&inst_main, &s3_inst, sizeof (struct s3_score_it));
|
2011-06-13 17:45:28 +08:00
|
|
|
|
|
|
|
if (s3_score_pic == s3_NO_PIC)
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
2018-05-12 14:51:22 +08:00
|
|
|
sprintf (append_str, "cmpi! r%d, 0", reg_a);
|
|
|
|
if (s3_append_insn (append_str, FALSE) == (int) s3_FAIL)
|
|
|
|
goto out;
|
|
|
|
memcpy (&inst_expand[0], &s3_inst, sizeof (struct s3_score_it));
|
|
|
|
if ((inst_main.instruction & 0x3e00007e) == 0x0000004c)
|
|
|
|
sprintf (append_str, "beq %s", keep_data);
|
|
|
|
else
|
|
|
|
sprintf (append_str, "bne %s", keep_data);
|
|
|
|
if (s3_append_insn (append_str, FALSE) == (int) s3_FAIL)
|
|
|
|
goto out;
|
|
|
|
memcpy (&inst_expand[1], &s3_inst, sizeof (struct s3_score_it));
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
* 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-23 01:56:02 +08:00
|
|
|
gas_assert (s3_inst.reloc.exp.X_add_symbol);
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
inst_main.relax_size = inst_expand[0].size + inst_expand[1].size;
|
|
|
|
inst_main.type = Insn_BCMP;
|
|
|
|
|
|
|
|
/* Adjust instruction opcode and to be relaxed instruction opcode. */
|
|
|
|
inst_main.instruction = s3_adjust_paritybit (inst_main.instruction, s3_GET_INSN_CLASS (inst_main.type));
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++)
|
2011-06-13 17:45:28 +08:00
|
|
|
inst_expand[i].instruction = s3_adjust_paritybit (inst_expand[i].instruction ,
|
|
|
|
s3_GET_INSN_CLASS (inst_expand[i].type));
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Check data dependency. */
|
|
|
|
s3_handle_dependency (&inst_main);
|
|
|
|
/* Start a new frag if frag_now is not empty. */
|
|
|
|
if (frag_now_fix () != 0)
|
2011-06-13 17:45:28 +08:00
|
|
|
{
|
|
|
|
if (!frag_now->tc_frag_data.is_insn)
|
|
|
|
frag_wane (frag_now);
|
|
|
|
frag_new (0);
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
frag_grow (20);
|
|
|
|
|
|
|
|
/* Write fr_fix part. */
|
|
|
|
char *p;
|
|
|
|
p = frag_more (inst_main.size);
|
|
|
|
s3_md_number_to_chars (p, inst_main.instruction, inst_main.size);
|
|
|
|
|
|
|
|
if (inst_main.reloc.type != BFD_RELOC_NONE)
|
2011-06-13 17:45:28 +08:00
|
|
|
{
|
|
|
|
s3_fix_new_score (frag_now, p - frag_now->fr_literal, inst_main.size,
|
|
|
|
&inst_main.reloc.exp, inst_main.reloc.pc_rel, inst_main.reloc.type);
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
#ifdef OBJ_ELF
|
|
|
|
dwarf2_emit_insn (inst_main.size);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* s3_GP instruction can not do optimization, only can do relax between
|
|
|
|
1 instruction and 3 instructions. */
|
|
|
|
p = frag_var (rs_machine_dependent, inst_main.relax_size + s3_RELAX_PAD_BYTE, 0,
|
|
|
|
s3_RELAX_ENCODE (inst_main.size, inst_main.relax_size, inst_main.type, 0, 4, 1),
|
|
|
|
inst_main.reloc.exp.X_add_symbol, 0, NULL);
|
|
|
|
|
|
|
|
/* Write fr_var part.
|
|
|
|
no calling s3_gen_insn_frag, no fixS will be generated. */
|
|
|
|
s3_md_number_to_chars (p, inst_expand[0].instruction, inst_expand[0].size);
|
|
|
|
p += inst_expand[0].size;
|
|
|
|
s3_md_number_to_chars (p, inst_expand[1].instruction, inst_expand[1].size);
|
|
|
|
p += inst_expand[1].size;
|
|
|
|
|
|
|
|
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
|
|
|
|
s3_inst.bwarn = -1;
|
2011-06-13 17:45:28 +08:00
|
|
|
}
|
2018-05-12 14:51:22 +08:00
|
|
|
out:
|
|
|
|
free (keep_data);
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
s3_nopic_need_relax (symbolS * sym, int before_relaxing)
|
|
|
|
{
|
|
|
|
if (sym == NULL)
|
|
|
|
return 0;
|
|
|
|
else if (s3_USE_GLOBAL_POINTER_OPT && s3_g_switch_value > 0)
|
|
|
|
{
|
|
|
|
const char *symname;
|
|
|
|
const char *segname;
|
|
|
|
|
|
|
|
/* Find out whether this symbol can be referenced off the $gp
|
|
|
|
register. It can be if it is smaller than the -G size or if
|
|
|
|
it is in the .sdata or .sbss section. Certain symbols can
|
|
|
|
not be referenced off the $gp, although it appears as though
|
|
|
|
they can. */
|
|
|
|
symname = S_GET_NAME (sym);
|
|
|
|
if (symname != (const char *)NULL
|
|
|
|
&& (strcmp (symname, "eprol") == 0
|
|
|
|
|| strcmp (symname, "etext") == 0
|
|
|
|
|| strcmp (symname, "_gp") == 0
|
|
|
|
|| strcmp (symname, "edata") == 0
|
|
|
|
|| strcmp (symname, "_fbss") == 0
|
|
|
|
|| strcmp (symname, "_fdata") == 0
|
|
|
|
|| strcmp (symname, "_ftext") == 0
|
|
|
|
|| strcmp (symname, "end") == 0
|
|
|
|
|| strcmp (symname, GP_DISP_LABEL) == 0))
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if ((!S_IS_DEFINED (sym) || S_IS_COMMON (sym)) && (0
|
2011-06-13 17:45:28 +08:00
|
|
|
/* We must defer this decision until after the whole file has been read,
|
|
|
|
since there might be a .extern after the first use of this symbol. */
|
|
|
|
|| (before_relaxing
|
|
|
|
&& S_GET_VALUE (sym) == 0)
|
|
|
|
|| (S_GET_VALUE (sym) != 0
|
|
|
|
&& S_GET_VALUE (sym) <= s3_g_switch_value)))
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
segname = segment_name (S_GET_SEGMENT (sym));
|
|
|
|
return (strcmp (segname, ".sdata") != 0
|
|
|
|
&& strcmp (segname, ".sbss") != 0
|
|
|
|
&& strncmp (segname, ".sdata.", 7) != 0
|
|
|
|
&& strncmp (segname, ".gnu.linkonce.s.", 16) != 0);
|
|
|
|
}
|
|
|
|
/* We are not optimizing for the $gp register. */
|
|
|
|
else
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Build a relax frag for lw/st instruction when generating s3_PIC,
|
|
|
|
external symbol first and local symbol second. */
|
|
|
|
static void
|
|
|
|
s3_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name)
|
|
|
|
{
|
|
|
|
symbolS *add_symbol = exp.X_add_symbol;
|
|
|
|
int add_number = exp.X_add_number;
|
|
|
|
struct s3_score_it fix_insts[s3_RELAX_INST_NUM];
|
|
|
|
struct s3_score_it var_insts[s3_RELAX_INST_NUM];
|
|
|
|
int fix_num = 0;
|
|
|
|
int var_num = 0;
|
|
|
|
char tmp[s3_MAX_LITERAL_POOL_SIZE];
|
|
|
|
int r1_bak;
|
|
|
|
|
|
|
|
r1_bak = s3_nor1;
|
|
|
|
s3_nor1 = 0;
|
|
|
|
|
|
|
|
if ((add_number == 0) || (add_number >= -0x8000 && add_number <= 0x7fff))
|
|
|
|
{
|
|
|
|
fix_num = 1;
|
|
|
|
var_num = 2;
|
|
|
|
|
|
|
|
/* For an external symbol, two insns are generated;
|
|
|
|
For a local symbol, three insns are generated. */
|
|
|
|
/* Fix part
|
|
|
|
For an external symbol: lw rD, <sym>($gp)
|
2011-06-13 17:45:28 +08:00
|
|
|
(BFD_RELOC_SCORE_GOT15) */
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
sprintf (tmp, "lw_pic r1, %s", S_GET_NAME (add_symbol));
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
memcpy (&fix_insts[0], &s3_inst, sizeof (struct s3_score_it));
|
|
|
|
|
|
|
|
/* Var part
|
|
|
|
For a local symbol :
|
|
|
|
lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15)
|
|
|
|
addi rD, <sym> (BFD_RELOC_GOT_LO16) */
|
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_GOT15;
|
|
|
|
memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
sprintf (tmp, "addi_s_pic r1, %s", S_GET_NAME (add_symbol));
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
memcpy (&var_insts[1], &s3_inst, sizeof (struct s3_score_it));
|
|
|
|
s3_build_relax_frag (fix_insts, fix_num, var_insts, var_num, add_symbol);
|
|
|
|
|
|
|
|
/* Insn 2 or Insn 3: lw/st rD, [r1, constant] */
|
|
|
|
sprintf (tmp, "%s r%d, [r1, %d]", insn_name, reg_rd, add_number);
|
|
|
|
if (s3_append_insn (tmp, TRUE) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
|
|
|
|
s3_inst.bwarn = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s3_inst.error = _("s3_PIC code offset overflow (max 16 signed bits)");
|
2006-12-25 17:26:22 +08:00
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_nor1 = r1_bak;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_macro_ldst_label (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int ldst_gp_p = 0;
|
|
|
|
int reg_rd;
|
|
|
|
int r1_bak;
|
|
|
|
char *backup_str;
|
|
|
|
char *label_str;
|
|
|
|
char *absolute_value;
|
2009-03-02 18:33:08 +08:00
|
|
|
char append_str[3][s3_MAX_LITERAL_POOL_SIZE];
|
|
|
|
char verifystr[s3_MAX_LITERAL_POOL_SIZE];
|
|
|
|
struct s3_score_it inst_backup;
|
|
|
|
struct s3_score_it inst_expand[3];
|
|
|
|
struct s3_score_it inst_main;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&inst_backup, &s3_inst, sizeof (struct s3_score_it));
|
2006-09-17 07:51:50 +08:00
|
|
|
strcpy (verifystr, str);
|
|
|
|
backup_str = verifystr;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (backup_str);
|
|
|
|
if ((reg_rd = s3_reg_required_here (&backup_str, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_skip_past_comma (&backup_str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
label_str = backup_str;
|
|
|
|
|
|
|
|
/* Ld/st rD, [rA, imm] ld/st rD, [rA]+, imm ld/st rD, [rA, imm]+. */
|
|
|
|
if (*backup_str == '[')
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.type = Rd_rvalueRs_preSI12;
|
|
|
|
s3_do_ldst_insn (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ld/st rD, imm. */
|
|
|
|
absolute_value = backup_str;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.type = Rd_rvalueRs_SI15;
|
|
|
|
|
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, &backup_str) == (int) s3_FAIL)
|
|
|
|
{
|
|
|
|
s3_inst.error = _("expression error");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if ((s3_inst.reloc.exp.X_add_symbol == NULL)
|
|
|
|
&& (s3_validate_immediate (s3_inst.reloc.exp.X_add_number, _VALUE, 0) == (int) s3_FAIL))
|
|
|
|
{
|
|
|
|
s3_inst.error = _("value not in range [0, 0x7fffffff]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (s3_end_of_line (backup_str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("end on line error");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.reloc.exp.X_add_symbol == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&s3_inst, &inst_backup, sizeof (struct s3_score_it));
|
|
|
|
s3_exp_macro_ldst_abs (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ld/st rD, label. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.type = Rd_rvalueRs_SI15;
|
2006-09-17 07:51:50 +08:00
|
|
|
backup_str = absolute_value;
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_data_op2 (&backup_str, 1, _GP_IMM15) == (int) s3_FAIL)
|
|
|
|
|| (s3_end_of_line (backup_str) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.reloc.exp.X_add_symbol == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (!s3_inst.error)
|
|
|
|
s3_inst.error = s3_BAD_ARGS;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_score_pic == s3_PIC)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2006-12-25 17:26:22 +08:00
|
|
|
int ldst_idx = 0;
|
2009-03-02 18:33:08 +08:00
|
|
|
ldst_idx = s3_inst.instruction & OPC_PSEUDOLDST_MASK;
|
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 06:11:02 +08:00
|
|
|
s3_build_lwst_pic (reg_rd, s3_inst.reloc.exp,
|
|
|
|
s3_score_ldst_insns[ldst_idx * 3 + 0].template_name);
|
2006-12-25 17:26:22 +08:00
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_inst.reloc.exp.X_add_number <= 0x3fff)
|
2011-06-13 17:45:28 +08:00
|
|
|
&& (s3_inst.reloc.exp.X_add_number >= -0x4000)
|
|
|
|
&& (!s3_nopic_need_relax (s3_inst.reloc.exp.X_add_symbol, 1)))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
int ldst_idx = 0;
|
|
|
|
|
|
|
|
/* Assign the real opcode. */
|
2009-03-02 18:33:08 +08:00
|
|
|
ldst_idx = s3_inst.instruction & OPC_PSEUDOLDST_MASK;
|
|
|
|
s3_inst.instruction &= ~OPC_PSEUDOLDST_MASK;
|
|
|
|
s3_inst.instruction |= s3_score_ldst_insns[ldst_idx * 3 + 0].value;
|
|
|
|
s3_inst.instruction |= reg_rd << 20;
|
|
|
|
s3_inst.instruction |= s3_GP << 15;
|
|
|
|
s3_inst.relax_inst = 0x8000;
|
|
|
|
s3_inst.relax_size = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
ldst_gp_p = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Backup s3_inst. */
|
|
|
|
memcpy (&inst_main, &s3_inst, sizeof (struct s3_score_it));
|
|
|
|
r1_bak = s3_nor1;
|
|
|
|
s3_nor1 = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Determine which instructions should be output. */
|
2007-01-22 16:55:34 +08:00
|
|
|
sprintf (append_str[0], "ld_i32hi r1, %s", label_str);
|
|
|
|
sprintf (append_str[1], "ld_i32lo r1, %s", label_str);
|
|
|
|
sprintf (append_str[2], "%s r%d, [r1, 0]", inst_backup.name, reg_rd);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Generate three instructions.
|
|
|
|
la r1, label
|
|
|
|
ld/st rd, [r1, 0] */
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_append_insn (append_str[i], FALSE) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
memcpy (&inst_expand[i], &s3_inst, sizeof (struct s3_score_it));
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ldst_gp_p)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
/* Adjust instruction opcode and to be relaxed instruction opcode. */
|
2009-03-02 18:33:08 +08:00
|
|
|
inst_main.instruction = s3_adjust_paritybit (inst_main.instruction, s3_GET_INSN_CLASS (inst_main.type));
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
/* relax lw rd, label -> ldis rs, imm16
|
|
|
|
ori rd, imm16
|
|
|
|
lw rd, [rs, imm15] or lw! rd, [rs, imm5]. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (inst_expand[2].relax_size == 0)
|
|
|
|
inst_main.relax_size = inst_expand[0].size + inst_expand[1].size + inst_expand[2].size;
|
|
|
|
else
|
|
|
|
inst_main.relax_size = inst_expand[0].size + inst_expand[1].size + inst_expand[2].relax_size;
|
|
|
|
|
2006-09-17 07:51:50 +08:00
|
|
|
inst_main.type = Insn_GP;
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++)
|
2011-06-13 17:45:28 +08:00
|
|
|
inst_expand[i].instruction = s3_adjust_paritybit (inst_expand[i].instruction,
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_GET_INSN_CLASS (inst_expand[i].type));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Check data dependency. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_handle_dependency (&inst_main);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Start a new frag if frag_now is not empty. */
|
|
|
|
if (frag_now_fix () != 0)
|
|
|
|
{
|
|
|
|
if (!frag_now->tc_frag_data.is_insn)
|
|
|
|
frag_wane (frag_now);
|
|
|
|
|
|
|
|
frag_new (0);
|
|
|
|
}
|
|
|
|
frag_grow (20);
|
|
|
|
|
|
|
|
/* Write fr_fix part. */
|
|
|
|
p = frag_more (inst_main.size);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_md_number_to_chars (p, inst_main.instruction, inst_main.size);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
if (inst_main.reloc.type != BFD_RELOC_NONE)
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_fix_new_score (frag_now, p - frag_now->fr_literal, inst_main.size,
|
2011-06-13 17:45:28 +08:00
|
|
|
&inst_main.reloc.exp, inst_main.reloc.pc_rel, inst_main.reloc.type);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef OBJ_ELF
|
|
|
|
dwarf2_emit_insn (inst_main.size);
|
|
|
|
#endif
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* s3_GP instruction can not do optimization, only can do relax between
|
2006-09-17 07:51:50 +08:00
|
|
|
1 instruction and 3 instructions. */
|
2009-03-02 18:33:08 +08:00
|
|
|
p = frag_var (rs_machine_dependent, inst_main.relax_size + s3_RELAX_PAD_BYTE, 0,
|
|
|
|
s3_RELAX_ENCODE (inst_main.size, inst_main.relax_size, inst_main.type, 0, 4, 0),
|
2006-09-17 07:51:50 +08:00
|
|
|
inst_main.reloc.exp.X_add_symbol, 0, NULL);
|
|
|
|
|
|
|
|
/* Write fr_var part.
|
2009-03-02 18:33:08 +08:00
|
|
|
no calling s3_gen_insn_frag, no fixS will be generated. */
|
|
|
|
s3_md_number_to_chars (p, inst_expand[0].instruction, inst_expand[0].size);
|
2006-09-17 07:51:50 +08:00
|
|
|
p += inst_expand[0].size;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_md_number_to_chars (p, inst_expand[1].instruction, inst_expand[1].size);
|
2006-09-17 07:51:50 +08:00
|
|
|
p += inst_expand[1].size;
|
2009-03-02 18:33:08 +08:00
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
/* relax lw rd, label -> ldis rs, imm16
|
|
|
|
ori rd, imm16
|
|
|
|
lw rd, [rs, imm15] or lw! rd, [rs, imm5]. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (inst_expand[2].relax_size == 0)
|
|
|
|
s3_md_number_to_chars (p, inst_expand[2].instruction, inst_expand[2].size);
|
|
|
|
else
|
|
|
|
s3_md_number_to_chars (p, inst_expand[2].relax_inst, inst_expand[2].relax_size);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_gen_insn_frag (&inst_expand[0], NULL);
|
|
|
|
s3_gen_insn_frag (&inst_expand[1], NULL);
|
|
|
|
s3_gen_insn_frag (&inst_expand[2], NULL);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_nor1 = r1_bak;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Set bwarn as -1, so macro instruction itself will not be generated frag. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.bwarn = -1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_lw_pic (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
int reg_rd;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if (((reg_rd = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
|
|
|
|
|| (s3_skip_past_comma (&str) == (int) s3_FAIL)
|
|
|
|
|| (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL)
|
|
|
|
|| (s3_end_of_line (str) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.reloc.exp.X_add_symbol == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (!s3_inst.error)
|
|
|
|
s3_inst.error = s3_BAD_ARGS;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.instruction |= s3_GP << 15;
|
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_GOT15;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_empty (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
str = str;
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_university_version == 1)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (((s3_inst.instruction & 0x3e0003ff) == 0x0c000004)
|
|
|
|
|| ((s3_inst.instruction & 0x3e0003ff) == 0x0c000024)
|
|
|
|
|| ((s3_inst.instruction & 0x3e0003ff) == 0x0c000044)
|
|
|
|
|| ((s3_inst.instruction & 0x3e0003ff) == 0x0c000064))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = s3_ERR_FOR_SCORE5U_MMU;
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.relax_inst != 0x8000)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.type == NO_OPD)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_size = 4;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do16_int (char *str)
|
|
|
|
{
|
|
|
|
s3_skip_whitespace (str);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_do_jump (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
char *save_in;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.reloc.exp.X_add_symbol == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("lacking label ");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (!(s3_inst.reloc.exp.X_add_number >= -16777216
|
2011-06-13 17:45:28 +08:00
|
|
|
&& s3_inst.reloc.exp.X_add_number <= 16777215))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("invalid constant: 25 bit expression not in range [-16777216, 16777215]");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
save_in = input_line_pointer;
|
|
|
|
input_line_pointer = str;
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_JMP;
|
|
|
|
s3_inst.reloc.pc_rel = 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
input_line_pointer = save_in;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do_branch (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else if (s3_inst.reloc.exp.X_add_symbol == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("lacking label ");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else if (!(s3_inst.reloc.exp.X_add_number >= -524288
|
2011-06-13 17:45:28 +08:00
|
|
|
&& s3_inst.reloc.exp.X_add_number <= 524287))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2017-01-23 23:23:07 +08:00
|
|
|
s3_inst.error = _("invalid constant: 20 bit expression not in range -2^19..2^19-1");
|
2006-09-17 07:51:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE_BRANCH;
|
|
|
|
s3_inst.reloc.pc_rel = 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
/* Branch 32 offset field : 20 bit, 16 bit branch offset field : 8 bit. */
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.instruction |= (s3_inst.reloc.exp.X_add_number & 0x3fe) | ((s3_inst.reloc.exp.X_add_number & 0xffc00) << 5);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2006-11-16 12:36:25 +08:00
|
|
|
/* Compute 16 bit branch instruction. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_inst.relax_inst != 0x8000)
|
|
|
|
&& (s3_inst.reloc.exp.X_add_number >= -512 && s3_inst.reloc.exp.X_add_number <= 511))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= ((s3_inst.reloc.exp.X_add_number >> 1) & 0x1ff);/*b! :disp 9 bit */
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_do16_branch (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_my_get_expression (&s3_inst.reloc.exp, &str) == (int) s3_FAIL
|
2011-06-13 17:45:28 +08:00
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else if (s3_inst.reloc.exp.X_add_symbol == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("lacking label");
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else if (!(s3_inst.reloc.exp.X_add_number >= -512
|
2011-06-13 17:45:28 +08:00
|
|
|
&& s3_inst.reloc.exp.X_add_number <= 511))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("invalid constant: 10 bit expression not in range [-2^9, 2^9-1]");
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.reloc.type = BFD_RELOC_SCORE16_BRANCH;
|
|
|
|
s3_inst.reloc.pc_rel = 1;
|
|
|
|
s3_inst.instruction |= ((s3_inst.reloc.exp.X_add_number >> 1) & 0x1ff);
|
|
|
|
s3_inst.relax_inst |= ((s3_inst.reloc.exp.X_add_number ) & 0x1ff);
|
|
|
|
s3_inst.relax_size = 4;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Return true if the given symbol should be considered local for s3_PIC. */
|
|
|
|
static bfd_boolean
|
|
|
|
s3_pic_need_relax (symbolS *sym, asection *segtype)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
asection *symsec;
|
|
|
|
bfd_boolean linkonce;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Handle the case of a symbol equated to another symbol. */
|
|
|
|
while (symbol_equated_reloc_p (sym))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
symbolS *n;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* It's possible to get a loop here in a badly written
|
|
|
|
program. */
|
|
|
|
n = symbol_get_value_expression (sym)->X_add_symbol;
|
|
|
|
if (n == sym)
|
|
|
|
break;
|
|
|
|
sym = n;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
symsec = S_GET_SEGMENT (sym);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* duplicate the test for LINK_ONCE sections as in adjust_reloc_syms */
|
|
|
|
linkonce = FALSE;
|
|
|
|
if (symsec != segtype && ! S_IS_LOCAL (sym))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
if ((bfd_section_flags (symsec) & SEC_LINK_ONCE) != 0)
|
2009-03-02 18:33:08 +08:00
|
|
|
linkonce = TRUE;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* The GNU toolchain uses an extension for ELF: a section
|
2011-06-13 17:45:28 +08:00
|
|
|
beginning with the magic string .gnu.linkonce is a linkonce
|
|
|
|
section. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (strncmp (segment_name (symsec), ".gnu.linkonce",
|
|
|
|
sizeof ".gnu.linkonce" - 1) == 0)
|
|
|
|
linkonce = TRUE;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* This must duplicate the test in adjust_reloc_syms. */
|
2012-05-05 11:05:32 +08:00
|
|
|
return (!bfd_is_und_section (symsec)
|
|
|
|
&& !bfd_is_abs_section (symsec)
|
|
|
|
&& !bfd_is_com_section (symsec)
|
2011-06-13 17:45:28 +08:00
|
|
|
&& !linkonce
|
2009-03-02 18:33:08 +08:00
|
|
|
#ifdef OBJ_ELF
|
|
|
|
/* A global or weak symbol is treated as external. */
|
|
|
|
&& (OUTPUT_FLAVOR != bfd_target_elf_flavour
|
|
|
|
|| (! S_IS_WEAK (sym) && ! S_IS_EXTERNAL (sym)))
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_parse_pce_inst (char *insnstr)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
char c;
|
|
|
|
char *p;
|
|
|
|
char first[s3_MAX_LITERAL_POOL_SIZE];
|
|
|
|
char second[s3_MAX_LITERAL_POOL_SIZE];
|
|
|
|
struct s3_score_it pec_part_1;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Get first part string of PCE. */
|
|
|
|
p = strstr (insnstr, "||");
|
|
|
|
c = *p;
|
|
|
|
*p = '\0';
|
|
|
|
sprintf (first, "%s", insnstr);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Get second part string of PCE. */
|
|
|
|
*p = c;
|
|
|
|
p += 2;
|
|
|
|
sprintf (second, "%s", p);
|
|
|
|
|
|
|
|
s3_parse_16_32_inst (first, FALSE);
|
|
|
|
if (s3_inst.error)
|
|
|
|
return;
|
|
|
|
|
|
|
|
memcpy (&pec_part_1, &s3_inst, sizeof (s3_inst));
|
|
|
|
|
|
|
|
s3_parse_16_32_inst (second, FALSE);
|
|
|
|
if (s3_inst.error)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ( ((pec_part_1.size == s3_INSN_SIZE) && (s3_inst.size == s3_INSN_SIZE))
|
2011-06-13 17:45:28 +08:00
|
|
|
|| ((pec_part_1.size == s3_INSN_SIZE) && (s3_inst.size == s3_INSN16_SIZE))
|
|
|
|
|| ((pec_part_1.size == s3_INSN16_SIZE) && (s3_inst.size == s3_INSN_SIZE)))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2017-01-23 23:23:07 +08:00
|
|
|
s3_inst.error = _("pce instruction error (16 bit || 16 bit).");
|
2014-03-27 17:41:06 +08:00
|
|
|
sprintf (s3_inst.str, "%s", insnstr);
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (!s3_inst.error)
|
|
|
|
s3_gen_insn_frag (&pec_part_1, &s3_inst);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* s3: dsp. */
|
|
|
|
static void
|
|
|
|
s3_do16_dsp (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
int rd = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
/* Check 3d. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_score3d == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("score3d instruction.");
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((rd = s3_reglow_required_here (&str, 0)) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= rd << 20;
|
|
|
|
s3_inst.relax_size = 4;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_do16_dsp2 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2011-06-13 17:45:28 +08:00
|
|
|
/* Check 3d. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_score3d == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("score3d instruction.");
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reglow_required_here (&str, 4) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reglow_required_here (&str, 0) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 8) & 0xf) << 20)
|
|
|
|
| (((s3_inst.instruction >> 8) & 0xf) << 15) | (((s3_inst.instruction >> 4) & 0xf) << 10);
|
|
|
|
s3_inst.relax_size = 4;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_do_dsp (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2011-06-13 17:45:28 +08:00
|
|
|
/* Check 3d. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_score3d == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("score3d instruction.");
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
|
|
|
|
|
|
|
if (s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 20) & 0x1f) == 3) )
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 10) & 0x1f)) | (((s3_inst.instruction >> 15) & 0x1f) << 5);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst = 0x8000;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_do_dsp2 (char *str)
|
|
|
|
{
|
|
|
|
int reg;
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
/* Check 3d. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_score3d == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("score3d instruction.");
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((reg = s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 10, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
|
|
|
{
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Check mulr, mulur rd is even number. */
|
|
|
|
if (((s3_inst.instruction & 0x3e0003ff) == 0x00000340
|
2011-06-13 17:45:28 +08:00
|
|
|
|| (s3_inst.instruction & 0x3e0003ff) == 0x00000342)
|
2009-03-02 18:33:08 +08:00
|
|
|
&& (reg % 2))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.error = _("rd must be even number.");
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((((s3_inst.instruction >> 15) & 0x10) == 0)
|
|
|
|
&& (((s3_inst.instruction >> 10) & 0x10) == 0)
|
|
|
|
&& (((s3_inst.instruction >> 20) & 0x10) == 0)
|
|
|
|
&& (s3_inst.relax_inst != 0x8000)
|
|
|
|
&& (((s3_inst.instruction >> 20) & 0xf) == ((s3_inst.instruction >> 15) & 0xf)))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 10) & 0xf) )
|
|
|
|
| (((s3_inst.instruction >> 15) & 0xf) << 4);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
|
|
|
s3_inst.relax_inst = 0x8000;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_do_dsp3 (char *str)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2011-06-13 17:45:28 +08:00
|
|
|
/* Check 3d. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_score3d == 0)
|
|
|
|
{
|
|
|
|
s3_inst.error = _("score3d instruction.");
|
|
|
|
return;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_skip_whitespace (str);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_reg_required_here (&str, 20, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&str) == (int) s3_FAIL
|
|
|
|
|| s3_reg_required_here (&str, 15, s3_REG_TYPE_SCORE) == (int) s3_FAIL
|
|
|
|
|| s3_end_of_line (str) == (int) s3_FAIL)
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_inst.relax_inst != 0x8000) && (((s3_inst.instruction >> 20) & 0x1f) == 3) )
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_inst.relax_inst |= (((s3_inst.instruction >> 10) & 0x1f)) | (((s3_inst.instruction >> 15) & 0x1f) << 5);
|
|
|
|
s3_inst.relax_size = 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else
|
|
|
|
s3_inst.relax_inst = 0x8000;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* If we change section we must dump the literal pool first. */
|
|
|
|
static void
|
|
|
|
s3_s_score_bss (int ignore ATTRIBUTE_UNUSED)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
subseg_set (bss_section, (subsegT) get_absolute_expression ());
|
|
|
|
demand_empty_rest_of_line ();
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_s_score_text (int ignore)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
obj_elf_text (ignore);
|
|
|
|
record_alignment (now_seg, 2);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_score_s_section (int ignore)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
obj_elf_section (ignore);
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
if ((bfd_section_flags (now_seg) & SEC_CODE) != 0)
|
2009-03-02 18:33:08 +08:00
|
|
|
record_alignment (now_seg, 2);
|
|
|
|
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_s_change_sec (int sec)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
segT seg;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
#ifdef OBJ_ELF
|
|
|
|
/* The ELF backend needs to know that we are changing sections, so
|
|
|
|
that .previous works correctly. We could do something like check
|
|
|
|
for an obj_section_change_hook macro, but that might be confusing
|
|
|
|
as it would not be appropriate to use it in the section changing
|
|
|
|
functions in read.c, since obj-elf.c intercepts those. FIXME:
|
|
|
|
This should be cleaner, somehow. */
|
|
|
|
obj_elf_section_change_hook ();
|
|
|
|
#endif
|
|
|
|
switch (sec)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
case 'r':
|
|
|
|
seg = subseg_new (s3_RDATA_SECTION_NAME, (subsegT) get_absolute_expression ());
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA));
|
2009-03-02 18:33:08 +08:00
|
|
|
if (strcmp (TARGET_OS, "elf") != 0)
|
|
|
|
record_alignment (seg, 4);
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
seg = subseg_new (".sdata", (subsegT) get_absolute_expression ());
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
bfd_set_section_flags (seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA);
|
2009-03-02 18:33:08 +08:00
|
|
|
if (strcmp (TARGET_OS, "elf") != 0)
|
|
|
|
record_alignment (seg, 4);
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
break;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_s_score_mask (int reg_type ATTRIBUTE_UNUSED)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
long mask, off;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_cur_proc_ptr == (s3_procS *) NULL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
as_warn (_(".mask outside of .ent"));
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
if (get_absolute_expression_and_terminator (&mask) != ',')
|
|
|
|
{
|
|
|
|
as_warn (_("Bad .mask directive"));
|
|
|
|
--input_line_pointer;
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
off = get_absolute_expression ();
|
|
|
|
s3_cur_proc_ptr->reg_mask = mask;
|
|
|
|
s3_cur_proc_ptr->reg_offset = off;
|
|
|
|
demand_empty_rest_of_line ();
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static symbolS *
|
|
|
|
s3_get_symbol (void)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
int c;
|
|
|
|
char *name;
|
|
|
|
symbolS *p;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2015-08-21 23:42:14 +08:00
|
|
|
c = get_symbol_name (&name);
|
2009-03-02 18:33:08 +08:00
|
|
|
p = (symbolS *) symbol_find_or_make (name);
|
2015-08-21 23:42:14 +08:00
|
|
|
(void) restore_line_pointer (c);
|
2009-03-02 18:33:08 +08:00
|
|
|
return p;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static long
|
|
|
|
s3_get_number (void)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
int negative = 0;
|
|
|
|
long val = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (*input_line_pointer == '-')
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
++input_line_pointer;
|
|
|
|
negative = 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
if (!ISDIGIT (*input_line_pointer))
|
|
|
|
as_bad (_("expected simple number"));
|
|
|
|
if (input_line_pointer[0] == '0')
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (input_line_pointer[1] == 'x')
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
input_line_pointer += 2;
|
|
|
|
while (ISXDIGIT (*input_line_pointer))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
val <<= 4;
|
|
|
|
val |= hex_value (*input_line_pointer++);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
return negative ? -val : val;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
++input_line_pointer;
|
|
|
|
while (ISDIGIT (*input_line_pointer))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
val <<= 3;
|
|
|
|
val |= *input_line_pointer++ - '0';
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
return negative ? -val : val;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
if (!ISDIGIT (*input_line_pointer))
|
|
|
|
{
|
|
|
|
printf (_(" *input_line_pointer == '%c' 0x%02x\n"), *input_line_pointer, *input_line_pointer);
|
|
|
|
as_warn (_("invalid number"));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
while (ISDIGIT (*input_line_pointer))
|
|
|
|
{
|
|
|
|
val *= 10;
|
|
|
|
val += *input_line_pointer++ - '0';
|
|
|
|
}
|
|
|
|
return negative ? -val : val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The .aent and .ent directives. */
|
|
|
|
static void
|
|
|
|
s3_s_score_ent (int aent)
|
|
|
|
{
|
|
|
|
symbolS *symbolP;
|
|
|
|
int maybe_text;
|
|
|
|
|
|
|
|
symbolP = s3_get_symbol ();
|
|
|
|
if (*input_line_pointer == ',')
|
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-')
|
|
|
|
s3_get_number ();
|
|
|
|
|
|
|
|
#ifdef BFD_ASSEMBLER
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
if ((bfd_section_flags (now_seg) & SEC_CODE) != 0)
|
2009-03-02 18:33:08 +08:00
|
|
|
maybe_text = 1;
|
|
|
|
else
|
|
|
|
maybe_text = 0;
|
|
|
|
#else
|
|
|
|
if (now_seg != data_section && now_seg != bss_section)
|
|
|
|
maybe_text = 1;
|
|
|
|
else
|
|
|
|
maybe_text = 0;
|
|
|
|
#endif
|
|
|
|
if (!maybe_text)
|
|
|
|
as_warn (_(".ent or .aent not in text section."));
|
|
|
|
if (!aent && s3_cur_proc_ptr)
|
|
|
|
as_warn (_("missing .end"));
|
|
|
|
if (!aent)
|
|
|
|
{
|
|
|
|
s3_cur_proc_ptr = &s3_cur_proc;
|
|
|
|
s3_cur_proc_ptr->reg_mask = 0xdeadbeaf;
|
|
|
|
s3_cur_proc_ptr->reg_offset = 0xdeadbeaf;
|
|
|
|
s3_cur_proc_ptr->fpreg_mask = 0xdeafbeaf;
|
|
|
|
s3_cur_proc_ptr->leaf = 0xdeafbeaf;
|
|
|
|
s3_cur_proc_ptr->frame_offset = 0xdeafbeaf;
|
|
|
|
s3_cur_proc_ptr->frame_reg = 0xdeafbeaf;
|
|
|
|
s3_cur_proc_ptr->pc_reg = 0xdeafbeaf;
|
|
|
|
s3_cur_proc_ptr->isym = symbolP;
|
|
|
|
symbol_get_bfdsym (symbolP)->flags |= BSF_FUNCTION;
|
|
|
|
++s3_numprocs;
|
|
|
|
if (debug_type == DEBUG_STABS)
|
|
|
|
stabs_generate_asm_func (S_GET_NAME (symbolP), S_GET_NAME (symbolP));
|
|
|
|
}
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_s_score_frame (int ignore ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
char *backupstr;
|
|
|
|
char str[30];
|
|
|
|
long val;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
backupstr = input_line_pointer;
|
|
|
|
|
|
|
|
#ifdef OBJ_ELF
|
|
|
|
if (s3_cur_proc_ptr == (s3_procS *) NULL)
|
|
|
|
{
|
|
|
|
as_warn (_(".frame outside of .ent"));
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
s3_cur_proc_ptr->frame_reg = s3_reg_required_here ((&backupstr), 0, s3_REG_TYPE_SCORE);
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
s3_skip_past_comma (&backupstr);
|
|
|
|
while (*backupstr != ',')
|
|
|
|
{
|
|
|
|
str[i] = *backupstr;
|
|
|
|
i++;
|
|
|
|
backupstr++;
|
|
|
|
}
|
|
|
|
str[i] = '\0';
|
|
|
|
val = atoi (str);
|
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
s3_skip_past_comma (&backupstr);
|
|
|
|
s3_cur_proc_ptr->frame_offset = val;
|
|
|
|
s3_cur_proc_ptr->pc_reg = s3_reg_required_here ((&backupstr), 0, s3_REG_TYPE_SCORE);
|
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
s3_skip_past_comma (&backupstr);
|
|
|
|
i = 0;
|
|
|
|
while (*backupstr != '\n')
|
|
|
|
{
|
|
|
|
str[i] = *backupstr;
|
|
|
|
i++;
|
|
|
|
backupstr++;
|
|
|
|
}
|
|
|
|
str[i] = '\0';
|
|
|
|
val = atoi (str);
|
|
|
|
s3_cur_proc_ptr->leaf = val;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
s3_skip_past_comma (&backupstr);
|
|
|
|
|
|
|
|
#endif /* OBJ_ELF */
|
|
|
|
while (input_line_pointer != backupstr)
|
|
|
|
input_line_pointer++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The .end directive. */
|
|
|
|
static void
|
|
|
|
s3_s_score_end (int x ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
symbolS *p;
|
|
|
|
int maybe_text;
|
|
|
|
|
|
|
|
/* Generate a .pdr section. */
|
|
|
|
segT saved_seg = now_seg;
|
|
|
|
subsegT saved_subseg = now_subseg;
|
|
|
|
expressionS exp;
|
|
|
|
char *fragp;
|
|
|
|
|
|
|
|
if (!is_end_of_line[(unsigned char)*input_line_pointer])
|
|
|
|
{
|
|
|
|
p = s3_get_symbol ();
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p = NULL;
|
|
|
|
|
|
|
|
#ifdef BFD_ASSEMBLER
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
if ((bfd_section_flags (now_seg) & SEC_CODE) != 0)
|
2009-03-02 18:33:08 +08:00
|
|
|
maybe_text = 1;
|
|
|
|
else
|
|
|
|
maybe_text = 0;
|
|
|
|
#else
|
|
|
|
if (now_seg != data_section && now_seg != bss_section)
|
|
|
|
maybe_text = 1;
|
|
|
|
else
|
|
|
|
maybe_text = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!maybe_text)
|
|
|
|
as_warn (_(".end not in text section"));
|
|
|
|
if (!s3_cur_proc_ptr)
|
|
|
|
{
|
|
|
|
as_warn (_(".end directive without a preceding .ent directive."));
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (p != NULL)
|
|
|
|
{
|
* 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-23 01:56:02 +08:00
|
|
|
gas_assert (S_GET_NAME (p));
|
2009-03-02 18:33:08 +08:00
|
|
|
if (strcmp (S_GET_NAME (p), S_GET_NAME (s3_cur_proc_ptr->isym)))
|
|
|
|
as_warn (_(".end symbol does not match .ent symbol."));
|
|
|
|
if (debug_type == DEBUG_STABS)
|
|
|
|
stabs_generate_asm_endfunc (S_GET_NAME (p), S_GET_NAME (p));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
as_warn (_(".end directive missing or unknown symbol"));
|
|
|
|
|
|
|
|
if ((s3_cur_proc_ptr->reg_mask == 0xdeadbeaf) ||
|
|
|
|
(s3_cur_proc_ptr->reg_offset == 0xdeadbeaf) ||
|
|
|
|
(s3_cur_proc_ptr->leaf == 0xdeafbeaf) ||
|
|
|
|
(s3_cur_proc_ptr->frame_offset == 0xdeafbeaf) ||
|
|
|
|
(s3_cur_proc_ptr->frame_reg == 0xdeafbeaf) || (s3_cur_proc_ptr->pc_reg == 0xdeafbeaf));
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
2011-06-13 17:45:28 +08:00
|
|
|
(void) frag_now_fix ();
|
* 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-23 01:56:02 +08:00
|
|
|
gas_assert (s3_pdr_seg);
|
2009-03-02 18:33:08 +08:00
|
|
|
subseg_set (s3_pdr_seg, 0);
|
|
|
|
/* Write the symbol. */
|
|
|
|
exp.X_op = O_symbol;
|
|
|
|
exp.X_add_symbol = p;
|
|
|
|
exp.X_add_number = 0;
|
|
|
|
emit_expr (&exp, 4);
|
|
|
|
fragp = frag_more (7 * 4);
|
|
|
|
md_number_to_chars (fragp, (valueT) s3_cur_proc_ptr->reg_mask, 4);
|
|
|
|
md_number_to_chars (fragp + 4, (valueT) s3_cur_proc_ptr->reg_offset, 4);
|
|
|
|
md_number_to_chars (fragp + 8, (valueT) s3_cur_proc_ptr->fpreg_mask, 4);
|
|
|
|
md_number_to_chars (fragp + 12, (valueT) s3_cur_proc_ptr->leaf, 4);
|
|
|
|
md_number_to_chars (fragp + 16, (valueT) s3_cur_proc_ptr->frame_offset, 4);
|
|
|
|
md_number_to_chars (fragp + 20, (valueT) s3_cur_proc_ptr->frame_reg, 4);
|
|
|
|
md_number_to_chars (fragp + 24, (valueT) s3_cur_proc_ptr->pc_reg, 4);
|
|
|
|
subseg_set (saved_seg, saved_subseg);
|
|
|
|
|
|
|
|
}
|
|
|
|
s3_cur_proc_ptr = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the .set pseudo-op. */
|
|
|
|
static void
|
|
|
|
s3_s_score_set (int x ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
char name[s3_MAX_LITERAL_POOL_SIZE];
|
|
|
|
char * orig_ilp = input_line_pointer;
|
|
|
|
|
|
|
|
while (!is_end_of_line[(unsigned char)*input_line_pointer])
|
|
|
|
{
|
|
|
|
name[i] = (char) * input_line_pointer;
|
|
|
|
i++;
|
|
|
|
++input_line_pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
name[i] = '\0';
|
|
|
|
|
|
|
|
if (strcmp (name, "nwarn") == 0)
|
|
|
|
{
|
|
|
|
s3_warn_fix_data_dependency = 0;
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "fixdd") == 0)
|
|
|
|
{
|
|
|
|
s3_fix_data_dependency = 1;
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "nofixdd") == 0)
|
|
|
|
{
|
|
|
|
s3_fix_data_dependency = 0;
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "r1") == 0)
|
|
|
|
{
|
|
|
|
s3_nor1 = 0;
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "nor1") == 0)
|
|
|
|
{
|
|
|
|
s3_nor1 = 1;
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "optimize") == 0)
|
|
|
|
{
|
|
|
|
s3_g_opt = 1;
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "volatile") == 0)
|
|
|
|
{
|
|
|
|
s3_g_opt = 0;
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "pic") == 0)
|
|
|
|
{
|
|
|
|
s3_score_pic = s3_PIC;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
input_line_pointer = orig_ilp;
|
|
|
|
s_set (0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the .cpload pseudo-op. This is used when generating s3_PIC code. It sets the
|
|
|
|
$gp register for the function based on the function address, which is in the register
|
|
|
|
named in the argument. This uses a relocation against GP_DISP_LABEL, which is handled
|
|
|
|
specially by the linker. The result is:
|
|
|
|
ldis gp, %hi(GP_DISP_LABEL)
|
|
|
|
ori gp, %low(GP_DISP_LABEL)
|
|
|
|
add gp, gp, .cpload argument
|
|
|
|
The .cpload argument is normally r29. */
|
|
|
|
static void
|
|
|
|
s3_s_score_cpload (int ignore ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
int reg;
|
|
|
|
char insn_str[s3_MAX_LITERAL_POOL_SIZE];
|
|
|
|
|
|
|
|
/* If we are not generating s3_PIC code, .cpload is ignored. */
|
|
|
|
if (s3_score_pic == s3_NO_PIC)
|
|
|
|
{
|
|
|
|
s_ignore (0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
|
|
|
|
sprintf (insn_str, "ld_i32hi r%d, %s", s3_GP, GP_DISP_LABEL);
|
|
|
|
if (s3_append_insn (insn_str, TRUE) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sprintf (insn_str, "ld_i32lo r%d, %s", s3_GP, GP_DISP_LABEL);
|
|
|
|
if (s3_append_insn (insn_str, TRUE) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sprintf (insn_str, "add r%d, r%d, r%d", s3_GP, s3_GP, reg);
|
|
|
|
if (s3_append_insn (insn_str, TRUE) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the .cprestore pseudo-op. This stores $gp into a given
|
|
|
|
offset from $sp. The offset is remembered, and after making a s3_PIC
|
|
|
|
call $gp is restored from that location. */
|
|
|
|
static void
|
|
|
|
s3_s_score_cprestore (int ignore ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
int reg;
|
|
|
|
int cprestore_offset;
|
|
|
|
char insn_str[s3_MAX_LITERAL_POOL_SIZE];
|
|
|
|
|
|
|
|
/* If we are not generating s3_PIC code, .cprestore is ignored. */
|
|
|
|
if (s3_score_pic == s3_NO_PIC)
|
|
|
|
{
|
|
|
|
s_ignore (0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL
|
|
|
|
|| s3_skip_past_comma (&input_line_pointer) == (int) s3_FAIL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
cprestore_offset = get_absolute_expression ();
|
|
|
|
|
|
|
|
if (cprestore_offset <= 0x3fff)
|
|
|
|
{
|
|
|
|
sprintf (insn_str, "sw r%d, [r%d, %d]", s3_GP, reg, cprestore_offset);
|
|
|
|
if (s3_append_insn (insn_str, TRUE) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int r1_bak;
|
|
|
|
|
|
|
|
r1_bak = s3_nor1;
|
|
|
|
s3_nor1 = 0;
|
|
|
|
|
|
|
|
sprintf (insn_str, "li r1, %d", cprestore_offset);
|
|
|
|
if (s3_append_insn (insn_str, TRUE) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sprintf (insn_str, "add r1, r1, r%d", reg);
|
|
|
|
if (s3_append_insn (insn_str, TRUE) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sprintf (insn_str, "sw r%d, [r1]", s3_GP);
|
|
|
|
if (s3_append_insn (insn_str, TRUE) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
s3_nor1 = r1_bak;
|
|
|
|
}
|
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the .gpword pseudo-op. This is used when generating s3_PIC
|
|
|
|
code. It generates a 32 bit s3_GP relative reloc. */
|
|
|
|
static void
|
|
|
|
s3_s_score_gpword (int ignore ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
expressionS ex;
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
/* When not generating s3_PIC code, this is treated as .word. */
|
|
|
|
if (s3_score_pic == s3_NO_PIC)
|
|
|
|
{
|
|
|
|
cons (4);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
expression (&ex);
|
|
|
|
if (ex.X_op != O_symbol || ex.X_add_number != 0)
|
|
|
|
{
|
|
|
|
as_bad (_("Unsupported use of .gpword"));
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
}
|
|
|
|
p = frag_more (4);
|
|
|
|
s3_md_number_to_chars (p, (valueT) 0, 4);
|
|
|
|
fix_new_exp (frag_now, p - frag_now->fr_literal, 4, &ex, FALSE, BFD_RELOC_GPREL32);
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the .cpadd pseudo-op. This is used when dealing with switch
|
|
|
|
tables in s3_PIC code. */
|
|
|
|
static void
|
|
|
|
s3_s_score_cpadd (int ignore ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
int reg;
|
|
|
|
char insn_str[s3_MAX_LITERAL_POOL_SIZE];
|
|
|
|
|
|
|
|
/* If we are not generating s3_PIC code, .cpload is ignored. */
|
|
|
|
if (s3_score_pic == s3_NO_PIC)
|
|
|
|
{
|
|
|
|
s_ignore (0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((reg = s3_reg_required_here (&input_line_pointer, -1, s3_REG_TYPE_SCORE)) == (int) s3_FAIL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
|
|
|
|
/* Add $gp to the register named as an argument. */
|
|
|
|
sprintf (insn_str, "add r%d, r%d, r%d", reg, reg, s3_GP);
|
|
|
|
if (s3_append_insn (insn_str, TRUE) == (int) s3_FAIL)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef TC_IMPLICIT_LCOMM_ALIGNMENT
|
2011-06-13 17:45:28 +08:00
|
|
|
#define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
if ((SIZE) >= 8) \
|
|
|
|
(P2VAR) = 3; \
|
|
|
|
else if ((SIZE) >= 4) \
|
|
|
|
(P2VAR) = 2; \
|
|
|
|
else if ((SIZE) >= 2) \
|
|
|
|
(P2VAR) = 1; \
|
|
|
|
else \
|
|
|
|
(P2VAR) = 0; \
|
|
|
|
} \
|
2009-03-02 18:33:08 +08:00
|
|
|
while (0)
|
|
|
|
#endif
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_s_score_lcomm (int bytes_p)
|
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
char c;
|
|
|
|
char *p;
|
|
|
|
int temp;
|
|
|
|
symbolS *symbolP;
|
|
|
|
segT current_seg = now_seg;
|
|
|
|
subsegT current_subseg = now_subseg;
|
|
|
|
const int max_alignment = 15;
|
|
|
|
int align = 0;
|
|
|
|
segT bss_seg = bss_section;
|
|
|
|
int needs_align = 0;
|
|
|
|
|
2015-08-21 23:42:14 +08:00
|
|
|
c = get_symbol_name (&name);
|
2009-03-02 18:33:08 +08:00
|
|
|
p = input_line_pointer;
|
2015-08-21 23:42:14 +08:00
|
|
|
(void) restore_line_pointer (c);
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
if (name == p)
|
|
|
|
{
|
|
|
|
as_bad (_("expected symbol name"));
|
|
|
|
discard_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
|
|
|
|
/* Accept an optional comma after the name. The comma used to be
|
|
|
|
required, but Irix 5 cc does not generate it. */
|
|
|
|
if (*input_line_pointer == ',')
|
|
|
|
{
|
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_end_of_line[(unsigned char)*input_line_pointer])
|
|
|
|
{
|
|
|
|
as_bad (_("missing size expression"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((temp = get_absolute_expression ()) < 0)
|
|
|
|
{
|
|
|
|
as_warn (_("BSS length (%d) < 0 ignored"), temp);
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined (TC_SCORE)
|
|
|
|
if (OUTPUT_FLAVOR == bfd_target_ecoff_flavour || OUTPUT_FLAVOR == bfd_target_elf_flavour)
|
|
|
|
{
|
|
|
|
/* For Score and Alpha ECOFF or ELF, small objects are put in .sbss. */
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
if ((unsigned) temp <= bfd_get_gp_size (stdoutput))
|
|
|
|
{
|
|
|
|
bss_seg = subseg_new (".sbss", 1);
|
|
|
|
seg_info (bss_seg)->bss = 1;
|
2009-03-02 18:33:08 +08:00
|
|
|
#ifdef BFD_ASSEMBLER
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
if (!bfd_set_section_flags (bss_seg, SEC_ALLOC))
|
|
|
|
as_warn (_("error setting flags for \".sbss\": %s"),
|
|
|
|
bfd_errmsg (bfd_get_error ()));
|
2009-03-02 18:33:08 +08:00
|
|
|
#endif
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
#endif
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer == ',')
|
|
|
|
{
|
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
|
|
|
|
if (is_end_of_line[(unsigned char)*input_line_pointer])
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
as_bad (_("missing alignment"));
|
|
|
|
return;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
align = get_absolute_expression ();
|
|
|
|
needs_align = 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (!needs_align)
|
|
|
|
{
|
|
|
|
TC_IMPLICIT_LCOMM_ALIGNMENT (temp, align);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Still zero unless TC_IMPLICIT_LCOMM_ALIGNMENT set it. */
|
|
|
|
if (align)
|
|
|
|
record_alignment (bss_seg, align);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (needs_align)
|
|
|
|
{
|
|
|
|
if (bytes_p)
|
|
|
|
{
|
|
|
|
/* Convert to a power of 2. */
|
|
|
|
if (align != 0)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
for (i = 0; align != 0; align >>= 1, ++i)
|
|
|
|
;
|
|
|
|
align = i - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (align > max_alignment)
|
|
|
|
{
|
|
|
|
align = max_alignment;
|
|
|
|
as_warn (_("alignment too large; %d assumed"), align);
|
|
|
|
}
|
|
|
|
else if (align < 0)
|
|
|
|
{
|
|
|
|
align = 0;
|
|
|
|
as_warn (_("alignment negative; 0 assumed"));
|
|
|
|
}
|
|
|
|
|
|
|
|
record_alignment (bss_seg, align);
|
|
|
|
}
|
|
|
|
else
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Assume some objects may require alignment on some systems. */
|
|
|
|
#if defined (TC_ALPHA) && ! defined (VMS)
|
|
|
|
if (temp > 1)
|
|
|
|
{
|
|
|
|
align = ffs (temp) - 1;
|
|
|
|
if (temp % (1 << align))
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
*p = 0;
|
|
|
|
symbolP = symbol_find_or_make (name);
|
|
|
|
*p = c;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (
|
Remove i860, i960, bout and aout-adobe targets
Plus remove a few leftovers from the 29k support.
include/
* aout/adobe.h: Delete.
* aout/reloc.h: Delete.
* coff/i860.h: Delete.
* coff/i960.h: Delete.
* elf/i860.h: Delete.
* elf/i960.h: Delete.
* opcode/i860.h: Delete.
* opcode/i960.h: Delete.
* aout/aout64.h (enum reloc_type): Trim off 29k and other unused values.
* aout/ar.h (ARMAGB): Remove.
* coff/internal.h (struct internal_aouthdr, struct internal_scnhdr,
union internal_auxent): Remove i960 support.
bfd/
* aout-adobe.c: Delete.
* bout.c: Delete.
* coff-i860.c: Delete.
* coff-i960.c: Delete.
* cpu-i860.c: Delete.
* cpu-i960.c: Delete.
* elf32-i860.c: Delete.
* elf32-i960.c: Delete.
* hosts/i860mach3.h: Delete.
* Makefile.am: Remove i860, i960, bout, and adobe support.
* archures.c: Remove i860 and i960 support.
* coffcode.h: Likewise.
* reloc.c: Likewise.
* aoutx.h: Comment updates.
* archive.c: Remove BOUT and i960 support.
* bfd.c: Remove BOUT support.
* coffswap.h: Remove i960 support.
* config.bfd: Remove i860, i960 and adobe targets.
* configure.ac: Remove adode, bout, i860, i960, icoff targets.
* targets.c: Likewise.
* ieee.c: Remove i960 support.
* mach-o.c: Remove i860 support.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* libbfd.h: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
opcodes/
* opcodes/i860-dis.c: Delete.
* opcodes/i960-dis.c: Delete.
* Makefile.am: Remove i860 and i960 support.
* configure.ac: Likewise.
* disassemble.c: Likewise.
* disassemble.h: Likewise.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/POTFILES.in: Regenerate.
binutils/
* ieee.c: Remove i960 support.
* od-macho.c: Remove i860 support.
* readelf.c: Remove i860 and i960 support.
* testsuite/binutils-all/objcopy.exp: Likewise.
* testsuite/binutils-all/objdump.exp: Likewise.
* testsuite/lib/binutils-common.exp: Likewise.
gas/
* config/aout_gnu.h: Delete.
* config/tc-i860.c: Delete.
* config/tc-i860.h: Delete.
* config/tc-i960.c: Delete.
* config/tc-i960.h: Delete.
* doc/c-i860.texi: Delete.
* doc/c-i960.texi: Delete.
* testsuite/gas/i860/README.i860: Delete.
* testsuite/gas/i860/bitwise.d: Delete.
* testsuite/gas/i860/bitwise.s: Delete.
* testsuite/gas/i860/branch.d: Delete.
* testsuite/gas/i860/branch.s: Delete.
* testsuite/gas/i860/bte.d: Delete.
* testsuite/gas/i860/bte.s: Delete.
* testsuite/gas/i860/dir-align01.d: Delete.
* testsuite/gas/i860/dir-align01.s: Delete.
* testsuite/gas/i860/dir-intel01.d: Delete.
* testsuite/gas/i860/dir-intel01.s: Delete.
* testsuite/gas/i860/dir-intel02.d: Delete.
* testsuite/gas/i860/dir-intel02.s: Delete.
* testsuite/gas/i860/dir-intel03-err.l: Delete.
* testsuite/gas/i860/dir-intel03-err.s: Delete.
* testsuite/gas/i860/dual01.d: Delete.
* testsuite/gas/i860/dual01.s: Delete.
* testsuite/gas/i860/dual02-err.l: Delete.
* testsuite/gas/i860/dual02-err.s: Delete.
* testsuite/gas/i860/dual03.d: Delete.
* testsuite/gas/i860/dual03.s: Delete.
* testsuite/gas/i860/fldst01.d: Delete.
* testsuite/gas/i860/fldst01.s: Delete.
* testsuite/gas/i860/fldst02.d: Delete.
* testsuite/gas/i860/fldst02.s: Delete.
* testsuite/gas/i860/fldst03.d: Delete.
* testsuite/gas/i860/fldst03.s: Delete.
* testsuite/gas/i860/fldst04.d: Delete.
* testsuite/gas/i860/fldst04.s: Delete.
* testsuite/gas/i860/fldst05.d: Delete.
* testsuite/gas/i860/fldst05.s: Delete.
* testsuite/gas/i860/fldst06.d: Delete.
* testsuite/gas/i860/fldst06.s: Delete.
* testsuite/gas/i860/fldst07.d: Delete.
* testsuite/gas/i860/fldst07.s: Delete.
* testsuite/gas/i860/fldst08.d: Delete.
* testsuite/gas/i860/fldst08.s: Delete.
* testsuite/gas/i860/float01.d: Delete.
* testsuite/gas/i860/float01.s: Delete.
* testsuite/gas/i860/float02.d: Delete.
* testsuite/gas/i860/float02.s: Delete.
* testsuite/gas/i860/float03.d: Delete.
* testsuite/gas/i860/float03.s: Delete.
* testsuite/gas/i860/float04.d: Delete.
* testsuite/gas/i860/float04.s: Delete.
* testsuite/gas/i860/form.d: Delete.
* testsuite/gas/i860/form.s: Delete.
* testsuite/gas/i860/i860.exp: Delete.
* testsuite/gas/i860/iarith.d: Delete.
* testsuite/gas/i860/iarith.s: Delete.
* testsuite/gas/i860/ldst01.d: Delete.
* testsuite/gas/i860/ldst01.s: Delete.
* testsuite/gas/i860/ldst02.d: Delete.
* testsuite/gas/i860/ldst02.s: Delete.
* testsuite/gas/i860/ldst03.d: Delete.
* testsuite/gas/i860/ldst03.s: Delete.
* testsuite/gas/i860/ldst04.d: Delete.
* testsuite/gas/i860/ldst04.s: Delete.
* testsuite/gas/i860/ldst05.d: Delete.
* testsuite/gas/i860/ldst05.s: Delete.
* testsuite/gas/i860/ldst06.d: Delete.
* testsuite/gas/i860/ldst06.s: Delete.
* testsuite/gas/i860/pfam.d: Delete.
* testsuite/gas/i860/pfam.s: Delete.
* testsuite/gas/i860/pfmam.d: Delete.
* testsuite/gas/i860/pfmam.s: Delete.
* testsuite/gas/i860/pfmsm.d: Delete.
* testsuite/gas/i860/pfmsm.s: Delete.
* testsuite/gas/i860/pfsm.d: Delete.
* testsuite/gas/i860/pfsm.s: Delete.
* testsuite/gas/i860/pseudo-ops01.d: Delete.
* testsuite/gas/i860/pseudo-ops01.s: Delete.
* testsuite/gas/i860/regress01.d: Delete.
* testsuite/gas/i860/regress01.s: Delete.
* testsuite/gas/i860/shift.d: Delete.
* testsuite/gas/i860/shift.s: Delete.
* testsuite/gas/i860/simd.d: Delete.
* testsuite/gas/i860/simd.s: Delete.
* testsuite/gas/i860/system.d: Delete.
* testsuite/gas/i860/system.s: Delete.
* testsuite/gas/i860/xp.d: Delete.
* testsuite/gas/i860/xp.s: Delete.
* Makefile.am: Remove i860 and i960 support.
* configure.tgt: Likewise.
* doc/Makefile.am: Likewise.
* doc/all.texi: Likewise.
* testsuite/gas/all/gas.exp
* config/obj-coff.h: Remove i960 support.
* doc/internals.texi: Likewise.
* expr.c: Likewise.
* read.c: Likewise.
* write.c: Likewise.
* write.h: Likewise.
* testsuite/gas/lns/lns.exp: Likewise.
* testsuite/gas/symver/symver.exp: Likewise.
* config/tc-m68k.c: Remove BOUT support.
* config/tc-score.c: Likewise.
* config/tc-score7.c: Likewise.
* config/tc-sparc.c: Likewise.
* symbols.c: Likewise.
* doc/h8.texi: Likewise.
* configure.ac: Remove BOUT and i860 support.
* doc/as.texinfo: Remove BOUT, i860 and i960 support
* Makefile.in: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
* doc/Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
ld/
* emulparams/coff_i860.sh: Delete.
* emulparams/elf32_i860.sh: Delete.
* emulparams/elf32_i960.sh: Delete.
* emulparams/gld960.sh: Delete.
* emulparams/gld960coff.sh: Delete.
* emulparams/lnk960.sh: Delete.
* emultempl/gld960.em: Delete.
* emultempl/gld960c.em: Delete.
* emultempl/lnk960.em: Delete.
* scripttempl/i860coff.sc: Delete.
* scripttempl/i960.sc: Delete.
* ld.texinfo: Remove i960 support.
* Makefile.am: Remove i860 and i960 support.
* configure.tgt: Likewise.
* testsuite/ld-discard/extern.d: Likewise.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
* testsuite/ld-elf/compressed1d.d: Likewise.
* testsuite/ld-elf/group1.d: Likewise.
* testsuite/ld-elf/group3b.d: Likewise.
* testsuite/ld-elf/group8a.d: Likewise.
* testsuite/ld-elf/group8b.d: Likewise.
* testsuite/ld-elf/group9a.d: Likewise.
* testsuite/ld-elf/group9b.d: Likewise.
* testsuite/ld-elf/linkonce2.d: Likewise.
* testsuite/ld-elf/merge.d: Likewise.
* testsuite/ld-elf/merge2.d: Likewise.
* testsuite/ld-elf/merge3.d: Likewise.
* testsuite/ld-elf/orphan-10.d: Likewise.
* testsuite/ld-elf/orphan-11.d: Likewise.
* testsuite/ld-elf/orphan-12.d: Likewise.
* testsuite/ld-elf/orphan-9.d: Likewise.
* testsuite/ld-elf/orphan-region.d: Likewise.
* testsuite/ld-elf/orphan.d: Likewise.
* testsuite/ld-elf/orphan3.d: Likewise.
* testsuite/ld-elf/pr12851.d: Likewise.
* testsuite/ld-elf/pr12975.d: Likewise.
* testsuite/ld-elf/pr13177.d: Likewise.
* testsuite/ld-elf/pr13195.d: Likewise.
* testsuite/ld-elf/pr17550a.d: Likewise.
* testsuite/ld-elf/pr17550b.d: Likewise.
* testsuite/ld-elf/pr17550c.d: Likewise.
* testsuite/ld-elf/pr17550d.d: Likewise.
* testsuite/ld-elf/pr17615.d: Likewise.
* testsuite/ld-elf/pr20528a.d: Likewise.
* testsuite/ld-elf/pr20528b.d: Likewise.
* testsuite/ld-elf/pr21562a.d: Likewise.
* testsuite/ld-elf/pr21562b.d: Likewise.
* testsuite/ld-elf/pr21562c.d: Likewise.
* testsuite/ld-elf/pr21562d.d: Likewise.
* testsuite/ld-elf/pr21562i.d: Likewise.
* testsuite/ld-elf/pr21562j.d: Likewise.
* testsuite/ld-elf/pr21562k.d: Likewise.
* testsuite/ld-elf/pr21562l.d: Likewise.
* testsuite/ld-elf/pr21562m.d: Likewise.
* testsuite/ld-elf/pr21562n.d: Likewise.
* testsuite/ld-elf/pr22677.d: Likewise.
* testsuite/ld-elf/pr22836-1a.d: Likewise.
* testsuite/ld-elf/pr22836-1b.d: Likewise.
* testsuite/ld-elf/pr349.d: Likewise.
* testsuite/ld-elf/sec-to-seg.exp: Likewise.
* testsuite/ld-elf/sec64k.exp: Likewise.
* testsuite/ld-elf/warn1.d: Likewise.
* testsuite/ld-elf/warn2.d: Likewise.
* testsuite/ld-elf/warn3.d: Likewise.
* testsuite/lib/ld-lib.exp: Likewise.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.
2018-04-11 17:16:05 +08:00
|
|
|
#if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
|
2009-03-02 18:33:08 +08:00
|
|
|
#ifdef BFD_ASSEMBLER
|
2011-06-13 17:45:28 +08:00
|
|
|
(OUTPUT_FLAVOR != bfd_target_aout_flavour
|
|
|
|
|| (S_GET_OTHER (symbolP) == 0 && S_GET_DESC (symbolP) == 0)) &&
|
2009-03-02 18:33:08 +08:00
|
|
|
#else
|
2011-06-13 17:45:28 +08:00
|
|
|
(S_GET_OTHER (symbolP) == 0 && S_GET_DESC (symbolP) == 0) &&
|
2009-03-02 18:33:08 +08:00
|
|
|
#endif
|
|
|
|
#endif
|
2011-06-13 17:45:28 +08:00
|
|
|
(S_GET_SEGMENT (symbolP) == bss_seg || (!S_IS_DEFINED (symbolP) && S_GET_VALUE (symbolP) == 0)))
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
|
|
|
char *pfrag;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
subseg_set (bss_seg, 1);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (align)
|
|
|
|
frag_align (align, 0, 0);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Detach from old frag. */
|
|
|
|
if (S_GET_SEGMENT (symbolP) == bss_seg)
|
|
|
|
symbol_get_frag (symbolP)->fr_symbol = NULL;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
symbol_set_frag (symbolP, frag_now);
|
|
|
|
pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, (offsetT) temp, NULL);
|
|
|
|
*pfrag = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
S_SET_SEGMENT (symbolP, bss_seg);
|
|
|
|
|
|
|
|
#ifdef OBJ_COFF
|
|
|
|
/* The symbol may already have been created with a preceding
|
|
|
|
".globl" directive -- be careful not to step on storage class
|
|
|
|
in that case. Otherwise, set it to static. */
|
|
|
|
if (S_GET_STORAGE_CLASS (symbolP) != C_EXT)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
S_SET_STORAGE_CLASS (symbolP, C_STAT);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
#endif /* OBJ_COFF */
|
|
|
|
|
|
|
|
#ifdef S_SET_SIZE
|
|
|
|
S_SET_SIZE (symbolP, temp);
|
|
|
|
#endif
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else
|
|
|
|
as_bad (_("symbol `%s' is already defined"), S_GET_NAME (symbolP));
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
subseg_set (current_seg, current_subseg);
|
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_insert_reg (const struct s3_reg_entry *r, struct hash_control *htab)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
int len = strlen (r->name) + 2;
|
2016-04-01 21:26:30 +08:00
|
|
|
char *buf = XNEWVEC (char, len);
|
|
|
|
char *buf2 = XNEWVEC (char, len);
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
strcpy (buf + i, r->name);
|
|
|
|
for (i = 0; buf[i]; i++)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
buf2[i] = TOUPPER (buf[i]);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
buf2[i] = '\0';
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
hash_insert (htab, buf, (void *) r);
|
|
|
|
hash_insert (htab, buf2, (void *) r);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_build_reg_hsh (struct s3_reg_map *map)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
const struct s3_reg_entry *r;
|
|
|
|
|
|
|
|
if ((map->htab = hash_new ()) == NULL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
as_fatal (_("virtual memory exhausted"));
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
for (r = map->names; r->name != NULL; r++)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_insert_reg (r, map->htab);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Iterate over the base tables to create the instruction patterns. */
|
2006-09-17 07:51:50 +08:00
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_build_score_ops_hsh (void)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
unsigned int i;
|
|
|
|
static struct obstack insn_obstack;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
obstack_begin (&insn_obstack, 4000);
|
|
|
|
for (i = 0; i < sizeof (s3_score_insns) / sizeof (struct s3_asm_opcode); i++)
|
|
|
|
{
|
|
|
|
const struct s3_asm_opcode *insn = s3_score_insns + i;
|
2014-07-26 19:30:50 +08:00
|
|
|
size_t len = strlen (insn->template_name);
|
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 06:11:02 +08:00
|
|
|
struct s3_asm_opcode *new_opcode;
|
|
|
|
char *template_name;
|
|
|
|
new_opcode = (struct s3_asm_opcode *)
|
2011-06-13 17:45:28 +08:00
|
|
|
obstack_alloc (&insn_obstack, sizeof (struct s3_asm_opcode));
|
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 06:11:02 +08:00
|
|
|
template_name = (char *) obstack_alloc (& insn_obstack, len + 1);
|
2006-09-17 07:51:50 +08: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 06:11:02 +08:00
|
|
|
strcpy (template_name, insn->template_name);
|
|
|
|
new_opcode->template_name = template_name;
|
|
|
|
new_opcode->parms = insn->parms;
|
|
|
|
new_opcode->value = insn->value;
|
|
|
|
new_opcode->relax_value = insn->relax_value;
|
|
|
|
new_opcode->type = insn->type;
|
|
|
|
new_opcode->bitmask = insn->bitmask;
|
|
|
|
hash_insert (s3_score_ops_hsh, new_opcode->template_name,
|
|
|
|
(void *) new_opcode);
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_build_dependency_insn_hsh (void)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
static struct obstack dependency_obstack;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
obstack_begin (&dependency_obstack, 4000);
|
|
|
|
for (i = 0; i < sizeof (s3_insn_to_dependency_table) / sizeof (s3_insn_to_dependency_table[0]); i++)
|
|
|
|
{
|
|
|
|
const struct s3_insn_to_dependency *tmp = s3_insn_to_dependency_table + i;
|
2014-07-26 19:30:50 +08:00
|
|
|
size_t len = strlen (tmp->insn_name);
|
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 06:11:02 +08:00
|
|
|
struct s3_insn_to_dependency *new_i2n;
|
2016-03-20 13:34:02 +08:00
|
|
|
char *buf;
|
2006-09-17 07:51:50 +08: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 06:11:02 +08:00
|
|
|
new_i2n = (struct s3_insn_to_dependency *)
|
2011-06-13 17:45:28 +08:00
|
|
|
obstack_alloc (&dependency_obstack,
|
|
|
|
sizeof (struct s3_insn_to_dependency));
|
2016-03-20 13:34:02 +08:00
|
|
|
buf = (char *) obstack_alloc (&dependency_obstack, len + 1);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2016-03-20 13:34:02 +08:00
|
|
|
strcpy (buf, tmp->insn_name);
|
|
|
|
new_i2n->insn_name = buf;
|
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 06:11:02 +08:00
|
|
|
new_i2n->type = tmp->type;
|
|
|
|
hash_insert (s3_dependency_insn_hsh, new_i2n->insn_name,
|
|
|
|
(void *) new_i2n);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s_score_bss (int ignore ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_s_score_bss (ignore);
|
|
|
|
else
|
|
|
|
return s7_s_score_bss (ignore);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s_score_text (int ignore)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (score3)
|
|
|
|
return s3_s_score_text (ignore);
|
|
|
|
else
|
|
|
|
return s7_s_score_text (ignore);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s_section (int ignore)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_score_s_section (ignore);
|
|
|
|
else
|
|
|
|
return s7_s_section (ignore);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s_change_sec (int sec)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_s_change_sec (sec);
|
2006-09-17 07:51:50 +08:00
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
return s7_s_change_sec (sec);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s_score_mask (int reg_type ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_s_score_mask (reg_type);
|
|
|
|
else
|
|
|
|
return s7_s_score_mask (reg_type);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s_score_ent (int aent)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (score3)
|
|
|
|
return s3_s_score_ent (aent);
|
|
|
|
else
|
|
|
|
return s7_s_score_ent (aent);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s_score_frame (int ignore ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_s_score_frame (ignore);
|
|
|
|
else
|
|
|
|
return s7_s_score_frame (ignore);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s_score_end (int x ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_s_score_end (x);
|
|
|
|
else
|
|
|
|
return s7_s_score_end (x);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s_score_set (int x ATTRIBUTE_UNUSED)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (score3)
|
|
|
|
return s3_s_score_set (x);
|
|
|
|
else
|
|
|
|
return s7_s_score_set (x);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s_score_cpload (int ignore ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_s_score_cpload (ignore);
|
|
|
|
else
|
|
|
|
return s7_s_score_cpload (ignore);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s_score_cprestore (int ignore ATTRIBUTE_UNUSED)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (score3)
|
|
|
|
return s3_s_score_cprestore (ignore);
|
2011-06-13 17:45:28 +08:00
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
return s7_s_score_cprestore (ignore);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s_score_gpword (int ignore ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_s_score_gpword (ignore);
|
2011-06-13 17:45:28 +08:00
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
return s7_s_score_gpword (ignore);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s_score_cpadd (int ignore ATTRIBUTE_UNUSED)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (score3)
|
|
|
|
return s3_s_score_cpadd (ignore);
|
2011-06-13 17:45:28 +08:00
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
return s7_s_score_cpadd (ignore);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s_score_lcomm (int bytes_p)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_s_score_lcomm (bytes_p);
|
2011-06-13 17:45:28 +08:00
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
return s7_s_score_lcomm (bytes_p);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_assemble (char *str)
|
|
|
|
{
|
|
|
|
know (str);
|
|
|
|
know (strlen (str) < s3_MAX_LITERAL_POOL_SIZE);
|
|
|
|
|
|
|
|
memset (&s3_inst, '\0', sizeof (s3_inst));
|
|
|
|
if (s3_INSN_IS_PCE_P (str))
|
|
|
|
s3_parse_pce_inst (str);
|
|
|
|
else if (s3_INSN_IS_48_P (str))
|
|
|
|
s3_parse_48_inst (str, TRUE);
|
|
|
|
else
|
|
|
|
s3_parse_16_32_inst (str, TRUE);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.error)
|
|
|
|
as_bad (_("%s -- `%s'"), s3_inst.error, s3_inst.str);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
static void
|
2009-12-11 21:42:17 +08:00
|
|
|
s3_operand (expressionS * exp)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_in_my_get_expression)
|
|
|
|
{
|
2009-12-11 21:42:17 +08:00
|
|
|
exp->X_op = O_illegal;
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_inst.error == NULL)
|
|
|
|
{
|
|
|
|
s3_inst.error = _("bad expression");
|
|
|
|
}
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_begin (void)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
unsigned int i;
|
|
|
|
segT seg;
|
|
|
|
subsegT subseg;
|
|
|
|
|
|
|
|
if ((s3_score_ops_hsh = hash_new ()) == NULL)
|
|
|
|
as_fatal (_("virtual memory exhausted"));
|
|
|
|
|
|
|
|
s3_build_score_ops_hsh ();
|
|
|
|
|
|
|
|
if ((s3_dependency_insn_hsh = hash_new ()) == NULL)
|
|
|
|
as_fatal (_("virtual memory exhausted"));
|
|
|
|
|
|
|
|
s3_build_dependency_insn_hsh ();
|
|
|
|
|
|
|
|
for (i = (int)s3_REG_TYPE_FIRST; i < (int)s3_REG_TYPE_MAX; i++)
|
|
|
|
s3_build_reg_hsh (s3_all_reg_maps + i);
|
|
|
|
|
|
|
|
/* Initialize dependency vector. */
|
|
|
|
s3_init_dependency_vector ();
|
|
|
|
|
|
|
|
bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0);
|
|
|
|
seg = now_seg;
|
|
|
|
subseg = now_subseg;
|
|
|
|
s3_pdr_seg = subseg_new (".pdr", (subsegT) 0);
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
bfd_set_section_flags (s3_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING);
|
|
|
|
bfd_set_section_alignment (s3_pdr_seg, 2);
|
2009-03-02 18:33:08 +08:00
|
|
|
subseg_set (seg, subseg);
|
|
|
|
|
|
|
|
if (s3_USE_GLOBAL_POINTER_OPT)
|
|
|
|
bfd_set_gp_size (stdoutput, s3_g_switch_value);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_number_to_chars (char *buf, valueT val, int n)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (target_big_endian)
|
|
|
|
number_to_chars_bigendian (buf, val, n);
|
|
|
|
else
|
|
|
|
number_to_chars_littleendian (buf, val, n);
|
|
|
|
}
|
|
|
|
|
|
|
|
static valueT
|
|
|
|
s3_normal_chars_to_number (char *buf, int n)
|
|
|
|
{
|
|
|
|
valueT result = 0;
|
|
|
|
unsigned char *where = (unsigned char *)buf;
|
|
|
|
|
|
|
|
if (target_big_endian)
|
|
|
|
{
|
|
|
|
while (n--)
|
2011-06-13 17:45:28 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
result <<= 8;
|
2011-06-13 17:45:28 +08:00
|
|
|
result |= (*where++ & 255);
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (n--)
|
2011-06-13 17:45:28 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
result <<= 8;
|
2011-06-13 17:45:28 +08:00
|
|
|
result |= (where[n] & 255);
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
return result;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_number_to_chars_littleendian (void *p, valueT data, int n)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
char *buf = (char *) p;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
switch (n)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
case 4:
|
|
|
|
md_number_to_chars (buf, data >> 16, 2);
|
|
|
|
md_number_to_chars (buf + 2, data, 2);
|
2006-09-17 07:51:50 +08:00
|
|
|
break;
|
2009-03-02 18:33:08 +08:00
|
|
|
case 6:
|
|
|
|
md_number_to_chars (buf, data >> 32, 2);
|
|
|
|
md_number_to_chars (buf + 2, data >> 16, 2);
|
|
|
|
md_number_to_chars (buf + 4, data, 2);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Error routine. */
|
|
|
|
as_bad_where (__FILE__, __LINE__, _("size is not 4 or 6"));
|
2006-09-17 07:51:50 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static valueT
|
|
|
|
s3_chars_to_number_littleendian (const void *p, int n)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
char *buf = (char *) p;
|
|
|
|
valueT result = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
switch (n)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
case 4:
|
|
|
|
result = s3_normal_chars_to_number (buf, 2) << 16;
|
|
|
|
result |= s3_normal_chars_to_number (buf + 2, 2);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
result = s3_normal_chars_to_number (buf, 2) << 32;
|
|
|
|
result |= s3_normal_chars_to_number (buf + 2, 2) << 16;
|
|
|
|
result |= s3_normal_chars_to_number (buf + 4, 2);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Error routine. */
|
|
|
|
as_bad_where (__FILE__, __LINE__, _("size is not 4 or 6"));
|
|
|
|
break;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
return result;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_md_number_to_chars (char *buf, valueT val, int n)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2011-06-13 17:45:28 +08:00
|
|
|
if (!target_big_endian && n >= 4)
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_number_to_chars_littleendian (buf, val, n);
|
|
|
|
else
|
|
|
|
md_number_to_chars (buf, val, n);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static valueT
|
|
|
|
s3_md_chars_to_number (char *buf, int n)
|
|
|
|
{
|
|
|
|
valueT result = 0;
|
|
|
|
|
|
|
|
if (!target_big_endian && n >= 4)
|
|
|
|
result = s3_chars_to_number_littleendian (buf, n);
|
|
|
|
else
|
|
|
|
result = s3_normal_chars_to_number (buf, n);
|
|
|
|
|
|
|
|
return result;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2016-04-01 20:07:50 +08:00
|
|
|
static const char *
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_atof (int type, char *litP, int *sizeP)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
int prec;
|
2019-05-10 23:57:31 +08:00
|
|
|
LITTLENUM_TYPE words[MAX_LITTLENUMS];
|
2009-03-02 18:33:08 +08:00
|
|
|
char *t;
|
|
|
|
int i;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
switch (type)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
case 'f':
|
|
|
|
case 'F':
|
|
|
|
case 's':
|
|
|
|
case 'S':
|
|
|
|
prec = 2;
|
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
case 'D':
|
|
|
|
case 'r':
|
|
|
|
case 'R':
|
|
|
|
prec = 4;
|
|
|
|
break;
|
|
|
|
case 'x':
|
|
|
|
case 'X':
|
|
|
|
case 'p':
|
|
|
|
case 'P':
|
|
|
|
prec = 6;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*sizeP = 0;
|
|
|
|
return _("bad call to MD_ATOF()");
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
t = atof_ieee (input_line_pointer, type, words);
|
|
|
|
if (t)
|
|
|
|
input_line_pointer = t;
|
|
|
|
*sizeP = prec * 2;
|
|
|
|
|
|
|
|
if (target_big_endian)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
for (i = 0; i < prec; i++)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_md_number_to_chars (litP, (valueT) words[i], 2);
|
|
|
|
litP += 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
for (i = 0; i < prec; i += 2)
|
|
|
|
{
|
|
|
|
s3_md_number_to_chars (litP, (valueT) words[i + 1], 2);
|
|
|
|
s3_md_number_to_chars (litP + 2, (valueT) words[i], 2);
|
|
|
|
litP += 4;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
return 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static void
|
|
|
|
s3_frag_check (fragS * fragp ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
know (fragp->insn_addr <= s3_RELAX_PAD_BYTE);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_validate_fix (fixS *fixP)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
fixP->fx_where += fixP->fx_frag->insn_addr;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static int
|
|
|
|
s3_force_relocation (struct fix *fixp)
|
|
|
|
{
|
|
|
|
int retval = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|
|
|
|
|| fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|
|
|
|
|| fixp->fx_r_type == BFD_RELOC_SCORE_JMP
|
|
|
|
|| fixp->fx_r_type == BFD_RELOC_SCORE_BRANCH
|
|
|
|
|| fixp->fx_r_type == BFD_RELOC_SCORE16_JMP
|
2011-06-13 17:45:28 +08:00
|
|
|
|| fixp->fx_r_type == BFD_RELOC_SCORE16_BRANCH
|
2009-03-02 18:33:08 +08:00
|
|
|
|| fixp->fx_r_type == BFD_RELOC_SCORE_BCMP)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
retval = 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
return retval;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static bfd_boolean
|
|
|
|
s3_fix_adjustable (fixS * fixP)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (fixP->fx_addsy == NULL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
return 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else if (OUTPUT_FLAVOR == bfd_target_elf_flavour
|
2011-06-13 17:45:28 +08:00
|
|
|
&& (S_IS_EXTERNAL (fixP->fx_addsy) || S_IS_WEAK (fixP->fx_addsy)))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
return 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|
|
|
|
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|
|
|
|
|| fixP->fx_r_type == BFD_RELOC_SCORE_JMP
|
|
|
|
|| fixP->fx_r_type == BFD_RELOC_SCORE16_JMP)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
return 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
return 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_elf_final_processing (void)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
unsigned long val = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (score3)
|
|
|
|
val = E_SCORE_MACH_SCORE3;
|
|
|
|
else if (score7)
|
|
|
|
val = E_SCORE_MACH_SCORE7;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
elf_elfheader (stdoutput)->e_machine = EM_SCORE;
|
|
|
|
elf_elfheader (stdoutput)->e_flags &= ~EF_SCORE_MACH;
|
|
|
|
elf_elfheader (stdoutput)->e_flags |= val;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_fix_data_dependency == 1)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
elf_elfheader (stdoutput)->e_flags |= EF_SCORE_FIXDEP;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_score_pic == s3_PIC)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
elf_elfheader (stdoutput)->e_flags |= EF_SCORE_PIC;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static int
|
|
|
|
s3_judge_size_before_relax (fragS * fragp, asection *sec)
|
|
|
|
{
|
|
|
|
int change = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (s3_score_pic == s3_NO_PIC)
|
|
|
|
change = s3_nopic_need_relax (fragp->fr_symbol, 0);
|
2006-09-17 07:51:50 +08:00
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
change = s3_pic_need_relax (fragp->fr_symbol, sec);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (change == 1)
|
|
|
|
{
|
|
|
|
/* Only at the first time determining whether s3_GP instruction relax should be done,
|
2017-01-23 23:23:07 +08:00
|
|
|
return the difference between instruction size and instruction relax size. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if (fragp->fr_opcode == NULL)
|
|
|
|
{
|
|
|
|
fragp->fr_fix = s3_RELAX_NEW (fragp->fr_subtype);
|
|
|
|
fragp->fr_opcode = fragp->fr_literal + s3_RELAX_RELOC1 (fragp->fr_subtype);
|
|
|
|
return s3_RELAX_NEW (fragp->fr_subtype) - s3_RELAX_OLD (fragp->fr_subtype);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
return 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static int
|
|
|
|
s3_estimate_size_before_relax (fragS * fragp, asection * sec ATTRIBUTE_UNUSED)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((s3_RELAX_TYPE (fragp->fr_subtype) == Insn_GP)
|
|
|
|
|| (s3_RELAX_TYPE (fragp->fr_subtype) == Insn_PIC))
|
|
|
|
return s3_judge_size_before_relax (fragp, sec);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static int
|
|
|
|
s3_relax_branch_inst32 (fragS * fragp)
|
|
|
|
{
|
|
|
|
fragp->fr_opcode = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static int
|
|
|
|
s3_relax_branch_inst16 (fragS * fragp)
|
|
|
|
{
|
|
|
|
int relaxable_p = 0;
|
|
|
|
int frag_addr = fragp->fr_address + fragp->insn_addr;
|
|
|
|
addressT symbol_address = 0;
|
|
|
|
symbolS *s;
|
|
|
|
offsetT offset;
|
|
|
|
long value;
|
|
|
|
unsigned long inst_value;
|
|
|
|
|
|
|
|
relaxable_p = s3_RELAX_OPT (fragp->fr_subtype);
|
|
|
|
|
|
|
|
s = fragp->fr_symbol;
|
|
|
|
if (s == NULL)
|
|
|
|
frag_addr = 0;
|
|
|
|
else
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
symbol_address = (addressT) symbol_get_frag (s)->fr_address;
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN16_SIZE);
|
|
|
|
offset = (inst_value & 0x1ff) << 1;
|
|
|
|
if ((offset & 0x200) == 0x200)
|
|
|
|
offset |= 0xfffffc00;
|
|
|
|
|
|
|
|
value = offset + symbol_address - frag_addr;
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
if (relaxable_p
|
2009-03-02 18:33:08 +08:00
|
|
|
&& (!((value & 0xfffffe00) == 0 || (value & 0xfffffe00) == 0xfffffe00))
|
|
|
|
&& fragp->fr_fix == 2
|
|
|
|
&& (S_IS_DEFINED (s)
|
|
|
|
&& !S_IS_COMMON (s)
|
|
|
|
&& !S_IS_EXTERNAL (s)))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Relax branch 32 to branch 16. */
|
|
|
|
fragp->fr_opcode = fragp->fr_literal + s3_RELAX_RELOC1 (fragp->fr_subtype);
|
|
|
|
fragp->fr_fix = 4;
|
|
|
|
return 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
s3_relax_cmpbranch_inst32 (fragS * fragp)
|
|
|
|
{
|
|
|
|
int relaxable_p = 0;
|
|
|
|
symbolS *s;
|
|
|
|
/* For sign bit. */
|
|
|
|
long offset;
|
|
|
|
long frag_addr = fragp->fr_address + fragp->insn_addr;
|
|
|
|
long symbol_address = 0;
|
|
|
|
long value;
|
|
|
|
unsigned long inst_value;
|
|
|
|
|
|
|
|
relaxable_p = s3_RELAX_OPT (fragp->fr_subtype);
|
|
|
|
|
|
|
|
s = fragp->fr_symbol;
|
|
|
|
if (s == NULL)
|
|
|
|
frag_addr = 0;
|
|
|
|
else
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
symbol_address = (addressT) symbol_get_frag (s)->fr_address;
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN_SIZE);
|
|
|
|
offset = (inst_value & 0x1)
|
2011-06-13 17:45:28 +08:00
|
|
|
| (((inst_value >> 7) & 0x7) << 1)
|
|
|
|
| (((inst_value >> 21) & 0x1f) << 4);
|
2009-03-02 18:33:08 +08:00
|
|
|
offset <<= 1;
|
|
|
|
if ((offset & 0x200) == 0x200)
|
|
|
|
offset |= 0xfffffe00;
|
|
|
|
|
|
|
|
value = offset + symbol_address - frag_addr;
|
|
|
|
/* change the order of judging rule is because
|
2017-01-23 23:23:07 +08:00
|
|
|
1.not defined symbol or common symbol or external symbol will change
|
2011-06-13 17:45:28 +08:00
|
|
|
bcmp to cmp!+beq/bne ,here need to record fragp->fr_opcode
|
|
|
|
2.if the flow is as before : it will results to recursive loop
|
2009-03-02 18:33:08 +08:00
|
|
|
*/
|
|
|
|
if (fragp->fr_fix == 6)
|
2011-06-13 17:45:28 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Have already relaxed! Just return 0 to terminate the loop. */
|
|
|
|
return 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2017-01-23 23:23:07 +08:00
|
|
|
/* need to translate when extern or not defined or common symbol */
|
2011-06-13 17:45:28 +08:00
|
|
|
else if ((relaxable_p
|
|
|
|
&& (!((value & 0xfffffe00) == 0 || (value & 0xfffffe00) == 0xfffffe00))
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
&& fragp->fr_fix == 4)
|
2011-06-13 17:45:28 +08:00
|
|
|
|| !S_IS_DEFINED (s)
|
|
|
|
||S_IS_COMMON (s)
|
|
|
|
||S_IS_EXTERNAL (s))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
fragp->fr_opcode = fragp->fr_literal + s3_RELAX_RELOC1 (fragp->fr_subtype);
|
|
|
|
fragp->fr_fix = 6;
|
|
|
|
return 2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
else
|
2011-06-13 17:45:28 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Never relax. Modify fr_opcode to NULL to verify it's value in
|
|
|
|
md_apply_fix. */
|
|
|
|
fragp->fr_opcode = NULL;
|
|
|
|
return 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static int
|
|
|
|
s3_relax_other_inst32 (fragS * fragp)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
int relaxable_p = s3_RELAX_OPT (fragp->fr_subtype);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (relaxable_p
|
|
|
|
&& fragp->fr_fix == 4)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
fragp->fr_opcode = fragp->fr_literal + s3_RELAX_RELOC1 (fragp->fr_subtype);
|
|
|
|
fragp->fr_fix = 2;
|
|
|
|
return -2;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static int
|
|
|
|
s3_relax_gp_and_pic_inst32 (void)
|
|
|
|
{
|
2011-06-13 17:45:28 +08:00
|
|
|
/* md_estimate_size_before_relax has already relaxed s3_GP and s3_PIC
|
2009-03-02 18:33:08 +08:00
|
|
|
instructions. We don't change relax size here. */
|
|
|
|
return 0;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static int
|
|
|
|
s3_relax_frag (asection * sec ATTRIBUTE_UNUSED, fragS * fragp, long stretch ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
int grows = 0;
|
|
|
|
int adjust_align_p = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* If the instruction address is odd, make it half word align first. */
|
|
|
|
if ((fragp->fr_address) % 2 != 0)
|
|
|
|
{
|
|
|
|
if ((fragp->fr_address + fragp->insn_addr) % 2 != 0)
|
2011-06-13 17:45:28 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
fragp->insn_addr = 1;
|
|
|
|
grows += 1;
|
|
|
|
adjust_align_p = 1;
|
2011-06-13 17:45:28 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
switch (s3_RELAX_TYPE (fragp->fr_subtype))
|
|
|
|
{
|
|
|
|
case PC_DISP19div2:
|
|
|
|
grows += s3_relax_branch_inst32 (fragp);
|
|
|
|
break;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
case PC_DISP8div2:
|
|
|
|
grows += s3_relax_branch_inst16 (fragp);
|
|
|
|
break;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
case Insn_BCMP :
|
|
|
|
grows += s3_relax_cmpbranch_inst32 (fragp);
|
|
|
|
break;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
case Insn_GP:
|
|
|
|
case Insn_PIC:
|
|
|
|
grows += s3_relax_gp_and_pic_inst32 ();
|
|
|
|
break;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
default:
|
|
|
|
grows += s3_relax_other_inst32 (fragp);
|
|
|
|
break;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* newly added */
|
|
|
|
if (adjust_align_p && fragp->insn_addr)
|
2006-12-25 17:26:22 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
fragp->fr_fix += fragp->insn_addr;
|
2006-12-25 17:26:22 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
return grows;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s3_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED, fragS * fragp)
|
|
|
|
{
|
2019-04-16 09:40:44 +08:00
|
|
|
unsigned int r_old;
|
|
|
|
unsigned int r_new;
|
2009-03-02 18:33:08 +08:00
|
|
|
char backup[20];
|
|
|
|
fixS *fixp;
|
|
|
|
|
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 06:11:02 +08:00
|
|
|
r_old = s3_RELAX_OLD (fragp->fr_subtype);
|
|
|
|
r_new = s3_RELAX_NEW (fragp->fr_subtype);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* fragp->fr_opcode indicates whether this frag should be relaxed. */
|
|
|
|
if (fragp->fr_opcode == NULL)
|
2006-12-25 17:26:22 +08: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 06:11:02 +08:00
|
|
|
memcpy (backup, fragp->fr_literal, r_old);
|
|
|
|
fragp->fr_fix = r_old;
|
2006-12-25 17:26:22 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
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 06:11:02 +08:00
|
|
|
memcpy (backup, fragp->fr_literal + r_old, r_new);
|
|
|
|
fragp->fr_fix = r_new;
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
2006-12-25 17:26:22 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
fixp = fragp->tc_frag_data.fixp;
|
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 06:11:02 +08:00
|
|
|
while (fixp && fixp->fx_frag == fragp && fixp->fx_where < r_old)
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
|
|
|
if (fragp->fr_opcode)
|
|
|
|
fixp->fx_done = 1;
|
|
|
|
fixp = fixp->fx_next;
|
|
|
|
}
|
|
|
|
while (fixp && fixp->fx_frag == fragp)
|
|
|
|
{
|
|
|
|
if (fragp->fr_opcode)
|
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 06:11:02 +08:00
|
|
|
fixp->fx_where -= r_old + fragp->insn_addr;
|
2009-03-02 18:33:08 +08:00
|
|
|
else
|
|
|
|
fixp->fx_done = 1;
|
|
|
|
fixp = fixp->fx_next;
|
2006-12-25 17:26:22 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (fragp->insn_addr)
|
|
|
|
{
|
|
|
|
s3_md_number_to_chars (fragp->fr_literal, 0x0, fragp->insn_addr);
|
|
|
|
}
|
|
|
|
memcpy (fragp->fr_literal + fragp->insn_addr, backup, fragp->fr_fix);
|
|
|
|
fragp->fr_fix += fragp->insn_addr;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static long
|
|
|
|
s3_pcrel_from (fixS * fixP)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
long retval = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if (fixP->fx_addsy
|
|
|
|
&& (S_GET_SEGMENT (fixP->fx_addsy) == undefined_section)
|
|
|
|
&& (fixP->fx_subsy == NULL))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
retval = 0;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
retval = fixP->fx_where + fixP->fx_frag->fr_address;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
return retval;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static valueT
|
|
|
|
s3_section_align (segT segment ATTRIBUTE_UNUSED, valueT size)
|
|
|
|
{
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
int align = bfd_section_alignment (segment);
|
2015-11-10 00:12:57 +08:00
|
|
|
return ((size + (1 << align) - 1) & -(1 << align));
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_apply_fix (fixS *fixP, valueT *valP, segT seg)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
offsetT value = *valP;
|
|
|
|
offsetT newval;
|
|
|
|
offsetT content;
|
|
|
|
unsigned short HI, LO;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
char *buf = fixP->fx_frag->fr_literal + fixP->fx_where;
|
|
|
|
|
* 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-23 01:56:02 +08:00
|
|
|
gas_assert (fixP->fx_r_type < BFD_RELOC_UNUSED);
|
2009-03-02 18:33:08 +08:00
|
|
|
if (fixP->fx_addsy == 0 && !fixP->fx_pcrel)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (fixP->fx_r_type != BFD_RELOC_SCORE_DUMMY_HI16)
|
|
|
|
fixP->fx_done = 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* If this symbol is in a different section then we need to leave it for
|
|
|
|
the linker to deal with. Unfortunately, md_pcrel_from can't tell,
|
|
|
|
so we have to undo it's effects here. */
|
|
|
|
if (fixP->fx_pcrel)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (fixP->fx_addsy != NULL
|
|
|
|
&& S_IS_DEFINED (fixP->fx_addsy)
|
|
|
|
&& S_GET_SEGMENT (fixP->fx_addsy) != seg)
|
|
|
|
value += md_pcrel_from (fixP);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Remember value for emit_reloc. */
|
|
|
|
fixP->fx_addnumber = value;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
switch (fixP->fx_r_type)
|
|
|
|
{
|
|
|
|
case BFD_RELOC_HI16_S:
|
|
|
|
if (fixP->fx_done) /* For la rd, imm32. */
|
|
|
|
{
|
|
|
|
newval = s3_md_chars_to_number (buf, s3_INSN_SIZE);
|
|
|
|
HI = (value) >> 16; /* mul to 2, then take the hi 16 bit. */
|
|
|
|
newval |= (HI & 0x3fff) << 1;
|
|
|
|
newval |= ((HI >> 14) & 0x3) << 16;
|
|
|
|
s3_md_number_to_chars (buf, newval, s3_INSN_SIZE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BFD_RELOC_LO16:
|
|
|
|
if (fixP->fx_done) /* For la rd, imm32. */
|
|
|
|
{
|
|
|
|
newval = s3_md_chars_to_number (buf, s3_INSN_SIZE);
|
|
|
|
LO = (value) & 0xffff;
|
|
|
|
newval |= (LO & 0x3fff) << 1; /* 16 bit: imm -> 14 bit in lo, 2 bit in hi. */
|
|
|
|
newval |= ((LO >> 14) & 0x3) << 16;
|
|
|
|
s3_md_number_to_chars (buf, newval, s3_INSN_SIZE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BFD_RELOC_SCORE_JMP:
|
|
|
|
{
|
|
|
|
content = s3_md_chars_to_number (buf, s3_INSN_SIZE);
|
|
|
|
value = fixP->fx_offset;
|
|
|
|
content = (content & ~0x3ff7ffe) | ((value << 1) & 0x3ff0000) | (value & 0x7fff);
|
|
|
|
s3_md_number_to_chars (buf, content, s3_INSN_SIZE);
|
|
|
|
}
|
|
|
|
break;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
case BFD_RELOC_SCORE_IMM30:
|
|
|
|
{
|
|
|
|
content = s3_md_chars_to_number (buf, s3_INSN48_SIZE);
|
|
|
|
value = fixP->fx_offset;
|
|
|
|
value >>= 2;
|
|
|
|
content = (content & ~0x7f7fff7f80LL)
|
2011-06-13 17:45:28 +08:00
|
|
|
| (((value & 0xff) >> 0) << 7)
|
|
|
|
| (((value & 0x7fff00) >> 8) << 16)
|
|
|
|
| (((value & 0x3f800000) >> 23) << 32);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_md_number_to_chars (buf, content, s3_INSN48_SIZE);
|
|
|
|
break;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
case BFD_RELOC_SCORE_IMM32:
|
|
|
|
{
|
|
|
|
content = s3_md_chars_to_number (buf, s3_INSN48_SIZE);
|
|
|
|
value = fixP->fx_offset;
|
|
|
|
content = (content & ~0x7f7fff7fe0LL)
|
2011-06-13 17:45:28 +08:00
|
|
|
| ((value & 0x3ff) << 5)
|
|
|
|
| (((value >> 10) & 0x7fff) << 16)
|
|
|
|
| (((value >> 25) & 0x7f) << 32);
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_md_number_to_chars (buf, content, s3_INSN48_SIZE);
|
|
|
|
break;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
case BFD_RELOC_SCORE_BRANCH:
|
|
|
|
if ((S_GET_SEGMENT (fixP->fx_addsy) != seg) || (fixP->fx_addsy != NULL && S_IS_EXTERNAL (fixP->fx_addsy)))
|
|
|
|
value = fixP->fx_offset;
|
|
|
|
else
|
|
|
|
fixP->fx_done = 1;
|
|
|
|
|
|
|
|
content = s3_md_chars_to_number (buf, s3_INSN_SIZE);
|
|
|
|
|
|
|
|
/* Don't check c-bit. */
|
|
|
|
if (fixP->fx_frag->fr_opcode != 0)
|
|
|
|
{
|
|
|
|
if ((value & 0xfffffe00) != 0 && (value & 0xfffffe00) != 0xfffffe00)
|
|
|
|
{
|
|
|
|
as_bad_where (fixP->fx_file, fixP->fx_line,
|
2017-01-23 23:23:07 +08:00
|
|
|
_(" branch relocation truncate (0x%x) [-2^9 ~ 2^9-1]"), (unsigned int) value);
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
content = s3_md_chars_to_number (buf, s3_INSN16_SIZE);
|
|
|
|
content &= 0xfe00;
|
|
|
|
content = (content & 0xfe00) | ((value >> 1) & 0x1ff);
|
|
|
|
s3_md_number_to_chars (buf, content, s3_INSN16_SIZE);
|
|
|
|
fixP->fx_r_type = BFD_RELOC_SCORE16_BRANCH;
|
|
|
|
fixP->fx_size = 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((value & 0xfff80000) != 0 && (value & 0xfff80000) != 0xfff80000)
|
|
|
|
{
|
|
|
|
as_bad_where (fixP->fx_file, fixP->fx_line,
|
2017-01-23 23:23:07 +08:00
|
|
|
_(" branch relocation truncate (0x%x) [-2^19 ~ 2^19-1]"), (unsigned int) value);
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
content = s3_md_chars_to_number (buf, s3_INSN_SIZE);
|
|
|
|
content &= 0xfc00fc01;
|
|
|
|
content = (content & 0xfc00fc01) | (value & 0x3fe) | ((value << 6) & 0x3ff0000);
|
|
|
|
s3_md_number_to_chars (buf, content, s3_INSN_SIZE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BFD_RELOC_SCORE16_JMP:
|
|
|
|
content = s3_md_chars_to_number (buf, s3_INSN16_SIZE);
|
|
|
|
content &= 0xf001;
|
|
|
|
value = fixP->fx_offset & 0xfff;
|
|
|
|
content = (content & 0xfc01) | (value & 0xffe);
|
|
|
|
s3_md_number_to_chars (buf, content, s3_INSN16_SIZE);
|
|
|
|
break;
|
2011-06-13 17:45:28 +08:00
|
|
|
case BFD_RELOC_SCORE16_BRANCH:
|
2009-03-02 18:33:08 +08:00
|
|
|
content = s3_md_chars_to_number (buf, s3_INSN_SIZE);
|
|
|
|
/* Don't check c-bit. */
|
|
|
|
if (fixP->fx_frag->fr_opcode != 0)
|
|
|
|
{
|
|
|
|
if ((S_GET_SEGMENT (fixP->fx_addsy) != seg) ||
|
|
|
|
(fixP->fx_addsy != NULL && S_IS_EXTERNAL (fixP->fx_addsy)))
|
|
|
|
value = fixP->fx_offset;
|
|
|
|
else
|
|
|
|
fixP->fx_done = 1;
|
|
|
|
if ((value & 0xfff80000) != 0 && (value & 0xfff80000) != 0xfff80000)
|
|
|
|
{
|
|
|
|
as_bad_where (fixP->fx_file, fixP->fx_line,
|
2017-01-23 23:23:07 +08:00
|
|
|
_(" branch relocation truncate (0x%x) [-2^19 ~ 2^19-1]"), (unsigned int) value);
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
content = s3_md_chars_to_number (buf, s3_INSN_SIZE);
|
|
|
|
content = (content & 0xfc00fc01) | (value & 0x3fe) | ((value << 6) & 0x3ff0000);
|
|
|
|
s3_md_number_to_chars (buf, content, s3_INSN_SIZE);
|
|
|
|
fixP->fx_r_type = BFD_RELOC_SCORE_BRANCH;
|
|
|
|
fixP->fx_size = 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-11-26 04:01:41 +08:00
|
|
|
/* In different section. */
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((S_GET_SEGMENT (fixP->fx_addsy) != seg) ||
|
|
|
|
(fixP->fx_addsy != NULL && S_IS_EXTERNAL (fixP->fx_addsy)))
|
|
|
|
value = fixP->fx_offset;
|
|
|
|
else
|
|
|
|
fixP->fx_done = 1;
|
|
|
|
|
|
|
|
if ((value & 0xfffffe00) != 0 && (value & 0xfffffe00) != 0xfffffe00)
|
|
|
|
{
|
|
|
|
as_bad_where (fixP->fx_file, fixP->fx_line,
|
2017-01-23 23:23:07 +08:00
|
|
|
_(" branch relocation truncate (0x%x) [-2^9 ~ 2^9-1]"), (unsigned int) value);
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
content = s3_md_chars_to_number (buf, s3_INSN16_SIZE);
|
|
|
|
content = (content & 0xfe00) | ((value >> 1) & 0x1ff);
|
|
|
|
s3_md_number_to_chars (buf, content, s3_INSN16_SIZE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
break;
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
case BFD_RELOC_SCORE_BCMP:
|
|
|
|
if (fixP->fx_frag->fr_opcode != 0)
|
|
|
|
{
|
|
|
|
char *buf_ptr = buf;
|
|
|
|
buf_ptr += 2;
|
|
|
|
|
|
|
|
if ((S_GET_SEGMENT (fixP->fx_addsy) != seg) || (fixP->fx_addsy != NULL && S_IS_EXTERNAL (fixP->fx_addsy)))
|
|
|
|
value = fixP->fx_offset;
|
|
|
|
else
|
|
|
|
fixP->fx_done = 1;
|
|
|
|
|
2011-06-13 17:45:28 +08:00
|
|
|
/* NOTE!!!
|
2009-03-02 18:33:08 +08:00
|
|
|
bcmp -> cmp! and branch, so value -= 2. */
|
|
|
|
value -= 2;
|
|
|
|
|
|
|
|
if ((value & 0xfff80000) != 0 && (value & 0xfff80000) != 0xfff80000)
|
|
|
|
{
|
|
|
|
as_bad_where (fixP->fx_file, fixP->fx_line,
|
2017-01-23 23:23:07 +08:00
|
|
|
_(" branch relocation truncate (0x%x) [-2^19 ~ 2^19-1]"), (unsigned int) value);
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
content = s3_md_chars_to_number (buf_ptr, s3_INSN_SIZE);
|
|
|
|
content &= 0xfc00fc01;
|
|
|
|
content = (content & 0xfc00fc01) | (value & 0x3fe) | ((value << 6) & 0x3ff0000);
|
|
|
|
s3_md_number_to_chars (buf_ptr, content, s3_INSN_SIZE);
|
|
|
|
/* change relocation type to BFD_RELOC_SCORE_BRANCH */
|
|
|
|
fixP->fx_r_type = BFD_RELOC_SCORE_BRANCH;
|
|
|
|
fixP->fx_where+=2; /* first insn is cmp! , the second insn is beq/bne */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((S_GET_SEGMENT (fixP->fx_addsy) != seg) || (fixP->fx_addsy != NULL && S_IS_EXTERNAL (fixP->fx_addsy)))
|
|
|
|
value = fixP->fx_offset;
|
|
|
|
else
|
|
|
|
fixP->fx_done = 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
content = s3_md_chars_to_number (buf, s3_INSN_SIZE);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
if ((value & 0xfffffe00) != 0 && (value & 0xfffffe00) != 0xfffffe00)
|
|
|
|
{
|
|
|
|
as_bad_where (fixP->fx_file, fixP->fx_line,
|
2017-01-23 23:23:07 +08:00
|
|
|
_(" branch relocation truncate (0x%x) [-2^9 ~ 2^9-1]"), (unsigned int) value);
|
2009-03-02 18:33:08 +08:00
|
|
|
return;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
value >>= 1;
|
|
|
|
content &= ~0x03e00381;
|
|
|
|
content = content
|
2011-06-13 17:45:28 +08:00
|
|
|
| (value & 0x1)
|
|
|
|
| (((value & 0xe) >> 1) << 7)
|
|
|
|
| (((value & 0x1f0) >> 4) << 21);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
s3_md_number_to_chars (buf, content, s3_INSN_SIZE);
|
|
|
|
break;
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
case BFD_RELOC_8:
|
|
|
|
if (fixP->fx_done || fixP->fx_pcrel)
|
|
|
|
s3_md_number_to_chars (buf, value, 1);
|
|
|
|
#ifdef OBJ_ELF
|
|
|
|
else
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
value = fixP->fx_offset;
|
|
|
|
s3_md_number_to_chars (buf, value, 1);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
#endif
|
2009-03-02 18:33:08 +08:00
|
|
|
break;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
case BFD_RELOC_16:
|
|
|
|
if (fixP->fx_done || fixP->fx_pcrel)
|
|
|
|
s3_md_number_to_chars (buf, value, 2);
|
|
|
|
#ifdef OBJ_ELF
|
|
|
|
else
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
value = fixP->fx_offset;
|
|
|
|
s3_md_number_to_chars (buf, value, 2);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case BFD_RELOC_RVA:
|
|
|
|
case BFD_RELOC_32:
|
|
|
|
if (fixP->fx_done || fixP->fx_pcrel)
|
|
|
|
md_number_to_chars (buf, value, 4);
|
|
|
|
#ifdef OBJ_ELF
|
2006-09-17 07:51:50 +08:00
|
|
|
else
|
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
value = fixP->fx_offset;
|
|
|
|
md_number_to_chars (buf, value, 4);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case BFD_RELOC_VTABLE_INHERIT:
|
|
|
|
fixP->fx_done = 0;
|
|
|
|
if (fixP->fx_addsy && !S_IS_DEFINED (fixP->fx_addsy) && !S_IS_WEAK (fixP->fx_addsy))
|
|
|
|
S_SET_WEAK (fixP->fx_addsy);
|
|
|
|
break;
|
|
|
|
case BFD_RELOC_VTABLE_ENTRY:
|
|
|
|
fixP->fx_done = 0;
|
|
|
|
break;
|
|
|
|
case BFD_RELOC_SCORE_GPREL15:
|
|
|
|
content = s3_md_chars_to_number (buf, s3_INSN_SIZE);
|
|
|
|
/* c-bit. */
|
|
|
|
if ((fixP->fx_frag->fr_opcode != 0) && ((content & 0xfc1c8000) != 0x94180000))
|
|
|
|
fixP->fx_r_type = BFD_RELOC_NONE;
|
|
|
|
fixP->fx_done = 0;
|
|
|
|
break;
|
|
|
|
case BFD_RELOC_SCORE_GOT15:
|
|
|
|
case BFD_RELOC_SCORE_DUMMY_HI16:
|
|
|
|
case BFD_RELOC_SCORE_GOT_LO16:
|
|
|
|
case BFD_RELOC_SCORE_CALL15:
|
|
|
|
case BFD_RELOC_GPREL32:
|
|
|
|
break;
|
|
|
|
case BFD_RELOC_NONE:
|
|
|
|
default:
|
|
|
|
as_bad_where (fixP->fx_file, fixP->fx_line, _("bad relocation fixup type (%d)"), fixP->fx_r_type);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
static arelent **
|
|
|
|
s3_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
|
|
|
|
{
|
|
|
|
static arelent *retval[MAX_RELOC_EXPANSION + 1]; /* MAX_RELOC_EXPANSION equals 2. */
|
|
|
|
arelent *reloc;
|
|
|
|
bfd_reloc_code_real_type code;
|
2016-04-03 04:30:13 +08:00
|
|
|
const char *type;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2016-04-01 21:26:30 +08:00
|
|
|
reloc = retval[0] = XNEW (arelent);
|
2009-03-02 18:33:08 +08:00
|
|
|
retval[1] = NULL;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2016-04-01 21:26:30 +08:00
|
|
|
reloc->sym_ptr_ptr = XNEW (asymbol *);
|
2009-03-02 18:33:08 +08:00
|
|
|
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
|
|
|
|
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
|
|
|
|
reloc->addend = fixp->fx_offset;
|
|
|
|
|
|
|
|
/* If this is a variant frag, we may need to adjust the existing
|
|
|
|
reloc and generate a new one. */
|
|
|
|
if (fixp->fx_frag->fr_opcode != NULL && (fixp->fx_r_type == BFD_RELOC_SCORE_GPREL15))
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Update instruction imm bit. */
|
|
|
|
offsetT newval;
|
|
|
|
unsigned short off;
|
|
|
|
char *buf;
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
buf = fixp->fx_frag->fr_literal + fixp->fx_frag->insn_addr;
|
|
|
|
newval = s3_md_chars_to_number (buf, s3_INSN_SIZE);
|
|
|
|
off = fixp->fx_offset >> 16;
|
|
|
|
newval |= (off & 0x3fff) << 1;
|
|
|
|
newval |= ((off >> 14) & 0x3) << 16;
|
|
|
|
s3_md_number_to_chars (buf, newval, s3_INSN_SIZE);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
buf += s3_INSN_SIZE;
|
|
|
|
newval = s3_md_chars_to_number (buf, s3_INSN_SIZE);
|
|
|
|
off = fixp->fx_offset & 0xffff;
|
|
|
|
newval |= ((off & 0x3fff) << 1);
|
|
|
|
newval |= (((off >> 14) & 0x3) << 16);
|
|
|
|
s3_md_number_to_chars (buf, newval, s3_INSN_SIZE);
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2016-04-01 21:26:30 +08:00
|
|
|
retval[1] = XNEW (arelent);
|
2009-03-02 18:33:08 +08:00
|
|
|
retval[2] = NULL;
|
2016-04-01 21:26:30 +08:00
|
|
|
retval[1]->sym_ptr_ptr = XNEW (asymbol *);
|
2009-03-02 18:33:08 +08:00
|
|
|
*retval[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
|
|
|
|
retval[1]->address = (reloc->address + s3_RELAX_RELOC2 (fixp->fx_frag->fr_subtype));
|
|
|
|
|
|
|
|
retval[1]->addend = 0;
|
|
|
|
retval[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_LO16);
|
* 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-23 01:56:02 +08:00
|
|
|
gas_assert (retval[1]->howto != NULL);
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
fixp->fx_r_type = BFD_RELOC_HI16_S;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
|
|
|
|
code = fixp->fx_r_type;
|
|
|
|
switch (fixp->fx_r_type)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
case BFD_RELOC_32:
|
|
|
|
if (fixp->fx_pcrel)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
code = BFD_RELOC_32_PCREL;
|
|
|
|
break;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2016-10-05 15:47:02 +08:00
|
|
|
/* Fall through. */
|
2009-03-02 18:33:08 +08:00
|
|
|
case BFD_RELOC_HI16_S:
|
|
|
|
case BFD_RELOC_LO16:
|
|
|
|
case BFD_RELOC_SCORE_JMP:
|
|
|
|
case BFD_RELOC_SCORE_BRANCH:
|
|
|
|
case BFD_RELOC_SCORE16_JMP:
|
|
|
|
case BFD_RELOC_SCORE16_BRANCH:
|
|
|
|
case BFD_RELOC_SCORE_BCMP:
|
|
|
|
case BFD_RELOC_VTABLE_ENTRY:
|
|
|
|
case BFD_RELOC_VTABLE_INHERIT:
|
|
|
|
case BFD_RELOC_SCORE_GPREL15:
|
|
|
|
case BFD_RELOC_SCORE_GOT15:
|
|
|
|
case BFD_RELOC_SCORE_DUMMY_HI16:
|
|
|
|
case BFD_RELOC_SCORE_GOT_LO16:
|
|
|
|
case BFD_RELOC_SCORE_CALL15:
|
|
|
|
case BFD_RELOC_GPREL32:
|
|
|
|
case BFD_RELOC_NONE:
|
|
|
|
case BFD_RELOC_SCORE_IMM30:
|
|
|
|
case BFD_RELOC_SCORE_IMM32:
|
|
|
|
code = fixp->fx_r_type;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
type = _("<unknown>");
|
|
|
|
as_bad_where (fixp->fx_file, fixp->fx_line,
|
|
|
|
_("cannot represent %s relocation in this object file format"), type);
|
|
|
|
return NULL;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
reloc->howto = bfd_reloc_type_lookup (stdoutput, code);
|
|
|
|
if (reloc->howto == NULL)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
as_bad_where (fixp->fx_file, fixp->fx_line,
|
|
|
|
_("cannot represent %s relocation in this object file format1"),
|
|
|
|
bfd_get_reloc_code_name (code));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
/* HACK: Since arm ELF uses Rel instead of Rela, encode the
|
|
|
|
vtable entry to be used in the relocation's section offset. */
|
|
|
|
if (fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
|
|
|
|
reloc->address = fixp->fx_offset;
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
md_assemble (char *str)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
s3_assemble (str);
|
|
|
|
else
|
|
|
|
s7_assemble (str);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We handle all bad expressions here, so that we can report the faulty
|
|
|
|
instruction in the error message. */
|
|
|
|
void
|
2009-12-11 21:42:17 +08:00
|
|
|
md_operand (expressionS * exp)
|
2009-03-02 18:33:08 +08:00
|
|
|
{
|
|
|
|
if (score3)
|
2009-12-11 21:42:17 +08:00
|
|
|
s3_operand (exp);
|
2009-03-02 18:33:08 +08:00
|
|
|
else
|
2009-12-11 21:42:17 +08:00
|
|
|
s7_operand (exp);
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Turn an integer of n bytes (in val) into a stream of bytes appropriate
|
|
|
|
for use in the a.out file, and stores them in the array pointed to by buf.
|
|
|
|
This knows about the endian-ness of the target machine and does
|
|
|
|
THE RIGHT THING, whatever it is. Possible values for n are 1 (byte)
|
|
|
|
2 (short) and 4 (long) Floating numbers are put out as a series of
|
|
|
|
LITTLENUMS (shorts, here at least). */
|
|
|
|
void
|
|
|
|
md_number_to_chars (char *buf, valueT val, int n)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
s3_number_to_chars (buf, val, n);
|
|
|
|
else
|
|
|
|
s7_number_to_chars (buf, val, n);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Turn a string in input_line_pointer into a floating point constant
|
|
|
|
of type TYPE, and store the appropriate bytes in *LITP. The number
|
|
|
|
of LITTLENUMS emitted is stored in *SIZEP. An error message is
|
|
|
|
returned, or NULL on OK.
|
|
|
|
|
|
|
|
Note that fp constants aren't represent in the normal way on the ARM.
|
|
|
|
In big endian mode, things are as expected. However, in little endian
|
|
|
|
mode fp constants are big-endian word-wise, and little-endian byte-wise
|
|
|
|
within the words. For example, (double) 1.1 in big endian mode is
|
|
|
|
the byte sequence 3f f1 99 99 99 99 99 9a, and in little endian mode is
|
|
|
|
the byte sequence 99 99 f1 3f 9a 99 99 99. */
|
2016-04-01 20:07:50 +08:00
|
|
|
const char *
|
2009-03-02 18:33:08 +08:00
|
|
|
md_atof (int type, char *litP, int *sizeP)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_atof (type, litP, sizeP);
|
|
|
|
else
|
|
|
|
return s7_atof (type, litP, sizeP);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
void
|
|
|
|
score_frag_check (fragS * fragp ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
s3_frag_check (fragp);
|
|
|
|
else
|
|
|
|
s7_frag_check (fragp);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Implementation of TC_VALIDATE_FIX.
|
|
|
|
Called before md_apply_fix() and after md_convert_frag(). */
|
|
|
|
void
|
|
|
|
score_validate_fix (fixS *fixP)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
s3_validate_fix (fixP);
|
|
|
|
else
|
|
|
|
s7_validate_fix (fixP);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
int
|
|
|
|
score_force_relocation (struct fix *fixp)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_force_relocation (fixp);
|
|
|
|
else
|
|
|
|
return s7_force_relocation (fixp);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Implementation of md_frag_check.
|
|
|
|
Called after md_convert_frag(). */
|
|
|
|
bfd_boolean
|
|
|
|
score_fix_adjustable (fixS * fixP)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_fix_adjustable (fixP);
|
|
|
|
else
|
|
|
|
return s7_fix_adjustable (fixP);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
void
|
|
|
|
score_elf_final_processing (void)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
s3_elf_final_processing ();
|
|
|
|
else
|
|
|
|
s7_elf_final_processing ();
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* In this function, we determine whether s3_GP instruction should do relaxation,
|
|
|
|
for the label being against was known now.
|
|
|
|
Doing this here but not in md_relax_frag() can induce iteration times
|
|
|
|
in stage of doing relax. */
|
|
|
|
int
|
|
|
|
md_estimate_size_before_relax (fragS * fragp, asection * sec ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_estimate_size_before_relax (fragp, sec);
|
|
|
|
else
|
|
|
|
return s7_estimate_size_before_relax (fragp, sec);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
int
|
|
|
|
score_relax_frag (asection * sec ATTRIBUTE_UNUSED, fragS * fragp, long stretch ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_relax_frag (sec, fragp, stretch);
|
2011-06-13 17:45:28 +08:00
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
return s7_relax_frag (sec, fragp, stretch);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED, fragS * fragp)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_convert_frag (abfd, sec, fragp);
|
2006-09-17 07:51:50 +08:00
|
|
|
else
|
2009-03-02 18:33:08 +08:00
|
|
|
return s7_convert_frag (abfd, sec, fragp);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
long
|
|
|
|
md_pcrel_from (fixS * fixP)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_pcrel_from (fixP);
|
|
|
|
else
|
|
|
|
return s7_pcrel_from (fixP);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Round up a section size to the appropriate boundary. */
|
|
|
|
valueT
|
|
|
|
md_section_align (segT segment ATTRIBUTE_UNUSED, valueT size)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_section_align (segment, size);
|
|
|
|
else
|
|
|
|
return s7_section_align (segment, size);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
void
|
|
|
|
md_apply_fix (fixS *fixP, valueT *valP, segT seg)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (score3)
|
|
|
|
return s3_apply_fix (fixP, valP, seg);
|
|
|
|
else
|
|
|
|
return s7_apply_fix (fixP, valP, seg);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Translate internal representation of relocation info to BFD target format. */
|
|
|
|
arelent **
|
|
|
|
tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
|
|
|
|
{
|
|
|
|
if (score3)
|
|
|
|
return s3_gen_reloc (section, fixp);
|
|
|
|
else
|
|
|
|
return s7_gen_reloc (section, fixp);
|
|
|
|
}
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
void
|
|
|
|
md_begin (void)
|
|
|
|
{
|
|
|
|
s3_begin ();
|
|
|
|
s7_begin ();
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-03-02 18:33:08 +08:00
|
|
|
score_set_mach (const char *arg)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
if (strcmp (arg, MARCH_SCORE3) == 0)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
score3 = 1;
|
|
|
|
score7 = 0;
|
|
|
|
s3_score3d = 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
2009-03-02 18:33:08 +08:00
|
|
|
else if (strcmp (arg, MARCH_SCORE7) == 0)
|
|
|
|
{
|
|
|
|
score3 = 0;
|
|
|
|
score7 = 1;
|
|
|
|
s7_score7d = 1;
|
|
|
|
s7_university_version = 0;
|
|
|
|
s7_vector_size = s7_SCORE7_PIPELINE;
|
|
|
|
}
|
|
|
|
else if (strcmp (arg, MARCH_SCORE5) == 0)
|
|
|
|
{
|
|
|
|
score3 = 0;
|
|
|
|
score7 = 1;
|
|
|
|
s7_score7d = 1;
|
|
|
|
s7_university_version = 0;
|
|
|
|
s7_vector_size = s7_SCORE5_PIPELINE;
|
|
|
|
}
|
|
|
|
else if (strcmp (arg, MARCH_SCORE5U) == 0)
|
|
|
|
{
|
|
|
|
score3 = 0;
|
|
|
|
score7 = 1;
|
|
|
|
s7_score7d = 1;
|
|
|
|
s7_university_version = 1;
|
|
|
|
s7_vector_size = s7_SCORE5_PIPELINE;
|
|
|
|
}
|
|
|
|
else
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
as_bad (_("unknown architecture `%s'\n"), arg);
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
int
|
2016-02-27 22:35:32 +08:00
|
|
|
md_parse_option (int c, const char *arg)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
#ifdef OPTION_EB
|
|
|
|
case OPTION_EB:
|
|
|
|
target_big_endian = 1;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef OPTION_EL
|
|
|
|
case OPTION_EL:
|
|
|
|
target_big_endian = 0;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case OPTION_FIXDD:
|
|
|
|
s3_fix_data_dependency = 1;
|
|
|
|
s7_fix_data_dependency = 1;
|
|
|
|
break;
|
|
|
|
case OPTION_NWARN:
|
|
|
|
s3_warn_fix_data_dependency = 0;
|
|
|
|
s7_warn_fix_data_dependency = 0;
|
|
|
|
break;
|
|
|
|
case OPTION_SCORE5:
|
|
|
|
score3 = 0;
|
|
|
|
score7 = 1;
|
|
|
|
s7_university_version = 0;
|
|
|
|
s7_vector_size = s7_SCORE5_PIPELINE;
|
|
|
|
break;
|
|
|
|
case OPTION_SCORE5U:
|
|
|
|
score3 = 0;
|
|
|
|
score7 = 1;
|
|
|
|
s7_university_version = 1;
|
|
|
|
s7_vector_size = s7_SCORE5_PIPELINE;
|
|
|
|
break;
|
|
|
|
case OPTION_SCORE7:
|
|
|
|
score3 = 0;
|
|
|
|
score7 = 1;
|
|
|
|
s7_score7d = 1;
|
|
|
|
s7_university_version = 0;
|
|
|
|
s7_vector_size = s7_SCORE7_PIPELINE;
|
|
|
|
break;
|
|
|
|
case OPTION_SCORE3:
|
|
|
|
score3 = 1;
|
|
|
|
score7 = 0;
|
|
|
|
s3_score3d = 1;
|
|
|
|
break;
|
|
|
|
case OPTION_R1:
|
|
|
|
s3_nor1 = 0;
|
|
|
|
s7_nor1 = 0;
|
|
|
|
break;
|
|
|
|
case 'G':
|
|
|
|
s3_g_switch_value = atoi (arg);
|
|
|
|
s7_g_switch_value = atoi (arg);
|
|
|
|
break;
|
|
|
|
case OPTION_O0:
|
|
|
|
s3_g_opt = 0;
|
|
|
|
s7_g_opt = 0;
|
|
|
|
break;
|
|
|
|
case OPTION_SCORE_VERSION:
|
|
|
|
printf (_("Sunplus-v2-0-0-20060510\n"));
|
|
|
|
break;
|
|
|
|
case OPTION_PIC:
|
|
|
|
s3_score_pic = s3_NO_PIC; /* Score3 doesn't support PIC now. */
|
|
|
|
s7_score_pic = s7_PIC;
|
|
|
|
s3_g_switch_value = 0; /* Must set -G num as 0 to generate s3_PIC code. */
|
|
|
|
s7_g_switch_value = 0; /* Must set -G num as 0 to generate s7_PIC code. */
|
|
|
|
break;
|
|
|
|
case OPTION_MARCH:
|
|
|
|
score_set_mach (arg);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
2006-09-17 07:51:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
void
|
|
|
|
md_show_usage (FILE * fp)
|
2006-09-17 07:51:50 +08:00
|
|
|
{
|
2009-03-02 18:33:08 +08:00
|
|
|
fprintf (fp, _(" Score-specific assembler options:\n"));
|
|
|
|
#ifdef OPTION_EB
|
|
|
|
fprintf (fp, _("\
|
|
|
|
-EB\t\tassemble code for a big-endian cpu\n"));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef OPTION_EL
|
|
|
|
fprintf (fp, _("\
|
|
|
|
-EL\t\tassemble code for a little-endian cpu\n"));
|
|
|
|
#endif
|
2006-09-17 07:51:50 +08:00
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
fprintf (fp, _("\
|
2017-01-23 23:23:07 +08:00
|
|
|
-FIXDD\t\tfix data dependencies\n"));
|
2009-03-02 18:33:08 +08:00
|
|
|
fprintf (fp, _("\
|
2017-01-23 23:23:07 +08:00
|
|
|
-NWARN\t\tdo not print warning message when fixing data dependencies\n"));
|
2009-03-02 18:33:08 +08:00
|
|
|
fprintf (fp, _("\
|
2017-01-23 23:23:07 +08:00
|
|
|
-SCORE5\t\tassemble code for target SCORE5\n"));
|
2009-03-02 18:33:08 +08:00
|
|
|
fprintf (fp, _("\
|
2017-01-23 23:23:07 +08:00
|
|
|
-SCORE5U\tassemble code for target SCORE5U\n"));
|
2009-03-02 18:33:08 +08:00
|
|
|
fprintf (fp, _("\
|
2017-01-23 23:23:07 +08:00
|
|
|
-SCORE7\t\tassemble code for target SCORE7 [default]\n"));
|
2009-03-02 18:33:08 +08:00
|
|
|
fprintf (fp, _("\
|
2017-01-23 23:23:07 +08:00
|
|
|
-SCORE3\t\tassemble code for target SCORE3\n"));
|
2009-03-02 18:33:08 +08:00
|
|
|
fprintf (fp, _("\
|
2017-01-23 23:23:07 +08:00
|
|
|
-march=score7\tassemble code for target SCORE7 [default]\n"));
|
2009-03-02 18:33:08 +08:00
|
|
|
fprintf (fp, _("\
|
2017-01-23 23:23:07 +08:00
|
|
|
-march=score3\tassemble code for target SCORE3\n"));
|
2009-03-02 18:33:08 +08:00
|
|
|
fprintf (fp, _("\
|
|
|
|
-USE_R1\t\tassemble code for no warning message when using temp register r1\n"));
|
|
|
|
fprintf (fp, _("\
|
2017-01-23 23:23:07 +08:00
|
|
|
-KPIC\t\tgenerate PIC\n"));
|
2009-03-02 18:33:08 +08:00
|
|
|
fprintf (fp, _("\
|
2017-01-23 23:23:07 +08:00
|
|
|
-O0\t\tdo not perform any optimizations\n"));
|
2009-03-02 18:33:08 +08:00
|
|
|
fprintf (fp, _("\
|
2017-01-23 23:23:07 +08:00
|
|
|
-G gpnum\tassemble code for setting gpsize, default is 8 bytes\n"));
|
2009-03-02 18:33:08 +08:00
|
|
|
fprintf (fp, _("\
|
2017-01-23 23:23:07 +08:00
|
|
|
-V \t\tSunplus release version\n"));
|
2009-03-02 18:33:08 +08:00
|
|
|
}
|