shithub: scc

Download patch

ref: a55a15f4d28510af4023b35ea2301bbbbf5c231a
parent: 2a60c595e712d405d7aefdc7cef07bdfa0e4b407
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Oct 29 17:54:44 EDT 2021

nm: Add flag -f

This flag is intended for full output, and it forces
to print all the symbols, included those symbols that
are usually suppresed.

--- a/src/cmd/nm.c
+++ b/src/cmd/nm.c
@@ -24,6 +24,7 @@
 static int vflag;
 static int gflag;
 static int uflag;
+static int fflag;
 static char *filename, *membname;
 
 static void
@@ -125,8 +126,8 @@
 	size_t n, size;
 	int type = sym->type;
 
-	if (type == '?'
-	|| type == 'N'
+	if (type == '?' && !fflag
+	|| type == 'N' && !fflag
 	|| uflag && type != 'U'
 	|| gflag && !isupper(type)) {
 		return 0;
@@ -238,7 +239,7 @@
 static void
 usage(void)
 {
-	fputs("nm [-APv][ -g| -u][-t format] [file...]\n", stderr);
+	fputs("nm [-APvf][-g|-u][-t format] [file...]\n", stderr);
 	exit(1);
 }
 
@@ -256,6 +257,9 @@
 		break;
 	case 'g':
 		gflag = 1;
+		break;
+	case 'f':
+		fflag = 1;
 		break;
 	case 'u':
 		uflag = 1;