Fix (or at least, work around) an issue with library order. Make sure the Basic

error symbols are actually defined.
This commit is contained in:
David Given 2016-11-13 13:28:09 +01:00
parent f52cb45e49
commit e9fe1d70a6
3 changed files with 8 additions and 6 deletions

View file

@ -729,9 +729,10 @@ definerule("simplerule",
definerule("installable", definerule("installable",
{ {
map = { type="targets", default={} }, map = { type="targets", default={} },
deps = { type="targets", default={} },
}, },
function (e) function (e)
local deps = {} local deps = filenamesof(e.deps)
local commands = {} local commands = {}
local srcs = {} local srcs = {}
local outs = {} local outs = {}

View file

@ -226,6 +226,7 @@ definerule("cprogram",
}, },
function (e) function (e)
local libs = matching(filenamesof(e.deps), "%.a$") local libs = matching(filenamesof(e.deps), "%.a$")
local srcs = {}
if (#e.srcs > 0) then if (#e.srcs > 0) then
for _, f in pairs( for _, f in pairs(
matching( matching(
@ -240,7 +241,7 @@ definerule("cprogram",
"%.a$" "%.a$"
) )
) do ) do
libs[#libs+1] = f srcs[#srcs+1] = f
end end
end end
@ -248,7 +249,7 @@ definerule("cprogram",
name = e.name, name = e.name,
cwd = e.cwd, cwd = e.cwd,
deps = e.deps, deps = e.deps,
ins = libs, ins = { srcs, libs },
outleaves = { e.name }, outleaves = { e.name },
commands = e.commands, commands = e.commands,
} }

View file

@ -1,6 +1,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
int _errsym;
int _erlsym;
/* error takes an error value in the range of 0-255 */ /* error takes an error value in the range of 0-255 */
/* and generates a trap */ /* and generates a trap */
@ -52,9 +55,6 @@ char *errortable[255]={
error(index) error(index)
int index; int index;
{ {
extern int _errsym;
extern int _erlsym;
_setline(); _setline();
if( index<0 || index >40 ) if( index<0 || index >40 )
printf("LINE %d:ERROR %d: Unprintable error\n",_erlsym,index); printf("LINE %d:ERROR %d: Unprintable error\n",_erlsym,index);