The GNU toolchain explicitly avoids common variables.  Whoever
hacked up this derived version didn't understand that.

* binutils: Since linkrelax is already defined as a global variable,
  it is already initialized to 0, so we can simply drop this
  initialization.

* gcc-bootstrap, gcc: Use the mechanism provided by the .opt file
  processing to initialize these globals.

With this, devel/avr32/* builds.

OK?

Index: binutils/Makefile
===================================================================
RCS file: /cvs/ports/devel/avr32/binutils/Makefile,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile
--- binutils/Makefile   12 Jul 2019 21:15:34 -0000      1.4
+++ binutils/Makefile   12 Feb 2021 22:41:54 -0000
@@ -2,6 +2,7 @@
 
 COMMENT =      Atmel AVR 32-bit binutils
 V =            2.23.1
+REVISION =     0
 DISTNAME =     avr32-binutils-${V}
 
 # GPLv3
Index: binutils/patches/patch-gas_config_tc-avr32_c
===================================================================
RCS file: binutils/patches/patch-gas_config_tc-avr32_c
diff -N binutils/patches/patch-gas_config_tc-avr32_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ binutils/patches/patch-gas_config_tc-avr32_c        12 Feb 2021 22:41:54 
-0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+fix for -fno-common
+
+Index: gas/config/tc-avr32.c
+--- gas/config/tc-avr32.c.orig
++++ gas/config/tc-avr32.c
+@@ -47,7 +47,6 @@
+ 
+ /* Flags given on the command line */
+ static int avr32_pic  = FALSE;
+-int linkrelax = FALSE;
+ int avr32_iarcompat   = FALSE;
+ 
+ /* This array holds the chars that always start a comment. */
Index: gcc/Makefile
===================================================================
RCS file: /cvs/ports/devel/avr32/gcc/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- gcc/Makefile        15 Jan 2021 19:03:58 -0000      1.8
+++ gcc/Makefile        12 Feb 2021 22:41:54 -0000
@@ -3,7 +3,7 @@
 COMMENT =      Atmel AVR 32-bit gcc
 V =            4.4.7
 DISTNAME =     avr32-gcc-${V}
-REVISION =     1
+REVISION =     2
 
 # GPLv3
 PERMIT_PACKAGE =       Yes
