mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
Use linkerscript parser in rgblink
Signed-off-by: AntonioND <antonio_nd@outlook.com>
This commit is contained in:
@@ -35,6 +35,9 @@ extern void CreateSymbolTable(void);
|
|||||||
extern SLONG MaxBankUsed;
|
extern SLONG MaxBankUsed;
|
||||||
extern SLONG MaxAvail[MAXBANKS];
|
extern SLONG MaxAvail[MAXBANKS];
|
||||||
|
|
||||||
|
void
|
||||||
|
SetLinkerscriptName(char *tzLinkerscriptFile);
|
||||||
|
|
||||||
int
|
int
|
||||||
IsSectionSameTypeBankAndFloating(const char *name, enum eSectionType type, int bank);
|
IsSectionSameTypeBankAndFloating(const char *name, enum eSectionType type, int bank);
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "extern/err.h"
|
#include "extern/err.h"
|
||||||
|
#include "link/assign.h"
|
||||||
#include "link/mylink.h"
|
#include "link/mylink.h"
|
||||||
#include "link/main.h"
|
#include "link/main.h"
|
||||||
|
#include "link/script.h"
|
||||||
#include "link/symbol.h"
|
#include "link/symbol.h"
|
||||||
#include "link/assign.h"
|
|
||||||
|
|
||||||
struct sFreeArea {
|
struct sFreeArea {
|
||||||
SLONG nOrg;
|
SLONG nOrg;
|
||||||
@@ -338,6 +339,14 @@ AssignFloatingBankSections(enum eSectionType type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *tzLinkerscriptName = NULL;
|
||||||
|
|
||||||
|
void
|
||||||
|
SetLinkerscriptName(char *tzLinkerscriptFile)
|
||||||
|
{
|
||||||
|
tzLinkerscriptName = tzLinkerscriptFile;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AssignSections(void)
|
AssignSections(void)
|
||||||
{
|
{
|
||||||
@@ -415,8 +424,16 @@ AssignSections(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First, let's assign all the fixed sections...
|
* First, let's parse the linkerscript.
|
||||||
* And all because of that Jens Restemeier character ;)
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (tzLinkerscriptName) {
|
||||||
|
script_Parse(tzLinkerscriptName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Second, let's assign all the fixed sections...
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ static void
|
|||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"usage: rgblink [-tw] [-m mapfile] [-n symfile] [-O overlay] [-o outfile] \n"
|
"usage: rgblink [-tw] [-l linkerscript] [-m mapfile] [-n symfile] [-O overlay]\n"
|
||||||
" [-p pad_value] [-s symbol] file [...]\n");
|
" [-o outfile] [-p pad_value] [-s symbol] file [...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +56,11 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
progname = argv[0];
|
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) {
|
switch (ch) {
|
||||||
|
case 'l':
|
||||||
|
SetLinkerscriptName(optarg);
|
||||||
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
SetMapfileName(optarg);
|
SetMapfileName(optarg);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user