From feebeb67516bbf62dcb04c2e32456b8def2b08a2 Mon Sep 17 00:00:00 2001 From: Steven Solie Date: Tue, 27 Jun 2017 21:28:58 -0600 Subject: [PATCH 1/2] GCC 5 changes --- library/GNUmakefile.os4 | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/library/GNUmakefile.os4 b/library/GNUmakefile.os4 index dbe3f93..c232f5b 100644 --- a/library/GNUmakefile.os4 +++ b/library/GNUmakefile.os4 @@ -60,7 +60,7 @@ WARNINGS := \ # -Wconversion -Wshadow INCLUDES := -Iinclude -I. -I$(SDK_INCLUDE) - OPTIONS := -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common -std=gnu99 -mcrt=clib2 + OPTIONS := -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-builtin -fno-common -std=c99 -mcrt=clib2 OPTIMIZE := -DNDEBUG -O3 #DEBUG := -ggdb @@ -160,6 +160,10 @@ cvs-tag: # General build rules for all object files and the individual libraries +lib/crtbegin.o : CFLAGS += -fno-aggressive-loop-optimizations +lib/crtbegin.o : crtbegin.c + @$(COMPILE) + lib/%.o : AFLAGS += $(LARGEDATA) lib/%.o : %.S @$(ASSEMBLE) @@ -171,6 +175,11 @@ lib/small-data/%.o : AFLAGS += $(SMALLDATA) lib/small-data/%.o : %.S @$(ASSEMBLE) +lib/small-data/crtbegin.o : CFLAGS += $(SMALLDATA) -fno-aggressive-loop-optimizations +lib/small-data/crtbegin.o : crtbegin.c + @$(COMPILE) + +lib/small-data/%.o : CFLAGS += $(SMALLDATA) lib/small-data/%.o : %.c @$(COMPILE) @@ -178,6 +187,11 @@ lib/soft-float/%.o : AFLAGS += $(SOFTFLOAT) lib/soft-float/%.o : %.S @$(ASSEMBLE) +lib/soft-float/crtbegin.o : CFLAGS += $(SOFTFLOAT) -fno-aggressive-loop-optimizations +lib/soft-float/crtbegin.o : crtbegin.c + @$(COMPILE) + +lib/soft-float/%.o : CFLAGS += $(SOFTFLOAT) lib/soft-float/%.o : %.c @$(COMPILE) @@ -185,6 +199,11 @@ lib/baserel/%.o : AFLAGS += $(BASEREL) lib/baserel/%.o : %.S @$(ASSEMBLE) +lib/baserel/crtbegin.o : CFLAGS += $(BASEREL) -fno-aggressive-loop-optimizations +lib/baserel/crtbegin.o : crtbegin.c + @$(COMPILE) + +lib/baserel/%.o : CFLAGS += $(BASEREL) lib/baserel/%.o : %.c @$(COMPILE) @@ -192,6 +211,11 @@ lib.threadsafe/%.o : AFLAGS += $(LARGEDATA) $(THREADSAFE) lib.threadsafe/%.o : %.S @$(ASSEMBLE) +lib.threadsafe/crtbegin.o : CFLAGS += $(THREADSAFE) $(LARGEDATA) -fno-aggressive-loop-optimizations +lib.threadsafe/crtbegin.o : crtbegin.c + @$(COMPILE) + +lib.threadsafe/%.o : CFLAGS += $(THREADSAFE) $(LARGEDATA) lib.threadsafe/%.o : %.c @$(COMPILE) @@ -199,6 +223,11 @@ lib.threadsafe/small-data/%.o : AFLAGS += $(SMALLDATA) $(THREADSAFE) lib.threadsafe/small-data/%.o : %.S @$(ASSEMBLE) +lib.threadsafe/small-data/crtbegin.o : CFLAGS += $(THREADSAFE) $(SMALLDATA) -fno-aggressive-loop-optimizations +lib.threadsafe/small-data/crtbegin.o : crtbegin.c + @$(COMPILE) + +lib.threadsafe/small-data/%.o : CFLAGS += $(THREADSAFE) $(SMALLDATA) lib.threadsafe/small-data/%.o : %.c @$(COMPILE) @@ -206,6 +235,11 @@ lib.threadsafe/soft-float/%.o : AFLAGS += $(SOFTFLOAT) $(THREADSAFE) lib.threadsafe/soft-float/%.o : %.S @$(ASSEMBLE) +lib.threadsafe/soft-float/crtbegin.o : CFLAGS += $(THREADSAFE) $(SOFTFLOAT) -fno-aggressive-loop-optimizations +lib.threadsafe/soft-float/crtbegin.o : crtbegin.c + @$(COMPILE) + +lib.threadsafe/soft-float/%.o : CFLAGS += $(THREADSAFE) $(SOFTFLOAT) lib.threadsafe/soft-float/%.o : %.c @$(COMPILE) @@ -213,6 +247,11 @@ lib.threadsafe/baserel/%.o : AFLAGS += $(BASEREL) $(THREADSAFE) lib.threadsafe/baserel/%.o : %.S @$(ASSEMBLE) +lib.threadsafe/baserel/crtbegin.o : CFLAGS += $(THREADSAFE) $(BASEREL) -fno-aggressive-loop-optimizations +lib.threadsafe/baserel/crtbegin.o : crtbegin.c + @$(COMPILE) + +lib.threadsafe/baserel/%.o : CFLAGS += $(THREADSAFE) $(BASEREL) lib.threadsafe/baserel/%.o : %.c @$(COMPILE) From 6a1fd36b3a43ad6193f16374a05ac9aa1d26fb31 Mon Sep 17 00:00:00 2001 From: Steven Solie Date: Tue, 27 Jun 2017 21:31:27 -0600 Subject: [PATCH 2/2] Revision bump. --- library/amiga.lib_rev.h | 10 +++++----- library/amiga.lib_rev.rev | 2 +- library/c.lib_rev.h | 10 +++++----- library/c.lib_rev.rev | 2 +- library/changes | 9 +++++++++ library/crtbegin.c | 9 +++++++-- library/debug.lib_rev.h | 10 +++++----- library/debug.lib_rev.rev | 2 +- library/m.lib_rev.h | 10 +++++----- library/m.lib_rev.rev | 2 +- library/net.lib_rev.h | 10 +++++----- library/net.lib_rev.rev | 2 +- library/unix.lib_rev.h | 10 +++++----- library/unix.lib_rev.rev | 2 +- 14 files changed, 52 insertions(+), 38 deletions(-) diff --git a/library/amiga.lib_rev.h b/library/amiga.lib_rev.h index 6068aa8..15183b1 100644 --- a/library/amiga.lib_rev.h +++ b/library/amiga.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 214 -#define DATE "27.4.2017" -#define VERS "amiga.lib 1.214" -#define VSTRING "amiga.lib 1.214 (27.4.2017)\r\n" -#define VERSTAG "\0$VER: amiga.lib 1.214 (27.4.2017)" +#define REVISION 215 +#define DATE "26.6.2017" +#define VERS "amiga.lib 1.215" +#define VSTRING "amiga.lib 1.215 (26.6.2017)\r\n" +#define VERSTAG "\0$VER: amiga.lib 1.215 (26.6.2017)" diff --git a/library/amiga.lib_rev.rev b/library/amiga.lib_rev.rev index 9d683f8..c34a804 100644 --- a/library/amiga.lib_rev.rev +++ b/library/amiga.lib_rev.rev @@ -1 +1 @@ -214 +215 diff --git a/library/c.lib_rev.h b/library/c.lib_rev.h index 92ed87b..6eaa68e 100644 --- a/library/c.lib_rev.h +++ b/library/c.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 214 -#define DATE "27.4.2017" -#define VERS "c.lib 1.214" -#define VSTRING "c.lib 1.214 (27.4.2017)\r\n" -#define VERSTAG "\0$VER: c.lib 1.214 (27.4.2017)" +#define REVISION 215 +#define DATE "26.6.2017" +#define VERS "c.lib 1.215" +#define VSTRING "c.lib 1.215 (26.6.2017)\r\n" +#define VERSTAG "\0$VER: c.lib 1.215 (26.6.2017)" diff --git a/library/c.lib_rev.rev b/library/c.lib_rev.rev index 9d683f8..c34a804 100644 --- a/library/c.lib_rev.rev +++ b/library/c.lib_rev.rev @@ -1 +1 @@ -214 +215 diff --git a/library/changes b/library/changes index 912381c..a76cfee 100644 --- a/library/changes +++ b/library/changes @@ -1,3 +1,12 @@ +c.lib 1.215 (26.6.2017) + +- Added -fno-aggressive-loop-optimizations option when building crtbegin.c + to work around constructor/destructor hack with GCC 5.4.0 on AmigaOS 4. + +- Added -fno-builtin option to fix conflicts with builtin memset() + with GCC 5.4.0 on AmigaOS 4. + + c.lib 1.214 (27.4.2017) - Added integer overflow test to calloc(). diff --git a/library/crtbegin.c b/library/crtbegin.c index 1321ef4..9909e8b 100644 --- a/library/crtbegin.c +++ b/library/crtbegin.c @@ -1,5 +1,5 @@ /* - * $Id: crtbegin.c,v 1.13 2010-08-21 11:37:03 obarthel Exp $ + * crtbegin.c * * :ts=4 * @@ -48,7 +48,12 @@ * Dummy constructor and destructor array. The linker script will put these at the * very beginning of section ".ctors" and ".dtors". crtend.o contains a similar entry * with a NULL pointer entry and is put at the end of the sections. This way, the init - * code can find the global constructor/destructor pointers + * code can find the global constructor/destructor pointers. + * + * WARNING: + * This hack does not work correctly with GCC 5 and higher. The optimizer + * will see a one element array and act appropriately. The current workaround + * is to use -fno-aggressive-loop-optimizations when compiling this file. */ static void (*__CTOR_LIST__[1]) (void) __attribute__(( used, section(".ctors"), aligned(sizeof(void (*)(void))) )); static void (*__DTOR_LIST__[1]) (void) __attribute__(( used, section(".dtors"), aligned(sizeof(void (*)(void))) )); diff --git a/library/debug.lib_rev.h b/library/debug.lib_rev.h index 0d331ff..6446e1b 100644 --- a/library/debug.lib_rev.h +++ b/library/debug.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 214 -#define DATE "27.4.2017" -#define VERS "debug.lib 1.214" -#define VSTRING "debug.lib 1.214 (27.4.2017)\r\n" -#define VERSTAG "\0$VER: debug.lib 1.214 (27.4.2017)" +#define REVISION 215 +#define DATE "26.6.2017" +#define VERS "debug.lib 1.215" +#define VSTRING "debug.lib 1.215 (26.6.2017)\r\n" +#define VERSTAG "\0$VER: debug.lib 1.215 (26.6.2017)" diff --git a/library/debug.lib_rev.rev b/library/debug.lib_rev.rev index 9d683f8..c34a804 100644 --- a/library/debug.lib_rev.rev +++ b/library/debug.lib_rev.rev @@ -1 +1 @@ -214 +215 diff --git a/library/m.lib_rev.h b/library/m.lib_rev.h index e554f25..03a0cc6 100644 --- a/library/m.lib_rev.h +++ b/library/m.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 214 -#define DATE "27.4.2017" -#define VERS "m.lib 1.214" -#define VSTRING "m.lib 1.214 (27.4.2017)\r\n" -#define VERSTAG "\0$VER: m.lib 1.214 (27.4.2017)" +#define REVISION 215 +#define DATE "26.6.2017" +#define VERS "m.lib 1.215" +#define VSTRING "m.lib 1.215 (26.6.2017)\r\n" +#define VERSTAG "\0$VER: m.lib 1.215 (26.6.2017)" diff --git a/library/m.lib_rev.rev b/library/m.lib_rev.rev index 9d683f8..c34a804 100644 --- a/library/m.lib_rev.rev +++ b/library/m.lib_rev.rev @@ -1 +1 @@ -214 +215 diff --git a/library/net.lib_rev.h b/library/net.lib_rev.h index 25ecad1..caa4c1b 100644 --- a/library/net.lib_rev.h +++ b/library/net.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 214 -#define DATE "27.4.2017" -#define VERS "net.lib 1.214" -#define VSTRING "net.lib 1.214 (27.4.2017)\r\n" -#define VERSTAG "\0$VER: net.lib 1.214 (27.4.2017)" +#define REVISION 215 +#define DATE "26.6.2017" +#define VERS "net.lib 1.215" +#define VSTRING "net.lib 1.215 (26.6.2017)\r\n" +#define VERSTAG "\0$VER: net.lib 1.215 (26.6.2017)" diff --git a/library/net.lib_rev.rev b/library/net.lib_rev.rev index 9d683f8..c34a804 100644 --- a/library/net.lib_rev.rev +++ b/library/net.lib_rev.rev @@ -1 +1 @@ -214 +215 diff --git a/library/unix.lib_rev.h b/library/unix.lib_rev.h index 6c5c974..c93fb22 100644 --- a/library/unix.lib_rev.h +++ b/library/unix.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 214 -#define DATE "27.4.2017" -#define VERS "unix.lib 1.214" -#define VSTRING "unix.lib 1.214 (27.4.2017)\r\n" -#define VERSTAG "\0$VER: unix.lib 1.214 (27.4.2017)" +#define REVISION 215 +#define DATE "26.6.2017" +#define VERS "unix.lib 1.215" +#define VSTRING "unix.lib 1.215 (26.6.2017)\r\n" +#define VERSTAG "\0$VER: unix.lib 1.215 (26.6.2017)" diff --git a/library/unix.lib_rev.rev b/library/unix.lib_rev.rev index 9d683f8..c34a804 100644 --- a/library/unix.lib_rev.rev +++ b/library/unix.lib_rev.rev @@ -1 +1 @@ -214 +215