Index: gcc/patches/patch-gcc_config_avr32_avr32_c
===================================================================
RCS file: gcc/patches/patch-gcc_config_avr32_avr32_c
diff -N gcc/patches/patch-gcc_config_avr32_avr32_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gcc/patches/patch-gcc_config_avr32_avr32_c  12 Feb 2021 22:41:54 -0000
@@ -0,0 +1,18 @@
+$OpenBSD$
+
+fix for -fno-common
+
+Index: gcc/config/avr32/avr32.c
+--- gcc/config/avr32/avr32.c.orig
++++ gcc/config/avr32/avr32.c
+@@ -207,10 +207,6 @@ static const struct arch_type_s avr32_arch_types[] = {
+   {NULL, 0, 0, 0, NULL}
+ };
+ 
+-/* Default arch name */
+-const char *avr32_arch_name = "none";
+-const char *avr32_part_name = "none";
+-
+ const struct part_type_s *avr32_part;
+ const struct arch_type_s *avr32_arch;
+ 
Index: gcc/patches/patch-gcc_config_avr32_avr32_opt
===================================================================
RCS file: gcc/patches/patch-gcc_config_avr32_avr32_opt
diff -N gcc/patches/patch-gcc_config_avr32_avr32_opt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gcc/patches/patch-gcc_config_avr32_avr32_opt        12 Feb 2021 22:41:54 
-0000
@@ -0,0 +1,25 @@
+$OpenBSD$
+
+fix for -fno-common
+
+Index: gcc/config/avr32/avr32.opt
+--- gcc/config/avr32/avr32.opt.orig
++++ gcc/config/avr32/avr32.opt
+@@ -56,7 +56,7 @@ Target Report Mask(HAS_ASM_ADDR_PSEUDOS) 
+ Use assembler pseudo-instructions lda.w and call for handling direct 
addresses. (Enabled by default)
+ 
+ mpart=
+-Target Report RejectNegative Joined Var(avr32_part_name)
++Target Report RejectNegative Joined Var(avr32_part_name) Init("none")
+ Specify the AVR32 part name
+ 
+ mcpu=
+@@ -64,7 +64,7 @@ Target Report RejectNegative Joined Undocumented Var(a
+ Specify the AVR32 part name (deprecated)
+ 
+ march=
+-Target Report RejectNegative Joined Var(avr32_arch_name)
++Target Report RejectNegative Joined Var(avr32_arch_name) Init("none")
+ Specify the AVR32 architecture name
+ 
+ mfast-float
Index: gcc-bootstrap/Makefile
===================================================================
RCS file: /cvs/ports/devel/avr32/gcc-bootstrap/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- gcc-bootstrap/Makefile      9 Jan 2021 21:41:16 -0000       1.8
+++ gcc-bootstrap/Makefile      12 Feb 2021 22:41:54 -0000
@@ -7,7 +7,7 @@ PKGNAME =       avr32-gcc-bootstrap-${V}
 
 # GPLv3
 PERMIT_PACKAGE =       Yes
-REVISION =             1
+REVISION =             2
 
 WANTLIB =              c gmp mpfr
 DIST_SUBDIR =          gcc
Index: gcc-bootstrap/patches/patch-gcc_config_avr32_avr32_c
===================================================================
RCS file: gcc-bootstrap/patches/patch-gcc_config_avr32_avr32_c
diff -N gcc-bootstrap/patches/patch-gcc_config_avr32_avr32_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gcc-bootstrap/patches/patch-gcc_config_avr32_avr32_c        12 Feb 2021 
22:41:54 -0000
@@ -0,0 +1,18 @@
+$OpenBSD$
+
+fix for -fno-common
+
+Index: gcc/config/avr32/avr32.c
+--- gcc/config/avr32/avr32.c.orig
++++ gcc/config/avr32/avr32.c
+@@ -207,10 +207,6 @@ static const struct arch_type_s avr32_arch_types[] = {
+   {NULL, 0, 0, 0, NULL}
+ };
+ 
+-/* Default arch name */
+-const char *avr32_arch_name = "none";
+-const char *avr32_part_name = "none";
+-
+ const struct part_type_s *avr32_part;
+ const struct arch_type_s *avr32_arch;
+ 
Index: gcc-bootstrap/patches/patch-gcc_config_avr32_avr32_opt
===================================================================
RCS file: gcc-bootstrap/patches/patch-gcc_config_avr32_avr32_opt
diff -N gcc-bootstrap/patches/patch-gcc_config_avr32_avr32_opt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gcc-bootstrap/patches/patch-gcc_config_avr32_avr32_opt      12 Feb 2021 
22:41:54 -0000
@@ -0,0 +1,25 @@
+$OpenBSD$
+
+fix for -fno-common
+
+Index: gcc/config/avr32/avr32.opt
+--- gcc/config/avr32/avr32.opt.orig
++++ gcc/config/avr32/avr32.opt
+@@ -56,7 +56,7 @@ Target Report Mask(HAS_ASM_ADDR_PSEUDOS) 
+ Use assembler pseudo-instructions lda.w and call for handling direct 
addresses. (Enabled by default)
+ 
+ mpart=
+-Target Report RejectNegative Joined Var(avr32_part_name)
++Target Report RejectNegative Joined Var(avr32_part_name) Init("none")
+ Specify the AVR32 part name
+ 
+ mcpu=
+@@ -64,7 +64,7 @@ Target Report RejectNegative Joined Undocumented Var(a
+ Specify the AVR32 part name (deprecated)
+ 
+ march=
+-Target Report RejectNegative Joined Var(avr32_arch_name)
++Target Report RejectNegative Joined Var(avr32_arch_name) Init("none")
+ Specify the AVR32 architecture name
+ 
+ mfast-float
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to