diff lwlink/main.c @ 185:b89adfb0d174

Added support for outputting a linkmap
author lost
date Sat, 21 Mar 2009 19:47:45 +0000
parents 833d392fec82
children 857cb407229e
line wrap: on
line diff
--- a/lwlink/main.c	Sat Mar 21 17:39:45 2009 +0000
+++ b/lwlink/main.c	Sat Mar 21 19:47:45 2009 +0000
@@ -96,7 +96,11 @@
 	case 0x100:
 		add_section_base(arg);
 		break;
-		
+	
+	case 'm':
+		map_file = arg;
+		break;
+	
 	case ARGP_KEY_ARG:
 		add_input_file(arg);
 		break;
@@ -127,6 +131,8 @@
 				"Add DIR to the library search path" },
 	{ "section-base", 0x100,	"SECT=BASE",	0,
 				"Load section SECT at BASE" },
+	{ "map",		'm',	"FILE",		0,
+				"Output informaiton about the link" },
 	{ 0 }
 };
 
@@ -143,6 +149,7 @@
 extern void resolve_sections(void);
 extern void resolve_references(void);
 extern void do_output(void);
+extern void display_map(void);
 
 // main function; parse command line, set up assembler state, and run the
 // assembler on the first file
@@ -171,6 +178,10 @@
 	
 	// do the actual output
 	do_output();
-	
+
+	// display/output the link map
+	if (map_file)
+		display_map();
+
 	exit(0);
 }