scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 3af210a83dd2456a57cc84828ccd5d9c44af3aea
parent 4a59d9140388e39c986b69f0c5a0ac12a55608a1
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 20 Feb 2019 08:08:59 +0000

[libmach] Keep archive names with at least 1 letter

This fix is needed for files with names like '/' used
by some libraries for the index file.

Diffstat:
Msrc/cmd/nm.c | 2+-
Msrc/libmach/armember.c | 2+-
Msrc/libmach/coff32/coff32getsyms.c | 8++++----
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/cmd/nm.c b/src/cmd/nm.c @@ -155,7 +155,7 @@ newobject(FILE *fp, int type) return; } - if (objread(obj, fp) < 0 || objsyms(obj)) + if (objread(obj, fp) < 0 || objsyms(obj) < 0) goto error; for (sym = obj->syms; sym; sym = sym->next) diff --git a/src/libmach/armember.c b/src/libmach/armember.c @@ -14,7 +14,7 @@ getfname(struct ar_hdr *hdr, char *dst) memcpy(dst, hdr->ar_name, SARNAM); dst[SARNAM] = '\0'; - for (i = SARNAM-1; i >= 0; i--) { + for (i = SARNAM-1; i > 0; i--) { if (dst[i] != ' ' && dst[i] != '/') break; dst[i] = '\0'; diff --git a/src/libmach/coff32/coff32getsyms.c b/src/libmach/coff32/coff32getsyms.c @@ -73,18 +73,18 @@ coff32getsyms(Obj *obj) ent = &coff->ents[i]; if ((t = typeof(coff, ent)) < 0) - return 0; + return -1; if ((s = symname(coff, ent)) == NULL) - return 0; + return -1; if ((sym = objlookup(obj, s, 1)) == NULL) - return 0; + return -1; sym->type = t; sym->value = ent->n_value; sym->size = (sym->type == 'C') ? ent->n_value : 0; } - return 1; + return i; }