aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-08-10 02:45:41 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-08-10 02:45:41 -0700
commita2c1c7d0d4581e3ae58effff449d6fedec06aaae (patch)
tree139137a91fbe53c2d57c3769f4e85a27b3042c90
parent14b16442ce951942f13756cdb5d44c1fe4f3e98f (diff)
downloadnasm-a2c1c7d0d4581e3ae58effff449d6fedec06aaae.tar.gz
nasm-a2c1c7d0d4581e3ae58effff449d6fedec06aaae.tar.xz
nasm-a2c1c7d0d4581e3ae58effff449d6fedec06aaae.zip
listing: coalesce TIMES in non-final passes, print <len>, clarify hex
Merge TIMES in the nonfinal passes, there is no point in getting <len ...> an arbitrary number of times. Actually print <len> (OUT_RAWDATA without a data pointer), not <res> (OUT_RESERVE). Dropping the zero-fill for the hex format made the listing more manageable, but it also doesn't immediately look like hex, plus there is now the -Ld option. Put an h after hex (shorter than leading 0x) to make it obvious. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--asm/listing.c2
-rw-r--r--asm/nasm.c21
2 files changed, 10 insertions, 13 deletions
diff --git a/asm/listing.c b/asm/listing.c
index 9d263769..f1215660 100644
--- a/asm/listing.c
+++ b/asm/listing.c
@@ -208,7 +208,7 @@ static void list_size(int64_t offset, const char *tag, uint64_t size)
if (list_option('d'))
fmt = "<%s %"PRIu64">";
else
- fmt = "<%s %"PRIX64">";
+ fmt = "<%s %"PRIX64"h>";
snprintf(buf, sizeof buf, fmt, tag, size);
list_out(offset, buf);
diff --git a/asm/nasm.c b/asm/nasm.c
index 6d73a5f5..7b6494e4 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -1517,25 +1517,22 @@ static void process_insn(insn *instruction)
* (usually to 1) when called.
*/
if (!pass_final()) {
+ int64_t start = location.offset;
for (n = 1; n <= instruction->times; n++) {
l = insn_size(location.segment, location.offset,
globalbits, instruction);
-
- if (list_option('p')) {
- if (l > 0) {
- struct out_data dummy;
- memset(&dummy, 0, sizeof dummy);
- dummy.type = OUT_RESERVE;
- dummy.offset = location.offset;
- dummy.size = l;
- lfmt->output(&dummy);
- }
- }
-
/* l == -1 -> invalid instruction */
if (l != -1)
increment_offset(l);
}
+ if (list_option('p')) {
+ struct out_data dummy;
+ memset(&dummy, 0, sizeof dummy);
+ dummy.type = OUT_RAWDATA; /* Handled specially with .data NULL */
+ dummy.offset = start;
+ dummy.size = location.offset - start;
+ lfmt->output(&dummy);
+ }
} else {
l = assemble(location.segment, location.offset,
globalbits, instruction);