* .version, doc/sdccman.lyx: bumped sdcc version to 2.8.6
due changes in sdcc asxxxx linkers - it sholud be done 2 days ago :(
* doc/README.txt: updated John Hartman's e-mail address
+ * as/link/lkrel.c, as/link/lksdcclib.c:
+ fixed bug #2484677: Linker hangs
2009-01-04 Philipp Klaus Krause <pkk AT spth.de>
2008-11-06 Borut Razem <borut.razem AT siol.net>
- * src/SDCCmain.c: #fixed bug 2224960: sdcc -MM no working correctly
+ * src/SDCCmain.c: fixed bug #2224960: sdcc -MM no working correctly
pass system include paths with -isystem to sdcpp
* src/SDCCglue.c, src/pic/glue.c, src/pic16/glue.c: removed unneeded
functions (closePipes), (closeTmpFiles) and (rmTmpFiles)
}
/* Load a .rel file embedded in a sdcclib file */
-static void
+static int
LoadRel (char *libfname, FILE * libfp, char *ModName)
{
char str[NINPUT];
case 0:
if (EQ (str, "<FILE>"))
{
- getline (str, sizeof (str), libfp);
- if (EQ (str, ModName))
+ if (NULL != getline (str, sizeof (str), libfp) && EQ (str, ModName))
state = 1;
else
- {
- fprintf (stderr, "?ASlink-Error-Bad offset in library file %s(%s)\n", libfname, ModName);
- lkexit (1);
- }
+ return 0;
}
+ else
+ return 0;
break;
+
case 1:
- if (EQ (str, "<REL>"))
- state = 2;
- break;
- case 2:
- load_rel (libfp, -1);
- break;
+ return EQ (str, "<REL>") ? load_rel (libfp, -1) : 0;
}
}
+
+ return 0;
}
#ifdef INDEXLIB
state = 1;
}
break;
- case 1:
+
+ case 1:
if (EQ (FLine, "<MODULE>"))
{
/* The next line has the name of the module and the offset
return This; /* Finish, get out of here */
}
break;
- case 2:
+
+ case 2:
if (EQ (FLine, "</MODULE>"))
{
This->loaded = 0;
{
char str[MAXLINE];
int state = 0;
- int ToReturn = 0;
+ int ret = 0;
while (getline (str, sizeof (str), libfp) != NULL)
{
if (EQ (str, "<ADB>"))
state = 1;
break;
+
case 1:
if (EQ (str, "</ADB>"))
- return ToReturn;
+ return ret;
fprintf (dfp, "%s\n", str);
- ToReturn = 1;
+ ret = 1;
break;
}
}
- return ToReturn;
+ return ret;
}
/* Check for a symbol in a SDCC library. If found, add the embedded .rel and
state = 1;
}
break;
- case 1:
+
+ case 1:
if (EQ (FLine, "<MODULE>"))
{
/* The next line has the name of the module and the offset
return 0;
}
break;
- case 2:
+
+ case 2:
if (EQ (FLine, "</MODULE>"))
{
/* The symbol is not in this module, try the next one */
/* Jump to where the .rel begins and load it. */
fseek (libfp, lbfh->offset, SEEK_SET);
- LoadRel (lbnh->libspc, libfp, ModName);
-
+ if (!LoadRel (lbnh->libspc, libfp, ModName))
+ {
+ fclose (libfp);
+ fprintf (stderr, "?ASlink-Error-Bad offset in library file %s(%s)\n", lbfh->libspc, ModName);
+ lkexit (1);
+ }
/* if cdb information required & .adb file present */
if (dflag && dfp)
{
loadfile_sdcclib (struct lbfile *lbfh)
{
FILE *fp;
+ int res;
+
#ifdef __CYGWIN__
char posix_path[PATH_MAX];
void cygwin_conv_to_full_posix_path (char *win_path, char *posix_path);
if (fp != NULL)
{
fseek (fp, lbfh->offset, SEEK_SET);
- LoadRel (lbfh->libspc, fp, lbfh->relfil);
+ res = LoadRel (lbfh->libspc, fp, lbfh->relfil);
fclose (fp);
+
+ if (!res)
+ {
+ fprintf (stderr, "?ASlink-Error-Bad offset in library file %s(%s)\n", lbfh->libspc, lbfh->relfil);
+ lkexit (1);
+ }
}
else
{
fprintf (stderr, "?ASlink-Error-Opening library '%s'\n", lbfh->libspc);
- fclose (fp);
lkexit (1);
}
}