* as.h (bfd_alloc_by_size_t): Don't declare.

* Many files: Use xmalloc rather than bfd_alloc_by_size_t.
This commit is contained in:
Ian Lance Taylor 1997-03-17 16:29:29 +00:00
parent 86eb1e292c
commit 590c50d82c
11 changed files with 3178 additions and 936 deletions

View File

@ -1,3 +1,8 @@
Mon Mar 17 11:21:09 1997 Ian Lance Taylor <ian@cygnus.com>
* as.h (bfd_alloc_by_size_t): Don't declare.
* Many files: Use xmalloc rather than bfd_alloc_by_size_t.
Sun Mar 16 13:49:21 1997 Philippe De Muyter <phdm@info.ucl.ac.be>
* symbols.c (symbol_new): Don't call debug_verify_symchain.

View File

@ -1,5 +1,5 @@
/* as.h - global header file
Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 1996
Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 1997
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@ -15,8 +15,9 @@
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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
along with GAS; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef GAS
#define GAS 1
@ -135,6 +136,7 @@ void *alloca ();
#ifdef BFD_ASSEMBLER
#include <bfd.h>
#endif
#include <libiberty.h>
/* Define the standard progress macros. */
#include <progress.h>
@ -161,8 +163,8 @@ extern void free ();
extern int errno;
#endif
/* This is needed for VMS. */
#if ! defined (HAVE_UNLINK) && defined (HAVE_REMOVE)
/* This is needed for VMS with DEC C. */
#if ! defined (__GNUC__) && ! defined (HAVE_UNLINK) && defined (HAVE_REMOVE)
#define unlink remove
#endif
@ -171,13 +173,6 @@ extern int errno;
#define bcopy(src,dest,size) memcpy(dest,src,size)
#endif
#ifdef BFD_ASSEMBLER
/* This one doesn't get declared, but we're using it anyways. This
should be fixed -- either it's part of the external interface or
it's not. */
extern PTR bfd_alloc_by_size_t PARAMS ((bfd *abfd, size_t sz));
#endif
/* Make Saber happier on obstack.h. */
#ifdef SABER
#undef __PTR_TO_INT
@ -348,11 +343,17 @@ enum _relax_state
constant length frag. */
rs_fill = 1,
/* Align: Fr_offset: power of 2. Variable chars: fill pattern. */
/* Align. The fr_offset field holds the power of 2 to which to
align. The fr_var field holds the number of characters in the
fill pattern. The fr_subtype field holds the maximum number of
bytes to skip when aligning, or 0 if there is no maximum. */
rs_align,
/* Align code: fr_offset: power of 2. Fill pattern is machine
specific, defaulting to all zeros. */
/* Align code. The fr_offset field holds the power of 2 to which
to align. This type is only generated by machine specific
code, which is normally responsible for handling the fill
pattern. The fr_subtype field holds the maximum number of
bytes to skip when aligning, or 0 if there is no maximum. */
rs_align_code,
/* Org: Fr_offset, fr_symbol: address. 1 variable char: fill
@ -498,6 +499,9 @@ COMMON unsigned char flag_print_statistics;
/* name of emitted object file */
COMMON char *out_file_name;
/* name of file defining extensions to the basic instruction set */
COMMON char *insttbl_file_name;
/* TRUE if we need a second pass. */
COMMON int need_pass_2;
@ -541,7 +545,7 @@ typedef struct _pseudo_type pseudo_typeS;
#endif
#ifdef USE_STDARG
#if __GNUC__ >= 2
#if (__GNUC__ >= 2) && !defined(VMS)
/* for use with -Wformat */
#define PRINTF_LIKE(FCN) void FCN (const char *format, ...) \
__attribute__ ((format (printf, 1, 2)))
@ -580,8 +584,6 @@ char *atof_ieee PARAMS ((char *str, int what_kind, LITTLENUM_TYPE * words));
char *input_scrub_include_file PARAMS ((char *filename, char *position));
char *input_scrub_new_file PARAMS ((char *filename));
char *input_scrub_next_buffer PARAMS ((char **bufp));
PTR xmalloc PARAMS ((unsigned long size));
PTR xrealloc PARAMS ((PTR ptr, unsigned long n));
int do_scrub_chars PARAMS ((int (*get) (char **), char *to, int tolen));
int gen_to_words PARAMS ((LITTLENUM_TYPE * words, int precision,
long exponent_bits));

View File

