diff lwlink/script.c @ 180:6ebb93b409ba

Added library paths and --section-base
author lost
date Thu, 05 Mar 2009 02:23:25 +0000
parents 106c2fe3c9d9
children 857cb407229e
line wrap: on
line diff
--- a/lwlink/script.c	Wed Mar 04 05:34:17 2009 +0000
+++ b/lwlink/script.c	Thu Mar 05 02:23:25 2009 +0000
@@ -113,6 +113,23 @@
 		}
 		
 		size = strlen(script);
+		if (nscriptls)
+		{
+			char *rscript;
+			int i;
+			// prepend the "extra" script lines
+			for (i = 0; i < nscriptls; i++)
+				size += strlen(scriptls[i]) + 1;
+			
+			rscript = lw_malloc(size + 1);
+			oscript = rscript;
+			for (i = 0; i < nscriptls; i++)
+			{
+				oscript += sprintf(oscript, "%s\n", scriptls[i]);
+			}
+			strcpy(oscript, script);
+			script = rscript;
+		}
 	}
 
 	oscript = script;
@@ -252,6 +269,6 @@
 		lw_free(line);
 	}
 	
-	if (scriptfile)
+	if (scriptfile || nscriptls)
 		lw_free(oscript);
 }