From e830516069a20053f16ae2e103e8b248d5d7b183 Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Sun, 14 Aug 2016 13:47:23 +0200 Subject: [PATCH] 6809: Build levee, sh and kernel with -fno-cprop-registers Something goes wrong in gcc6809's cprop_hardreg pass if there are exg,add,exg patterns around. The kernel seemed fine up to now, but add the flag just to avoid any undiscovered or future issues. Remove the gratuitous() workaround from sh/blok.c Signed-off-by: Tormod Volden --- Applications/V7/cmd/sh/Makefile.6809 | 2 ++ Applications/V7/cmd/sh/blok.c | 2 -- Applications/V7/cmd/sh/main.c | 4 ---- Applications/levee/Makefile.6809 | 2 ++ Kernel/cpu-6809/rules.mk | 2 ++ 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Applications/V7/cmd/sh/Makefile.6809 b/Applications/V7/cmd/sh/Makefile.6809 index 620c3711..b940f780 100644 --- a/Applications/V7/cmd/sh/Makefile.6809 +++ b/Applications/V7/cmd/sh/Makefile.6809 @@ -5,6 +5,8 @@ ASM = m6809-unknown-as AR = m6809-unknown-ar LINKER = lwlink CFLAGS = -I../../../../Library/include -I../../../../Library/include/6809 -Wall -pedantic -fno-strict-aliasing +# Workaround for gcc6809 bug - register copy propagation issue +CFLAGS += -fno-cprop-registers COPT = -Os LINKER_OPT = --format=raw -L../../../../Library/libs -lc6809 LIBGCCDIR = $(dir $(shell $(CC) -print-libgcc-file-name)) diff --git a/Applications/V7/cmd/sh/blok.c b/Applications/V7/cmd/sh/blok.c index 9f276add..e17250f1 100644 --- a/Applications/V7/cmd/sh/blok.c +++ b/Applications/V7/cmd/sh/blok.c @@ -53,7 +53,6 @@ ADDRESS alloc(POS nbytes) p->word = q->word; /* printf("H%d ", ADR(q) - ADR(p)); */ - gratuitous_call(); /* Big enough hole */ if (ADR(q) - ADR(p) >= rbytes) { /* blokp is the first byte after @@ -62,7 +61,6 @@ ADDRESS alloc(POS nbytes) /* Splitting ? */ if (q > blokp) { /* printf("S");*/ - gratuitous_call(); blokp->word = p->word; } /* Update our block */ diff --git a/Applications/V7/cmd/sh/main.c b/Applications/V7/cmd/sh/main.c index e2127d11..2c0b136a 100644 --- a/Applications/V7/cmd/sh/main.c +++ b/Applications/V7/cmd/sh/main.c @@ -193,7 +193,3 @@ void Ldup(register int fa, register int fb) close(fa); fcntl(fb, F_SETFD, FD_CLOEXEC); } - -void gratuitous_call(void) -{ -} diff --git a/Applications/levee/Makefile.6809 b/Applications/levee/Makefile.6809 index be46ff80..79da4f06 100644 --- a/Applications/levee/Makefile.6809 +++ b/Applications/levee/Makefile.6809 @@ -6,6 +6,8 @@ AR = m6809-unknown-ar LINKER = lwlink CFLAGS = -I../../Library/include -I../../Library/include/6809 COPT = -Os -fomit-frame-pointer +# Workaround for gcc6809 bug - register copy propagation issue +COPT += -fno-cprop-registers LINKER_OPT = --format=raw -L../../Library/libs -lc6809 LIBGCCDIR = $(dir $(shell $(CC) -print-libgcc-file-name)) LINKER_OPT += -L$(LIBGCCDIR) -lgcc diff --git a/Kernel/cpu-6809/rules.mk b/Kernel/cpu-6809/rules.mk index 084b932f..c7921d89 100644 --- a/Kernel/cpu-6809/rules.mk +++ b/Kernel/cpu-6809/rules.mk @@ -3,6 +3,8 @@ export CROSS_LD=lwlink export CROSS_CC = m6809-unknown-gcc #export CROSS_CCOPTS=-Wall -O2 -I$(ROOT_DIR)/cpu-6809 -I$(ROOT_DIR)/platform-$(TARGET) -I$(ROOT_DIR)/include export CROSS_CCOPTS=-c -Wall -Os -msoft-reg-count=0 -mfar-stack-param -I$(ROOT_DIR)/cpu-6809 -I$(ROOT_DIR)/platform-$(TARGET) -I$(ROOT_DIR)/include +# Workaround for gcc6809 bug - register copy propagation issue +CROSS_CCOPTS += -fno-cprop-registers export CROSS_CC_SEG1=-mcode-section=.text -mfar-code-page=1 export CROSS_CC_SEG2=-mcode-section=.text2 -mfar-code-page=2 #Given the compactness we don't need a CODE3 segment really -- 2.34.1