/* tc-sh64.c -- Assemble code for the SuperH SH SHcompact and SHmedia.
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
- Free Software Foundation.
+ Copyright (C) 2000-2017 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
};
static void shmedia_md_begin (void);
-static int shmedia_parse_reg (char *, int *, int *, shmedia_arg_type);
+static int shmedia_parse_reg (char *, shmedia_arg_type *, int *,
+ shmedia_arg_type);
static void shmedia_md_assemble (char *);
static void shmedia_md_apply_fix (fixS *, valueT *);
static int shmedia_md_estimate_size_before_relax (fragS *, segT);
sec_elf_data = sh64_elf_section_data (sec)->sh64_info;
if (sec_elf_data == NULL)
{
- sec_elf_data = xcalloc (1, sizeof (*sec_elf_data));
+ sec_elf_data = XCNEW (struct sh64_section_data);
sh64_elf_section_data (sec)->sh64_info = sec_elf_data;
}
{
offsetT val = *valp;
- char *msg = NULL;
+ const char *msg = NULL;
switch (reloc)
{
chars consumed. */
static int
-shmedia_parse_reg (char *src, int *mode, int *reg, shmedia_arg_type argtype)
+shmedia_parse_reg (char *src, shmedia_arg_type *mode, int *reg,
+ shmedia_arg_type argtype)
{
int l0 = TOLOWER (src[0]);
int l1 = l0 ? TOLOWER (src[1]) : 0;
offsetT value = fragP->fr_offset
+ (fragP->fr_symbol == NULL ? 0 : S_GET_VALUE (fragP->fr_symbol));
- if (value >= ((offsetT) -1 << 15) && value < ((offsetT) 1 << 15))
+ if (value >= (-((offsetT) 1 << 15)) && value < ((offsetT) 1 << 15))
{
/* Fits in 16-bit signed number. */
int what = GET_WHAT (fragP->fr_subtype);
shmedia_arg_type argtype)
{
char *src = *ptr;
- int mode = -1;
+ shmedia_arg_type mode = (shmedia_arg_type) -1;
unsigned int len;
len = shmedia_parse_reg (src, &mode, &(op->reg), argtype);
return (sh64_abi == sh64_abi_64) ? bfd_mach_sh5 : 0;
}
-/* This is MD_PCREL_FROM_SECTION, we we define so it is called instead of
+/* This is MD_PCREL_FROM_SECTION, we define so it is called instead of
md_pcrel_from (in tc-sh.c). */
valueT
shmedia_md_pcrel_from_section (struct fix *fixP, segT sec ATTRIBUTE_UNUSED)
{
/* Use the ISA for the instruction to decide which offset to use. We
- can glean it from the fisup type. */
+ can glean it from the fixup type. */
switch (fixP->fx_r_type)
{
case BFD_RELOC_SH_IMM_LOW16:
else
{
symbolS *dl_symp;
- const char *name = S_GET_NAME (symp);
- char *dl_name
- = xmalloc (strlen (name) + sizeof (DATALABEL_SUFFIX));
+ const char * sname = S_GET_NAME (symp);
+ char *dl_name = concat (sname, DATALABEL_SUFFIX, (char *) NULL);
/* Now we copy the datalabel-qualified symbol into a symbol
with the same name, but with " DL" appended. We mark the
the main symbol, so we don't have to inspect all symbol
names. Note that use of "datalabel" is not expected to
be a common case. */
- strcpy (dl_name, name);
- strcat (dl_name, DATALABEL_SUFFIX);
/* A FAKE_LABEL_NAME marks "$" or ".". There can be any
number of them and all have the same (faked) name; we
must make a new one each time. */
- if (strcmp (name, FAKE_LABEL_NAME) == 0)
+ if (strcmp (sname, FAKE_LABEL_NAME) == 0)
dl_symp = symbol_make (dl_name);
else
dl_symp = symbol_find_or_make (dl_name);