{ 0, OPTION_STACK_LOC, NULL, "<nnnn> Stack pointer initial value" },
{ 0, OPTION_DATA_LOC, NULL, "<nnnn> Direct data start location" },
{ 0, OPTION_IDATA_LOC, NULL, NULL },
+#if !OPT_DISABLE_DS390 || !OPT_DISABLE_MCS51 || !OPT_DISABLE_PIC
+ { 0, OPTION_STACK_SIZE, NULL,"MCS51/DS390/PIC - Tells the linker to allocate this space for stack"},
+#endif
#if !OPT_DISABLE_DS390 || !OPT_DISABLE_MCS51
- { 0, OPTION_STACK_SIZE, NULL,"MCS51/DS390 - Tells the linker to allocate this space for stack"},
{ 0, OPTION_PACK_IRAM, NULL,"MCS51/DS390 - Tells the linker to pack variables in internal ram (default)"},
{ 0, OPTION_NO_PACK_IRAM, &options.no_pack_iram,"MCS51/DS390 - Tells the linker not to pack variables in internal ram"},
#endif
/* setParseWithComma - separates string with comma to a set */
/*-----------------------------------------------------------------*/
void
-setParseWithComma (set **dest, char *src)
+setParseWithComma (set **dest, const char *src)
{
- char *p;
- int length;
+ const char *p, *end;
+ struct dbuf_s dbuf;
/* skip the initial white spaces */
while (isspace((unsigned char)*src))
- src++;
+ ++src;
/* skip the trailing white spaces */
- length = strlen(src);
- while (length && isspace((unsigned char)src[length-1]))
- src[--length] = '\0';
+ end = &src[strlen(src) - 1];
+ while (end >= src && isspace((unsigned char)*end))
+ --end;
+ ++end;
+
+ dbuf_init(&dbuf, 16);
+
+ p = src;
+ while (src < end)
+ {
+ while (p < end && ',' != *p)
+ ++p;
+ dbuf_append(&dbuf, src, p - src);
+ addSet(dest, Safe_strdup(dbuf_c_str(&dbuf)));
+ dbuf_set_size(&dbuf, 0);
+ src = ++p;
+ }
- for (p = strtok(src, ","); p != NULL; p = strtok(NULL, ","))
- addSet(dest, Safe_strdup(p));
+ dbuf_destroy(&dbuf);
}
/*-----------------------------------------------------------------*/
options.code_loc = 0; /* code starts at 0 */
options.data_loc = 0; /* JCF: By default let the linker locate data */
options.xdata_loc = 0;
- options.idata_loc = 0x80;
+ options.idata_loc = 0; /* MB: No need to limit idata to 0x80-0xFF */
options.nopeep = 0;
options.model = port->general.default_model;
options.nostdlib = 0;
}
/* if the extention is type .rel or .r or .REL or .R
- addtional object file will be passed to the linker */
+ additional object file will be passed to the linker */
if (strcmp (fext, ".r") == 0 || strcmp (fext, ".rel") == 0 ||
strcmp (fext, ".R") == 0 || strcmp (fext, ".REL") == 0 ||
strcmp (fext, port->linker.rel_ext) == 0)
{
werror (E_ARGUMENT_MISSING, szStart);
/* Die here rather than checking for errors later. */
- exit(-1);
+ exit(EXIT_FAILURE);
}
else
{
/* data segment start. If zero, the linker chooses
the best place for data */
- if(options.data_loc)
+ if (options.data_loc)
{
WRITE_SEG_LOC (DATA_NAME, options.data_loc);
}
/* xdata segment start. If zero, the linker chooses
the best place for xdata */
- if(options.xdata_loc)
+ if (options.xdata_loc)
{
WRITE_SEG_LOC (XDATA_NAME, options.xdata_loc);
}
fprintf(stderr,
"Add support for your FLAT24 target in %s @ line %d\n",
__FILE__, __LINE__);
- exit(-1);
+ exit(EXIT_FAILURE);
}
break;
case MODEL_PAGE0:
fprintf(stderr,
"Add support for your FLAT24 target in %s @ line %d\n",
__FILE__, __LINE__);
- exit(-1);
+ exit(EXIT_FAILURE);
}
}
#endif
/* if (options.verbose)fprintf(stderr, "linker command line: %s\n", buffer); */
system_ret = my_system (buffer);
+
+#ifdef _WIN32
+ #define STRCMP stricmp
+#else
+ #define STRCMP strcmp
+#endif
+
/* TODO: most linker don't have a -o parameter */
/* -o option overrides default name? */
if (fullDstFileName)
strncatz (scratchFileName,
options.out_fmt ? ".S19" : ".ihx",
sizeof(scratchFileName));
- if (strcmp (fullDstFileName, scratchFileName))
+ if (STRCMP (fullDstFileName, scratchFileName))
remove (fullDstFileName);
rename (scratchFileName, fullDstFileName);
strncatz (scratchFileName, ".map", sizeof(scratchFileName));
*q = 0;
strncatz(buffer, ".map", sizeof(buffer));
- if (strcmp (scratchFileName, buffer))
+ if (STRCMP (scratchFileName, buffer))
remove (buffer);
rename (scratchFileName, buffer);
*p = 0;
strncatz (scratchFileName, ".mem", sizeof(scratchFileName));
*q = 0;
strncatz(buffer, ".mem", sizeof(buffer));
- if (strcmp (scratchFileName, buffer))
+ if (STRCMP (scratchFileName, buffer))
remove (buffer);
rename (scratchFileName, buffer);
if (options.debug)
strncatz (scratchFileName, ".cdb", sizeof(scratchFileName));
*q = 0;
strncatz(buffer, ".cdb", sizeof(buffer));
- if (strcmp (scratchFileName, buffer))
+ if (STRCMP (scratchFileName, buffer))
remove (buffer);
rename (scratchFileName, buffer);
/* and the OMF file without extension: */
*p = 0;
*q = 0;
- if (strcmp (scratchFileName, buffer))
+ if (STRCMP (scratchFileName, buffer))
remove (buffer);
rename (scratchFileName, buffer);
}
atexit(rm_tmpfiles);
/* install signal handler;
- it's only purpuse is to call exit() to remove temp files */
+ it's only purpose is to call exit() to remove temp files */
if (!getenv("SDCC_LEAVE_SIGNALS"))
{
signal (SIGABRT, sig_handler);