diff lwlink/link.c @ 262:7de7b14ebaee

Add support for os9 module edition byte Add support for the symbol "edition" in the __os9 section which defines the module edition byte which follows immedately after the module name in the module. It defaults to not setting one.
author William Astle <lost@l-w.ca>
date Mon, 04 Feb 2013 21:03:59 -0700
parents ebda5c96665e
children 8dd8c3bdca7c
line wrap: on
line diff
--- a/lwlink/link.c	Mon Feb 04 20:51:55 2013 -0700
+++ b/lwlink/link.c	Mon Feb 04 21:03:59 2013 -0700
@@ -726,6 +726,7 @@
 	int langseen;
 	int revseen;
 	int nameseen;
+	int edseen;
 };
 
 void check_os9_aux(section_t *s, void *arg)
@@ -739,6 +740,7 @@
 	// lang: module language
 	// attr: module attributes
 	// rev: module revision
+	// ed: module edition
 	//
 	// the symbols are not case sensitive
 	//
@@ -779,6 +781,11 @@
 		{
 			linkscript.stacksize += sym -> offset;
 		}
+		else if (!strcasecmp(sm, 'edition'))
+		{
+			linkscript.edition = sym -> offset;
+			st -> edseen++;
+		}
 	}
 }
 
@@ -801,10 +808,10 @@
 	
 	if (st.attrseen > 1 || st.typeseen > 1 ||
 		st.langseen > 1 || st.revseen > 1 ||
-		st.nameseen > 1
+		st.nameseen > 1 | st.edseen > 1
 	)
 	{
-		fprintf(stderr, "Warning: multiple instances of __os9 found with duplicate settings of type, lang, attr, rev, or module name.\n");
+		fprintf(stderr, "Warning: multiple instances of __os9 found with duplicate settings of type, lang, attr, rev, edition, or module name.\n");
 	}
 }