From b646773ebbdb60b886c712d43d9af78a5ad5d5cf Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Thu, 27 Apr 2023 17:18:36 +1200 Subject: gcc/12.2.0: Regenerate patches Run the patches through ./maintainer/manage-packages.sh -P -s gcc-12.2.0 to mop up the fact that we'd ended up with two 0005 patches. Signed-off-by: Chris Packham --- ...default-libc-to-be-specified-to-configure.patch | 25 ++--- ...nd-getenv-function-to-allow-default-value.patch | 102 --------------------- ...and-picolibc-as-default-C-library-choices.patch | 42 --------- ...nd-getenv-function-to-allow-default-value.patch | 95 +++++++++++++++++++ ...and-picolibc-as-default-C-library-choices.patch | 37 ++++++++ .../gcc/12.2.0/0007-Support-picolibc-targets.patch | 38 -------- .../gcc/12.2.0/0008-Support-picolibc-targets.patch | 33 +++++++ ...-gcc-Allow-g-to-work-differently-from-gcc.patch | 68 -------------- ...-gcc-Allow-g-to-work-differently-from-gcc.patch | 60 ++++++++++++ 9 files changed, 234 insertions(+), 266 deletions(-) delete mode 100644 packages/gcc/12.2.0/0005-driver-Extend-getenv-function-to-allow-default-value.patch delete mode 100644 packages/gcc/12.2.0/0006-Add-newlib-and-picolibc-as-default-C-library-choices.patch create mode 100644 packages/gcc/12.2.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch create mode 100644 packages/gcc/12.2.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch delete mode 100644 packages/gcc/12.2.0/0007-Support-picolibc-targets.patch create mode 100644 packages/gcc/12.2.0/0008-Support-picolibc-targets.patch delete mode 100644 packages/gcc/12.2.0/0008-gcc-Allow-g-to-work-differently-from-gcc.patch create mode 100644 packages/gcc/12.2.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch (limited to 'packages/gcc') diff --git a/packages/gcc/12.2.0/0005-Allow-default-libc-to-be-specified-to-configure.patch b/packages/gcc/12.2.0/0005-Allow-default-libc-to-be-specified-to-configure.patch index 4f155f61..113a982a 100644 --- a/packages/gcc/12.2.0/0005-Allow-default-libc-to-be-specified-to-configure.patch +++ b/packages/gcc/12.2.0/0005-Allow-default-libc-to-be-specified-to-configure.patch @@ -15,15 +15,13 @@ and stop. Signed-off-by: Keith Packard --- - gcc/config.gcc | 48 ++++++++++++++++++++++++++++++++++++++++-------- - gcc/configure.ac | 4 ++++ + gcc/config.gcc | 48 ++++++++++++++++++++++++++++++++++++++++-------- + gcc/configure.ac | 4 ++++ 2 files changed, 44 insertions(+), 8 deletions(-) -diff --git a/gcc/config.gcc b/gcc/config.gcc -index c5064dd3766..ddab68fbf8f 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc -@@ -648,6 +648,8 @@ esac +@@ -648,6 +648,8 @@ # Common C libraries. tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" @@ -32,7 +30,7 @@ index c5064dd3766..ddab68fbf8f 100644 # 32-bit x86 processors supported by --with-arch=. Each processor # MUST be separated by exactly one space. x86_archs="athlon athlon-4 athlon-fx athlon-mp athlon-tbird \ -@@ -854,16 +856,16 @@ case ${target} in +@@ -854,16 +856,16 @@ esac case $target in *-*-*android*) @@ -53,7 +51,7 @@ index c5064dd3766..ddab68fbf8f 100644 ;; esac # Assume that glibc or uClibc or Bionic are being used and so __cxa_atexit -@@ -956,7 +958,8 @@ case ${target} in +@@ -956,7 +958,8 @@ case ${enable_threads} in "" | yes | posix) thread_file='posix' ;; esac @@ -63,7 +61,7 @@ index c5064dd3766..ddab68fbf8f 100644 ;; *-*-rdos*) use_gcc_stdint=wrap -@@ -1606,13 +1609,13 @@ csky-*-*) +@@ -1606,13 +1609,13 @@ case ${target} in csky-*-linux-gnu*) @@ -79,7 +77,7 @@ index c5064dd3766..ddab68fbf8f 100644 default_use_cxa_atexit=no ;; *) -@@ -3065,7 +3068,7 @@ powerpc*-wrs-vxworks7r*) +@@ -3065,7 +3068,7 @@ tmake_file="${tmake_file} t-linux rs6000/t-linux64 rs6000/t-fprules rs6000/t-ppccomm" tmake_file="${tmake_file} rs6000/t-vxworks" @@ -88,7 +86,7 @@ index c5064dd3766..ddab68fbf8f 100644 extra_objs="$extra_objs linux.o rs6000-linux.o" ;; powerpc-wrs-vxworks*) -@@ -5915,3 +5918,32 @@ i[34567]86-*-* | x86_64-*-*) +@@ -5915,3 +5918,32 @@ fi ;; esac @@ -121,11 +119,9 @@ index c5064dd3766..ddab68fbf8f 100644 + tm_defines="$tm_defines DEFAULT_LIBC=$default_libc" + ;; +esac -diff --git a/gcc/configure.ac b/gcc/configure.ac -index 23bee7010a3..4fd41993b58 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac -@@ -2481,6 +2481,10 @@ if { { test x$host != x$target && test "x$with_sysroot" = x ; } || +@@ -2481,6 +2481,10 @@ fi AC_SUBST(inhibit_libc) @@ -136,6 +132,3 @@ index 23bee7010a3..4fd41993b58 100644 # When building gcc with a cross-compiler, we need to adjust things so # that the generator programs are still built with the native compiler. # Also, we cannot run fixincludes. --- -2.39.0 - diff --git a/packages/gcc/12.2.0/0005-driver-Extend-getenv-function-to-allow-default-value.patch b/packages/gcc/12.2.0/0005-driver-Extend-getenv-function-to-allow-default-value.patch deleted file mode 100644 index d0ac2cec..00000000 --- a/packages/gcc/12.2.0/0005-driver-Extend-getenv-function-to-allow-default-value.patch +++ /dev/null @@ -1,102 +0,0 @@ -From fff469f89d865ef3c15efe8e6b0511ea4d48603d Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Fri, 26 Aug 2022 14:30:03 -0700 -Subject: [PATCH 6/6] driver: Extend 'getenv' function to allow default value - -Right now, a missing environment variable provided to the 'getenv' -function in a .specs file causes a fatal error. That makes writing a -spec file that uses the GCC_EXEC_PREFIX value difficult as that -variable is only set when the driver has been relocated, but not when -run from the defined location. This makes building a relocatable -toolchain difficult to extend to other ancilary pieces which use specs -files to locate header and library files adjacent to the toolchain. - -This patch adds an optional third argument to the getenv function that -can be used to fall back to the standard installation path when the -driver hasn't set GCC_EXEC_PREFIX in the environment. - -For example, if an alternate C library is installed in -${prefix}/extra, then this change allows the specs file to locate that -relative to the gcc directory, if gcc is located in the original -installation directory (which would leave GCC_EXEC_PREFIX unset), or -if the gcc tree has been moved to a different location (where gcc -would set GCC_EXEC_PREFIX itself): - -*cpp: --isystem %:getenv(GCC_EXEC_PREFIX ../../extra/include ${prefix}/extra/include) - -I considered changing the behavior of either the %R sequence so that -it had a defined behavior when there was no sysroot defined, or making -the driver always set the GCC_EXEC_PREFIX environment variable and -decided that the approach of adding functionality to getenv where it -was previously invalid would cause the least potential for affecting -existing usage. - -Signed-off-by: Keith Packard ---- - gcc/doc/invoke.texi | 18 +++++++++++------- - gcc/gcc.cc | 10 +++++++++- - 2 files changed, 20 insertions(+), 8 deletions(-) - -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index ff6c338bedb..38eeeb7174b 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -33776,17 +33776,21 @@ The following built-in spec functions are provided: - - @table @code - @item @code{getenv} --The @code{getenv} spec function takes two arguments: an environment --variable name and a string. If the environment variable is not --defined, a fatal error is issued. Otherwise, the return value is the --value of the environment variable concatenated with the string. For --example, if @env{TOPDIR} is defined as @file{/path/to/top}, then: -+ -+The @code{getenv} spec function takes two or three arguments: an -+environment variable name, a string and an optional default value. If -+the environment variable is not defined and a default value is -+provided, that is used as the return value; otherwise a fatal error is -+issued. Otherwise, the return value is the value of the environment -+variable concatenated with the string. For example, if @env{TOPDIR} -+is defined as @file{/path/to/top}, then: - - @smallexample --%:getenv(TOPDIR /include) -+%:getenv(TOPDIR /include /path/to/default/include) - @end smallexample - --expands to @file{/path/to/top/include}. -+expands to @file{/path/to/top/include}. If @env{TOPDIR} is not -+defined, then this expands to @file{/path/to/default/include}. - - @item @code{if-exists} - The @code{if-exists} spec function takes one argument, an absolute -diff --git a/gcc/gcc.cc b/gcc/gcc.cc -index bb07cc244e3..930d9835768 100644 ---- a/gcc/gcc.cc -+++ b/gcc/gcc.cc -@@ -10194,12 +10194,20 @@ getenv_spec_function (int argc, const char **argv) - char *ptr; - size_t len; - -- if (argc != 2) -+ if (argc != 2 && argc != 3) - return NULL; - - varname = argv[0]; - value = env.get (varname); - -+ if (!value && argc == 3) -+ { -+ value = argv[2]; -+ result = XNEWVAR(char, strlen(value) + 1); -+ strcpy(result, value); -+ return result; -+ } -+ - /* If the variable isn't defined and this is allowed, craft our expected - return value. Assume variable names used in specs strings don't contain - any active spec character so don't need escaping. */ --- -2.39.0 - diff --git a/packages/gcc/12.2.0/0006-Add-newlib-and-picolibc-as-default-C-library-choices.patch b/packages/gcc/12.2.0/0006-Add-newlib-and-picolibc-as-default-C-library-choices.patch deleted file mode 100644 index e4805ae8..00000000 --- a/packages/gcc/12.2.0/0006-Add-newlib-and-picolibc-as-default-C-library-choices.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 2e3918a283c1c9fb3b4775fe96a56e430748579a Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Tue, 23 Aug 2022 22:12:06 -0700 -Subject: [PATCH 6/9] Add newlib and picolibc as default C library choices - -Signed-off-by: Keith Packard ---- - gcc/config.gcc | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/gcc/config.gcc b/gcc/config.gcc -index ddab68fbf8f..e294ff8fbc8 100644 ---- a/gcc/config.gcc -+++ b/gcc/config.gcc -@@ -646,7 +646,7 @@ case ${target} in - esac - - # Common C libraries. --tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" -+tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4 LIBC_NEWLIB=5 LIBC_PICOLIBC=6" - - default_libc="" - -@@ -5932,6 +5932,15 @@ bionic) - musl) - default_libc=LIBC_MUSL - ;; -+newlib) -+ # Newlib configurations don't set the DEFAULT_LIBC variable, so -+ # avoid changing those by allowing --with-default-libc=newlib but -+ # not actually setting the DEFAULT_LIBC variable. -+ default_libc= -+ ;; -+picolibc) -+ default_libc=LIBC_PICOLIBC -+ ;; - "") - ;; - *) --- -2.39.0 - diff --git a/packages/gcc/12.2.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch b/packages/gcc/12.2.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch new file mode 100644 index 00000000..32341c48 --- /dev/null +++ b/packages/gcc/12.2.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch @@ -0,0 +1,95 @@ +From fff469f89d865ef3c15efe8e6b0511ea4d48603d Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Fri, 26 Aug 2022 14:30:03 -0700 +Subject: [PATCH 6/6] driver: Extend 'getenv' function to allow default value + +Right now, a missing environment variable provided to the 'getenv' +function in a .specs file causes a fatal error. That makes writing a +spec file that uses the GCC_EXEC_PREFIX value difficult as that +variable is only set when the driver has been relocated, but not when +run from the defined location. This makes building a relocatable +toolchain difficult to extend to other ancilary pieces which use specs +files to locate header and library files adjacent to the toolchain. + +This patch adds an optional third argument to the getenv function that +can be used to fall back to the standard installation path when the +driver hasn't set GCC_EXEC_PREFIX in the environment. + +For example, if an alternate C library is installed in +${prefix}/extra, then this change allows the specs file to locate that +relative to the gcc directory, if gcc is located in the original +installation directory (which would leave GCC_EXEC_PREFIX unset), or +if the gcc tree has been moved to a different location (where gcc +would set GCC_EXEC_PREFIX itself): + +*cpp: +-isystem %:getenv(GCC_EXEC_PREFIX ../../extra/include ${prefix}/extra/include) + +I considered changing the behavior of either the %R sequence so that +it had a defined behavior when there was no sysroot defined, or making +the driver always set the GCC_EXEC_PREFIX environment variable and +decided that the approach of adding functionality to getenv where it +was previously invalid would cause the least potential for affecting +existing usage. + +Signed-off-by: Keith Packard +--- + gcc/doc/invoke.texi | 18 +++++++++++------- + gcc/gcc.cc | 10 +++++++++- + 2 files changed, 20 insertions(+), 8 deletions(-) + +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -33776,17 +33776,21 @@ + + @table @code + @item @code{getenv} +-The @code{getenv} spec function takes two arguments: an environment +-variable name and a string. If the environment variable is not +-defined, a fatal error is issued. Otherwise, the return value is the +-value of the environment variable concatenated with the string. For +-example, if @env{TOPDIR} is defined as @file{/path/to/top}, then: ++ ++The @code{getenv} spec function takes two or three arguments: an ++environment variable name, a string and an optional default value. If ++the environment variable is not defined and a default value is ++provided, that is used as the return value; otherwise a fatal error is ++issued. Otherwise, the return value is the value of the environment ++variable concatenated with the string. For example, if @env{TOPDIR} ++is defined as @file{/path/to/top}, then: + + @smallexample +-%:getenv(TOPDIR /include) ++%:getenv(TOPDIR /include /path/to/default/include) + @end smallexample + +-expands to @file{/path/to/top/include}. ++expands to @file{/path/to/top/include}. If @env{TOPDIR} is not ++defined, then this expands to @file{/path/to/default/include}. + + @item @code{if-exists} + The @code{if-exists} spec function takes one argument, an absolute +--- a/gcc/gcc.cc ++++ b/gcc/gcc.cc +@@ -10194,12 +10194,20 @@ + char *ptr; + size_t len; + +- if (argc != 2) ++ if (argc != 2 && argc != 3) + return NULL; + + varname = argv[0]; + value = env.get (varname); + ++ if (!value && argc == 3) ++ { ++ value = argv[2]; ++ result = XNEWVAR(char, strlen(value) + 1); ++ strcpy(result, value); ++ return result; ++ } ++ + /* If the variable isn't defined and this is allowed, craft our expected + return value. Assume variable names used in specs strings don't contain + any active spec character so don't need escaping. */ diff --git a/packages/gcc/12.2.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch b/packages/gcc/12.2.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch new file mode 100644 index 00000000..59169b70 --- /dev/null +++ b/packages/gcc/12.2.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch @@ -0,0 +1,37 @@ +From 2e3918a283c1c9fb3b4775fe96a56e430748579a Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Tue, 23 Aug 2022 22:12:06 -0700 +Subject: [PATCH 6/9] Add newlib and picolibc as default C library choices + +Signed-off-by: Keith Packard +--- + gcc/config.gcc | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -646,7 +646,7 @@ + esac + + # Common C libraries. +-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" ++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4 LIBC_NEWLIB=5 LIBC_PICOLIBC=6" + + default_libc="" + +@@ -5932,6 +5932,15 @@ + musl) + default_libc=LIBC_MUSL + ;; ++newlib) ++ # Newlib configurations don't set the DEFAULT_LIBC variable, so ++ # avoid changing those by allowing --with-default-libc=newlib but ++ # not actually setting the DEFAULT_LIBC variable. ++ default_libc= ++ ;; ++picolibc) ++ default_libc=LIBC_PICOLIBC ++ ;; + "") + ;; + *) diff --git a/packages/gcc/12.2.0/0007-Support-picolibc-targets.patch b/packages/gcc/12.2.0/0007-Support-picolibc-targets.patch deleted file mode 100644 index 01dbba87..00000000 --- a/packages/gcc/12.2.0/0007-Support-picolibc-targets.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 41b20e994970f0ae63fb3f49c6f89a0b2f06aecb Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Sun, 12 Feb 2023 14:23:32 -0800 -Subject: [PATCH 7/9] Support picolibc targets - -Match *-picolibc-* and select picolibc as the default C library, plus continuing to use -the newlib-based logic for other configuration items. - -Signed-off-by: Keith Packard ---- - gcc/config.gcc | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/gcc/config.gcc b/gcc/config.gcc -index e294ff8fbc8..06af4057079 100644 ---- a/gcc/config.gcc -+++ b/gcc/config.gcc -@@ -1082,6 +1082,17 @@ case ${target} in - ;; - esac - ;; -+*-picolibc-*) -+ # __cxa_atexit is provided. -+ default_use_cxa_atexit=yes -+ use_gcc_stdint=wrap -+ default_libc=LIBC_PICOLIBC -+ case "${with_newlib}-${with_headers}" in -+ no-no) use_gcc_stdint=provide ;; -+ *) ;; -+ esac -+ ;; -+ - *-*-elf|arc*-*-elf*) - # Assume that newlib is being used and so __cxa_atexit is provided. - default_use_cxa_atexit=yes --- -2.39.0 - diff --git a/packages/gcc/12.2.0/0008-Support-picolibc-targets.patch b/packages/gcc/12.2.0/0008-Support-picolibc-targets.patch new file mode 100644 index 00000000..776d9545 --- /dev/null +++ b/packages/gcc/12.2.0/0008-Support-picolibc-targets.patch @@ -0,0 +1,33 @@ +From 41b20e994970f0ae63fb3f49c6f89a0b2f06aecb Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Sun, 12 Feb 2023 14:23:32 -0800 +Subject: [PATCH 7/9] Support picolibc targets + +Match *-picolibc-* and select picolibc as the default C library, plus continuing to use +the newlib-based logic for other configuration items. + +Signed-off-by: Keith Packard +--- + gcc/config.gcc | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -1082,6 +1082,17 @@ + ;; + esac + ;; ++*-picolibc-*) ++ # __cxa_atexit is provided. ++ default_use_cxa_atexit=yes ++ use_gcc_stdint=wrap ++ default_libc=LIBC_PICOLIBC ++ case "${with_newlib}-${with_headers}" in ++ no-no) use_gcc_stdint=provide ;; ++ *) ;; ++ esac ++ ;; ++ + *-*-elf|arc*-*-elf*) + # Assume that newlib is being used and so __cxa_atexit is provided. + default_use_cxa_atexit=yes diff --git a/packages/gcc/12.2.0/0008-gcc-Allow-g-to-work-differently-from-gcc.patch b/packages/gcc/12.2.0/0008-gcc-Allow-g-to-work-differently-from-gcc.patch deleted file mode 100644 index d84e52f3..00000000 --- a/packages/gcc/12.2.0/0008-gcc-Allow-g-to-work-differently-from-gcc.patch +++ /dev/null @@ -1,68 +0,0 @@ -From e426a20988185695675a2c456e0c24dcea515baf Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Sat, 11 Feb 2023 23:07:08 -0800 -Subject: [PATCH 8/9] gcc: Allow g++ to work differently from gcc - -Compile gcc.cc with -DIN_GPP defined when building g++ so that the -code can respond appropriately for the default target language. This -allows the driver to customize the specs used, selecting different -linker scripts, adjusting the use of crtbegin.o/crtend.o etc. - -By default, this change has no effect; targets need to explicitly -check for IN_GPP to have alternate behavior. - -Signed-off-by: Keith Packard ---- - gcc/cp/Make-lang.in | 7 ++++++- - gcc/gpp.cc | 21 +++++++++++++++++++++ - 2 files changed, 27 insertions(+), 1 deletion(-) - create mode 100644 gcc/gpp.cc - -diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in -index 2de4e47c659..39c659b9537 100644 ---- a/gcc/cp/Make-lang.in -+++ b/gcc/cp/Make-lang.in -@@ -68,7 +68,12 @@ CFLAGS-cp/module.o += -DMODULE_VERSION='($(subst -,,$(MODULE_VERSION))U)' - endif - - # Create the compiler driver for g++. --GXX_OBJS = $(GCC_OBJS) cp/g++spec.o -+GXX_OBJS = $(GCC_OBJS:gcc.o=gpp.o) cp/g++spec.o -+ -+CFLAGS-gpp.o = $(CFLAGS-gcc.o) -+gpp.o: $(BASEVER) -+gpp.o: gcc.o -+ - xg++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS) - +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ - $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ -diff --git a/gcc/gpp.cc b/gcc/gpp.cc -new file mode 100644 -index 00000000000..3cd7b45e808 ---- /dev/null -+++ b/gcc/gpp.cc -@@ -0,0 +1,21 @@ -+/* Compiler driver program that can handle many languages. -+ Copyright (C) 1987-2022 Free Software Foundation, Inc. -+ -+This file is part of GCC. -+ -+GCC is free software; you can redistribute it and/or modify it under -+the terms of the GNU General Public License as published by the Free -+Software Foundation; either version 3, or (at your option) any later -+version. -+ -+GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+WARRANTY; without even the implied warranty of MERCHANTABILITY or -+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+for more details. -+ -+You should have received a copy of the GNU General Public License -+along with GCC; see the file COPYING3. If not see -+. */ -+ -+#define IN_GPP -+#include "gcc.cc" --- -2.39.0 - diff --git a/packages/gcc/12.2.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch b/packages/gcc/12.2.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch new file mode 100644 index 00000000..5265c03a --- /dev/null +++ b/packages/gcc/12.2.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch @@ -0,0 +1,60 @@ +From e426a20988185695675a2c456e0c24dcea515baf Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Sat, 11 Feb 2023 23:07:08 -0800 +Subject: [PATCH 8/9] gcc: Allow g++ to work differently from gcc + +Compile gcc.cc with -DIN_GPP defined when building g++ so that the +code can respond appropriately for the default target language. This +allows the driver to customize the specs used, selecting different +linker scripts, adjusting the use of crtbegin.o/crtend.o etc. + +By default, this change has no effect; targets need to explicitly +check for IN_GPP to have alternate behavior. + +Signed-off-by: Keith Packard +--- + gcc/cp/Make-lang.in | 7 ++++++- + gcc/gpp.cc | 21 +++++++++++++++++++++ + 2 files changed, 27 insertions(+), 1 deletion(-) + create mode 100644 gcc/gpp.cc + +--- a/gcc/cp/Make-lang.in ++++ b/gcc/cp/Make-lang.in +@@ -68,7 +68,12 @@ + endif + + # Create the compiler driver for g++. +-GXX_OBJS = $(GCC_OBJS) cp/g++spec.o ++GXX_OBJS = $(GCC_OBJS:gcc.o=gpp.o) cp/g++spec.o ++ ++CFLAGS-gpp.o = $(CFLAGS-gcc.o) ++gpp.o: $(BASEVER) ++gpp.o: gcc.o ++ + xg++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS) + +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ + $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ +--- /dev/null ++++ b/gcc/gpp.cc +@@ -0,0 +1,21 @@ ++/* Compiler driver program that can handle many languages. ++ Copyright (C) 1987-2022 Free Software Foundation, Inc. ++ ++This file is part of GCC. ++ ++GCC is free software; you can redistribute it and/or modify it under ++the terms of the GNU General Public License as published by the Free ++Software Foundation; either version 3, or (at your option) any later ++version. ++ ++GCC is distributed in the hope that it will be useful, but WITHOUT ANY ++WARRANTY; without even the implied warranty of MERCHANTABILITY or ++FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GCC; see the file COPYING3. If not see ++. */ ++ ++#define IN_GPP ++#include "gcc.cc" -- cgit v1.2.3