scc

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

commit 5cdbd266c31962ec9ebcef0415d2f104b209cddb
parent c1e1df2ac4a400eae9b97a01106a95cc927f83db
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Fri,  8 May 2026 19:08:59 +0200

ranlib: Use offset to member headers

We were generating an index table of pointers to the content of
the object files, but ld expects the pointers to the ar headers
which contain required information like the size of the object
file.

Diffstat:
Msrc/cmd/scc-ranlib.c | 11+++--------
1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/cmd/scc-ranlib.c b/src/cmd/scc-ranlib.c @@ -133,18 +133,13 @@ freehash(void) } static int -newmember(FILE *fp) +newmember(FILE *fp, long off) { int i,t, ret = 0; Obj *obj; Symbol sym; - offset = ftell(fp); - - if (offset == EOF) { - error(strerror(errno)); - return 0; - } + offset = off; t = objprobe(fp, NULL); if (t == -1 || artype != -1 && artype != t) { @@ -210,7 +205,7 @@ readsyms(FILE *fp) default: membname = memb; if (objprobe(fp, NULL) != -1) - newmember(fp); + newmember(fp, cur); membname = NULL; fseek(fp, cur, SEEK_SET); fseek(fp, off, SEEK_CUR);