@ -19,6 +19,8 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#define OBJ_HEADER "obj-coff.h"
#include "as.h"
#include "obstack.h"
#include "subsegs.h"
@ -327,14 +329,14 @@ static symbolS *line_fsym;
void
obj_symbol_new_hook (symbolP)
coff_obj_symbol_new_hook (symbolP)
symbolS *symbolP;
{
char underscore = 0; /* Symbol has leading _ */
{
long sz = (OBJ_COFF_MAX_AUXENTRIES + 1) * sizeof (combined_entry_type);
char *s = (char *) bfd_alloc_by_size_t (stdoutput, sz);
char *s = (char *) xmalloc (sz);
memset (s, 0, sz);
coffsymbol (symbolP->bsym)->native = (combined_entry_type *) s;
}
@ -364,8 +366,8 @@ add_lineno (frag, offset, num)
int offset;
int num;
{
struct line_no *new_line = (struct line_no *) bfd_alloc_by_size_t (stdoutput,
sizeof (struct line_no));
struct line_no *new_line =
(struct line_no *) xmalloc (sizeof (struct line_no));
if (!current_lineno_sym)
{
abort ();
@ -882,7 +884,7 @@ obj_coff_val (ignore)
}
void
obj_read_begin_hook ()
coff_obj_read_begin_hook ()
{
/* These had better be the same. Usually 18 bytes. */
#ifndef BFD_HEADERS
@ -1047,7 +1049,7 @@ coff_frob_symbol (symp, punt)
/* We need i entries for line numbers, plus 1 for the first
entry which BFD will override, plus 1 for the last zero
entry (a marker for BFD). */
l = (alent *) bfd_alloc_by_size_t (stdoutput, (i + 2) * sizeof (alent));
l = (alent *) xmalloc ((i + 2) * sizeof (alent));
coffsymbol (symp->bsym)->lineno = l;
l[i + 1].line_number = 0;
l[i + 1].u.sym = NULL;
@ -1120,6 +1122,7 @@ coff_frob_file ()
* 'w' for data
* 'd' (apparently m88k for data)
* 'x' for text
* 'r' for read-only data
* But if the argument is not a quoted string, treat it as a
* subsegment number.
*/
@ -1176,6 +1179,7 @@ obj_coff_section (ignore)
case 'd':
case 'w': flags &=~ SEC_READONLY; break;
case 'x': flags |= SEC_CODE; break;
case 'r': flags |= SEC_READONLY; break;
case 'i': /* STYP_INFO */
case 'l': /* STYP_LIB */
@ -2000,7 +2004,7 @@ symbol_to_chars (abfd, where, symbolP)
}
void
obj_symbol_new_hook (symbolP)
coff_obj_symbol_new_hook (symbolP)
symbolS *symbolP;
{
char underscore = 0; /* Symbol has leading _ */
@ -2571,7 +2575,7 @@ obj_coff_pe_handle_link_once (type)
#endif /* TE_PE */
void
obj_read_begin_hook ()
coff_obj_read_begin_hook ()
{
/* These had better be the same. Usually 18 bytes. */
#ifndef BFD_HEADERS
@ -2921,7 +2925,7 @@ crawl_symbols (h, abfd)
* order :
* . .file symbol
* . debug entries for functions
* . fake symbols for the sections, including.text .data and .bss
* . fake symbols for the sections, including .text .data and .bss
* . defined symbols
* . undefined symbols
* But this is not mandatory. The only important point is to put the
@ -3356,6 +3360,7 @@ obj_coff_add_segment (name)
* 'w' for data
* 'd' (apparently m88k for data)
* 'x' for text
* 'r' for read-only data
* But if the argument is not a quoted string, treat it as a
* subsegment number.
*/
@ -3420,6 +3425,7 @@ obj_coff_section (ignore)
case 'd':
case 'w': flags |= STYP_DATA; break;
case 'x': flags |= STYP_TEXT; break;
case 'r': flags |= STYP_LIT; break;
default:
as_warn("unknown section attribute '%c'",
*input_line_pointer);
@ -4312,6 +4318,7 @@ const pseudo_typeS obj_pseudo_table[] =
{"optim", s_ignore, 0}, /* For sun386i cc (?) */
{"ident", s_ignore, 0}, /* we don't yet handle this. */
#endif
{"version", s_ignore, 0},
{"ABORT", s_abort, 0},
#ifdef TC_M88K
/* The m88k uses sdef instead of def. */
@ -4319,3 +4326,60 @@ const pseudo_typeS obj_pseudo_table[] =
#endif
{NULL} /* end sentinel */
}; /* obj_pseudo_table */
#ifdef BFD_ASSEMBLER
/* Support for a COFF emulation. */
static void
coff_pop_insert ()
{
pop_insert (obj_pseudo_table);
}
static int
coff_sec_sym_ok_for_reloc (sec)
asection *sec;
{
return 0;
}
static void
no_func ()
{
abort ();
}
const struct format_ops coff_format_ops =
{
bfd_target_coff_flavour,
0,
1,
coff_frob_symbol,
coff_frob_file,
no_func,
0, 0,
0, 0,
0,
#if 0
obj_generate_asm_lineno,
#else
no_func,
#endif
#if 0
obj_stab,
#else
no_func,
#endif
coff_sec_sym_ok_for_reloc,
coff_pop_insert,
#if 0
obj_set_ext,
#else
no_func,
#endif
coff_obj_read_begin_hook,
coff_obj_symbol_new_hook,
};
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -95,7 +95,7 @@ const pseudo_typeS md_pseudo_table[] =
/* Opcode hash table. */
static struct hash_control *d10v_hash;
/* reg_name_search does a binary search of the pre_defined_registers
/* reg_name_search does a binary search of the d10v_predefined_registers
array to see if "name" is a valid regiter name. Returns the register
number from the array on success, or -1 on failure. */
@ -107,18 +107,18 @@ reg_name_search (name)
int cmp;
low = 0;
high = reg_name_cnt() - 1;
high = d10v_reg_name_cnt() - 1;
do
{
middle = (low + high) / 2;
cmp = strcasecmp (name, pre_defined_registers[middle].name);
cmp = strcasecmp (name, d10v_predefined_registers[middle].name);
if (cmp < 0)
high = middle - 1;
else if (cmp > 0)
low = middle + 1;
else
return pre_defined_registers[middle].value;
return d10v_predefined_registers[middle].value;
}
while (low <= high);
return -1;
@ -1225,7 +1225,7 @@ tc_gen_reloc (seg, fixp)
fixS *fixp;
{
arelent *reloc;
reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent));
reloc = (arelent *) xmalloc (sizeof (arelent));
reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);

View File

@ -104,7 +104,7 @@ typedef struct _i386_insn i386_insn;
/* This array holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful */
#if defined (TE_I386AIX) || defined (OBJ_ELF)
#if defined (TE_I386AIX) || defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
const char comment_chars[] = "#/";
#else
const char comment_chars[] = "#";
@ -118,7 +118,7 @@ const char comment_chars[] = "#";
#NO_APP at the beginning of its output. */
/* Also note that comments started like this one will always work if
'/' isn't otherwise defined. */
#if defined (TE_I386AIX) || defined (OBJ_ELF)
#if defined (TE_I386AIX) || defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
const char line_comment_chars[] = "";
#else
const char line_comment_chars[] = "/";
@ -577,10 +577,13 @@ md_begin ()
operand_chars[(unsigned char) *p] = *p;
}
#ifdef OBJ_ELF
record_alignment (text_section, 2);
record_alignment (data_section, 2);
record_alignment (bss_section, 2);
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
if (OUTPUT_FLAVOR == bfd_target_elf_flavour)
{
record_alignment (text_section, 2);
record_alignment (data_section, 2);
record_alignment (bss_section, 2);
}
#endif
}
@ -2653,11 +2656,13 @@ md_apply_fix3 (fixP, valp, seg)
if (fixP->fx_r_type == BFD_RELOC_32_PCREL && fixP->fx_addsy)
{
#ifndef OBJ_AOUT
value += fixP->fx_where + fixP->fx_frag->fr_address;
if (OUTPUT_FLAVOR == bfd_target_elf_flavour)
value += fixP->fx_where + fixP->fx_frag->fr_address;
#endif
#ifdef OBJ_ELF
if (S_GET_SEGMENT (fixP->fx_addsy) == seg
|| (fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) != 0)
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
if (OUTPUT_FLAVOR == bfd_target_elf_flavour
&& (S_GET_SEGMENT (fixP->fx_addsy) == seg
|| (fixP->fx_addsy->bsym->flags & BSF_SECTION_SYM) != 0))
{
/* Yes, we add the values in twice. This is because
bfd_perform_relocation subtracts them out again. I think
@ -2670,8 +2675,9 @@ md_apply_fix3 (fixP, valp, seg)
/* Fix a few things - the dynamic linker expects certain values here,
and we must not dissappoint it. */
#ifdef OBJ_ELF
if (fixP->fx_addsy)
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
if (OUTPUT_FLAVOR == bfd_target_elf_flavour
&& fixP->fx_addsy)
switch(fixP->fx_r_type) {
case BFD_RELOC_386_PLT32:
/* Make the jump instruction point to the address of the operand. At
@ -2860,7 +2866,7 @@ md_parse_option (c, arg)
flag_do_long_jump = 1;
break;
#ifdef OBJ_ELF
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
/* -k: Ignore for FreeBSD compatibility. */
case 'k':
break;
@ -2889,9 +2895,32 @@ md_show_usage (stream)
fprintf (stream, "\
-m do long jump\n");
}
/* We have no need to default values of symbols. */
#ifdef BFD_ASSEMBLER
#ifdef OBJ_MAYBE_ELF
#ifdef OBJ_MAYBE_COFF
/* Pick the target format to use. */
const char *
i386_target_format ()
{
switch (OUTPUT_FLAVOR)
{
case bfd_target_coff_flavour:
return "coff-i386";
case bfd_target_elf_flavour:
return "elf32-i386";
default:
abort ();
return NULL;
}
}
#endif /* OBJ_MAYBE_COFF */
#endif /* OBJ_MAYBE_ELF */
#endif /* BFD_ASSEMBLER */
/* ARGSUSED */
symbolS *
md_undefined_symbol (name)
@ -3001,9 +3030,7 @@ tc_gen_reloc (section, fixp)
&& fixp->fx_addsy == GOT_symbol)
code = BFD_RELOC_386_GOTPC;
rel = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent));
if (rel == NULL)
as_fatal ("Out of memory");
rel = (arelent *) xmalloc (sizeof (arelent));
rel->sym_ptr_ptr = &fixp->fx_addsy->bsym;
rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
if (fixp->fx_pcrel)

