Don't write the repeating nop pattern if it won't be used.
#endif
memset (p, 0, fix);
p += fix;
+ bytes -= fix;
fragP->fr_fix += fix;
}
- memcpy (p, aarch64_noop, noop_size);
- fragP->fr_var = noop_size;
+ if (bytes != 0)
+ {
+ fragP->fr_var = noop_size;
+ memcpy (p, aarch64_noop, noop_size);
+ }
}
/* Perform target specific initialisation of a frag.
bytes = fragP->fr_next->fr_address - fragP->fr_address - fragP->fr_fix;
p = fragP->fr_literal + fragP->fr_fix;
- fix = 0;
gas_assert ((fragP->tc_frag_data.thumb_mode & MODE_RECORDED) != 0);
#endif
}
- if (bytes & (noop_size - 1))
+ fix = bytes & (noop_size - 1);
+ if (fix != 0)
{
- fix = bytes & (noop_size - 1);
#ifdef OBJ_ELF
insert_data_mapping_symbol (state, fragP->fr_fix, fragP, fix);
#endif
}
fragP->fr_fix += fix;
- fragP->fr_var = noop_size;
- memcpy (p, noop, noop_size);
+ if (bytes != 0)
+ {
+ fragP->fr_var = noop_size;
+ memcpy (p, noop, noop_size);
+ }
}
/* Perform target specific initialisation of a frag.
if (bytes & 1)
{
*p++ = 0;
+ bytes--;
fragp->fr_fix++;
}
- memcpy (p, nop_pattern, 2);
- fragp->fr_var = 2;
+ if (bytes != 0)
+ {
+ fragp->fr_var = 2;
+ memcpy (p, nop_pattern, 2);
+ }
}
\f
/* Read a comma separated incrementing list of register names
included in fr_fix. The repeating larger nop only needs to
be written once to the frag memory. */
fragP->fr_fix = where - fragP->fr_literal;
- fragP->fr_var = limit;
if (count != 0)
- count = limit;
+ {
+ fragP->fr_var = limit;
+ count = limit;
+ }
}
const unsigned char *nops = patt[limit - 1];
{
memset (p, 0, fix);
p += fix;
+ bytes -= fix;
fragP->fr_fix += fix;
}
- memcpy (p, noop, 4);
- fragP->fr_var = 4;
+ if (bytes != 0)
+ {
+ fragP->fr_var = 4;
+ memcpy (p, noop, 4);
+ }
}
static char *
BFD_RELOC_NDS32_INSN16);
memcpy (p, nop16, 2);
p += 2;
+ bytes -= 2;
fix += 2;
}
fragp->fr_fix += fix;
- fragp->fr_var = 4;
- memcpy (p, nop32, 4);
+ if (bytes != 0)
+ {
+ fragp->fr_var = 4;
+ memcpy (p, nop32, 4);
+ }
}
/* md_flush_pending_output */
{
valueT count = (fragP->fr_next->fr_address
- (fragP->fr_address + fragP->fr_fix));
+ if (count == 0)
+ return;
+
char *dest = fragP->fr_literal + fragP->fr_fix;
enum ppc_nop_encoding_for_rs_align_code nop_select = *dest & 0xff;
We could pad with zeros up to an instruction boundary then follow
with nops but odd counts indicate data in an executable section
so padding with zeros is most appropriate. */
- if (count == 0
- || (nop_select == PPC_NOP_VLE ? (count & 1) != 0 : (count & 3) != 0))
+ if (nop_select == PPC_NOP_VLE ? (count & 1) != 0 : (count & 3) != 0)
{
*dest = 0;
return;