2003-01-04 05:47:21 +08:00
|
|
|
|
/* tc-iq2000.c -- Assembler for the Sitera IQ2000.
|
2020-01-01 15:57:01 +08:00
|
|
|
|
Copyright (C) 2003-2020 Free Software Foundation, Inc.
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
|
|
|
|
This file is part of GAS, the GNU Assembler.
|
|
|
|
|
|
|
|
|
|
GAS is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-07-03 19:01:12 +08:00
|
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
2003-01-04 05:47:21 +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
|
2005-05-05 17:13:19 +08:00
|
|
|
|
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
|
|
|
|
|
Boston, MA 02110-1301, USA. */
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
|
|
|
|
#include "as.h"
|
|
|
|
|
#include "safe-ctype.h"
|
2004-11-24 21:23:53 +08:00
|
|
|
|
#include "subsegs.h"
|
2003-01-04 05:47:21 +08:00
|
|
|
|
#include "symcat.h"
|
|
|
|
|
#include "opcodes/iq2000-desc.h"
|
|
|
|
|
#include "opcodes/iq2000-opc.h"
|
|
|
|
|
#include "cgen.h"
|
|
|
|
|
#include "elf/common.h"
|
|
|
|
|
#include "elf/iq2000.h"
|
2006-06-09 11:42:25 +08:00
|
|
|
|
#include "sb.h"
|
2003-01-04 05:47:21 +08:00
|
|
|
|
#include "macro.h"
|
|
|
|
|
|
|
|
|
|
/* Structure to hold all of the different components describing
|
|
|
|
|
an individual instruction. */
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
const CGEN_INSN * insn;
|
|
|
|
|
const CGEN_INSN * orig_insn;
|
|
|
|
|
CGEN_FIELDS fields;
|
|
|
|
|
#if CGEN_INT_INSN_P
|
|
|
|
|
CGEN_INSN_INT buffer [1];
|
|
|
|
|
#define INSN_VALUE(buf) (*(buf))
|
|
|
|
|
#else
|
|
|
|
|
unsigned char buffer [CGEN_MAX_INSN_SIZE];
|
|
|
|
|
#define INSN_VALUE(buf) (buf)
|
|
|
|
|
#endif
|
|
|
|
|
char * addr;
|
|
|
|
|
fragS * frag;
|
|
|
|
|
int num_fixups;
|
|
|
|
|
fixS * fixups [GAS_CGEN_MAX_FIXUPS];
|
|
|
|
|
int indices [MAX_OPERAND_INSTANCES];
|
|
|
|
|
}
|
|
|
|
|
iq2000_insn;
|
|
|
|
|
|
|
|
|
|
const char comment_chars[] = "#";
|
2005-03-03 21:03:48 +08:00
|
|
|
|
const char line_comment_chars[] = "#";
|
2004-11-24 21:23:53 +08:00
|
|
|
|
const char line_separator_chars[] = ";";
|
2003-01-04 05:47:21 +08:00
|
|
|
|
const char EXP_CHARS[] = "eE";
|
|
|
|
|
const char FLT_CHARS[] = "dD";
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* Default machine. */
|
2003-01-04 05:47:21 +08:00
|
|
|
|
#define DEFAULT_MACHINE bfd_mach_iq2000
|
|
|
|
|
#define DEFAULT_FLAGS EF_IQ2000_CPU_IQ2000
|
|
|
|
|
|
|
|
|
|
static unsigned long iq2000_mach = bfd_mach_iq2000;
|
|
|
|
|
static int cpu_mach = (1 << MACH_IQ2000);
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* Flags to set in the elf header. */
|
2003-01-04 05:47:21 +08:00
|
|
|
|
static flagword iq2000_flags = DEFAULT_FLAGS;
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
typedef struct proc
|
|
|
|
|
{
|
2003-01-04 05:47:21 +08:00
|
|
|
|
symbolS *isym;
|
|
|
|
|
unsigned long reg_mask;
|
|
|
|
|
unsigned long reg_offset;
|
|
|
|
|
unsigned long fpreg_mask;
|
|
|
|
|
unsigned long fpreg_offset;
|
|
|
|
|
unsigned long frame_offset;
|
|
|
|
|
unsigned long frame_reg;
|
|
|
|
|
unsigned long pc_reg;
|
|
|
|
|
} procS;
|
|
|
|
|
|
|
|
|
|
static procS cur_proc;
|
|
|
|
|
static procS *cur_proc_ptr;
|
|
|
|
|
static int numprocs;
|
|
|
|
|
|
|
|
|
|
/* Relocations against symbols are done in two
|
|
|
|
|
parts, with a HI relocation and a LO relocation. Each relocation
|
|
|
|
|
has only 16 bits of space to store an addend. This means that in
|
|
|
|
|
order for the linker to handle carries correctly, it must be able
|
|
|
|
|
to locate both the HI and the LO relocation. This means that the
|
|
|
|
|
relocations must appear in order in the relocation table.
|
|
|
|
|
|
|
|
|
|
In order to implement this, we keep track of each unmatched HI
|
|
|
|
|
relocation. We then sort them so that they immediately precede the
|
|
|
|
|
corresponding LO relocation. */
|
|
|
|
|
|
|
|
|
|
struct iq2000_hi_fixup
|
|
|
|
|
{
|
|
|
|
|
struct iq2000_hi_fixup * next; /* Next HI fixup. */
|
2004-11-24 21:23:53 +08:00
|
|
|
|
fixS * fixp; /* This fixup. */
|
|
|
|
|
segT seg; /* The section this fixup is in. */
|
2003-01-04 05:47:21 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* The list of unmatched HI relocs. */
|
|
|
|
|
static struct iq2000_hi_fixup * iq2000_hi_fixup_list;
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* Macro hash table, which we will add to. */
|
|
|
|
|
extern struct hash_control *macro_hash;
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
const char *md_shortopts = "";
|
2003-01-04 05:47:21 +08:00
|
|
|
|
struct option md_longopts[] =
|
2004-11-24 21:23:53 +08:00
|
|
|
|
{
|
|
|
|
|
{NULL, no_argument, NULL, 0}
|
2003-01-04 05:47:21 +08:00
|
|
|
|
};
|
|
|
|
|
size_t md_longopts_size = sizeof (md_longopts);
|
|
|
|
|
|
|
|
|
|
int
|
2004-11-24 21:23:53 +08:00
|
|
|
|
md_parse_option (int c ATTRIBUTE_UNUSED,
|
2016-02-27 22:35:32 +08:00
|
|
|
|
const char * arg ATTRIBUTE_UNUSED)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
2004-11-24 21:23:53 +08:00
|
|
|
|
return 0;
|
2003-01-04 05:47:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2004-11-24 21:23:53 +08:00
|
|
|
|
md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
2004-11-24 21:23:53 +08:00
|
|
|
|
|
2003-01-04 05:47:21 +08:00
|
|
|
|
/* Automatically enter conditional branch macros. */
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2003-01-04 05:47:21 +08:00
|
|
|
|
const char * mnemonic;
|
|
|
|
|
const char ** expansion;
|
|
|
|
|
const char ** args;
|
|
|
|
|
} iq2000_macro_defs_s;
|
|
|
|
|
|
|
|
|
|
static const char * abs_args[] = { "rd", "rs", "scratch=%1", NULL };
|
|
|
|
|
static const char * abs_expn = "\n sra \\rd,\\rs,31\n xor \\scratch,\\rd,\\rs\n sub \\rd,\\scratch,\\rd\n";
|
|
|
|
|
static const char * la_expn = "\n lui \\reg,%hi(\\label)\n ori \\reg,\\reg,%lo(\\label)\n";
|
|
|
|
|
static const char * la_args[] = { "reg", "label", NULL };
|
|
|
|
|
static const char * bxx_args[] = { "rs", "rt", "label", "scratch=%1", NULL };
|
|
|
|
|
static const char * bge_expn = "\n slt \\scratch,\\rs,\\rt\n beq %0,\\scratch,\\label\n";
|
|
|
|
|
static const char * bgeu_expn = "\n sltu \\scratch,\\rs,\\rt\n beq %0,\\scratch,\\label\n";
|
|
|
|
|
static const char * bgt_expn = "\n slt \\scratch,\\rt,\\rs\n bne %0,\\scratch,\\label\n";
|
|
|
|
|
static const char * bgtu_expn = "\n sltu \\scratch,\\rt,\\rs\n bne %0,\\scratch,\\label\n";
|
|
|
|
|
static const char * ble_expn = "\n slt \\scratch,\\rt,\\rs\n beq %0,\\scratch,\\label\n";
|
|
|
|
|
static const char * bleu_expn = "\n sltu \\scratch,\\rt,\\rs\n beq %0,\\scratch,\\label\n";
|
|
|
|
|
static const char * blt_expn = "\n slt \\scratch,\\rs,\\rt\n bne %0,\\scratch,\\label\n";
|
|
|
|
|
static const char * bltu_expn = "\n sltu \\scratch,\\rs,\\rt\n bne %0,\\scratch,\\label\n";
|
|
|
|
|
static const char * sxx_args[] = { "rd", "rs", "rt", NULL };
|
|
|
|
|
static const char * sge_expn = "\n slt \\rd,\\rs,\\rt\n xori \\rd,\\rd,1\n";
|
|
|
|
|
static const char * sgeu_expn = "\n sltu \\rd,\\rs,\\rt\n xori \\rd,\\rd,1\n";
|
|
|
|
|
static const char * sle_expn = "\n slt \\rd,\\rt,\\rs\n xori \\rd,\\rd,1\n";
|
|
|
|
|
static const char * sleu_expn = "\n sltu \\rd,\\rt,\\rs\n xori \\rd,\\rd,1\n";
|
|
|
|
|
static const char * sgt_expn = "\n slt \\rd,\\rt,\\rs\n";
|
|
|
|
|
static const char * sgtu_expn = "\n sltu \\rd,\\rt,\\rs\n";
|
|
|
|
|
static const char * sne_expn = "\n xor \\rd,\\rt,\\rs\n sltu \\rd,%0,\\rd\n";
|
|
|
|
|
static const char * seq_expn = "\n xor \\rd,\\rt,\\rs\n sltu \\rd,%0,\\rd\n xori \\rd,\\rd,1\n";
|
|
|
|
|
static const char * ai32_args[] = { "rt", "rs", "imm", NULL };
|
|
|
|
|
static const char * andi32_expn = "\n\
|
|
|
|
|
.if (\\imm & 0xffff0000 == 0xffff0000)\n\
|
|
|
|
|
andoi \\rt,\\rs,%lo(\\imm)\n\
|
|
|
|
|
.elseif (\\imm & 0x0000ffff == 0x0000ffff)\n\
|
|
|
|
|
andoui \\rt,\\rs,%uhi(\\imm)\n\
|
|
|
|
|
.elseif (\\imm & 0xffff0000 == 0x00000000)\n\
|
|
|
|
|
andi \\rt,\\rs,%lo(\\imm)\n\
|
|
|
|
|
.else\n\
|
|
|
|
|
andoui \\rt,\\rs,%uhi(\\imm)\n\
|
|
|
|
|
andoi \\rt,\\rt,%lo(\\imm)\n\
|
|
|
|
|
.endif\n";
|
|
|
|
|
static const char * ori32_expn = "\n\
|
|
|
|
|
.if (\\imm & 0xffff == 0)\n\
|
|
|
|
|
orui \\rt,\\rs,%uhi(\\imm)\n\
|
|
|
|
|
.elseif (\\imm & 0xffff0000 == 0)\n\
|
|
|
|
|
ori \\rt,\\rs,%lo(\\imm)\n\
|
|
|
|
|
.else\n\
|
|
|
|
|
orui \\rt,\\rs,%uhi(\\imm)\n\
|
|
|
|
|
ori \\rt,\\rt,%lo(\\imm)\n\
|
|
|
|
|
.endif\n";
|
|
|
|
|
|
|
|
|
|
static const char * neg_args[] = { "rd", "rs", NULL };
|
|
|
|
|
static const char * neg_expn = "\n sub \\rd,%0,\\rs\n";
|
|
|
|
|
static const char * negu_expn = "\n subu \\rd,%0,\\rs\n";
|
|
|
|
|
static const char * li_args[] = { "rt", "imm", NULL };
|
|
|
|
|
static const char * li_expn = "\n\
|
|
|
|
|
.if (\\imm & 0xffff0000 == 0x0)\n\
|
|
|
|
|
ori \\rt,%0,\\imm\n\
|
|
|
|
|
.elseif (\\imm & 0xffff0000 == 0xffff0000)\n\
|
|
|
|
|
addi \\rt,%0,\\imm\n\
|
2004-02-26 22:12:26 +08:00
|
|
|
|
.elseif (\\imm & 0x0000ffff == 0)\n\
|
2003-01-04 05:47:21 +08:00
|
|
|
|
lui \\rt,%uhi(\\imm)\n\
|
|
|
|
|
.else\n\
|
|
|
|
|
lui \\rt,%uhi(\\imm)\n\
|
|
|
|
|
ori \\rt,\\rt,%lo(\\imm)\n\
|
|
|
|
|
.endif\n";
|
2004-11-24 21:23:53 +08:00
|
|
|
|
|
|
|
|
|
static iq2000_macro_defs_s iq2000_macro_defs[] =
|
|
|
|
|
{
|
|
|
|
|
{"abs", (const char **) & abs_expn, (const char **) & abs_args},
|
|
|
|
|
{"la", (const char **) & la_expn, (const char **) & la_args},
|
|
|
|
|
{"bge", (const char **) & bge_expn, (const char **) & bxx_args},
|
|
|
|
|
{"bgeu", (const char **) & bgeu_expn, (const char **) & bxx_args},
|
|
|
|
|
{"bgt", (const char **) & bgt_expn, (const char **) & bxx_args},
|
|
|
|
|
{"bgtu", (const char **) & bgtu_expn, (const char **) & bxx_args},
|
|
|
|
|
{"ble", (const char **) & ble_expn, (const char **) & bxx_args},
|
|
|
|
|
{"bleu", (const char **) & bleu_expn, (const char **) & bxx_args},
|
|
|
|
|
{"blt", (const char **) & blt_expn, (const char **) & bxx_args},
|
|
|
|
|
{"bltu", (const char **) & bltu_expn, (const char **) & bxx_args},
|
|
|
|
|
{"sge", (const char **) & sge_expn, (const char **) & sxx_args},
|
|
|
|
|
{"sgeu", (const char **) & sgeu_expn, (const char **) & sxx_args},
|
|
|
|
|
{"sle", (const char **) & sle_expn, (const char **) & sxx_args},
|
|
|
|
|
{"sleu", (const char **) & sleu_expn, (const char **) & sxx_args},
|
|
|
|
|
{"sgt", (const char **) & sgt_expn, (const char **) & sxx_args},
|
|
|
|
|
{"sgtu", (const char **) & sgtu_expn, (const char **) & sxx_args},
|
|
|
|
|
{"seq", (const char **) & seq_expn, (const char **) & sxx_args},
|
|
|
|
|
{"sne", (const char **) & sne_expn, (const char **) & sxx_args},
|
|
|
|
|
{"neg", (const char **) & neg_expn, (const char **) & neg_args},
|
|
|
|
|
{"negu", (const char **) & negu_expn, (const char **) & neg_args},
|
|
|
|
|
{"li", (const char **) & li_expn, (const char **) & li_args},
|
|
|
|
|
{"ori32", (const char **) & ori32_expn, (const char **) & ai32_args},
|
|
|
|
|
{"andi32",(const char **) & andi32_expn,(const char **) & ai32_args},
|
2003-01-04 05:47:21 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
2004-11-24 21:23:53 +08:00
|
|
|
|
iq2000_add_macro (const char * name,
|
|
|
|
|
const char * semantics,
|
|
|
|
|
const char ** arguments)
|
|
|
|
|
{
|
|
|
|
|
macro_entry *macro;
|
|
|
|
|
sb macro_name;
|
|
|
|
|
const char *namestr;
|
|
|
|
|
|
2016-04-01 21:26:30 +08:00
|
|
|
|
macro = XNEW (macro_entry);
|
2004-11-24 21:23:53 +08:00
|
|
|
|
sb_new (& macro->sub);
|
|
|
|
|
sb_new (& macro_name);
|
|
|
|
|
|
|
|
|
|
macro->formal_count = 0;
|
|
|
|
|
macro->formals = 0;
|
|
|
|
|
|
|
|
|
|
sb_add_string (& macro->sub, semantics);
|
|
|
|
|
|
|
|
|
|
if (arguments != NULL)
|
|
|
|
|
{
|
|
|
|
|
formal_entry ** p = ¯o->formals;
|
|
|
|
|
|
|
|
|
|
macro->formal_count = 0;
|
|
|
|
|
macro->formal_hash = hash_new ();
|
|
|
|
|
|
|
|
|
|
while (*arguments != NULL)
|
|
|
|
|
{
|
|
|
|
|
formal_entry *formal;
|
|
|
|
|
|
2016-04-01 21:26:30 +08:00
|
|
|
|
formal = XNEW (formal_entry);
|
2004-11-24 21:23:53 +08:00
|
|
|
|
|
|
|
|
|
sb_new (& formal->name);
|
|
|
|
|
sb_new (& formal->def);
|
|
|
|
|
sb_new (& formal->actual);
|
|
|
|
|
|
|
|
|
|
/* chlm: Added the following to allow defaulted args. */
|
|
|
|
|
if (strchr (*arguments,'='))
|
|
|
|
|
{
|
|
|
|
|
char * tt_args = strdup (*arguments);
|
|
|
|
|
char * tt_dflt = strchr (tt_args,'=');
|
|
|
|
|
|
|
|
|
|
*tt_dflt = 0;
|
|
|
|
|
sb_add_string (& formal->name, tt_args);
|
|
|
|
|
sb_add_string (& formal->def, tt_dflt + 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
sb_add_string (& formal->name, *arguments);
|
|
|
|
|
|
|
|
|
|
/* Add to macro's hash table. */
|
|
|
|
|
hash_jam (macro->formal_hash, sb_terminate (& formal->name), formal);
|
|
|
|
|
|
|
|
|
|
formal->index = macro->formal_count;
|
|
|
|
|
macro->formal_count++;
|
|
|
|
|
*p = formal;
|
|
|
|
|
p = & formal->next;
|
|
|
|
|
*p = NULL;
|
|
|
|
|
++arguments;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sb_add_string (¯o_name, name);
|
|
|
|
|
namestr = sb_terminate (¯o_name);
|
|
|
|
|
hash_jam (macro_hash, namestr, macro);
|
|
|
|
|
|
|
|
|
|
macro_defined = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
iq2000_load_macros (void)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
int i;
|
2004-11-24 21:23:53 +08:00
|
|
|
|
int mcnt = ARRAY_SIZE (iq2000_macro_defs);
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < mcnt; i++)
|
|
|
|
|
iq2000_add_macro (iq2000_macro_defs[i].mnemonic,
|
|
|
|
|
*iq2000_macro_defs[i].expansion,
|
|
|
|
|
iq2000_macro_defs[i].args);
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
void
|
|
|
|
|
md_begin (void)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* Initialize the `cgen' interface. */
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* Set the machine number and endian. */
|
|
|
|
|
gas_cgen_cpu_desc = iq2000_cgen_cpu_open (CGEN_CPU_OPEN_MACHS, cpu_mach,
|
|
|
|
|
CGEN_CPU_OPEN_ENDIAN,
|
|
|
|
|
CGEN_ENDIAN_BIG,
|
|
|
|
|
CGEN_CPU_OPEN_END);
|
|
|
|
|
iq2000_cgen_init_asm (gas_cgen_cpu_desc);
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* This is a callback from cgen to gas to parse operands. */
|
|
|
|
|
cgen_set_parse_operand_fn (gas_cgen_cpu_desc, gas_cgen_parse_operand);
|
|
|
|
|
|
|
|
|
|
/* Set the ELF flags if desired. */
|
|
|
|
|
if (iq2000_flags)
|
|
|
|
|
bfd_set_private_flags (stdoutput, iq2000_flags);
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* Set the machine type */
|
|
|
|
|
bfd_default_set_arch_mach (stdoutput, bfd_arch_iq2000, iq2000_mach);
|
|
|
|
|
|
|
|
|
|
iq2000_load_macros ();
|
|
|
|
|
}
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
|
|
|
|
void
|
2004-11-24 21:23:53 +08:00
|
|
|
|
md_assemble (char * str)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
static long delayed_load_register = 0;
|
|
|
|
|
static int last_insn_had_delay_slot = 0;
|
|
|
|
|
static int last_insn_has_load_delay = 0;
|
|
|
|
|
static int last_insn_unconditional_jump = 0;
|
|
|
|
|
static int last_insn_was_ldw = 0;
|
|
|
|
|
|
|
|
|
|
iq2000_insn insn;
|
|
|
|
|
char * errmsg;
|
|
|
|
|
|
|
|
|
|
/* Initialize GAS's cgen interface for a new instruction. */
|
|
|
|
|
gas_cgen_init_parse ();
|
|
|
|
|
|
|
|
|
|
insn.insn = iq2000_cgen_assemble_insn
|
|
|
|
|
(gas_cgen_cpu_desc, str, & insn.fields, insn.buffer, & errmsg);
|
|
|
|
|
|
|
|
|
|
if (!insn.insn)
|
|
|
|
|
{
|
|
|
|
|
as_bad ("%s", errmsg);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Doesn't really matter what we pass for RELAX_P here. */
|
|
|
|
|
gas_cgen_finish_insn (insn.insn, insn.buffer,
|
|
|
|
|
CGEN_FIELDS_BITSIZE (& insn.fields), 1, NULL);
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* We need to generate an error if there's a yielding instruction in the delay
|
|
|
|
|
slot of a control flow modifying instruction (jump (yes), load (no)) */
|
2003-01-04 05:47:21 +08:00
|
|
|
|
if ((last_insn_had_delay_slot && !last_insn_has_load_delay) &&
|
|
|
|
|
CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_YIELD_INSN))
|
|
|
|
|
as_bad (_("the yielding instruction %s may not be in a delay slot."),
|
|
|
|
|
CGEN_INSN_NAME (insn.insn));
|
|
|
|
|
|
|
|
|
|
/* Warn about odd numbered base registers for paired-register
|
2004-11-24 21:23:53 +08:00
|
|
|
|
instructions like LDW. On iq2000, result is always rt. */
|
2003-01-04 05:47:21 +08:00
|
|
|
|
if (iq2000_mach == bfd_mach_iq2000
|
|
|
|
|
&& CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_EVEN_REG_NUM)
|
|
|
|
|
&& (insn.fields.f_rt % 2))
|
|
|
|
|
as_bad (_("Register number (R%ld) for double word access must be even."),
|
|
|
|
|
insn.fields.f_rt);
|
|
|
|
|
|
|
|
|
|
/* Warn about insns that reference the target of a previous load. */
|
|
|
|
|
/* NOTE: R0 is a special case and is not subject to load delays (except for ldw). */
|
|
|
|
|
if (delayed_load_register && (last_insn_has_load_delay || last_insn_was_ldw))
|
|
|
|
|
{
|
|
|
|
|
if (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RD) &&
|
|
|
|
|
insn.fields.f_rd == delayed_load_register)
|
|
|
|
|
as_warn (_("operand references R%ld of previous load."),
|
|
|
|
|
insn.fields.f_rd);
|
2004-11-24 21:23:53 +08:00
|
|
|
|
|
2003-01-04 05:47:21 +08:00
|
|
|
|
if (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RS) &&
|
|
|
|
|
insn.fields.f_rs == delayed_load_register)
|
|
|
|
|
as_warn (_("operand references R%ld of previous load."),
|
|
|
|
|
insn.fields.f_rs);
|
2004-11-24 21:23:53 +08:00
|
|
|
|
|
2003-01-04 05:47:21 +08:00
|
|
|
|
if (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RT) &&
|
|
|
|
|
insn.fields.f_rt == delayed_load_register)
|
|
|
|
|
as_warn (_("operand references R%ld of previous load."),
|
|
|
|
|
insn.fields.f_rt);
|
2004-11-24 21:23:53 +08:00
|
|
|
|
|
2003-01-04 05:47:21 +08:00
|
|
|
|
if (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_R31) &&
|
|
|
|
|
delayed_load_register == 31)
|
|
|
|
|
as_warn (_("instruction implicitly accesses R31 of previous load."));
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* Warn about insns that reference the (target + 1) of a previous ldw. */
|
|
|
|
|
if (last_insn_was_ldw)
|
|
|
|
|
{
|
|
|
|
|
if ((CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RD)
|
|
|
|
|
&& insn.fields.f_rd == delayed_load_register + 1)
|
|
|
|
|
|| (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RS)
|
|
|
|
|
&& insn.fields.f_rs == delayed_load_register + 1)
|
|
|
|
|
|| (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RT)
|
|
|
|
|
&& insn.fields.f_rt == delayed_load_register + 1))
|
|
|
|
|
as_warn (_("operand references R%ld of previous load."),
|
|
|
|
|
delayed_load_register + 1);
|
|
|
|
|
}
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
|
|
|
|
last_insn_had_delay_slot =
|
|
|
|
|
CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_DELAY_SLOT);
|
|
|
|
|
|
|
|
|
|
last_insn_has_load_delay =
|
|
|
|
|
CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_LOAD_DELAY);
|
|
|
|
|
|
|
|
|
|
if (last_insn_unconditional_jump)
|
|
|
|
|
last_insn_has_load_delay = last_insn_unconditional_jump = 0;
|
|
|
|
|
else if (! strcmp (CGEN_INSN_MNEMONIC (insn.insn), "j")
|
|
|
|
|
|| ! strcmp (CGEN_INSN_MNEMONIC (insn.insn), "jal"))
|
|
|
|
|
last_insn_unconditional_jump = 1;
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* The meaning of EVEN_REG_NUM was overloaded to also imply LDW. Since
|
|
|
|
|
that's not true for IQ10, let's make the above logic specific to LDW. */
|
2003-01-04 05:47:21 +08:00
|
|
|
|
last_insn_was_ldw = ! strcmp ("ldw", CGEN_INSN_NAME (insn.insn));
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* The assumption here is that the target of a load is always rt. */
|
2003-01-04 05:47:21 +08:00
|
|
|
|
delayed_load_register = insn.fields.f_rt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
valueT
|
2004-11-24 21:23:53 +08:00
|
|
|
|
md_section_align (segT segment, valueT size)
|
2003-01-04 05:47:21 +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
|
|
|
|
int align = bfd_section_alignment (segment);
|
2015-11-10 00:12:57 +08:00
|
|
|
|
return ((size + (1 << align) - 1) & -(1 << align));
|
2003-01-04 05:47:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
symbolS *
|
2004-11-24 21:23:53 +08:00
|
|
|
|
md_undefined_symbol (char * name ATTRIBUTE_UNUSED)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Interface to relax_segment. */
|
|
|
|
|
|
|
|
|
|
/* Return an initial guess of the length by which a fragment must grow to
|
|
|
|
|
hold a branch to reach its destination.
|
|
|
|
|
Also updates fr_type/fr_subtype as necessary.
|
|
|
|
|
|
|
|
|
|
Called just before doing relaxation.
|
|
|
|
|
Any symbol that is now undefined will not become defined.
|
|
|
|
|
The guess for fr_var is ACTUALLY the growth beyond fr_fix.
|
|
|
|
|
Whatever we do to grow fr_fix or fr_var contributes to our returned value.
|
|
|
|
|
Although it may not be explicit in the frag, pretend fr_var starts with a
|
|
|
|
|
0 value. */
|
|
|
|
|
|
|
|
|
|
int
|
2004-11-24 21:23:53 +08:00
|
|
|
|
md_estimate_size_before_relax (fragS * fragP,
|
|
|
|
|
segT segment ATTRIBUTE_UNUSED)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
int old_fr_fix = fragP->fr_fix;
|
|
|
|
|
|
|
|
|
|
/* The only thing we have to handle here are symbols outside of the
|
|
|
|
|
current segment. They may be undefined or in a different segment in
|
|
|
|
|
which case linker scripts may place them anywhere.
|
|
|
|
|
However, we can't finish the fragment here and emit the reloc as insn
|
|
|
|
|
alignment requirements may move the insn about. */
|
|
|
|
|
|
|
|
|
|
return (fragP->fr_var + fragP->fr_fix - old_fr_fix);
|
2004-11-24 21:23:53 +08:00
|
|
|
|
}
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
|
|
|
|
/* *fragP has been relaxed to its final size, and now needs to have
|
|
|
|
|
the bytes inside it modified to conform to the new size.
|
|
|
|
|
|
|
|
|
|
Called after relaxation is finished.
|
|
|
|
|
fragP->fr_type == rs_machine_dependent.
|
|
|
|
|
fragP->fr_subtype is the subtype of what the address relaxed to. */
|
|
|
|
|
|
|
|
|
|
void
|
2004-11-24 21:23:53 +08:00
|
|
|
|
md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
|
|
|
|
|
segT sec ATTRIBUTE_UNUSED,
|
|
|
|
|
fragS * fragP ATTRIBUTE_UNUSED)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Functions concerning relocs. */
|
|
|
|
|
|
|
|
|
|
long
|
2004-11-24 21:23:53 +08:00
|
|
|
|
md_pcrel_from_section (fixS * fixP, segT sec)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
if (fixP->fx_addsy != (symbolS *) NULL
|
|
|
|
|
&& (! S_IS_DEFINED (fixP->fx_addsy)
|
|
|
|
|
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
|
|
|
|
|
{
|
|
|
|
|
/* The symbol is undefined (or is defined but not in this section).
|
|
|
|
|
Let the linker figure it out. */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* Return the address of the delay slot. */
|
2003-01-04 05:47:21 +08:00
|
|
|
|
return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the bfd reloc type for OPERAND of INSN at fixup FIXP.
|
|
|
|
|
Returns BFD_RELOC_NONE if no reloc type can be found.
|
|
|
|
|
*FIXP may be modified if desired. */
|
|
|
|
|
|
|
|
|
|
bfd_reloc_code_real_type
|
2004-11-24 21:23:53 +08:00
|
|
|
|
md_cgen_lookup_reloc (const CGEN_INSN * insn ATTRIBUTE_UNUSED,
|
|
|
|
|
const CGEN_OPERAND * operand,
|
|
|
|
|
fixS * fixP ATTRIBUTE_UNUSED)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
switch (operand->type)
|
|
|
|
|
{
|
2004-11-24 21:23:53 +08:00
|
|
|
|
case IQ2000_OPERAND_OFFSET: return BFD_RELOC_16_PCREL_S2;
|
|
|
|
|
case IQ2000_OPERAND_JMPTARG: return BFD_RELOC_IQ2000_OFFSET_16;
|
|
|
|
|
case IQ2000_OPERAND_JMPTARGQ10: return BFD_RELOC_NONE;
|
|
|
|
|
case IQ2000_OPERAND_HI16: return BFD_RELOC_HI16;
|
|
|
|
|
case IQ2000_OPERAND_LO16: return BFD_RELOC_LO16;
|
|
|
|
|
default: break;
|
2003-01-04 05:47:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return BFD_RELOC_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Record a HI16 reloc for later matching with its LO16 cousin. */
|
|
|
|
|
|
|
|
|
|
static void
|
2004-11-24 21:23:53 +08:00
|
|
|
|
iq2000_record_hi16 (int reloc_type,
|
|
|
|
|
fixS * fixP,
|
|
|
|
|
segT seg ATTRIBUTE_UNUSED)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
struct iq2000_hi_fixup * hi_fixup;
|
|
|
|
|
|
* 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 (reloc_type == BFD_RELOC_HI16);
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
2016-04-01 21:26:30 +08:00
|
|
|
|
hi_fixup = XNEW (struct iq2000_hi_fixup);
|
2003-01-04 05:47:21 +08:00
|
|
|
|
hi_fixup->fixp = fixP;
|
|
|
|
|
hi_fixup->seg = now_seg;
|
|
|
|
|
hi_fixup->next = iq2000_hi_fixup_list;
|
2004-11-24 21:23:53 +08:00
|
|
|
|
|
2003-01-04 05:47:21 +08:00
|
|
|
|
iq2000_hi_fixup_list = hi_fixup;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Called while parsing an instruction to create a fixup.
|
|
|
|
|
We need to check for HI16 relocs and queue them up for later sorting. */
|
|
|
|
|
|
|
|
|
|
fixS *
|
2004-11-24 21:23:53 +08:00
|
|
|
|
iq2000_cgen_record_fixup_exp (fragS * frag,
|
|
|
|
|
int where,
|
|
|
|
|
const CGEN_INSN * insn,
|
|
|
|
|
int length,
|
|
|
|
|
const CGEN_OPERAND * operand,
|
|
|
|
|
int opinfo,
|
|
|
|
|
expressionS * exp)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
fixS * fixP = gas_cgen_record_fixup_exp (frag, where, insn, length,
|
|
|
|
|
operand, opinfo, exp);
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
if (operand->type == IQ2000_OPERAND_HI16
|
2003-01-04 05:47:21 +08:00
|
|
|
|
/* If low/high was used, it is recorded in `opinfo'. */
|
2004-11-24 21:23:53 +08:00
|
|
|
|
&& (fixP->fx_cgen.opinfo == BFD_RELOC_HI16
|
|
|
|
|
|| fixP->fx_cgen.opinfo == BFD_RELOC_LO16))
|
|
|
|
|
iq2000_record_hi16 (fixP->fx_cgen.opinfo, fixP, now_seg);
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
|
|
|
|
return fixP;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return BFD reloc type from opinfo field in a fixS.
|
|
|
|
|
It's tricky using fx_r_type in iq2000_frob_file because the values
|
|
|
|
|
are BFD_RELOC_UNUSED + operand number. */
|
|
|
|
|
#define FX_OPINFO_R_TYPE(f) ((f)->fx_cgen.opinfo)
|
|
|
|
|
|
|
|
|
|
/* Sort any unmatched HI16 relocs so that they immediately precede
|
gas:
* cgen.c, cgen.h, tc.h, write.c, config/obj-coff.c
* config/tc-a29k.c, config/tc-alpha.c, config/tc-alpha.h
* config/tc-arc.c, config/tc-arc.h, config/tc-arm.c
* config/tc-arm.h, config/tc-avr.c, config/tc-avr.h
* config/tc-cris.c, config/tc-crx.c, config/tc-d10v.c
* config/tc-d10v.h, config/tc-d30v.c, config/tc-d30v.h
* config/tc-dlx.c, config/tc-dlx.h, config/tc-fr30.h
* config/tc-frv.c, config/tc-frv.h, config/tc-h8300.c
* config/tc-h8500.c, config/tc-hppa.c, config/tc-hppa.h
* config/tc-i370.c, config/tc-i370.h, config/tc-i386.c
* config/tc-i386.h, config/tc-i860.c, config/tc-i860.h
* config/tc-i960.c, config/tc-i960.h, config/tc-ia64.c
* config/tc-ip2k.c, config/tc-ip2k.h, config/tc-iq2000.c
* config/tc-iq2000.h, config/tc-m32r.c, config/tc-m32r.h
* config/tc-m68hc11.c, config/tc-m68hc11.h, config/tc-m68k.c
* config/tc-m68k.h, config/tc-m88k.c, config/tc-maxq.c
* config/tc-mcore.c, config/tc-mcore.h, config/tc-mips.c
* config/tc-mips.h, config/tc-mmix.c, config/tc-mn10200.c
* config/tc-mn10300.c, config/tc-msp430.c, config/tc-ns32k.c
* config/tc-openrisc.h, config/tc-or32.c, config/tc-or32.h
* config/tc-pdp11.c, config/tc-pj.c, config/tc-pj.h
* config/tc-ppc.c, config/tc-ppc.h, config/tc-s390.c
* config/tc-s390.h, config/tc-sh64.c, config/tc-sh.c
* config/tc-sh.h, config/tc-sparc.c, config/tc-sparc.h
* config/tc-tahoe.c, config/tc-tic30.c, config/tc-tic4x.c
* config/tc-tic54x.c, config/tc-tic80.c, config/tc-v850.c
* config/tc-v850.h, config/tc-vax.c, config/tc-vax.h
* config/tc-w65.c, config/tc-xstormy16.c, config/tc-xstormy16.h
* config/tc-xtensa.c, config/tc-z8k.c:
Replace all instances of the string "_apply_fix3" with
"_apply_fix".
* po/POTFILES.in, po/gas.pot: Regenerate.
bfd:
* coff-i386.c: Change md_apply_fix3 to md_apply_fix in comment.
cgen:
* doc/porting.texi: Change all mention of md_apply_fix3 and
gas_cgen_md_apply_fix3 to md_apply_fix and gas_cgen_md_apply_fix
respectively.
2005-06-08 01:54:22 +08:00
|
|
|
|
the corresponding LO16 reloc. This is called before md_apply_fix and
|
2003-01-04 05:47:21 +08:00
|
|
|
|
tc_gen_reloc. */
|
|
|
|
|
|
|
|
|
|
void
|
2004-11-24 21:23:53 +08:00
|
|
|
|
iq2000_frob_file (void)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
struct iq2000_hi_fixup * l;
|
|
|
|
|
|
|
|
|
|
for (l = iq2000_hi_fixup_list; l != NULL; l = l->next)
|
|
|
|
|
{
|
|
|
|
|
segment_info_type * seginfo;
|
|
|
|
|
int pass;
|
2004-11-24 21:23:53 +08:00
|
|
|
|
|
* 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 (FX_OPINFO_R_TYPE (l->fixp) == BFD_RELOC_HI16
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|| FX_OPINFO_R_TYPE (l->fixp) == BFD_RELOC_LO16);
|
2004-11-24 21:23:53 +08:00
|
|
|
|
|
2003-01-04 05:47:21 +08:00
|
|
|
|
/* Check quickly whether the next fixup happens to be a matching low. */
|
|
|
|
|
if (l->fixp->fx_next != NULL
|
|
|
|
|
&& FX_OPINFO_R_TYPE (l->fixp->fx_next) == BFD_RELOC_LO16
|
|
|
|
|
&& l->fixp->fx_addsy == l->fixp->fx_next->fx_addsy
|
|
|
|
|
&& l->fixp->fx_offset == l->fixp->fx_next->fx_offset)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* Look through the fixups for this segment for a matching
|
|
|
|
|
`low'. When we find one, move the high just in front of it.
|
|
|
|
|
We do this in two passes. In the first pass, we try to find
|
|
|
|
|
a unique `low'. In the second pass, we permit multiple
|
|
|
|
|
high's relocs for a single `low'. */
|
|
|
|
|
seginfo = seg_info (l->seg);
|
|
|
|
|
for (pass = 0; pass < 2; pass++)
|
|
|
|
|
{
|
|
|
|
|
fixS * f;
|
|
|
|
|
fixS * prev;
|
|
|
|
|
|
|
|
|
|
prev = NULL;
|
|
|
|
|
for (f = seginfo->fix_root; f != NULL; f = f->fx_next)
|
|
|
|
|
{
|
|
|
|
|
/* Check whether this is a `low' fixup which matches l->fixp. */
|
|
|
|
|
if (FX_OPINFO_R_TYPE (f) == BFD_RELOC_LO16
|
|
|
|
|
&& f->fx_addsy == l->fixp->fx_addsy
|
|
|
|
|
&& f->fx_offset == l->fixp->fx_offset
|
|
|
|
|
&& (pass == 1
|
|
|
|
|
|| prev == NULL
|
|
|
|
|
|| (FX_OPINFO_R_TYPE (prev) != BFD_RELOC_HI16)
|
|
|
|
|
|| prev->fx_addsy != f->fx_addsy
|
|
|
|
|
|| prev->fx_offset != f->fx_offset))
|
|
|
|
|
{
|
|
|
|
|
fixS ** pf;
|
|
|
|
|
|
|
|
|
|
/* Move l->fixp before f. */
|
|
|
|
|
for (pf = &seginfo->fix_root;
|
|
|
|
|
* pf != l->fixp;
|
|
|
|
|
pf = & (* pf)->fx_next)
|
* 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 (* pf != NULL);
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
|
|
|
|
* pf = l->fixp->fx_next;
|
|
|
|
|
|
|
|
|
|
l->fixp->fx_next = f;
|
|
|
|
|
if (prev == NULL)
|
|
|
|
|
seginfo->fix_root = l->fixp;
|
|
|
|
|
else
|
|
|
|
|
prev->fx_next = l->fixp;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prev = f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (f != NULL)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (pass == 1)
|
|
|
|
|
as_warn_where (l->fixp->fx_file, l->fixp->fx_line,
|
|
|
|
|
_("Unmatched high relocation"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* See whether we need to force a relocation into the output file. */
|
|
|
|
|
|
|
|
|
|
int
|
2004-11-24 21:23:53 +08:00
|
|
|
|
iq2000_force_relocation (fixS * fix)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
if (fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|
|
|
|
|
|| fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Handle the .set pseudo-op. */
|
|
|
|
|
|
|
|
|
|
static void
|
2004-11-24 21:23:53 +08:00
|
|
|
|
s_iq2000_set (int x ATTRIBUTE_UNUSED)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
2004-11-24 21:23:53 +08:00
|
|
|
|
static const char * ignored_arguments [] =
|
|
|
|
|
{
|
|
|
|
|
"reorder",
|
|
|
|
|
"noreorder",
|
|
|
|
|
"at",
|
|
|
|
|
"noat",
|
|
|
|
|
"macro",
|
|
|
|
|
"nomacro",
|
|
|
|
|
"move",
|
|
|
|
|
"novolatile",
|
|
|
|
|
"nomove",
|
|
|
|
|
"volatile",
|
|
|
|
|
"bopt",
|
|
|
|
|
"nobopt",
|
|
|
|
|
NULL
|
|
|
|
|
};
|
2005-01-12 18:57:15 +08:00
|
|
|
|
const char ** ignored;
|
2003-01-04 05:47:21 +08:00
|
|
|
|
char *name = input_line_pointer, ch;
|
|
|
|
|
char *save_ILP = input_line_pointer;
|
|
|
|
|
|
|
|
|
|
while (!is_end_of_line[(unsigned char) *input_line_pointer])
|
|
|
|
|
input_line_pointer++;
|
|
|
|
|
ch = *input_line_pointer;
|
|
|
|
|
*input_line_pointer = '\0';
|
|
|
|
|
|
2005-01-12 18:57:15 +08:00
|
|
|
|
for (ignored = ignored_arguments; * ignored; ignored ++)
|
|
|
|
|
if (strcmp (* ignored, name) == 0)
|
2004-11-24 21:23:53 +08:00
|
|
|
|
break;
|
2005-01-12 18:57:15 +08:00
|
|
|
|
if (* ignored == NULL)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
/* We'd like to be able to use .set symbol, expn */
|
|
|
|
|
input_line_pointer = save_ILP;
|
|
|
|
|
s_set (0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
*input_line_pointer = ch;
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Write a value out to the object file, using the appropriate endianness. */
|
|
|
|
|
|
|
|
|
|
void
|
2004-11-24 21:23:53 +08:00
|
|
|
|
md_number_to_chars (char * buf, valueT val, int n)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
number_to_chars_bigendian (buf, val, n);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2004-11-24 21:23:53 +08:00
|
|
|
|
md_operand (expressionS * exp)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* In case of a syntax error, escape back to try next syntax combo. */
|
2003-01-04 05:47:21 +08:00
|
|
|
|
if (exp->X_op == O_absent)
|
|
|
|
|
gas_cgen_md_operand (exp);
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-01 20:07:50 +08:00
|
|
|
|
const char *
|
2004-11-24 21:23:53 +08:00
|
|
|
|
md_atof (int type, char * litP, int * sizeP)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
2007-10-18 00:45:56 +08:00
|
|
|
|
return ieee_md_atof (type, litP, sizeP, TRUE);
|
2003-01-04 05:47:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bfd_boolean
|
2004-11-24 21:23:53 +08:00
|
|
|
|
iq2000_fix_adjustable (fixS * fixP)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
bfd_reloc_code_real_type reloc_type;
|
|
|
|
|
|
|
|
|
|
if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
|
|
|
|
|
{
|
|
|
|
|
const CGEN_INSN *insn = NULL;
|
|
|
|
|
int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
|
|
|
|
|
const CGEN_OPERAND *operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex);
|
2004-11-24 21:23:53 +08:00
|
|
|
|
|
2003-01-04 05:47:21 +08:00
|
|
|
|
reloc_type = md_cgen_lookup_reloc (insn, operand, fixP);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
reloc_type = fixP->fx_r_type;
|
|
|
|
|
|
|
|
|
|
if (fixP->fx_addsy == NULL)
|
|
|
|
|
return TRUE;
|
2004-11-24 21:23:53 +08:00
|
|
|
|
|
2003-01-04 05:47:21 +08:00
|
|
|
|
/* Prevent all adjustments to global symbols. */
|
2005-04-21 01:40:01 +08:00
|
|
|
|
if (S_IS_EXTERNAL (fixP->fx_addsy))
|
2003-01-04 05:47:21 +08:00
|
|
|
|
return FALSE;
|
2004-11-24 21:23:53 +08:00
|
|
|
|
|
2003-01-04 05:47:21 +08:00
|
|
|
|
if (S_IS_WEAK (fixP->fx_addsy))
|
|
|
|
|
return FALSE;
|
2004-11-24 21:23:53 +08:00
|
|
|
|
|
2003-01-04 05:47:21 +08:00
|
|
|
|
/* We need the symbol name for the VTABLE entries. */
|
|
|
|
|
if ( reloc_type == BFD_RELOC_VTABLE_INHERIT
|
|
|
|
|
|| reloc_type == BFD_RELOC_VTABLE_ENTRY)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2004-11-24 21:23:53 +08:00
|
|
|
|
s_change_sec (int sec)
|
2003-01-04 05:47:21 +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 a 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)
|
|
|
|
|
{
|
|
|
|
|
case 't':
|
|
|
|
|
s_text (0);
|
|
|
|
|
break;
|
|
|
|
|
case 'd':
|
|
|
|
|
case 'r':
|
|
|
|
|
s_data (0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
static symbolS *
|
|
|
|
|
get_symbol (void)
|
|
|
|
|
{
|
|
|
|
|
int c;
|
|
|
|
|
char *name;
|
|
|
|
|
symbolS *p;
|
|
|
|
|
|
2015-08-21 23:42:14 +08:00
|
|
|
|
c = get_symbol_name (&name);
|
2004-11-24 21:23:53 +08:00
|
|
|
|
p = (symbolS *) symbol_find_or_make (name);
|
2015-08-21 23:42:14 +08:00
|
|
|
|
(void) restore_line_pointer (c);
|
2004-11-24 21:23:53 +08:00
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
2003-01-04 05:47:21 +08:00
|
|
|
|
/* The .end directive. */
|
|
|
|
|
|
|
|
|
|
static void
|
2004-11-24 21:23:53 +08:00
|
|
|
|
s_iq2000_end (int x ATTRIBUTE_UNUSED)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
symbolS *p;
|
|
|
|
|
int maybe_text;
|
|
|
|
|
|
|
|
|
|
if (!is_end_of_line[(unsigned char) *input_line_pointer])
|
|
|
|
|
{
|
|
|
|
|
p = get_symbol ();
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
p = NULL;
|
|
|
|
|
|
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)
|
2004-11-24 21:23:53 +08:00
|
|
|
|
maybe_text = 1;
|
|
|
|
|
else
|
|
|
|
|
maybe_text = 0;
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
if (!maybe_text)
|
|
|
|
|
as_warn (_(".end not in text section"));
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
if (!cur_proc_ptr)
|
|
|
|
|
{
|
|
|
|
|
as_warn (_(".end directive without a preceding .ent directive."));
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
if (p != NULL)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
* 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));
|
2004-11-24 21:23:53 +08:00
|
|
|
|
if (strcmp (S_GET_NAME (p), S_GET_NAME (cur_proc_ptr->isym)))
|
|
|
|
|
as_warn (_(".end symbol does not match .ent symbol."));
|
2003-01-04 05:47:21 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
2004-11-24 21:23:53 +08:00
|
|
|
|
as_warn (_(".end directive missing or unknown symbol"));
|
2003-01-04 05:47:21 +08:00
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
cur_proc_ptr = NULL;
|
2003-01-04 05:47:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2004-11-24 21:23:53 +08:00
|
|
|
|
get_number (void)
|
2003-01-04 05:47:21 +08:00
|
|
|
|
{
|
|
|
|
|
int negative = 0;
|
|
|
|
|
long val = 0;
|
|
|
|
|
|
|
|
|
|
if (*input_line_pointer == '-')
|
|
|
|
|
{
|
|
|
|
|
++input_line_pointer;
|
|
|
|
|
negative = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! ISDIGIT (*input_line_pointer))
|
|
|
|
|
as_bad (_("Expected simple number."));
|
|
|
|
|
|
|
|
|
|
if (input_line_pointer[0] == '0')
|
|
|
|
|
{
|
|
|
|
|
if (input_line_pointer[1] == 'x')
|
|
|
|
|
{
|
|
|
|
|
input_line_pointer += 2;
|
|
|
|
|
while (ISXDIGIT (*input_line_pointer))
|
|
|
|
|
{
|
|
|
|
|
val <<= 4;
|
|
|
|
|
val |= hex_value (*input_line_pointer++);
|
|
|
|
|
}
|
|
|
|
|
return negative ? -val : val;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
++input_line_pointer;
|
|
|
|
|
|
|
|
|
|
while (ISDIGIT (*input_line_pointer))
|
|
|
|
|
{
|
|
|
|
|
val <<= 3;
|
|
|
|
|
val |= *input_line_pointer++ - '0';
|
|
|
|
|
}
|
|
|
|
|
return negative ? -val : val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-24 21:23:53 +08:00
|
|
|
|
/* The .aent and .ent directives. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
s_iq2000_ent (int aent)
|
|
|
|
|
{
|
|
|
|
|
symbolS *symbolP;
|
|
|
|
|
int maybe_text;
|
|
|
|
|
|
|
|
|
|
symbolP = get_symbol ();
|
|
|
|
|
if (*input_line_pointer == ',')
|
|
|
|
|
input_line_pointer++;
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
|
if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-')
|
* config/obj-evax.h (S_SET_OTHER, S_SET_TYPE, S_SET_DESC): Don't define.
* config/tc-crx.c (gettrap): Constify arg.
(handle_LoadStor, get_cinv_parameters): Likewise.
(getreg_image): Fix enum warning
(md_assemble): Restore input line char.
* config/tc-hppa.c (tc_gen_reloc): Fix enum warning.
* config/tc-i960.c (mem_fmt): Rename var to fix shadow warning.
* config/tc-sh.c (sh_fdpic): Only define when OBJ_ELF.
(build_Mytes): Fix build failure for non-elf targets.
* config/tc-tic4x.c (tic4x_eval): Restore terminator char.
* config/tc-xtensa.c (xtensa_end_directive): Fix switch enum warning.
* cgen.c (gas_cgen_md_apply_fix): Avoid set but unused warning.
* ecoff.c (add_ecoff_symbol): Likewise.
* itbl-ops.c (append_insns_as_macros): Likewise.
* listing.c (debugging_pseudo): Likewise.
* read.c (s_mri_common, stringer): Likewise.
* config/obj-coff.c (coff_frob_section): Likewise.
* config/tc-alpha.c (emit_ldgp, s_alpha_proc): Likewise.
* config/tc-arm.c (my_get_expression): Likewise.
* config/tc-hppa.c (process_exit, pa_type_args): Likewise.
* config/tc-m32c.c (md_assemble): Likewise.
* config/tc-microblaze.c (md_convert_frag): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-mt.c (mt_fix_adjustable): Likewise.
* config/tc-xtensa.c (xtensa_literal_pseudo): Likewise.
* config/obj-aout.c (obj_aout_frob_symbol): Delete set but otherwise
unused vars.
* config/tc-alpha.c (load_expression): Likewise.
(s_alpha_rdata, s_alpha_section, s_alpha_prologue): Likewise.
* config/tc-arm.c (parse_neon_el_struct_list): Likewise.
* config/tc-avr.c (extract_word): Likewise.
* config/tc-cris.c (cris_get_expression): Likewise.
* config/tc-d30v.c (build_insn, find_format): Likewise.
* config/tc-dlx.c (machine_ip): Likewise.
* config/tc-hppa.c (pa_get_absolute_expression): Likewise.
* config/tc-i370.c (md_assemble): Likewise.
* config/tc-i960.c (brtab_emit): Likewise.
* config/tc-iq2000.c (s_iq2000_ent): Likewise.
* config/tc-m32c.c (md_convert_frag): Likewise.
* config/tc-m68hc11.c (fixup24, build_jump_insn): Likewise.
(md_estimate_size_before_relax, md_apply_fix): Likewise.
* config/tc-m68k.c (md_show_usage): Likewise.
* config/tc-microblaze.c (microblaze_s_lcomm): Likewise.
* config/tc-mips.c (s_mips_end): Likewise.
* config/tc-mmix.c (mmix_byte, mmix_cons): Likewise.
* config/tc-mn10300.c (md_assemble): Likewise.
* config/tc-msp430.c (extract_word): Likewise.
* config/tc-mt.c (md_assemble): Likewise.
* config/tc-or32.c (machine_ip): Likewise.
* config/tc-pj.c (md_apply_fix): Likewise.
* config/tc-s390.c (md_gather_operands): Likewise.
* config/tc-sh.c (sh_cons_align): Likewise.
* config/tc-sparc.c (sparc_cons_align): Likewise.
* config/tc-tic4x.c (tic4x_sect): Likewise.
* config/tc-tic54x.c (tic54x_stringer): Likewise.
* config/tc-vax.c (vip_op): Likewise.
* config/tc-xstormy16.c (xstormy16_cons_fix_new): Likewise.
* config/tc-xtensa.c (md_assemble): Likewise.
(xtensa_fix_short_loop_frags, convert_frag_immed): Likewise.
(xtensa_move_literals): Likewise.
2010-06-28 22:06:57 +08:00
|
|
|
|
get_number ();
|
2004-11-24 21:23:53 +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 (now_seg) & SEC_CODE) != 0)
|
2004-11-24 21:23:53 +08:00
|
|
|
|
maybe_text = 1;
|
|
|
|
|
else
|
|
|
|
|
maybe_text = 0;
|
|
|
|
|
|
|
|
|
|
if (!maybe_text)
|
|
|
|
|
as_warn (_(".ent or .aent not in text section."));
|
|
|
|
|
|
|
|
|
|
if (!aent && cur_proc_ptr)
|
|
|
|
|
as_warn (_("missing `.end'"));
|
|
|
|
|
|
|
|
|
|
if (!aent)
|
|
|
|
|
{
|
|
|
|
|
cur_proc_ptr = &cur_proc;
|
|
|
|
|
memset (cur_proc_ptr, '\0', sizeof (procS));
|
|
|
|
|
|
|
|
|
|
cur_proc_ptr->isym = symbolP;
|
|
|
|
|
|
|
|
|
|
symbol_get_bfdsym (symbolP)->flags |= BSF_FUNCTION;
|
|
|
|
|
|
|
|
|
|
numprocs++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The .frame directive. If the mdebug section is present (IRIX 5 native)
|
|
|
|
|
then ecoff.c (ecoff_directive_frame) is used. For embedded targets,
|
|
|
|
|
s_iq2000_frame is used so that we can set the PDR information correctly.
|
|
|
|
|
We can't use the ecoff routines because they make reference to the ecoff
|
|
|
|
|
symbol table (in the mdebug section). */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
s_iq2000_frame (int ignore)
|
|
|
|
|
{
|
|
|
|
|
s_ignore (ignore);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The .fmask and .mask directives. If the mdebug section is present
|
|
|
|
|
(IRIX 5 native) then ecoff.c (ecoff_directive_mask) is used. For
|
|
|
|
|
embedded targets, s_iq2000_mask is used so that we can set the PDR
|
|
|
|
|
information correctly. We can't use the ecoff routines because they
|
|
|
|
|
make reference to the ecoff symbol table (in the mdebug section). */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
s_iq2000_mask (int reg_type)
|
|
|
|
|
{
|
|
|
|
|
s_ignore (reg_type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The target specific pseudo-ops which we support. */
|
|
|
|
|
const pseudo_typeS md_pseudo_table[] =
|
|
|
|
|
{
|
|
|
|
|
{ "align", s_align_bytes, 0 },
|
|
|
|
|
{ "word", cons, 4 },
|
|
|
|
|
{ "rdata", s_change_sec, 'r'},
|
|
|
|
|
{ "sdata", s_change_sec, 's'},
|
|
|
|
|
{ "set", s_iq2000_set, 0 },
|
|
|
|
|
{ "ent", s_iq2000_ent, 0 },
|
|
|
|
|
{ "end", s_iq2000_end, 0 },
|
|
|
|
|
{ "frame", s_iq2000_frame, 0 },
|
|
|
|
|
{ "fmask", s_iq2000_mask, 'F'},
|
|
|
|
|
{ "mask", s_iq2000_mask, 'R'},
|
|
|
|
|
{ "dword", cons, 8 },
|
|
|
|
|
{ "half", cons, 2 },
|
|
|
|
|
{ NULL, NULL, 0 }
|
|
|
|
|
};
|