ref: d1ed4fbdedb5afef82e0711c0ee686a4dc83044c
parent: 22d4a10cb61566c0b696fd6accbad2a31a87358c
author: AntonioND <[email protected]>
date: Mon Mar 20 19:36:14 EDT 2017
Use linkerscript parser in rgblink Signed-off-by: AntonioND <[email protected]>
--- a/include/link/assign.h
+++ b/include/link/assign.h
@@ -35,6 +35,9 @@
extern SLONG MaxBankUsed;
extern SLONG MaxAvail[MAXBANKS];
+void
+SetLinkerscriptName(char *tzLinkerscriptFile);
+
int
IsSectionSameTypeBankAndFloating(const char *name, enum eSectionType type, int bank);
--- a/src/link/assign.c
+++ b/src/link/assign.c
@@ -4,10 +4,11 @@
#include <string.h>
#include "extern/err.h"
+#include "link/assign.h"
#include "link/mylink.h"
#include "link/main.h"
+#include "link/script.h"
#include "link/symbol.h"
-#include "link/assign.h"
struct sFreeArea {
SLONG nOrg;
@@ -338,7 +339,15 @@
}
}
+char *tzLinkerscriptName = NULL;
+
void
+SetLinkerscriptName(char *tzLinkerscriptFile)
+{
+ tzLinkerscriptName = tzLinkerscriptFile;
+}
+
+void
AssignSections(void)
{
SLONG i;
@@ -415,8 +424,16 @@
}
/*
- * First, let's assign all the fixed sections...
- * And all because of that Jens Restemeier character ;)
+ * First, let's parse the linkerscript.
+ *
+ */
+
+ if (tzLinkerscriptName) {
+ script_Parse(tzLinkerscriptName);
+ }
+
+ /*
+ * Second, let's assign all the fixed sections...
*
*/
--- a/src/link/main.c
+++ b/src/link/main.c
@@ -31,12 +31,12 @@
*
*/
-static void
+static void
usage(void)
{
printf(
-"usage: rgblink [-tw] [-m mapfile] [-n symfile] [-O overlay] [-o outfile] \n"
-" [-p pad_value] [-s symbol] file [...]\n");
+"usage: rgblink [-tw] [-l linkerscript] [-m mapfile] [-n symfile] [-O overlay]\n"
+" [-o outfile] [-p pad_value] [-s symbol] file [...]\n");
exit(1);
}
@@ -45,7 +45,7 @@
*
*/
-int
+int
main(int argc, char *argv[])
{
int ch;
@@ -56,8 +56,11 @@
progname = argv[0];
- while ((ch = getopt(argc, argv, "m:n:o:O:p:s:tw")) != -1) {
+ while ((ch = getopt(argc, argv, "l:m:n:o:O:p:s:tw")) != -1) {
switch (ch) {
+ case 'l':
+ SetLinkerscriptName(optarg);
+ break;
case 'm':
SetMapfileName(optarg);
break;