changeset 125:b8ac21536779

tiobjd disasm: bss handling
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 04 Apr 2014 18:56:23 +0000
parents 700d77d5cf00
children 2c6b1319383b
files ticoff/disasm.c
diffstat 1 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ticoff/disasm.c	Fri Apr 04 18:39:01 2014 +0000
+++ b/ticoff/disasm.c	Fri Apr 04 18:56:23 2014 +0000
@@ -12,6 +12,7 @@
 #include "globals.h"
 
 extern unsigned get_u16(), get_u32();
+extern char *storage_class_to_string();
 
 static void
 find_better_symbol(sec, symp, addp)
@@ -333,6 +334,24 @@
 }
 
 void
+disasm_bss(sec)
+	struct internal_scnhdr *sec;
+{
+	unsigned m;
+	struct internal_syment *sym;
+	char classbuf[8];
+
+	putchar('\n');
+	for (m = 0; m < sec->nsymbols; m++) {
+		sym = sec->sorted_symbols[m];
+		printf("%08X %-7s %s\n", sym->value,
+			storage_class_to_string(sym->class, classbuf),
+			sym->name);
+	}
+	printf("%08X <end of section>\n", sec->size);
+}
+
+void
 disasm_sectype_by_name(sec)
 	struct internal_scnhdr *sec;
 {
@@ -344,7 +363,8 @@
 		disasm_data_section(sec);
 	else if (!strcmp(sec->name, ".data"))
 		disasm_data_section(sec);
-	/* other section types to be added */
+	else if (!strcmp(sec->name, ".bss"))
+		disasm_bss(sec);
 	else
 		printf("Unrecognized section type, skipped\n");
 }