gas: make .nops output visible in listing
Due to using a different frag type (in turn due to storing data differently), making the resulting code appear in listings requires special handling.
This commit is contained in:
parent
c69011e953
commit
a0094f1a70
4
gas/as.h
4
gas/as.h
@ -247,7 +247,9 @@ enum _relax_state
|
||||
1 constant byte: no-op fill control byte. */
|
||||
rs_space_nop,
|
||||
|
||||
/* Similar to rs_fill. It is used to implement .nop directive . */
|
||||
/* Similar to rs_fill. It is used to implement .nops directive.
|
||||
When listings are enabled, fr_opcode gets the buffer assigned, once
|
||||
that's available. */
|
||||
rs_fill_nop,
|
||||
|
||||
/* A DWARF leb128 value; only ELF uses this. The subtype is 0 for
|
||||
|
@ -815,6 +815,28 @@ calc_hex (list_info_type *list)
|
||||
var_rep_idx = var_rep_max;
|
||||
}
|
||||
}
|
||||
else if (frag_ptr->fr_type == rs_fill_nop && frag_ptr->fr_opcode)
|
||||
{
|
||||
gas_assert (!octet_in_frag);
|
||||
|
||||
/* Print as many bytes from fr_opcode as is sensible. */
|
||||
while (octet_in_frag < (unsigned int) frag_ptr->fr_offset
|
||||
&& data_buffer_size < MAX_BYTES - 3)
|
||||
{
|
||||
if (address == ~(unsigned int) 0)
|
||||
address = frag_ptr->fr_address / OCTETS_PER_BYTE;
|
||||
|
||||
sprintf (data_buffer + data_buffer_size,
|
||||
"%02X",
|
||||
frag_ptr->fr_opcode[octet_in_frag] & 0xff);
|
||||
data_buffer_size += 2;
|
||||
|
||||
octet_in_frag++;
|
||||
}
|
||||
|
||||
free (frag_ptr->fr_opcode);
|
||||
frag_ptr->fr_opcode = NULL;
|
||||
}
|
||||
|
||||
frag_ptr = frag_ptr->fr_next;
|
||||
}
|
||||
|
@ -598,6 +598,7 @@ if [gas_32_check] then {
|
||||
run_list_test "inval-pseudo" "-al"
|
||||
run_dump_test "nop-1"
|
||||
run_dump_test "nop-1-suffix"
|
||||
run_list_test "nop-1" "-aln"
|
||||
run_dump_test "nop-2"
|
||||
run_dump_test "optimize-1"
|
||||
run_dump_test "optimize-1a"
|
||||
|
39
gas/testsuite/gas/i386/nop-1.l
Normal file
39
gas/testsuite/gas/i386/nop-1.l
Normal file
@ -0,0 +1,39 @@
|
||||
[ ]*[0-9]+[ ]+\.text
|
||||
[ ]*[0-9]+[ ]+single:
|
||||
[ ]*[0-9]+[ ]+\.nops 0
|
||||
[ ]*[0-9]+[ ]+.... 90[ ]+nop
|
||||
[ ]*[0-9]+[ ]*
|
||||
[ ]*[0-9]+[ ]+pseudo_1:
|
||||
[ ]*[0-9]+[ ]+.... 90[ ]+\.nops 1
|
||||
[ ]*[0-9]+[ ]*
|
||||
[ ]*[0-9]+[ ]+pseudo_8:
|
||||
[ ]*[0-9]+[ ]+.... 2E8DB426[ ]+\.nops 8
|
||||
[ ]*[0-9]+[ ]+00000000 *
|
||||
[ ]*[0-9]+[ ]*
|
||||
[ ]*[0-9]+[ ]+pseudo_8_4:
|
||||
[ ]*[0-9]+[ ]+.... 8D742600[ ]+\.nops 8, 4
|
||||
[ ]*[0-9]+[ ]+8D742600 *
|
||||
[ ]*[0-9]+[ ]*
|
||||
[ ]*[0-9]+[ ]+pseudo_20:
|
||||
[ ]*[0-9]+[ ]+.... 2E8DB426[ ]+\.nops 20
|
||||
[ ]*[0-9]+[ ]+00000000 *
|
||||
[ ]*[0-9]+[ ]+2E8DB426 *
|
||||
[ ]*[0-9]+[ ]+00000000 *
|
||||
[ ]*[0-9]+[ ]+8D742600 *
|
||||
[ ]*[0-9]+[ ]*
|
||||
[ ]*[0-9]+[ ]+pseudo_30:
|
||||
[ ]*[0-9]+[ ]+.... EB1C2E8D[ ]+\.nops 30
|
||||
[ ]*[0-9]+[ ]+B4260000 *
|
||||
[ ]*[0-9]+[ ]+00002E8D *
|
||||
[ ]*[0-9]+[ ]+B4260000 *
|
||||
[ ]*[0-9]+[ ]+00002E8D *
|
||||
[ ]*[0-9]+[ ]*
|
||||
[ ]*[0-9]+[ ]+pseudo_129:
|
||||
[ ]*[0-9]+[ ]+.... EB7F2E8D[ ]+\.nops 129
|
||||
[ ]*[0-9]+[ ]+B4260000 *
|
||||
[ ]*[0-9]+[ ]+00002E8D *
|
||||
[ ]*[0-9]+[ ]+B4260000 *
|
||||
[ ]*[0-9]+[ ]+00002E8D *
|
||||
[ ]*[0-9]+[ ]*
|
||||
[ ]*[0-9]+[ ]+end:
|
||||
#pass
|
@ -1682,7 +1682,12 @@ write_contents (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
bfd_get_filename (stdoutput),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
offset += count;
|
||||
free (buf);
|
||||
#ifndef NO_LISTING
|
||||
if (listing & LISTING_LISTING)
|
||||
f->fr_opcode = buf;
|
||||
else
|
||||
#endif
|
||||
free (buf);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user