mirror of
https://github.com/cc65/cc65.git
synced 2025-01-02 09:34:22 +00:00
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:
parent
da4bc2bcaa
commit
c1bbf69d72
@ -120,6 +120,7 @@ Long options:
|
||||
--macpack-dir dir Set a macro package directory
|
||||
--memory-model model Set the memory model
|
||||
--pagelength n Set the page length for the listing
|
||||
--relax-checks Relax some checks (see docs)
|
||||
--smart Enable smart mode
|
||||
--target sys Set the target system
|
||||
--verbose Increase verbosity
|
||||
@ -276,6 +277,20 @@ Here is a description of all the command line options:
|
||||
id=".PAGELENGTH" name=".PAGELENGTH"></tt> directive for more information.
|
||||
|
||||
|
||||
<label id="option--relax-checks">
|
||||
<tag><tt>--relax-checks</tt></tag>
|
||||
|
||||
Relax some checks done by the assembler. This will allow code that is an
|
||||
error in most cases and flagged as such by the assembler, but can be valid
|
||||
in special situations.
|
||||
|
||||
Examples are:
|
||||
<itemize>
|
||||
<item>Short branches between two different segments.
|
||||
<item>Byte sized address loads where the address is not a zeropage address.
|
||||
</itemize>
|
||||
|
||||
|
||||
<label id="option-s">
|
||||
<tag><tt>-s, --smart-mode</tt></tag>
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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 },
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user