From c0832c8df845c4e4111061226aad97145a0cba8c Mon Sep 17 00:00:00 2001 From: Andreas Ziermann Date: Mon, 30 Nov 2015 15:04:07 +0800 Subject: [PATCH 1/2] under CYGWIN bcc requires -o option to compile an .o file otherwise it ends up as .exe and cannot link --- libc/misc/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libc/misc/Makefile b/libc/misc/Makefile index 85614a7..c6eb91e 100644 --- a/libc/misc/Makefile +++ b/libc/misc/Makefile @@ -53,13 +53,13 @@ clean: rm -f *.o libc.a $(LIBC)(strtol.o): strtol.c - $(CC) -c -ansi $(ARCH) $(CCFLAGS) $(DEFS) $*.c + $(CC) -c -ansi $(ARCH) $(CCFLAGS) $(DEFS) -o strtol.o $*.c $(AR) $(ARFLAGS) $@ $*.o $(LIBC)(strtod.o): strtod.c - $(CC) -c -ansi $(ARCH) $(CCFLAGS) $(DEFS) $*.c + $(CC) -c -ansi $(ARCH) $(CCFLAGS) $(DEFS) -o strtod.o $*.c $(AR) $(ARFLAGS) $@ $*.o $(LIBC)(crypt.o): crypt.c - $(CC) -c -ansi $(ARCH) $(CCFLAGS) $(DEFS) $*.c + $(CC) -c -ansi $(ARCH) $(CCFLAGS) $(DEFS) -o crypt.o $*.c $(AR) $(ARFLAGS) $@ $*.o From a44b267e8f7a47123dad8811cf167c544f48cbe0 Mon Sep 17 00:00:00 2001 From: Andreas Ziermann Date: Mon, 30 Nov 2015 15:19:04 +0800 Subject: [PATCH 2/2] fix linker alignment for .bss segment --- ld/writex86.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ld/writex86.c b/ld/writex86.c index feb7b55..8c8b45f 100644 --- a/ld/writex86.c +++ b/ld/writex86.c @@ -56,7 +56,9 @@ #define ABS_TEXT_MAX 64 -#define offsetof(struc, mem) ((int) &((struc *) 0)->mem) +#ifndef offsetof + #define offsetof(struc, mem) ((size_t) &((struc *) 0)->mem) +#endif #define memsizeof(struc, mem) sizeof(((struc *) 0)->mem) PRIVATE bool_t bits32; /* nonzero for 32-bit executable */ @@ -194,10 +196,9 @@ bool_pt argxsym; } else { - tempoffset = ld_roundup(symptr->value, 4, bin_off_t); - /* temp kludge quad alignment for 386 */ - symptr->value = comsz[seg = symptr->flags & SEGM_MASK]; - comsz[seg] += tempoffset; + tempoffset = symptr->value; + symptr->value = ld_roundup(comsz[seg = symptr->flags & SEGM_MASK],tempoffset,bin_off_t); + comsz[seg] = symptr->value+tempoffset; if (!(symptr->flags & SA_MASK)) symptr->flags |= C_MASK; }