scc

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

commit 279ddf083f38a06bc0d075a292d908136e23d864
parent e532ed7566f8402a50b252bdc1496f9cdf87ea52
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 26 Feb 2019 05:10:29 +0000

[libmach] Fix coff32getsect()

The pointer to the section was not updated and the same section
was exported several times.

Diffstat:
Msrc/libmach/coff32/coff32getsect.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/libmach/coff32/coff32getsect.c b/src/libmach/coff32/coff32getsect.c @@ -19,7 +19,6 @@ coff32getsect(Obj *obj) coff = obj->data; hdr = &coff->hdr; - scn = coff->scns; secs = malloc(sizeof(Objsect) * hdr->f_nscns); if (!secs) @@ -28,6 +27,8 @@ coff32getsect(Obj *obj) for (i = 0; i < hdr->f_nscns; i++) { sp = &secs[i]; sp->next = (i < hdr->f_nscns-1) ? &secs[i+1] : NULL; + scn = &coff->scns[i]; + flags = scn->s_flags; if (flags & STYP_TEXT) { type = 'T'; @@ -66,6 +67,7 @@ coff32getsect(Obj *obj) sp->offset = scn->s_scnptr; sp->size = scn->s_size; sp->type = type; + sp->flags = sflags; sp->align = 4; /* TODO: Check how align is defined in coff */ } obj->secs = secs;