View File

@ -44,7 +44,7 @@ const char *m68k_comment_chars = "|";
first line of the input file. This is because the compiler outputs
#NO_APP at the beginning of its output. */
/* Also note that comments like this one will always work. */
const char line_comment_chars[] = "#";
const char line_comment_chars[] = "#*";
const char line_separator_chars[] = "";
@ -856,8 +856,7 @@ tc_gen_reloc (section, fixp)
#undef F
#undef MAP
reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent));
assert (reloc != 0);
reloc = (arelent *) xmalloc (sizeof (arelent));
reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
#ifndef OBJ_ELF
@ -904,7 +903,6 @@ m68k_ip (instring)
char c;
int losing;
int opsfound;
char *crack_operand ();
LITTLENUM_TYPE words[6];
LITTLENUM_TYPE *wordp;
unsigned long ok_arch = 0;
@ -3370,6 +3368,7 @@ md_assemble (str)
n = 1;
break;
case 'w':
case 'W':
n = 2;
break;
case 'l':

View File

@ -1,6 +1,6 @@
/* tc-mn10300.c -- Assembler code for the Matsushita 10300
Copyright (C) 1996 Free Software Foundation.
Copyright (C) 1996, 1997 Free Software Foundation.
This file is part of GAS, the GNU Assembler.
@ -53,6 +53,32 @@ const char EXP_CHARS[] = "eE";
const char FLT_CHARS[] = "dD";
const relax_typeS md_relax_table[] = {
/* bCC relaxing */
{0x7f, -0x80, 2, 1},
{0x7fff, -0x8000, 5, 2},
{0x7fffffff, -0x80000000, 7, 0},
/* bCC relaxing (uncommon cases) */
{0x7f, -0x80, 3, 4},
{0x7fff, -0x8000, 6, 5},
{0x7fffffff, -0x80000000, 8, 0},
/* call relaxing */
{0x7fff, -0x8000, 5, 7},
{0x7fffffff, -0x80000000, 7, 0},
/* calls relaxing */
{0x7fff, -0x8000, 4, 9},
{0x7fffffff, -0x80000000, 6, 0},
/* jmp relaxing */
{0x7f, -0x80, 2, 11},
{0x7fff, -0x8000, 3, 12},
{0x7fffffff, -0x80000000, 5, 0},
};
/* local functions */
static void mn10300_insert_operand PARAMS ((unsigned long *, unsigned long *,
const struct mn10300_operand *,
@ -361,8 +387,285 @@ md_convert_frag (abfd, sec, fragP)
asection *sec;
fragS *fragP;
{
/* printf ("call to md_convert_frag \n"); */
abort ();
static unsigned long label_count = 0;
char buf[40];
subseg_change (sec, 0);
if (fragP->fr_subtype == 0)
{
fix_new (fragP, fragP->fr_fix + 1, 1, fragP->fr_symbol,
fragP->fr_offset + 1, 1, BFD_RELOC_8_PCREL);
fragP->fr_var = 0;
fragP->fr_fix += 2;
}
else if (fragP->fr_subtype == 1)
{
/* Reverse the condition of the first branch. */
int offset = fragP->fr_fix;
int opcode = fragP->fr_literal[offset] & 0xff;
switch (opcode)
{
case 0xc8:
opcode = 0xc9;
break;
case 0xc9:
opcode = 0xc8;
break;
case 0xc0:
opcode = 0xc2;
break;
case 0xc2:
opcode = 0xc0;
break;
case 0xc3:
opcode = 0xc1;
break;
case 0xc1:
opcode = 0xc3;
break;
case 0xc4:
opcode = 0xc6;
break;
case 0xc6:
opcode = 0xc4;
break;
case 0xc7:
opcode = 0xc5;
break;
case 0xc5:
opcode = 0xc7;
break;
default:
abort ();
}
fragP->fr_literal[offset] = opcode;
/* Create a fixup for the reversed conditional branch. */
sprintf (buf, "%s_%d", FAKE_LABEL_NAME, label_count++);
fix_new (fragP, fragP->fr_fix + 1, 1,
symbol_new (buf, sec, 0, fragP->fr_next),
fragP->fr_offset + 1, 1, BFD_RELOC_8_PCREL);
/* Now create the unconditional branch + fixup to the
final target. */
fragP->fr_literal[offset + 2] = 0xcc;
fix_new (fragP, fragP->fr_fix + 3, 2, fragP->fr_symbol,
fragP->fr_offset + 1, 1, BFD_RELOC_16_PCREL);
fragP->fr_var = 0;
fragP->fr_fix += 5;
}
else if (fragP->fr_subtype == 2)
{
/* Reverse the condition of the first branch. */
int offset = fragP->fr_fix;
int opcode = fragP->fr_literal[offset] & 0xff;
switch (opcode)
{
case 0xc8:
opcode = 0xc9;
break;
case 0xc9:
opcode = 0xc8;
break;
case 0xc0:
opcode = 0xc2;
break;
case 0xc2:
opcode = 0xc0;
break;
case 0xc3:
opcode = 0xc1;
break;
case 0xc1:
opcode = 0xc3;
break;
case 0xc4:
opcode = 0xc6;
break;
case 0xc6:
opcode = 0xc4;
break;
case 0xc7:
opcode = 0xc5;
break;
case 0xc5:
opcode = 0xc7;
break;
default:
abort ();
}
fragP->fr_literal[offset] = opcode;
/* Create a fixup for the reversed conditional branch. */
sprintf (buf, "%s_%d", FAKE_LABEL_NAME, label_count++);
fix_new (fragP, fragP->fr_fix + 1, 1,
symbol_new (buf, sec, 0, fragP->fr_next),
fragP->fr_offset + 1, 1, BFD_RELOC_8_PCREL);
/* Now create the unconditional branch + fixup to the
final target. */
fragP->fr_literal[offset + 2] = 0xdc;
fix_new (fragP, fragP->fr_fix + 3, 4, fragP->fr_symbol,
fragP->fr_offset + 1, 1, BFD_RELOC_32_PCREL);
fragP->fr_var = 0;
fragP->fr_fix += 7;
}
else if (fragP->fr_subtype == 3)
{
fix_new (fragP, fragP->fr_fix + 2, 1, fragP->fr_symbol,
fragP->fr_offset + 2, 1, BFD_RELOC_8_PCREL);
fragP->fr_var = 0;
fragP->fr_fix += 3;
}
else if (fragP->fr_subtype == 4)
{
/* Reverse the condition of the first branch. */
int offset = fragP->fr_fix;
int opcode = fragP->fr_literal[offset + 1] & 0xff;
switch (opcode)
{
case 0xe8:
opcode = 0xe9;
break;
case 0xe9:
opcode = 0xe8;
break;
case 0xea:
opcode = 0xeb;
break;
case 0xeb:
opcode = 0xea;
break;
default:
abort ();
}
fragP->fr_literal[offset + 1] = opcode;
/* Create a fixup for the reversed conditional branch. */
sprintf (buf, "%s_%d", FAKE_LABEL_NAME, label_count++);
fix_new (fragP, fragP->fr_fix + 2, 1,
symbol_new (buf, sec, 0, fragP->fr_next),
fragP->fr_offset + 2, 1, BFD_RELOC_8_PCREL);
/* Now create the unconditional branch + fixup to the
final target. */
fragP->fr_literal[offset + 3] = 0xcc;
fix_new (fragP, fragP->fr_fix + 4, 2, fragP->fr_symbol,
fragP->fr_offset + 1, 1, BFD_RELOC_16_PCREL);
fragP->fr_var = 0;
fragP->fr_fix += 6;
}
else if (fragP->fr_subtype == 5)
{
/* Reverse the condition of the first branch. */
int offset = fragP->fr_fix;
int opcode = fragP->fr_literal[offset + 1] & 0xff;
switch (opcode)
{
case 0xe8:
opcode = 0xe9;
break;
case 0xea:
opcode = 0xeb;
break;
case 0xeb:
opcode = 0xea;
break;
default:
abort ();
}
fragP->fr_literal[offset + 1] = opcode;
/* Create a fixup for the reversed conditional branch. */
sprintf (buf, "%s_%d", FAKE_LABEL_NAME, label_count++);
fix_new (fragP, fragP->fr_fix + 2, 1,
symbol_new (buf, sec, 0, fragP->fr_next),
fragP->fr_offset + 2, 1, BFD_RELOC_8_PCREL);
/* Now create the unconditional branch + fixup to the
final target. */
fragP->fr_literal[offset + 3] = 0xdc;
fix_new (fragP, fragP->fr_fix + 4, 4, fragP->fr_symbol,
fragP->fr_offset + 1, 1, BFD_RELOC_32_PCREL);
fragP->fr_var = 0;
fragP->fr_fix += 8;
}
else if (fragP->fr_subtype == 6)
{
int offset = fragP->fr_fix;
fragP->fr_literal[offset] = 0xcd;
fix_new (fragP, fragP->fr_fix + 1, 2, fragP->fr_symbol,
fragP->fr_offset + 1, 1, BFD_RELOC_16_PCREL);
fragP->fr_var = 0;
fragP->fr_fix += 5;
}
else if (fragP->fr_subtype == 7)
{
int offset = fragP->fr_fix;
fragP->fr_literal[offset] = 0xdd;
fragP->fr_literal[offset + 5] = fragP->fr_literal[offset + 3];
fragP->fr_literal[offset + 6] = fragP->fr_literal[offset + 4];
fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol,
fragP->fr_offset + 2, 1, BFD_RELOC_32_PCREL);
fragP->fr_var = 0;
fragP->fr_fix += 7;
}
else if (fragP->fr_subtype == 8)
{
int offset = fragP->fr_fix;
fragP->fr_literal[offset] = 0xfa;
fragP->fr_literal[offset + 1] = 0xff;
fix_new (fragP, fragP->fr_fix + 2, 2, fragP->fr_symbol,
fragP->fr_offset + 2, 1, BFD_RELOC_16_PCREL);
fragP->fr_var = 0;
fragP->fr_fix += 4;
}
else if (fragP->fr_subtype == 9)
{
int offset = fragP->fr_fix;
fragP->fr_literal[offset] = 0xfc;
fragP->fr_literal[offset + 1] = 0xff;
fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol,
fragP->fr_offset + 2, 1, BFD_RELOC_32_PCREL);
fragP->fr_var = 0;
fragP->fr_fix += 6;
}
else if (fragP->fr_subtype == 10)
{
fragP->fr_literal[fragP->fr_fix] = 0xca;
fix_new (fragP, fragP->fr_fix + 1, 1, fragP->fr_symbol,
fragP->fr_offset + 1, 1, BFD_RELOC_8_PCREL);
fragP->fr_var = 0;
fragP->fr_fix += 2;
}
else if (fragP->fr_subtype == 11)
{
int offset = fragP->fr_fix;
fragP->fr_literal[offset] = 0xcc;
fix_new (fragP, fragP->fr_fix + 1, 4, fragP->fr_symbol,
fragP->fr_offset + 1, 1, BFD_RELOC_16_PCREL);
fragP->fr_var = 0;
fragP->fr_fix += 3;
}
else if (fragP->fr_subtype == 12)
{
int offset = fragP->fr_fix;
fragP->fr_literal[offset] = 0xdc;
fix_new (fragP, fragP->fr_fix + 1, 4, fragP->fr_symbol,
fragP->fr_offset + 1, 1, BFD_RELOC_32_PCREL);
fragP->fr_var = 0;
fragP->fr_fix += 5;
}
else
abort ();
}
valueT
@ -412,7 +715,7 @@ md_assemble (str)
struct mn10300_opcode *opcode;
struct mn10300_opcode *next_opcode;
const unsigned char *opindex_ptr;
int next_opindex;
int next_opindex, relaxable;
unsigned long insn, extension, size = 0;
char *f;
int i;
@ -445,6 +748,7 @@ md_assemble (str)
char *hold;
int extra_shift = 0;
relaxable = 0;
fc = 0;
match = 0;
next_opindex = 0;
@ -472,6 +776,9 @@ md_assemble (str)
while (*str == ' ' || *str == ',')
++str;
if (operand->flags & MN10300_OPERAND_RELAX)
relaxable = 1;
/* Gather the operand. */
hold = input_line_pointer;
input_line_pointer = str;
@ -686,7 +993,8 @@ md_assemble (str)
/* If this operand can be promoted, and it doesn't
fit into the allocated bitfield for this insn,
then promote it (ie this opcode does not match). */
if (operand->flags & MN10300_OPERAND_PROMOTE
if (operand->flags
& (MN10300_OPERAND_PROMOTE | MN10300_OPERAND_RELAX)
&& ! check_operand (insn, operand, ex.X_add_number))
{
input_line_pointer = hold;
@ -778,192 +1086,244 @@ keep_going:
if (opcode->format == FMT_D4)
size = 6;
/* Allocate space for the instruction. */
f = frag_more (size);
if (relaxable && fc > 0)
{
int type;
/* Fill in bytes for the instruction. Note that opcode fields
are written big-endian, 16 & 32bit immediates are written
little endian. Egad. */
if (opcode->format == FMT_S0
|| opcode->format == FMT_S1
|| opcode->format == FMT_D0
|| opcode->format == FMT_D1)
{
number_to_chars_bigendian (f, insn, size);
}
else if (opcode->format == FMT_S2
&& opcode->opcode != 0xdf0000
&& opcode->opcode != 0xde0000)
{
/* A format S2 instruction that is _not_ "ret" and "retf". */
number_to_chars_bigendian (f, (insn >> 16) & 0xff, 1);
number_to_chars_littleendian (f + 1, insn & 0xffff, 2);
}
else if (opcode->format == FMT_S2)
{
/* This must be a ret or retf, which is written entirely in big-endian
format. */
number_to_chars_bigendian (f, insn, 3);
}
else if (opcode->format == FMT_S4
&& opcode->opcode != 0xdc000000)
{
/* This must be a format S4 "call" instruction. What a pain. */
unsigned long temp = (insn >> 8) & 0xffff;
number_to_chars_bigendian (f, (insn >> 24) & 0xff, 1);
number_to_chars_littleendian (f + 1, temp, 2);
number_to_chars_bigendian (f + 3, insn & 0xff, 1);
number_to_chars_bigendian (f + 4, extension & 0xff, 1);
}
else if (opcode->format == FMT_S4)
{
/* This must be a format S4 "jmp" instruction. */
unsigned long temp = ((insn & 0xffffff) << 8) | (extension & 0xff);
number_to_chars_bigendian (f, (insn >> 24) & 0xff, 1);
number_to_chars_littleendian (f + 1, temp, 4);
}
else if (opcode->format == FMT_S6)
{
unsigned long temp = ((insn & 0xffffff) << 8)
| ((extension >> 16) & 0xff);
number_to_chars_bigendian (f, (insn >> 24) & 0xff, 1);
number_to_chars_littleendian (f + 1, temp, 4);
number_to_chars_bigendian (f + 5, (extension >> 8) & 0xff, 1);
number_to_chars_bigendian (f + 6, extension & 0xff, 1);
}
else if (opcode->format == FMT_D2
&& opcode->opcode != 0xfaf80000
&& opcode->opcode != 0xfaf00000
&& opcode->opcode != 0xfaf40000)
{
/* A format D2 instruction where the 16bit immediate is
really a single 16bit value, not two 8bit values. */
number_to_chars_bigendian (f, (insn >> 16) & 0xffff, 2);
number_to_chars_littleendian (f + 2, insn & 0xffff, 2);
}
else if (opcode->format == FMT_D2)
{
/* A format D2 instruction where the 16bit immediate
is really two 8bit immediates. */
number_to_chars_bigendian (f, insn, 4);
}
else if (opcode->format == FMT_D4)
{
unsigned long temp = ((insn & 0xffff) << 16) | (extension & 0xffff);
number_to_chars_bigendian (f, (insn >> 16) & 0xffff, 2);
number_to_chars_littleendian (f + 2, temp, 4);
}
else if (opcode->format == FMT_D5)
{
unsigned long temp = ((insn & 0xffff) << 16) | ((extension >> 8) & 0xffff);
number_to_chars_bigendian (f, (insn >> 16) & 0xffff, 2);
number_to_chars_littleendian (f + 2, temp, 4);
number_to_chars_bigendian (f + 6, extension & 0xff, 1);
}
/* Create any fixups. */
for (i = 0; i < fc; i++)
{
const struct mn10300_operand *operand;
operand = &mn10300_operands[fixups[i].opindex];
if (fixups[i].reloc != BFD_RELOC_UNUSED)
{
reloc_howto_type *reloc_howto;
int size;
int offset;
fixS *fixP;
reloc_howto = bfd_reloc_type_lookup (stdoutput, fixups[i].reloc);
if (!reloc_howto)
abort();
size = bfd_get_reloc_size (reloc_howto);
if (size < 1 || size > 4)
abort();
offset = 4 - size;
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset, size,
&fixups[i].exp,
reloc_howto->pc_relative,
fixups[i].reloc);
}
/* bCC */
if (size == 2)
type = 0;
/* call */
else if (size == 5)
type = 6;
/* calls */
else if (size == 4)
type = 8;
/* jmp */
else if (size == 3 && opcode->opcode == 0xcc0000)
type = 10;
/* bCC (uncommon cases) */
else
type = 3;
f = frag_var (rs_machine_dependent, 8, 8 - size, type,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
(char *)fixups[0].opindex);
/* This is pretty hokey. We basically just care about the
opcode, so we have to write out the first word big endian.
The exception is "call", which has two operands that we
care about.
The first operand (the register list) happens to be in the
first instruction word, and will be in the right place if
we output the first word in big endian mode.
The second operand (stack size) is in the extension word,
and we want it to appear as the first character in the extension
word (as it appears in memory). Luckily, writing the extension
word in big endian format will do what we want. */
number_to_chars_bigendian (f, insn, size > 4 ? 4 : size);
if (size > 8)
{
int reloc, pcrel, reloc_size, offset;
fixS *fixP;
number_to_chars_bigendian (f + 4, extension, 4);
number_to_chars_bigendian (f + 8, 0, size - 8);
}
else if (size > 4)
number_to_chars_bigendian (f + 4, extension, size - 4);
}
else
{
/* Allocate space for the instruction. */
f = frag_more (size);
reloc = BFD_RELOC_NONE;
/* How big is the reloc? Remember SPLIT relocs are
implicitly 32bits. */
if ((operand->flags & MN10300_OPERAND_SPLIT) != 0)
reloc_size = 32;
/* Fill in bytes for the instruction. Note that opcode fields
are written big-endian, 16 & 32bit immediates are written
little endian. Egad. */
if (opcode->format == FMT_S0
|| opcode->format == FMT_S1
|| opcode->format == FMT_D0
|| opcode->format == FMT_D1)
{
number_to_chars_bigendian (f, insn, size);
}
else if (opcode->format == FMT_S2
&& opcode->opcode != 0xdf0000
&& opcode->opcode != 0xde0000)
{
/* A format S2 instruction that is _not_ "ret" and "retf". */
number_to_chars_bigendian (f, (insn >> 16) & 0xff, 1);
number_to_chars_littleendian (f + 1, insn & 0xffff, 2);
}
else if (opcode->format == FMT_S2)
{
/* This must be a ret or retf, which is written entirely in
big-endian format. */
number_to_chars_bigendian (f, insn, 3);
}
else if (opcode->format == FMT_S4
&& opcode->opcode != 0xdc000000)
{
/* This must be a format S4 "call" instruction. What a pain. */
unsigned long temp = (insn >> 8) & 0xffff;
number_to_chars_bigendian (f, (insn >> 24) & 0xff, 1);
number_to_chars_littleendian (f + 1, temp, 2);
number_to_chars_bigendian (f + 3, insn & 0xff, 1);
number_to_chars_bigendian (f + 4, extension & 0xff, 1);
}
else if (opcode->format == FMT_S4)
{
/* This must be a format S4 "jmp" instruction. */
unsigned long temp = ((insn & 0xffffff) << 8) | (extension & 0xff);
number_to_chars_bigendian (f, (insn >> 24) & 0xff, 1);
number_to_chars_littleendian (f + 1, temp, 4);
}
else if (opcode->format == FMT_S6)
{
unsigned long temp = ((insn & 0xffffff) << 8)
| ((extension >> 16) & 0xff);
number_to_chars_bigendian (f, (insn >> 24) & 0xff, 1);
number_to_chars_littleendian (f + 1, temp, 4);
number_to_chars_bigendian (f + 5, (extension >> 8) & 0xff, 1);
number_to_chars_bigendian (f + 6, extension & 0xff, 1);
}
else if (opcode->format == FMT_D2
&& opcode->opcode != 0xfaf80000
&& opcode->opcode != 0xfaf00000
&& opcode->opcode != 0xfaf40000)
{
/* A format D2 instruction where the 16bit immediate is
really a single 16bit value, not two 8bit values. */
number_to_chars_bigendian (f, (insn >> 16) & 0xffff, 2);
number_to_chars_littleendian (f + 2, insn & 0xffff, 2);
}
else if (opcode->format == FMT_D2)
{
/* A format D2 instruction where the 16bit immediate
is really two 8bit immediates. */
number_to_chars_bigendian (f, insn, 4);
}
else if (opcode->format == FMT_D4)
{
unsigned long temp = ((insn & 0xffff) << 16) | (extension & 0xffff);
number_to_chars_bigendian (f, (insn >> 16) & 0xffff, 2);
number_to_chars_littleendian (f + 2, temp, 4);
}
else if (opcode->format == FMT_D5)
{
unsigned long temp = ((insn & 0xffff) << 16)
| ((extension >> 8) & 0xffff);
number_to_chars_bigendian (f, (insn >> 16) & 0xffff, 2);
number_to_chars_littleendian (f + 2, temp, 4);
number_to_chars_bigendian (f + 6, extension & 0xff, 1);
}
/* Create any fixups. */
for (i = 0; i < fc; i++)
{
const struct mn10300_operand *operand;
operand = &mn10300_operands[fixups[i].opindex];
if (fixups[i].reloc != BFD_RELOC_UNUSED)
{
reloc_howto_type *reloc_howto;
int size;
int offset;
fixS *fixP;
reloc_howto = bfd_reloc_type_lookup (stdoutput, fixups[i].reloc);
if (!reloc_howto)
abort();
size = bfd_get_reloc_size (reloc_howto);
if (size < 1 || size > 4)
abort();
offset = 4 - size;
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset,
size, &fixups[i].exp,
reloc_howto->pc_relative,
fixups[i].reloc);
}
else
reloc_size = operand->bits;
{
int reloc, pcrel, reloc_size, offset;
fixS *fixP;
/* Is the reloc pc-relative? */
pcrel = (operand->flags & MN10300_OPERAND_PCREL) != 0;
reloc = BFD_RELOC_NONE;
/* How big is the reloc? Remember SPLIT relocs are
implicitly 32bits. */
if ((operand->flags & MN10300_OPERAND_SPLIT) != 0)
reloc_size = 32;
else
reloc_size = operand->bits;
/* Gross. This disgusting hack is to make sure we
get the right offset for the 16/32 bit reloc in
"call" instructions. Basically they're a pain
because the reloc isn't at the end of the instruction. */
if ((size == 5 || size == 7)
&& (((insn >> 24) & 0xff) == 0xcd
|| ((insn >> 24) & 0xff) == 0xdd))
size -= 2;
/* Is the reloc pc-relative? */
pcrel = (operand->flags & MN10300_OPERAND_PCREL) != 0;
/* Similarly for certain bit instructions which don't
hav their 32bit reloc at the tail of the instruction. */
if (size == 7
&& (((insn >> 16) & 0xffff) == 0xfe00
|| ((insn >> 16) & 0xffff) == 0xfe01
|| ((insn >> 16) & 0xffff) == 0xfe02))
size -= 1;
/* Gross. This disgusting hack is to make sure we
get the right offset for the 16/32 bit reloc in
"call" instructions. Basically they're a pain
because the reloc isn't at the end of the instruction. */
if ((size == 5 || size == 7)
&& (((insn >> 24) & 0xff) == 0xcd
|| ((insn >> 24) & 0xff) == 0xdd))
size -= 2;
/* Similarly for certain bit instructions which don't
hav their 32bit reloc at the tail of the instruction. */
if (size == 7
&& (((insn >> 16) & 0xffff) == 0xfe00
|| ((insn >> 16) & 0xffff) == 0xfe01
|| ((insn >> 16) & 0xffff) == 0xfe02))
size -= 1;
offset = size - reloc_size / 8;
offset = size - reloc_size / 8;
/* Choose a proper BFD relocation type. */
if (pcrel)
{
if (reloc_size == 32)
reloc = BFD_RELOC_32_PCREL;
else if (reloc_size == 16)
reloc = BFD_RELOC_16_PCREL;
else if (reloc_size == 8)
reloc = BFD_RELOC_8_PCREL;
/* Choose a proper BFD relocation type. */
if (pcrel)
{
if (reloc_size == 32)
reloc = BFD_RELOC_32_PCREL;
else if (reloc_size == 16)
reloc = BFD_RELOC_16_PCREL;
else if (reloc_size == 8)
reloc = BFD_RELOC_8_PCREL;
else
abort ();
}
else
abort ();
}
else
{
if (reloc_size == 32)
reloc = BFD_RELOC_32;
{
if (reloc_size == 32)
reloc = BFD_RELOC_32;
else if (reloc_size == 16)
reloc = BFD_RELOC_16;
else if (reloc_size == 8)
reloc = BFD_RELOC_8;
else
abort ();
}
/* Convert the size of the reloc into what fix_new_exp wants. */
reloc_size = reloc_size / 8;
if (reloc_size == 8)
reloc_size = 0;
else if (reloc_size == 16)
reloc = BFD_RELOC_16;
else if (reloc_size == 8)
reloc = BFD_RELOC_8;
else
abort ();
reloc_size = 1;
else if (reloc_size == 32)
reloc_size = 2;
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset,
reloc_size, &fixups[i].exp, pcrel,
((bfd_reloc_code_real_type) reloc));
if (pcrel)
fixP->fx_offset += offset;
}
/* Convert the size of the reloc into what fix_new_exp wants. */
reloc_size = reloc_size / 8;
if (reloc_size == 8)
reloc_size = 0;
else if (reloc_size == 16)
reloc_size = 1;
else if (reloc_size == 32)
reloc_size = 2;
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset,
reloc_size, &fixups[i].exp, pcrel,
((bfd_reloc_code_real_type) reloc));
if (pcrel)
fixP->fx_offset += offset;
}
}
}
@ -978,7 +1338,7 @@ tc_gen_reloc (seg, fixp)
fixS *fixp;
{
arelent *reloc;
reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent));
reloc = (arelent *) xmalloc (sizeof (arelent));
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
if (reloc->howto == (reloc_howto_type *) NULL)
@ -1009,7 +1369,43 @@ md_estimate_size_before_relax (fragp, seg)
fragS *fragp;
asection *seg;
{
return 0;
if (fragp->fr_subtype == 0)
return 2;
if (fragp->fr_subtype == 3)
return 3;
if (fragp->fr_subtype == 6)
{
if (!S_IS_DEFINED (fragp->fr_symbol)
|| seg != S_GET_SEGMENT (fragp->fr_symbol))
{
fragp->fr_subtype = 7;
return 7;
}
else
return 5;
}
if (fragp->fr_subtype == 8)
{
if (!S_IS_DEFINED (fragp->fr_symbol)
|| seg != S_GET_SEGMENT (fragp->fr_symbol))
{
fragp->fr_subtype = 9;
return 6;
}
else
return 4;
}
if (fragp->fr_subtype == 10)
{
if (!S_IS_DEFINED (fragp->fr_symbol)
|| seg != S_GET_SEGMENT (fragp->fr_symbol))
{
fragp->fr_subtype = 12;
return 5;
}
else
return 2;
}
}
long

