New option --relax-checks that disable the check for a match beween size oif

an expression and the address size. Will allow short branches between segments
among other things. Suggested by Spiro Trikaliotis.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5810 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2012-08-20 20:07:05 +00:00
parent da4bc2bcaa
commit c1bbf69d72
5 changed files with 38 additions and 12 deletions

View File

@@ -65,6 +65,7 @@ unsigned char SmartMode = 0; /* Smart mode */
unsigned char DbgSyms = 0; /* Add debug symbols */
unsigned char LineCont = 0; /* Allow line continuation */
unsigned char LargeAlignment = 0; /* Don't warn about large alignments */
unsigned char RelaxChecks = 0; /* Relax a few assembler checks */
/* Emulation features */
unsigned char DollarIsPC = 0; /* Allow the $ symbol as current PC */
@@ -80,7 +81,7 @@ unsigned char UbiquitousIdents = 0; /* Allow ubiquitous identifiers */
unsigned char OrgPerSeg = 0; /* Make .org local to current seg */
unsigned char CComments = 0; /* Allow C like comments */
unsigned char ForceRange = 0; /* Force values into expected range */
/* Misc stuff */
const char Copyright[] = "(C) Copyright 1998-2011 Ullrich von Bassewitz";

View File

@@ -67,6 +67,7 @@ extern unsigned char SmartMode; /* Smart mode */
extern unsigned char DbgSyms; /* Add debug symbols */
extern unsigned char LineCont; /* Allow line continuation */
extern unsigned char LargeAlignment; /* Don't warn about large alignments */
extern unsigned char RelaxChecks; /* Relax a few assembler checks */
/* Emulation features */
extern unsigned char DollarIsPC; /* Allow the $ symbol as current PC */

View File

@@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 1998-2011, Ullrich von Bassewitz */
/* (C) 1998-2012, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
@@ -125,6 +125,7 @@ static void Usage (void)
" --macpack-dir dir\t\tSet a macro package directory\n"
" --memory-model model\t\tSet the memory model\n"
" --pagelength n\t\tSet the page length for the listing\n"
" --relax-checks\t\tRelax some checks (see docs)\n"
" --smart\t\t\tEnable smart mode\n"
" --target sys\t\t\tSet the target system\n"
" --verbose\t\t\tIncrease verbosity\n"
@@ -561,6 +562,15 @@ static void OptPageLength (const char* Opt attribute ((unused)), const char* Arg
static void OptRelaxChecks (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Handle the --relax-checks options */
{
RelaxChecks = 1;
}
static void OptSmart (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Handle the -s/--smart options */
@@ -871,6 +881,7 @@ int main (int argc, char* argv [])
{ "--macpack-dir", 1, OptMacPackDir },
{ "--memory-model", 1, OptMemoryModel },
{ "--pagelength", 1, OptPageLength },
{ "--relax-checks", 0, OptRelaxChecks },
{ "--smart", 0, OptSmart },
{ "--target", 1, OptTarget },
{ "--verbose", 0, OptVerbose },

View File

@@ -407,20 +407,18 @@ void SegDone (void)
}
F->Type = FRAG_LITERAL;
} else {
} else if (RelaxChecks == 0) {
/* Simplify the expression */
/* ### F->V.Expr = SimplifyExpr (F->V.Expr, &ED); */
/* We cannot evaluate the expression now, leave the job for
* the linker. However, we can check if the address size
* matches the fragment size, and we will do so.
*/
/* We cannot evaluate the expression now, leave the job for
* the linker. However, we can check if the address size
* matches the fragment size. Mismatches are errors in
* most situations.
*/
if ((F->Len == 1 && ED.AddrSize > ADDR_SIZE_ZP) ||
(F->Len == 2 && ED.AddrSize > ADDR_SIZE_ABS) ||
(F->Len == 3 && ED.AddrSize > ADDR_SIZE_FAR)) {
LIError (&F->LI, "Range error");
}
LIError (&F->LI, "Range error");
}
}
/* Release memory allocated for the expression decriptor */