ref: a77ab9891df84fa7e6286b10087692e267532469
parent: 358742b714ee1245b08578ba057385489814fbd2
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Oct 30 03:55:29 EDT 2021
nm: Add -a flag GNU nm uses -a instead of -f. Since it is very easy to support it we add it to be compatible with GNU.
--- a/src/cmd/nm.c
+++ b/src/cmd/nm.c
@@ -241,7 +241,7 @@
static void
usage(void)
{
- fputs("nm [-APvf][-g|-u][-t format] [file...]\n", stderr);
+ fputs("nm [-APvfa][-g|-u][-t format] [file...]\n", stderr);
exit(1);
}
@@ -260,6 +260,7 @@
case 'g':
gflag = 1;
break;
+ case 'a':
case 'f':
fflag = 1;
break;
--- /dev/null
+++ b/tests/nm/execute/0013-z80-a.sh
@@ -1,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+tmp1=`mktemp`
+tmp2=`mktemp`
+trap "rm -f $tmp1 $tmp2; exit" 0 2 3
+
+nm -a z80.out > $tmp1
+
+cat <<! > $tmp2
+0000000000000000 b .bss
+0000000000000000 d .data
+0000000000000000 N .file
+0000000000000000 t .text
+0000000000000001 B averylongbss
+0000000000000001 D averylongdata
+0000000000000001 T averylongtext
+0000000000000000 B bss1
+0000000000000002 b bss3
+000000000000000a C bss4
+0000000000000012 C bss5
+0000000000000000 D data1
+0000000000000002 d data3
+000000000000000a C data4
+0000000000000012 C data5
+0000000000000000 T text1
+0000000000000002 t text3
+000000000000000a C text4
+0000000000000012 C text5
+ U text6
+!
+
+diff $tmp1 $tmp2