View File

@ -1,5 +1,5 @@
/* tc-sparc.c -- Assemble for the SPARC
Copyright (C) 1989, 90-95, 1996 Free Software Foundation, Inc.
Copyright (C) 1989, 90-96, 1997 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@ -355,7 +355,7 @@ s_reserve (ignore)
subseg_set (bss_section, 1); /* switch to bss */
if (align)
frag_align (align, 0); /* do alignment */
frag_align (align, 0, 0); /* do alignment */
/* detach from old frag */
if (S_GET_SEGMENT(symbolP) == bss_section)
@ -472,7 +472,7 @@ s_common (ignore)
record_alignment (bss_section, align);
subseg_set (bss_section, 0);
if (align)
frag_align (align, 0);
frag_align (align, 0, 0);
if (S_GET_SEGMENT (symbolP) == bss_section)
symbolP->sy_frag->fr_symbol = 0;
symbolP->sy_frag = frag_now;
@ -515,6 +515,11 @@ s_common (ignore)
;
goto allocate_common;
}
#ifdef BFD_ASSEMBLER
symbolP->bsym->flags |= BSF_OBJECT;
#endif
demand_empty_rest_of_line ();
return;
@ -2613,8 +2618,7 @@ tc_gen_reloc (section, fixp)
arelent *reloc;
bfd_reloc_code_real_type code;
reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent));
assert (reloc != 0);
reloc = (arelent *) xmalloc (sizeof (arelent));
reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@ -2972,7 +2976,7 @@ md_show_usage (stream)
fprintf (stream, "\
specify variant of SPARC architecture\n\
-bump warn when assembler switches architectures\n\
-sparc ignored\n
-sparc ignored\n\
--enforce-aligned-data force .long, etc., to be aligned correctly\n");
#ifdef OBJ_AOUT
fprintf (stream, "\

View File

@ -851,8 +851,7 @@ write_relocs (abfd, sec, xxx)
#ifndef RELOC_EXPANSION_POSSIBLE
/* Set up reloc information as well. */
relocs = (arelent **) bfd_alloc_by_size_t (stdoutput,
n * sizeof (arelent *));
relocs = (arelent **) xmalloc (n * sizeof (arelent *));
memset ((char*)relocs, 0, n * sizeof (arelent*));
i = 0;
@ -913,7 +912,7 @@ write_relocs (abfd, sec, xxx)
as_bad_where (fixp->fx_file, fixp->fx_line, "relocation overflow");
break;
default:
as_fatal ("%s:%u: bad return from bfd_perform_relocation",
as_fatal ("%s:%u: bad return from bfd_install_relocation",
fixp->fx_file, fixp->fx_line);
}
relocs[i++] = reloc;
@ -921,8 +920,7 @@ write_relocs (abfd, sec, xxx)
#else
n = n * MAX_RELOC_EXPANSION;
/* Set up reloc information as well. */
relocs = (arelent **) bfd_alloc_by_size_t (stdoutput,
n * sizeof (arelent *));
relocs = (arelent **) xmalloc (stdoutput, n * sizeof (arelent *));
i = 0;
for (fixp = seginfo->fix_root; fixp != (fixS *) NULL; fixp = fixp->fx_next)
@ -975,7 +973,7 @@ write_relocs (abfd, sec, xxx)
"relocation overflow");
break;
default:
as_fatal ("%s:%u: bad return from bfd_perform_relocation",
as_fatal ("%s:%u: bad return from bfd_install_relocation",
fixp->fx_file, fixp->fx_line);
}
}
@ -1339,7 +1337,7 @@ write_object_file ()
for (frchainP = frchain_root; frchainP; frchainP = frchainP->frch_next)
{
subseg_set (frchainP->frch_seg, frchainP->frch_subseg);
frag_align (SUB_SEGMENT_ALIGN (now_seg), NOP_OPCODE);
frag_align (SUB_SEGMENT_ALIGN (now_seg), NOP_OPCODE, 0);
/* frag_align will have left a new frag.
Use this last frag for an empty ".fill".
@ -2037,13 +2035,18 @@ relax_segment (segment_frag_root, segment)
case rs_align:
case rs_align_code:
{
int offset = relax_align (address, (int) fragP->fr_offset);
addressT offset = relax_align (address, (int) fragP->fr_offset);
if (fragP->fr_subtype != 0 && offset > fragP->fr_subtype)
offset = 0;
if (offset % fragP->fr_var != 0)
{
as_bad ("alignment padding (%d bytes) not a multiple of %ld",
offset, (long) fragP->fr_var);
as_bad ("alignment padding (%lu bytes) not a multiple of %ld",
(unsigned long) offset, (long) fragP->fr_var);
offset -= (offset % fragP->fr_var);
}
address += offset;
}
break;
@ -2086,8 +2089,8 @@ relax_segment (segment_frag_root, segment)
for (fragP = segment_frag_root; fragP; fragP = fragP->fr_next)
{
long growth = 0;
unsigned long was_address;
long offset;
addressT was_address;
offsetT offset;
symbolS *symbolP;
was_address = fragP->fr_address;
@ -2164,12 +2167,24 @@ relax_segment (segment_frag_root, segment)
#endif
case rs_align:
case rs_align_code:
growth = (relax_align ((relax_addressT) (address
+ fragP->fr_fix),
(int) offset)
- relax_align ((relax_addressT) (was_address
+ fragP->fr_fix),
(int) offset));
{
addressT oldoff, newoff;
oldoff = relax_align (was_address + fragP->fr_fix,
(int) offset);
newoff = relax_align (address + fragP->fr_fix,
(int) offset);
if (fragP->fr_subtype != 0)
{
if (oldoff > fragP->fr_subtype)
oldoff = 0;
if (newoff > fragP->fr_subtype)
newoff = 0;
}
growth = newoff - oldoff;
}
break;
case rs_org: