case ABSL:
if (w) // Defined
{
+ if (optim_pc)
+ if (aNexattr&(DEFINED | REFERENCED | EQUATED) == DEFINED | REFERENCED)
+ return error("relocation not allowed");
+
if (tdb)
MarkRelocatable(cursect, sloc, tdb, MLONG, NULL);
if ((fd = open(string[*tok], _OPEN_INC)) < 0)
{
- for(i=0; nthpath("RMACPATH", i, buf1)!= 0; i++)
+ for(i=0; nthpath("RMACPATH", i, buf1)!=0; i++)
{
fd = strlen(buf1);
}
else if ((*tok >= KW_D0) && (*tok <= KW_D7))
{
- //Since index register isn't used here, store register number in this field
+ // Since index register isn't used here, store register number in this field
AnIXREG = *tok++ & 7; // (Dn)
if (*tok == ')')
// expr[.L]
AMn = ABSL;
+ // When PC relative is enforced, check for any symbols that aren't
+ // EQU'd, in this case it's an illegal mode
+ if (optim_pc)
+ if (AnEXATTR & REFERENCED)
+ if (AnEXATTR & DEFINED)
+ if (!(AnEXATTR & EQUATED))
+ return error("relocation not allowed");
+
// .L is forced here
if (*tok == DOTL)
{
char * searchpath; // Search path for include files
char defname[] = "noname.o"; // Default output filename
int optim_flags[OPT_COUNT]; // Specific optimisations on/off matrix
+int optim_pc = 0; // Enforce PC relative
int activecpu = CPU_68000; // Active 68k CPU (68000 by default)
int activefpu = FPU_NONE; // Active FPU (none by default)
int org68k_active = 0; // .org switch for 68k (only with RAW output format)
" o7: clr.l Dx to moveq #0,Dx (off)\n"
" o8: adda.w/l #x,Dy to addq.w/l #x,Dy (off)\n"
" o9: adda.w/l #x,Dy to lea x(Dy),Dy (off)\n"
+ " op: Enforce PC relative (off)\n"
" ~o[value] Turn a specific optimisation off\n"
" +oall Turn all optimisations on\n"
" ~oall Turn all optimisations off\n"
}
else if (optstring[1] == 'o' || optstring[1] == 'O') // Turn on specific optimisation
{
+ if (optstring[2] == 'p' || optstring[2] == 'P')
+ {
+ optim_pc = 1;
+ return OK;
+ }
+
int opt_no = atoi(&optstring[2]);
if ((opt_no >= 0) && (opt_no < OPT_COUNT))
extern int prg_flag; // 1 = write ".PRG" relocatable executable
extern LONG PRGFLAGS;
extern int optim_flags[OPT_COUNT];
+extern int optim_pc;
extern int activecpu;
extern int activefpu;
extern uint32_t org68k_address;
// evexpr presumably issues the errors/warnings here
if (evexpr(fup->expr, &eval, &eattr, &esym) != OK)
continue;
+
+ if (optim_pc)
+ if (eattr & REFERENCED)
+ if (eattr & DEFINED)
+ if (!(eattr & EQUATED))
+ {
+ error("relocation not allowed");
+ continue;
+ }
}
// Simple symbol
else
SYM * sy = fup->symbol;
eattr = sy->sattr;
+ if (optim_pc)
+ if (eattr & REFERENCED)
+ if (eattr & DEFINED)
+ if (!(eattr & EQUATED))
+ {
+ error("relocation not allowed");
+ continue;
+ }
+
if (eattr & DEFINED)
eval = sy->svalue;
else