Commit 0a9ef439 authored by Richard Henderson's avatar Richard Henderson

* as.h (rs_align_test): New.

	* frags.c (NOP_OPCODE): Move default from read.c.
	(MAX_MEM_FOR_RS_ALIGN_CODE): New default.
	(frag_align_code): New.
	* frags.h (frag_align_code): Declare.
	* read.c (NOP_OPCODE): Remove.
	(do_align): Use frag_align_code.
	* write.c (NOP_OPCODE): Remove.
	(get_recorded_alignment): New.
	(cvt_frag_to_fill): Handle rs_align_test.
	(relax_segment): Likewise.
	(subsegs_finish): Align last subseg in section to the
	section alignment.  Use frag_align_code.
	* write.h (get_recorded_alignment): Declare.
	* config/obj-coff.c (size_section): Handle rs_align_test.
	(fill_section, fixup_mdeps): Likewise.
	(write_object_file): Use frag_align_code.

	* config/tc-alpha.c (alpha_align): Use frag_align_code.
	(alpha_handle_align): New.
	* config/tc-alpha.h (HANDLE_ALIGN): New.
	(MAX_MEM_FOR_RS_ALIGN_CODE): New.

	* config/tc-i386.h (md_do_align): Use frag_align_code.
	(MAX_MEM_FOR_RS_ALIGN_CODE): New.

	* config/tc-ia64.c (ia64_md_do_align): Don't do code alignment.
	(ia64_handle_align): New.
	* config/tc-ia64.h (HANDLE_ALIGN): New.
	(MAX_MEM_FOR_RS_ALIGN_CODE): New.

	* config/tc-m32r.c (m32r_do_align): Remove.
	(m32r_handle_align): New.
	(fill_insn): Use frag_align_code.
	* config/tc-m32r.h (md_do_align): Remove.
	(HANDLE_ALIGN, MAX_MEM_FOR_RS_ALIGN_CODE): New.
	* config/tc-m88k.c, config/tc-m88k.h: Similarly.
	* config/tc-mips.c, config/tc-mips.h: Similarly.

	* config/tc-sh.c (sh_cons_align): Use rs_align_test.
	(sh_handle_align): Likewise.  Handle rs_align_code.
	(sh_do_align): Remove.
	* config/tc-sh.h (md_do_align): Remove.
	(MAX_MEM_FOR_RS_ALIGN_CODE): New.

	* config/tc-sparc.c (sparc_cons_align): Use rs_align_test.
	(sparc_handle_align): Likewise.  Handle rs_align_code.
	* config/tc-sparc.h (md_do_align): Remove.
	(MAX_MEM_FOR_RS_ALIGN_CODE): New.
