if(a != ACALL) {
q = brchain(p->link);
if(q != P && q->mark)
- if(a != ALOOP) {
+ if(a != ALOOP && a != ATEXT) {
p->as = relinv(a);
p->link = p->pcond;
p->pcond = q;
switch(s->type) {
default:
/* diag prints TNAME first */
- diag("%s is undefined", s->name);
+ diag("undefined: %s", s->name);
s->type = STEXT;
s->value = vexit;
break; /* or fall through to set offset? */
if(p->as == ATEXT) {
curtext = p;
autoffset = p->to.offset;
- if(autoffset < 0)
+ if(autoffset < 0) {
autoffset = 0;
+ p->to.offset = 0;
+ }
if(autoffset) {
p = appendp(p);
p->as = AADJSP;
n = 0;
for(i = 0; i < NHASH; i++)
for(s = hash[i]; s != S; s = s->link)
- if(s->sig != 0 && s->type != SXREF && s->type != SUNDEF && (nexports == 0 || s->subtype == SEXPORT))
+ if(s->type != SXREF && s->type != SUNDEF && (nexports == 0 && s->sig != 0 || s->subtype == SEXPORT || allexport))
n++;
esyms = malloc(n*sizeof(Sym*));
ne = n;
n = 0;
for(i = 0; i < NHASH; i++)
for(s = hash[i]; s != S; s = s->link)
- if(s->sig != 0 && s->type != SXREF && s->type != SUNDEF && (nexports == 0 || s->subtype == SEXPORT))
+ if(s->type != SXREF && s->type != SUNDEF && (nexports == 0 && s->sig != 0 || s->subtype == SEXPORT || allexport))
esyms[n++] = s;
for(i = 0; i < ne-1; i++)
for(j = i+1; j < ne; j++)