From 3e670b934f83d262fd584278293fa22c32b55e07 Mon Sep 17 00:00:00 2001 From: luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> Date: Wed, 25 Nov 2020 09:30:16 -0500 Subject: [PATCH 1/5] Add support for building agbcc without devkitPro --- libc/Makefile | 6 ++++++ libgcc/Makefile | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/libc/Makefile b/libc/Makefile index 48bfa403..c377f1ab 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -1,4 +1,10 @@ +ifneq (,$(wildcard $(DEVKITARM)/base_tools)) include $(DEVKITARM)/base_tools +else +PREFIX := arm-none-eabi- +export AR := $(PREFIX)ar +export AS := $(PREFIX)as +endif SHELL := /bin/bash -o pipefail diff --git a/libgcc/Makefile b/libgcc/Makefile index b1490373..721d9d24 100644 --- a/libgcc/Makefile +++ b/libgcc/Makefile @@ -1,4 +1,11 @@ +ifneq (,$(wildcard $(DEVKITARM)/base_tools)) include $(DEVKITARM)/base_tools +else +PREFIX := arm-none-eabi- +export AR := $(PREFIX)ar +export AS := $(PREFIX)as +endif + CC1 = ../old_agbcc libgcc.a: libgcc1.a libgcc2.a fp-bit.o dp-bit.o From 1d64f265ac4efa58a1866a839c16af9dce6b6ae0 Mon Sep 17 00:00:00 2001 From: luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> Date: Wed, 16 Dec 2020 13:48:32 -0500 Subject: [PATCH 2/5] Check $(DEVKITARM)/bin instead of $(DEVKITARM)/base_tools Rationale: uninstalling devkitarm doesn't remove base_tools, but removes bin. If the binaries exist but not base_tools, then the user clearly wants to install using dkA. Otherwise, if base_tools exists but not binaries, it is possible that the user wants to use standalone arm-none-eabi binaries. --- libc/Makefile | 2 +- libgcc/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/Makefile b/libc/Makefile index c377f1ab..2b60a95d 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -1,4 +1,4 @@ -ifneq (,$(wildcard $(DEVKITARM)/base_tools)) +ifneq (,$(wildcard $(DEVKITARM)/bin)) include $(DEVKITARM)/base_tools else PREFIX := arm-none-eabi- diff --git a/libgcc/Makefile b/libgcc/Makefile index 721d9d24..1aec873f 100644 --- a/libgcc/Makefile +++ b/libgcc/Makefile @@ -1,4 +1,4 @@ -ifneq (,$(wildcard $(DEVKITARM)/base_tools)) +ifneq (,$(wildcard $(DEVKITARM)/bin)) include $(DEVKITARM)/base_tools else PREFIX := arm-none-eabi- From e4250fbaac8c4944d27f58cbfa469edd8b6374f5 Mon Sep 17 00:00:00 2001 From: luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> Date: Wed, 16 Dec 2020 19:43:34 -0500 Subject: [PATCH 3/5] Check for $(DEVKITARM) first before checking for $(DEVKITARM)/bin --- libc/Makefile | 13 +++++++++++-- libgcc/Makefile | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/libc/Makefile b/libc/Makefile index 2b60a95d..d9de489f 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -1,6 +1,15 @@ -ifneq (,$(wildcard $(DEVKITARM)/bin)) -include $(DEVKITARM)/base_tools +ifneq (,$(DEVKITARM)) + ifneq (,$(wildcard $(DEVKITARM)/bin)) + include $(DEVKITARM)/base_tools + DKA_EXISTS=1 + else + DKA_EXISTS=0 + endif else +DKA_EXISTS=0 +endif + +ifneq ($(DKA_EXISTS),1) PREFIX := arm-none-eabi- export AR := $(PREFIX)ar export AS := $(PREFIX)as diff --git a/libgcc/Makefile b/libgcc/Makefile index 1aec873f..6461d8ec 100644 --- a/libgcc/Makefile +++ b/libgcc/Makefile @@ -1,6 +1,15 @@ -ifneq (,$(wildcard $(DEVKITARM)/bin)) -include $(DEVKITARM)/base_tools +ifneq (,$(DEVKITARM)) + ifneq (,$(wildcard $(DEVKITARM)/bin)) + include $(DEVKITARM)/base_tools + DKA_EXISTS=1 + else + DKA_EXISTS=0 + endif else +DKA_EXISTS=0 +endif + +ifneq ($(DKA_EXISTS),1) PREFIX := arm-none-eabi- export AR := $(PREFIX)ar export AS := $(PREFIX)as From 1f83e3d73ffcb5ed0d028f132337d8d86b8d0ead Mon Sep 17 00:00:00 2001 From: luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> Date: Mon, 25 Jan 2021 22:25:35 -0500 Subject: [PATCH 4/5] Fix builds on xcode 12+ Enforce the use of -Werror-implicit-function-declaration for all platforms to catch this. See: https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes --- gcc/Makefile | 2 +- gcc/toplev.c | 1 + gcc_arm/Makefile.in | 2 +- gcc_arm/config/arm/arm.c | 2 +- gcc_arm/config/arm/arm.h | 6 ++++++ gcc_arm/gcse.c | 3 +-- gcc_arm/genoutput.c | 2 +- gcc_arm/range.c | 2 ++ gcc_arm/rtl.h | 3 +++ 9 files changed, 17 insertions(+), 6 deletions(-) diff --git a/gcc/Makefile b/gcc/Makefile index c30991a8..9756e901 100644 --- a/gcc/Makefile +++ b/gcc/Makefile @@ -24,7 +24,7 @@ VPATH = $(srcdir) CC = gcc -BASE_CFLAGS = -g -std=gnu11 +BASE_CFLAGS = -g -std=gnu11 -Werror-implicit-function-declaration INCLUDES = -I. -I$(srcdir) diff --git a/gcc/toplev.c b/gcc/toplev.c index 10d85089..e80ed20c 100755 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -40,6 +40,7 @@ #include "except.h" #include "toplev.h" #include "expr.h" +#include "unistd.h" #if defined (DWARF2_DEBUGGING_INFO) #include "dwarf2out.h" diff --git a/gcc_arm/Makefile.in b/gcc_arm/Makefile.in index e180a12f..09a87117 100755 --- a/gcc_arm/Makefile.in +++ b/gcc_arm/Makefile.in @@ -64,7 +64,7 @@ ALLOCA_FINISH = true XCFLAGS = TCFLAGS = # CYGNUS LOCAL nowarnings/law -CFLAGS = -g +CFLAGS = -g -Werror-implicit-function-declaration BOOT_CFLAGS = -O2 $(CFLAGS) WARN_CFLAGS = # END CYGNUS LOCAL diff --git a/gcc_arm/config/arm/arm.c b/gcc_arm/config/arm/arm.c index 06d942ab..cd643a3d 100755 --- a/gcc_arm/config/arm/arm.c +++ b/gcc_arm/config/arm/arm.c @@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA. */ #include "tree.h" #include "expr.h" #include "toplev.h" +#include "recog.h" /* The maximum number of insns skipped which will be conditionalised if possible. */ @@ -47,7 +48,6 @@ extern FILE *asm_out_file; /* Some function declarations. */ /* CYGNUS LOCAL */ -void arm_increase_location PROTO ((int)); static int get_prologue_size PROTO ((void)); /* END CYGNUS LOCAL */ diff --git a/gcc_arm/config/arm/arm.h b/gcc_arm/config/arm/arm.h index 6429c3dd..964389e7 100755 --- a/gcc_arm/config/arm/arm.h +++ b/gcc_arm/config/arm/arm.h @@ -2215,4 +2215,10 @@ int ok_integer_or_other (); /* END CYGNUS LOCAL */ int s_register_operand (/* register rtx op, enum machine_mode mode */); +void arm_asm_output_label (/*FILE *, char **/); +void arm_increase_location PARAMS ((int)); +int short_branch PARAMS ((int, int)); +int arm_insn_not_targeted (/* rtx */); +int arm_backwards_branch PARAMS ((int, int)); + #endif /* __ARM_H__ */ diff --git a/gcc_arm/gcse.c b/gcc_arm/gcse.c index a91068a7..facc748e 100755 --- a/gcc_arm/gcse.c +++ b/gcc_arm/gcse.c @@ -5168,9 +5168,8 @@ invalidate_nonnull_info (x, setter) This could probably be integrated with global cprop with a little work. */ void -delete_null_pointer_checks (f, pass) +delete_null_pointer_checks (f) rtx f; - int pass; { int_list_ptr *s_preds, *s_succs; int *num_preds, *num_succs; diff --git a/gcc_arm/genoutput.c b/gcc_arm/genoutput.c index 9b57027f..32130d92 100755 --- a/gcc_arm/genoutput.c +++ b/gcc_arm/genoutput.c @@ -226,7 +226,7 @@ from the machine description file `md'. */\n\n"); printf ("#include \"insn-attr.h\"\n\n"); printf ("#include \"insn-codes.h\"\n\n"); printf ("#include \"recog.h\"\n\n"); - + printf ("#include \"tree.h\"\n"); printf ("#include \"output.h\"\n"); } diff --git a/gcc_arm/range.c b/gcc_arm/range.c index d96cacab..f7b69b65 100755 --- a/gcc_arm/range.c +++ b/gcc_arm/range.c @@ -43,6 +43,8 @@ Boston, MA 02111-1307, USA. */ #include "range.h" #include "toplev.h" +void init_regset_vector PROTO ((regset *, int, struct obstack *)); + extern struct obstack *rtl_obstack; /* Information that we gather about registers */ diff --git a/gcc_arm/rtl.h b/gcc_arm/rtl.h index eed04763..c68f0564 100755 --- a/gcc_arm/rtl.h +++ b/gcc_arm/rtl.h @@ -1449,6 +1449,9 @@ extern int gcse_main PROTO ((rtx, FILE *)); /* END CYGNUS LOCAL */ #endif +extern void delete_null_pointer_checks PARAMS ((rtx)); +extern void merge_blocks PARAMS ((rtx)); + /* In global.c */ extern void mark_elimination PROTO ((int, int)); #ifdef BUFSIZ From 5297ebf5085b236d8735c6722034dc5a782c2b0e Mon Sep 17 00:00:00 2001 From: luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> Date: Mon, 9 Aug 2021 18:18:36 -0400 Subject: [PATCH 5/5] Fix compilation on BSD make (from pizza2004). Long-term, this should be fixed by just requiring macOS to use GNU make (probably via setting some alias), but this change is really overdue and not having a macOS computer makes this harder to test. --- libgcc/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libgcc/Makefile b/libgcc/Makefile index 6461d8ec..0e96527d 100644 --- a/libgcc/Makefile +++ b/libgcc/Makefile @@ -18,8 +18,8 @@ endif CC1 = ../old_agbcc libgcc.a: libgcc1.a libgcc2.a fp-bit.o dp-bit.o - $(AR) -x libgcc1.a - $(AR) -x libgcc2.a + $(AR) -x libgcc1.a; + $(AR) -x libgcc2.a; $(AR) -rc libgcc.a *.o LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX @@ -66,19 +66,19 @@ libgcc2.a: libgcc2.c longlong.h mv tmplibgcc2.a libgcc2.a fp-bit.o: fp-bit.c - $(CPP) -undef -I ../ginclude -nostdinc -o fp-bit.i fp-bit.c + $(CPP) -undef -I ../ginclude -nostdinc -o fp-bit.i fp-bit.c; $(CC1) -O2 fp-bit.i rm -f fp-bit.i bash -c 'echo -e ".text\n\t.align\t2, 0\n"' >> fp-bit.s - $(AS) -mcpu=arm7tdmi -o fp-bit.o fp-bit.s + $(AS) -mcpu=arm7tdmi -o fp-bit.o fp-bit.s; rm -f fp-bit.s dp-bit.o: dp-bit.c - $(CPP) -undef -I ../ginclude -nostdinc -o dp-bit.i dp-bit.c + $(CPP) -undef -I ../ginclude -nostdinc -o dp-bit.i dp-bit.c; $(CC1) -O2 dp-bit.i rm -f dp-bit.i bash -c 'echo -e ".text\n\t.align\t2, 0\n"' >> dp-bit.s - $(AS) -mcpu=arm7tdmi -o dp-bit.o dp-bit.s + $(AS) -mcpu=arm7tdmi -o dp-bit.o dp-bit.s; rm -f dp-bit.s fp-bit.c: fp-bit-base.c @@ -94,4 +94,4 @@ dp-bit.c: fp-bit-base.c .PHONY: clean clean: - rm -f *.o *.a *.s *.i + rm -f *.o *.a *.s *.i \ No newline at end of file