parent bda9cb72
2000-12-28 Richard Henderson <rth@redhat.com>
* as.h (rs_align_test): New.
* frags.c (NOP_OPCODE): Move default from read.c.
(MAX_MEM_FOR_RS_ALIGN_CODE): New default.
(frag_align_code): New.
* frags.h (frag_align_code): Declare.
* read.c (NOP_OPCODE): Remove.
(do_align): Use frag_align_code.
* write.c (NOP_OPCODE): Remove.
(get_recorded_alignment): New.
(cvt_frag_to_fill): Handle rs_align_test.
(relax_segment): Likewise.
(subsegs_finish): Align last subseg in section to the
section alignment. Use frag_align_code.
* write.h (get_recorded_alignment): Declare.
* config/obj-coff.c (size_section): Handle rs_align_test.
(fill_section, fixup_mdeps): Likewise.
(write_object_file): Use frag_align_code.
* config/tc-alpha.c (alpha_align): Use frag_align_code.
(alpha_handle_align): New.
* config/tc-alpha.h (HANDLE_ALIGN): New.
(MAX_MEM_FOR_RS_ALIGN_CODE): New.
* config/tc-i386.h (md_do_align): Use frag_align_code.
(MAX_MEM_FOR_RS_ALIGN_CODE): New.
* config/tc-ia64.c (ia64_md_do_align): Don't do code alignment.
(ia64_handle_align): New.
* config/tc-ia64.h (HANDLE_ALIGN): New.
(MAX_MEM_FOR_RS_ALIGN_CODE): New.
* config/tc-m32r.c (m32r_do_align): Remove.
(m32r_handle_align): New.
(fill_insn): Use frag_align_code.
* config/tc-m32r.h (md_do_align): Remove.
(HANDLE_ALIGN, MAX_MEM_FOR_RS_ALIGN_CODE): New.
* config/tc-m88k.c, config/tc-m88k.h: Similarly.
* config/tc-mips.c, config/tc-mips.h: Similarly.
* config/tc-sh.c (sh_cons_align): Use rs_align_test.
(sh_handle_align): Likewise. Handle rs_align_code.
(sh_do_align): Remove.
* config/tc-sh.h (md_do_align): Remove.
(MAX_MEM_FOR_RS_ALIGN_CODE): New.
* config/tc-sparc.c (sparc_cons_align): Use rs_align_test.
(sparc_handle_align): Likewise. Handle rs_align_code.
* config/tc-sparc.h (md_do_align): Remove.
(MAX_MEM_FOR_RS_ALIGN_CODE): New.
2000-12-22 DJ Delorie <dj@redhat.com>
* config/tc-d10v.c (md_assemble): set prev_seg and prev_subseg
......
......@@ -364,6 +364,10 @@ enum _relax_state {
bytes to skip when aligning, or 0 if there is no maximum. */
rs_align_code,
/* Test for alignment. Like rs_align, but used by several targets
to warn if data is not properly aligned. */
rs_align_test,
/* Org: Fr_offset, fr_symbol: address. 1 variable char: fill
character. */
rs_org,
......
......@@ -1826,6 +1826,7 @@ size_section (abfd, idx)
break;
case rs_align:
case rs_align_code:
case rs_align_test:
{
addressT off;
......@@ -2135,6 +2136,7 @@ fill_section (abfd, h, file_cursor)
case rs_fill:
case rs_align:
case rs_align_code:
case rs_align_test:
case rs_org:
if (frag->fr_fix)
{
......@@ -3443,12 +3445,15 @@ write_object_file ()
md_do_align (SUB_SEGMENT_ALIGN (now_seg), (char *) NULL, 0, 0,
alignment_done);
#endif
frag_align (SUB_SEGMENT_ALIGN (now_seg),
subseg_text_p (now_seg) ? NOP_OPCODE : 0,
0);
if (subseg_text_p (now_seg))
frag_align_code (SUB_SEGMENT_ALIGN (now_seg), 0);
else
frag_align (SUB_SEGMENT_ALIGN (now_seg), 0, 0);
#ifdef md_do_align
alignment_done:
#endif
frag_wane (frag_now);
frag_now->fr_fix = 0;
know (frag_now->fr_next == NULL);
......@@ -4092,6 +4097,7 @@ fixup_mdeps (frags, h, this_segment)
{
case rs_align:
case rs_align_code:
case rs_align_test:
case rs_org:
#ifdef HANDLE_ALIGN
HANDLE_ALIGN (frags);
......
......@@ -5673,27 +5673,8 @@ alpha_align (n, pfill, label, force)
if (pfill == NULL)
{
if (n > 2
&& (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
{
static char const unop[4] = { 0x00, 0x00, 0xe0, 0x2f };
static char const nopunop[8] = {
0x1f, 0x04, 0xff, 0x47,
0x00, 0x00, 0xe0, 0x2f
};
/* First, make sure we're on a four-byte boundary, in case
someone has been putting .byte values into the text
section. The DEC assembler silently fills with unaligned
no-op instructions. This will zero-fill, then nop-fill
with proper alignment. */
if (alpha_current_align < 2)
frag_align (2, 0, 0);
if (alpha_current_align < 3)
frag_align_pattern (3, unop, sizeof unop, 0);
if (n > 3)
frag_align_pattern (n, nopunop, sizeof nopunop, 0);
}
if (subseg_text_p (now_seg))
frag_align_code (n, 0);
else
frag_align (n, 0, 0);
}
......@@ -5710,10 +5691,55 @@ alpha_align (n, pfill, label, force)
record_alignment (now_seg, n);
/* ??? if alpha_flag_relax && force && elf, record the requested alignment
/* ??? If alpha_flag_relax && force && elf, record the requested alignment
in a reloc for the linker to see. */
}
/* This is called from HANDLE_ALIGN in write.c. Fill in the contents
of an rs_align_code fragment. */
void
alpha_handle_align (fragp)
fragS *fragp;
{
static char const unop[4] = { 0x00, 0x00, 0xe0, 0x2f };
static char const nopunop[8] = {
0x1f, 0x04, 0xff, 0x47,
0x00, 0x00, 0xe0, 0x2f
};
int bytes, fix;
char *p;
if (fragp->fr_type != rs_align_code)
return;
bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
p = fragp->fr_literal + fragp->fr_fix;
fix = 0;
if (bytes & 3)
{
fix = bytes & 3;
memset (p, 0, fix);
p += fix;
bytes -= fix;
}
if (bytes & 4)
{
memcpy (p, unop, 4);
p += 4;
bytes -= 4;
fix += 4;
}
memcpy (p, nopunop, 8);
fragp->fr_fix += fix;
fragp->fr_var = 8;
}
/* The Alpha has support for some VAX floating point types, as well as for
IEEE floating point. We consider IEEE to be the primary floating point
format, and sneak in the VAX floating point support here. */
......
......@@ -90,6 +90,11 @@ extern void alpha_define_label PARAMS ((symbolS *));
#define md_cons_align(nbytes) alpha_cons_align (nbytes)
extern void alpha_cons_align PARAMS ((int));
#define HANDLE_ALIGN(fragp) alpha_handle_align (fragp)
extern void alpha_handle_align PARAMS ((struct frag *));
#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 8)
#ifdef OBJ_ECOFF
#define tc_frob_file_before_adjust() alpha_frob_file_before_adjust ()
extern void alpha_frob_file_before_adjust PARAMS ((void));
......
......@@ -505,13 +505,12 @@ if ((n) && !need_pass_2 \
&& (!(fill) || ((char)*(fill) == (char)0x90 && (len) == 1)) \
&& subseg_text_p (now_seg)) \
{ \
char *p; \
p = frag_var (rs_align_code, 15, 1, (relax_substateT) max, \
(symbolS *) 0, (offsetT) (n), (char *) 0); \
*p = 0x90; \
frag_align_code ((n), (max)); \
goto around; \
}
#define MAX_MEM_FOR_RS_ALIGN_CODE 15
extern void i386_align_code PARAMS ((fragS *, int));
#define HANDLE_ALIGN(fragP) \
......
......@@ -9768,42 +9768,52 @@ md_section_align (seg, size)
/* Handle ia64 specific semantics of the align directive. */
int
void
ia64_md_do_align (n, fill, len, max)
int n;
const char *fill;
int len ATTRIBUTE_UNUSED;
int max;
{
/* Fill any pending bundle with nops. */
if (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE)
if (subseg_text_p (now_seg))
ia64_flush_insns ();
}
/* When we align code in a text section, emit a bundle of 3 nops instead of
zero bytes. We can only do this if a multiple of 16 bytes was requested.
N is log base 2 of the requested alignment. */
if (fill == NULL
&& bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE
&& n > 4)
{
/* Use mfi bundle of nops with no stop bits. */
static const unsigned char be_nop[]
= { 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c};
static const unsigned char le_nop[]
= { 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00};
/* Make sure we are on a 16-byte boundary, in case someone has been
putting data into a text section. */
frag_align (4, 0, 0);
/* This is called from HANDLE_ALIGN in write.c. Fill in the contents
of an rs_align_code fragment. */
if (target_big_endian)
frag_align_pattern (n, be_nop, 16, max);
else
frag_align_pattern (n, le_nop, 16, max);
return 1;
void
ia64_handle_align (fragp)
fragS *fragp;
{
/* Use mfi bundle of nops with no stop bits. */
static const unsigned char be_nop[]
= { 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c};
static const unsigned char le_nop[]
= { 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00};
int bytes;
char *p;
if (fragp->fr_type != rs_align_code)
return;
bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
p = fragp->fr_literal + fragp->fr_fix;
/* Make sure we are on a 16-byte boundary, in case someone has been
putting data into a text section. */
if (bytes & 15)
{
int fix = bytes & 15;
memset (p, 0, fix);
p += fix;
bytes -= fix;
fragp->fr_fix += fix;
}
return 0;
memcpy (p, (target_big_endian ? be_nop : le_nop), 16);
fragp->fr_var = 16;
}
......@@ -83,7 +83,8 @@ extern void ia64_validate_fix PARAMS ((struct fix *fix));
extern char * ia64_canonicalize_symbol_name PARAMS ((char *));
extern flagword ia64_elf_section_flags PARAMS ((flagword, int, int));
extern long ia64_pcrel_from_section PARAMS ((struct fix *fix, segT sec));
extern int ia64_md_do_align PARAMS ((int, const char *, int, int));
extern void ia64_md_do_align PARAMS ((int, const char *, int, int));
extern void ia64_handle_align PARAMS ((fragS *f));
#define md_end() ia64_end_of_source ()
#define md_start_line_hook() ia64_start_line ()
......@@ -108,7 +109,10 @@ extern int ia64_md_do_align PARAMS ((int, const char *, int, int));
#define TC_CONS_FIX_NEW(f,o,l,e) ia64_cons_fix_new (f, o, l, e)
#define TC_VALIDATE_FIX(fix,seg,skip) ia64_validate_fix (fix)
#define MD_PCREL_FROM_SECTION(fix,sec) ia64_pcrel_from_section (fix, sec)
#define md_do_align(n,f,l,m,j) if (ia64_md_do_align (n,f,l,m)) goto j
#define md_do_align(n,f,l,m,j) ia64_md_do_align (n,f,l,m)
#define HANDLE_ALIGN(f) ia64_handle_align (f)
#define MAX_MEM_FOR_RS_ALIGN_CODE (15 + 16)
/* Call md_apply_fix3 with segment instead of md_apply_fix. */
#define MD_APPLY_FIX3
......
......@@ -327,54 +327,44 @@ const pseudo_typeS md_pseudo_table[] =
#define NOP_INSN 0x7000
#define PAR_NOP_INSN 0xf000 /* Can only be used in 2nd slot. */
/* When we align the .text section, insert the correct NOP pattern.
N is the power of 2 alignment. LEN is the length of pattern FILL.
MAX is the maximum number of characters to skip when doing the alignment,
or 0 if there is no maximum. */
/* This is called from HANDLE_ALIGN in write.c. Fill in the contents
of an rs_align_code fragment. */
int
m32r_do_align (n, fill, len, max)
int n;
const char *fill;
int len;
int max;
void
m32r_handle_align (fragp)
{
/* Only do this if the fill pattern wasn't specified. */
if (fill == NULL
&& subseg_text_p (now_seg)
/* Only do this special handling if aligning to at least a
4 byte boundary. */
&& n > 1
/* Only do this special handling if we're allowed to emit at
least two bytes. */
&& (max == 0 || max > 1))
{
static const unsigned char nop_pattern[] = { 0xf0, 0x00 };
static const unsigned char nop_pattern[] = { 0xf0, 0x00 };
static const unsigned char multi_nop_pattern[] = { 0x70, 0x00, 0xf0, 0x00 };
#if 0
/* First align to a 2 byte boundary, in case there is an odd .byte. */
/* FIXME: How much memory will cause gas to use when assembling a big
program? Perhaps we can avoid the frag_align call? */
frag_align (1, 0, 0);
#endif
/* Next align to a 4 byte boundary (we know n >= 2) using a parallel
nop. */
frag_align_pattern (2, nop_pattern, sizeof nop_pattern, 0);
/* If doing larger alignments use a repeating sequence of appropriate
nops. */
if (n > 2)
{
static const unsigned char multi_nop_pattern[] =
{ 0x70, 0x00, 0xf0, 0x00 };
frag_align_pattern (n, multi_nop_pattern, sizeof multi_nop_pattern,
max ? max - 2 : 0);
}
int bytes, fix;
char *p;
prev_insn.insn = NULL;
return 1;
if (fragp->fr_type != rs_align_code)
return;
bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
p = fragp->fr_literal + fragp->fr_fix;
fix = 0;
if (bytes & 1)
{
fix = 1;
*p++ = 0;
bytes--;
}
return 0;
if (bytes & 2)
{
memcpy (p, nop_pattern, 2);
p += 2;
bytes -= 2;
fix += 2;
}
memcpy (p, multi_nop_pattern, 4);
fragp->fr_fix += fix;
fragp->fr_var = 4;
}
/* If the last instruction was the first of 2 16 bit insns,
......@@ -390,7 +380,7 @@ static void
fill_insn (ignore)
int ignore;
{
(void) m32r_do_align (2, NULL, 0, 0);
frag_align_code (2, 0);
prev_insn.insn = NULL;
seen_relaxable_p = 0;
}
......
......@@ -61,11 +61,11 @@ m32r_relax_frag (fragP, stretch)
/* Account for nop if 32 bit insn falls on odd halfword boundary. */
#define TC_CGEN_MAX_RELAX(insn, len) (6)
/* Alignments are used to ensure 32 bit insns live on 32 bit boundaries, so
we use a special alignment function to insert the correct nop pattern. */
extern int m32r_do_align PARAMS ((int, const char *, int, int));
#define md_do_align(n, fill, len, max, l) \
if (m32r_do_align (n, fill, len, max)) goto l
/* Fill in rs_align_code fragments. */
extern void m32r_handle_align PARAMS ((fragS *));
#define HANDLE_ALIGN(f) m32r_handle_align (f)
#define MAX_MEM_FOR_RS_ALIGN_CODE (1 + 2 + 4)
#define MD_APPLY_FIX3
#define md_apply_fix3 gas_cgen_md_apply_fix3
......
......@@ -1427,23 +1427,34 @@ md_pcrel_from (fixp)
/*NOTREACHED*/
}
/* When we align the .init section, insert the correct NOP pattern. */
/* Fill in rs_align_code fragments. */
int
m88k_do_align (n, fill, max, len)
int n;
const char *fill;
int len;
int max;
void
m88k_handle_align (fragp)
fragS *fragp;
{
if (fill == NULL
&& strcmp (obj_segment_name (now_seg), ".init") == 0)
static const unsigned char nop_pattern[] = { 0xf4, 0x00, 0x58, 0x00 };
int bytes;
char *p;
if (fragp->fr_type != rs_align_code)
return;
bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
p = fragp->fr_literal + fragp->fr_fix;
if (bytes & 3)
{
static const unsigned char nop_pattern[] = { 0xf4, 0x00, 0x58, 0x00 };
frag_align_pattern (n, nop_pattern, sizeof (nop_pattern), max);
return 1;
int fix = bytes & 3;
memset (p, 0, fix);
p += fix;
bytes -= fix;
fragp->fr_fix += fix;
}
return 0;
memcpy (p, nop_pattern, 4);
fragp->fr_var = 4;
}
#endif /* M88KCOFF */
......@@ -100,9 +100,10 @@ struct reloc_info_m88k
#endif
#define SUB_SEGMENT_ALIGN(SEG) max (section_alignment[(int) (SEG)], 4)
/* We use a special alignment function to insert the correct nop
pattern in .init. */
extern int m88k_do_align PARAMS ((int, const char *, int, int));
#define md_do_align(n,fill,len,max,l) if (m88k_do_align(n,fill,max,len)) goto l
/* Fill in rs_align_code fragments. */
extern void m88k_handle_align PARAMS ((fragS *));
#define HANDLE_ALIGN(frag) m88k_handle_align (frag)
#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4)
#endif /* M88KCOFF */
......@@ -11550,34 +11550,37 @@ static procS cur_proc;
static procS *cur_proc_ptr;
static int numprocs;
/* When we align code in the .text section of mips16, use the correct two
byte nop pattern of 0x6500 (move $0,$0) */
/* Fill in an rs_align_code fragment. */
int
mips_do_align (n, fill, len, max)
int n;
const char *fill;
int len ATTRIBUTE_UNUSED;
int max;
void
mips_handle_align (fragp)
fragS *fragp;
{
if (fill == NULL
&& subseg_text_p (now_seg)
&& n > 1
&& mips_opts.mips16)
if (fragp->fr_type != rs_align_code)
return;
if (mips_opts.mips16)
{
static const unsigned char be_nop[] = { 0x65, 0x00 };
static const unsigned char le_nop[] = { 0x00, 0x65 };
frag_align (1, 0, 0);
int bytes;
char *p;
if (target_big_endian)
frag_align_pattern (n, be_nop, 2, max);
else
frag_align_pattern (n, le_nop, 2, max);
return 1;
bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
p = fragp->fr_literal + fragp->fr_fix;
if (bytes & 1)
{
*p++ = 0;
fragp->fr_fix += 1;
}
memcpy (p, (target_big_endian ? be_nop : le_nop), 2);
fragp->fr_var = 2;
}
return 0;
/* For mips32, a nop is a zero, which we trivially get by doing nothing. */
}
static void
......
......@@ -55,8 +55,10 @@ extern int mips_relax_frag PARAMS ((struct frag *, long));
#define md_undefined_symbol(name) (0)
#define md_operand(x)
extern int mips_do_align PARAMS ((int, const char *, int, int));
#define md_do_align(n,fill,len,max,l) if (mips_do_align (n,fill,len,max)) goto l
extern void mips_handle_align PARAMS ((struct frag *));
#define HANDLE_ALIGN(fragp) mips_handle_align (fragp)
#define MAX_MEM_FOR_RS_ALIGN_CODE (1 + 2)
/* We permit PC relative difference expressions when generating
embedded PIC code. */
......
......@@ -2582,7 +2582,7 @@ sh_cons_align (nbytes)
return;
}
p = frag_var (rs_align_code, 1, 1, (relax_substateT) 0,
p = frag_var (rs_align_test, 1, 1, (relax_substateT) 0,
(symbolS *) NULL, (offsetT) nalign, (char *) NULL);
record_alignment (now_seg, nalign);
......@@ -2596,17 +2596,47 @@ void
sh_handle_align (frag)
fragS *frag;
{
int bytes = frag->fr_next->fr_address - frag->fr_address - frag->fr_fix;
if (frag->fr_type == rs_align_code)
{
static const unsigned char big_nop_pattern[] = { 0x00, 0x09 };
static const unsigned char little_nop_pattern[] = { 0x09, 0x00 };
char *p = frag->fr_literal + frag->fr_fix;
if (bytes & 1)
{
*p++ = 0;
bytes--;
frag->fr_fix += 1;
}
if (target_big_endian)
{
memcpy (p, big_nop_pattern, sizeof big_nop_pattern);
frag->fr_var = sizeof big_nop_pattern;
}
else
{
memcpy (p, little_nop_pattern, sizeof little_nop_pattern);
frag->fr_var = sizeof little_nop_pattern;
}
}
else if (frag->fr_type == rs_align_test)
{
if (bytes != 0)
as_warn_where (frag->fr_file, frag->fr_line, _("misaligned data"));
}
if (sh_relax
&& frag->fr_type == rs_align
&& (frag->fr_type == rs_align
|| frag->fr_type == rs_align_code)
&& frag->fr_address + frag->fr_fix > 0
&& frag->fr_offset > 1
&& now_seg != bss_section)
fix_new (frag, frag->fr_fix, 2, &abs_symbol, frag->fr_offset, 0,
BFD_RELOC_SH_ALIGN);
if (frag->fr_type == rs_align_code
&& frag->fr_next->fr_address - frag->fr_address - frag->fr_fix != 0)
as_warn_where (frag->fr_file, frag->fr_line, _("misaligned data"));
}
/* This macro decides whether a particular reloc is an entry in a
......@@ -3082,36 +3112,6 @@ tc_coff_sizemachdep (frag)
#endif /* OBJ_COFF */
/* When we align the .text section, insert the correct NOP pattern. */
int
sh_do_align (n, fill, len, max)
int n;
const char *fill;
int len ATTRIBUTE_UNUSED;
int max;
{
if (fill == NULL
&& subseg_text_p (now_seg)
&& n > 1)
{
static const unsigned char big_nop_pattern[] = { 0x00, 0x09 };
static const unsigned char little_nop_pattern[] = { 0x09, 0x00 };
/* First align to a 2 byte boundary, in case there is an odd
.byte. */
frag_align (1, 0, 0);
if (target_big_endian)
frag_align_pattern (n, big_nop_pattern, sizeof big_nop_pattern, max);
else
frag_align_pattern (n, little_nop_pattern, sizeof little_nop_pattern,
max);
return 1;
}
return 0;
}
#ifndef BFD_ASSEMBLER
#ifdef OBJ_COFF
......
......@@ -53,6 +53,8 @@ extern void sh_cons_align PARAMS ((int));
#define HANDLE_ALIGN(frag) sh_handle_align (frag)
extern void sh_handle_align PARAMS ((fragS *));
#define MAX_MEM_FOR_RS_ALIGN_CODE (1 + 2)
/* We need to force out some relocations when relaxing. */
#define TC_FORCE_RELOCATION(fix) sh_force_relocation (fix)
extern int sh_force_relocation ();
......@@ -76,11 +78,6 @@ extern boolean sh_fix_adjustable PARAMS ((struct fix *));
extern const struct relax_type md_relax_table[];
#define TC_GENERIC_RELAX_TABLE md_relax_table
/* We use a special alignment function to insert the correct nop
pattern. */
extern int sh_do_align PARAMS ((int, const char *, int, int));
#define md_do_align(n,fill,len,max,l) if (sh_do_align (n,fill,len,max)) goto l
/* We record, for each section, whether we have most recently output a
CODE reloc or a DATA reloc. */
struct sh_segment_info_type
......
......@@ -4085,53 +4085,65 @@ sparc_cons_align (nbytes)
return;
}
p = frag_var (rs_align_code, 1, 1, (relax_substateT) 0,
p = frag_var (rs_align_test, 1, 1, (relax_substateT) 0,
(symbolS *) NULL, (offsetT) nalign, (char *) NULL);
record_alignment (now_seg, nalign);
}
/* This is where we do the unexpected alignment check.
This is called from HANDLE_ALIGN in tc-sparc.h. */
/* This is called from HANDLE_ALIGN in tc-sparc.h. */
void
sparc_handle_align (fragp)
fragS *fragp;
{
if (fragp->fr_type == rs_align_code && !fragp->fr_subtype
&& fragp