gcc: update to allow compiling different versions

This is based on the toolchain GCC, and aims to share as much of its
Makefile and patches with that definition. The package requires two
additional patches:

(1) 003-dont-choke-when-building-32bit-on-64bit.patch, which fixes the
`error: size of array 'test_real_width' is negative` error that occurs
when building a 32-bit GCC on a 64-bit host. (Search the Internet for
examples of this error appearing.)

(2) 980-add-nostdinc++.patch, which backports a fix from 11.3.0 (11.2.0
only).

Signed-off-by: W. Michael Petullo <mike@flyn.org>
This commit is contained in:
W. Michael Petullo 2022-05-18 17:06:25 -05:00 committed by Rosen Penev
parent abbe33b369
commit ceaa6e840e
73 changed files with 2009 additions and 602 deletions

View File

@ -1,16 +1,54 @@
#
# Copyright (C) 2008 OpenWrt.org
# Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org>
# Copyright (C) 2004 Manuel Novoa III <mjn3@uclibc.org>
# Copyright (C) 2005-2006 Felix Fietkau <nbd@nbd.name>
# Copyright (C) 2006-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include $(TOPDIR)/rules.mk
define Package/gcc/description
Build a native toolchain for compiling on target
device.
endef
PKG_NAME:=gcc
GCC_VERSION:=$(call qstrip,$(CONFIG_GCC_VERSION))
PKG_VERSION:=$(firstword $(subst +, ,$(GCC_VERSION)))
PKG_RELEASE:=$(AUTORELEASE)
GCC_DIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_INSTALL:=1
PKG_FIXUP:=libtool
PKG_BUILD_PARALLEL:=1
PKG_CPE_ID:=cpe:/a:gnu:gcc
ifeq ($(PKG_VERSION),8.4.0)
PKG_HASH:=e30a6e52d10e1f27ed55104ad233c30bd1e99cfb5ff98ab022dc941edd1b2dd4
endif
ifeq ($(PKG_VERSION),10.3.0)
PKG_HASH:=64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344
endif
ifeq ($(PKG_VERSION),11.2.0)
PKG_HASH:=d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b
endif
PATCH_DIR=./patches/$(GCC_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/gcc
SECTION:=devel
@ -21,26 +59,6 @@ define Package/gcc
MENU:=1
endef
PKG_NAME:=gcc
# PKG_VERSION=7.3.0
PKG_VERSION=7.4.0
PKG_RELEASE:=7
PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_INSTALL:=1
PKG_FIXUP:=libtool
PKG_BUILD_PARALLEL:=1
PKG_CPE_ID:=cpe:/a:gnu:gcc
ifeq ($(PKG_VERSION),7.3.0)
PKG_HASH:=832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c
endif
ifeq ($(PKG_VERSION),7.4.0)
PKG_HASH:=eddde28d04f334aec1604456e536416549e9b1aa137fc69204e65eb0c009fe51
endif
define Package/gcc/config
source "$(SOURCE)/Config.in"
endef
@ -62,13 +80,12 @@ ifeq ($(CONFIG_INCLUDE_STATIC_LINK_SPEC),y)
REMOVE_STATIC_SPEC=rm /usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/specs
endif
include $(INCLUDE_DIR)/package.mk
TARGET_LANGUAGES:="c,c++"
BUGURL=https://dev.openwrt.org/
PKGVERSION=OpenWrt GCC $(PKG_VERSION)
TARGET_CPPFLAGS += -D_GLIBCXX_INCLUDE_NEXT_C_HEADERS
# not using sstrip here as this fucks up the .so's somehow
# not using sstrip here as this messes up the .so's somehow
STRIP:=$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)strip
RSTRIP:= \
NM="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)nm" \
@ -81,6 +98,7 @@ ifneq ($(CONFIG_SOFT_FLOAT),y)
ARM_FLOAT_OPTION:= --with-float=hard
endif
endif
GMPSRC=gmp-6.1.0
define Download/gmp
@ -110,7 +128,7 @@ $(eval $(call Download,mpfr))
define Build/Prepare
$(PKG_UNPACK)
# we have to download and unpack additional stuff before patching
# we have to download and unpack additional stuff before patching
tar -C $(PKG_BUILD_DIR) -xvjf $(DL_DIR)/$(GMPSRC).tar.bz2
ln -sf $(PKG_BUILD_DIR)/$(GMPSRC) $(PKG_BUILD_DIR)/gmp
tar -C $(PKG_BUILD_DIR) -xvzf $(DL_DIR)/$(MPCSRC).tar.gz
@ -125,7 +143,7 @@ define Build/Prepare
cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/mpc/
endef
CONFIGURE_ARGS += CXXFLAGS_FOR_TARGET="-g -O2 -D_GLIBCXX_INCLUDE_NEXT_C_HEADERS"
CONFIGURE_ARGS += CXXFLAGS_FOR_TARGET="-g -O2 -D_GLIBCXX_INCLUDE_NEXT_C_HEADERS"
define Build/Configure
(cd $(PKG_BUILD_DIR); rm -f config.cache; \

View File

@ -1,77 +0,0 @@
commit 31285a20390a5e53a74a2a71d1b5c82f366ddd5a
Author: Felix Fietkau <nbd@openwrt.org>
Date: Tue May 6 11:49:05 2014 +0000
gcc: revert an upstream patch that is causing a regression on powerpc
https://forum.openwrt.org/viewtopic.php?pid=232494#p232494
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 40709
Revert of:
commit 275035b56823b26d5fb7e90fad945b998648edf2
Author: bergner <bergner@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu Sep 5 14:09:07 2013 +0000
PR target/58139
* reginfo.c (choose_hard_reg_mode): Scan through all mode classes
looking for widest mode.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202286 138bc75d-0d04-0410-961f-82ee72b054a4
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -637,35 +637,40 @@ choose_hard_reg_mode (unsigned int regno
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) hard_regno_nregs[regno][mode] == nregs
&& HARD_REGNO_MODE_OK (regno, mode)
- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
found_mode = mode;
+ if (found_mode != VOIDmode)
+ return found_mode;
+
for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) hard_regno_nregs[regno][mode] == nregs
&& HARD_REGNO_MODE_OK (regno, mode)
- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
found_mode = mode;
+ if (found_mode != VOIDmode)
+ return found_mode;
+
for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) hard_regno_nregs[regno][mode] == nregs
&& HARD_REGNO_MODE_OK (regno, mode)
- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
found_mode = mode;
+ if (found_mode != VOIDmode)
+ return found_mode;
+
for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) hard_regno_nregs[regno][mode] == nregs
&& HARD_REGNO_MODE_OK (regno, mode)
- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
found_mode = mode;
if (found_mode != VOIDmode)

View File

@ -1,42 +0,0 @@
@@ -0,0 +1,45 @@
--- a/gcc/configure
+++ b/gcc/configure
@@ -29036,19 +29036,6 @@ $as_echo "#define ENABLE_DEFAULT_SSP 1"
fi
-# Test for <sys/sdt.h> on the target.
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
-$as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
-have_sys_sdt_h=no
-if test -f $target_header_dir/sys/sdt.h; then
- have_sys_sdt_h=yes
-
-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
-$as_echo "$have_sys_sdt_h" >&6; }
# Check if TFmode long double should be used by default or not.
# Some glibc targets used DFmode long double, but with glibc 2.4
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5787,16 +5787,6 @@ if test x$enable_default_ssp = xyes ; th
fi
AC_SUBST([enable_default_ssp])
-# Test for <sys/sdt.h> on the target.
-GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
-AC_MSG_CHECKING(sys/sdt.h in the target C library)
-have_sys_sdt_h=no
-if test -f $target_header_dir/sys/sdt.h; then
- have_sys_sdt_h=yes
- AC_DEFINE(HAVE_SYS_SDT_H, 1,
- [Define if your target C library provides sys/sdt.h])
-fi
-AC_MSG_RESULT($have_sys_sdt_h)
# Check if TFmode long double should be used by default or not.
# Some glibc targets used DFmode long double, but with glibc 2.4

View File

@ -0,0 +1,24 @@
commit 81cc26c706b2bc8c8c1eb1a322e5c5157900836e
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun Oct 19 21:45:51 2014 +0000
gcc: do not assume that the Mac OS X filesystem is case insensitive
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 42973
--- a/include/filenames.h
+++ b/include/filenames.h
@@ -44,11 +44,6 @@ extern "C" {
# define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
# define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
#else /* not DOSish */
-# if defined(__APPLE__)
-# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
-# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
-# endif
-# endif /* __APPLE__ */
# define HAS_DRIVE_SPEC(f) (0)
# define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
# define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)

View File

@ -0,0 +1,14 @@
diff -u --recursive gcc-10.3.0-vanilla/gcc/real.h gcc-10.3.0/gcc/real.h
--- gcc-10.3.0-vanilla/gcc/real.h 2021-04-08 06:56:28.561746620 -0500
+++ gcc-10.3.0/gcc/real.h 2022-05-18 17:04:32.076412174 -0500
@@ -77,8 +77,10 @@
+ (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */
/* Verify the guess. */
+#ifndef __LP64__
extern char test_real_width
[sizeof (REAL_VALUE_TYPE) <= REAL_WIDTH * sizeof (HOST_WIDE_INT) ? 1 : -1];
+#endif
/* Calculate the format for CONST_DOUBLE. We need as many slots as
are necessary to overlay a REAL_VALUE_TYPE on them. This could be

View File

@ -12,7 +12,7 @@ Date: Tue Feb 26 16:16:33 2013 +0000
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3121,18 +3121,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
@@ -3285,18 +3285,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
doc/gccint.info: $(TEXI_GCCINT_FILES)
doc/cppinternals.info: $(TEXI_CPPINT_FILES)

View File

@ -5,7 +5,7 @@ instructions.
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -3098,6 +3098,12 @@ mips_emit_call_insn (rtx pattern, rtx or
@@ -3132,6 +3132,12 @@ mips_emit_call_insn (rtx pattern, rtx or
emit_insn (gen_update_got_version ());
}

View File

@ -0,0 +1,13 @@
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -875,7 +875,9 @@ proper position among the other output f
#endif
#ifndef LINK_SSP_SPEC
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if DEFAULT_LIBC == LIBC_MUSL
+#define LINK_SSP_SPEC "-lssp_nonshared"
+#elif defined(TARGET_LIBC_PROVIDES_SSP)
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit:}"
#else

View File

@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -19790,7 +19790,7 @@ mips_option_override (void)
@@ -20041,7 +20041,7 @@ mips_option_override (void)
flag_pcc_struct_return = 0;
/* Decide which rtx_costs structure to use. */

View File

@ -8,7 +8,7 @@ Date: Mon Oct 19 23:26:09 2009 +0000
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -920,11 +920,12 @@ $(libgcov-driver-objects): %$(objext): $
@@ -929,11 +929,12 @@ $(libgcov-driver-objects): %$(objext): $
# Static libraries.
libgcc.a: $(libgcc-objects)
@ -22,7 +22,7 @@ Date: Mon Oct 19 23:26:09 2009 +0000
-rm -f $@
objects="$(objects)"; \
@@ -945,7 +946,7 @@ all: libunwind.a
@@ -957,7 +958,7 @@ all: libunwind.a
endif
ifeq ($(enable_shared),yes)
@ -31,7 +31,7 @@ Date: Mon Oct 19 23:26:09 2009 +0000
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
@@ -1151,6 +1152,10 @@ install-shared:
@@ -1163,6 +1164,10 @@ install-shared:
chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a

View File

@ -0,0 +1,28 @@
commit 7edc8ca5456d9743dd0075eb3cc5b04f4f24c8cc
Author: Imre Kaloz <kaloz@openwrt.org>
Date: Wed Feb 2 19:34:36 2011 +0000
add armv4 fixup patches
SVN-Revision: 25322
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -91,10 +91,15 @@
#define MUSL_DYNAMIC_LINKER \
"/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
+/* For armv4 we pass --fix-v4bx to linker to support EABI */
+#undef TARGET_FIX_V4BX_SPEC
+#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
+ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
+
/* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
use the GNU/Linux version, not the generic BPABI version. */
#undef LINK_SPEC
-#define LINK_SPEC EABI_LINK_SPEC \
+#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \
LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)

View File

@ -0,0 +1,54 @@
commit dcfc40358b5a3cae7320c17f8d1cebd5ad5540cd
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun Feb 12 20:25:47 2012 +0000
gcc 4.6: port over the missing patch 850-use_shared_libgcc.patch to prevent libgcc crap from leaking into every single binary
SVN-Revision: 30486
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -132,10 +132,6 @@
"%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \
LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
- do not use -lfloat. */
-#undef LIBGCC_SPEC
-
/* Clear the instruction cache from `beg' to `end'. This is
implemented in lib1funcs.S, so ensure an error if this definition
is used. */
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -66,6 +66,10 @@ see the files COPYING3 and COPYING.RUNTI
builtin_version ("CRuntime_Musl"); \
} while (0)
+#ifndef LIBGCC_SPEC
+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
+#endif
+
/* Determine which dynamic linker to use depending on whether GLIBC or
uClibc or Bionic or musl is the default C library and whether
-muclibc or -mglibc or -mbionic or -mmusl has been passed to change
--- a/libgcc/mkmap-symver.awk
+++ b/libgcc/mkmap-symver.awk
@@ -136,5 +136,5 @@ function output(lib) {
else if (inherit[lib])
printf("} %s;\n", inherit[lib]);
else
- printf ("\n local:\n\t*;\n};\n");
+ printf ("\n\t*;\n};\n");
}
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -62,6 +62,9 @@
#undef CPP_OS_DEFAULT_SPEC
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
+#undef LIBGCC_SPEC
+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
+
#undef LINK_SHLIB_SPEC
#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
%{static-pie:-static -pie --no-dynamic-linker -z text}"

View File

@ -0,0 +1,11 @@
--- a/gcc/config/rs6000/rs6000-logue.c
+++ b/gcc/config/rs6000/rs6000-logue.c
@@ -348,7 +348,7 @@ rs6000_savres_strategy (rs6000_stack_t *
/* Define cutoff for using out-of-line functions to save registers. */
if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
{
- if (!optimize_size)
+ if (1)
{
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;

View File

@ -0,0 +1,11 @@
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
#endif
#if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
-# define USE_TM_CLONE_REGISTRY 1
+# define USE_TM_CLONE_REGISTRY 0
#elif !defined(USE_TM_CLONE_REGISTRY)
# define USE_TM_CLONE_REGISTRY 0
#endif

View File

@ -0,0 +1,9 @@
--- a/libgcc/config/mips/t-mips16
+++ b/libgcc/config/mips/t-mips16
@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
# Version these symbols if building libgcc.so.
SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
+
+CRTSTUFF_T_CFLAGS += -mno-mips16
+CRTSTUFF_T_CFLAGS_S += -mno-mips16

View File

@ -0,0 +1,146 @@
commit 99368862e44740ff4fd33760893f04e14f9dbdf1
Author: Felix Fietkau <nbd@openwrt.org>
Date: Tue Jul 31 00:52:27 2007 +0000
Port the mbsd_multi patch from freewrt, which adds -fhonour-copts. This will emit warnings in packages that don't use our target cflags properly
SVN-Revision: 8256
This patch brings over a feature from MirBSD:
* -fhonour-copts
If this option is not given, it's warned (depending
on environment variables). This is to catch errors
of misbuilt packages which override CFLAGS themselves.
This patch was authored by Thorsten Glaser <tg at mirbsd.de>
with copyright assignment to the FSF in effect.
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -107,6 +107,9 @@ static dump_flags_t original_dump_flags;
/* Whether any standard preincluded header has been preincluded. */
static bool done_preinclude;
+/* Check if a port honours COPTS. */
+static int honour_copts = 0;
+
static void handle_OPT_d (const char *);
static void set_std_cxx98 (int);
static void set_std_cxx11 (int);
@@ -455,6 +458,12 @@ c_common_handle_option (size_t scode, co
flag_no_builtin = !value;
break;
+ case OPT_fhonour_copts:
+ if (c_language == clk_c) {
+ honour_copts++;
+ }
+ break;
+
case OPT_fconstant_string_class_:
constant_string_class_name = arg;
break;
@@ -1168,6 +1177,47 @@ c_common_init (void)
return false;
}
+ if (c_language == clk_c) {
+ char *ev = getenv ("GCC_HONOUR_COPTS");
+ int evv;
+ if (ev == NULL)
+ evv = -1;
+ else if ((*ev == '0') || (*ev == '\0'))
+ evv = 0;
+ else if (*ev == '1')
+ evv = 1;
+ else if (*ev == '2')
+ evv = 2;
+ else if (*ev == 's')
+ evv = -1;
+ else {
+ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
+ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
+ }
+ if (evv == 1) {
+ if (honour_copts == 0) {
+ error ("someone does not honour COPTS at all in lenient mode");
+ return false;
+ } else if (honour_copts != 1) {
+ warning (0, "someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ }
+ } else if (evv == 2) {
+ if (honour_copts == 0) {
+ error ("someone does not honour COPTS at all in strict mode");
+ return false;
+ } else if (honour_copts != 1) {
+ error ("someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ return false;
+ }
+ } else if (evv == 0) {
+ if (honour_copts != 1)
+ inform (UNKNOWN_LOCATION, "someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ }
+ }
+
return true;
}
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1590,6 +1590,9 @@ C++ ObjC++ Optimization Alias(fexception
fhonor-std
C++ ObjC++ WarnRemoved
+fhonour-copts
+C ObjC C++ ObjC++ RejectNegative
+
fhosted
C ObjC
Assume normal C execution environment.
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1660,6 +1660,9 @@ fguess-branch-probability
Common Report Var(flag_guess_branch_prob) Optimization
Enable guessing of branch probabilities.
+fhonour-copts
+Common RejectNegative
+
; Nonzero means ignore `#ident' directives. 0 means handle them.
; Generate position-independent code for executables if possible
; On SVR4 targets, it also controls whether or not to emit a
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -8171,6 +8171,17 @@ This option is only supported for C and
@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
@option{-Wno-pointer-sign}.
+@item -fhonour-copts
+@opindex fhonour-copts
+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
+given at least once, and warn if it is given more than once.
+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
+given exactly once.
+If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
+is not given exactly once.
+The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
+This flag and environment variable only affect the C language.
+
@item -Wstack-protector
@opindex Wstack-protector
@opindex Wno-stack-protector
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -2318,6 +2318,9 @@ common_handle_option (struct gcc_options
/* Currently handled in a prescan. */
break;
+ case OPT_fhonour_copts:
+ break;
+
case OPT_Werror:
dc->warning_as_error_requested = value;
break;

View File

@ -0,0 +1,22 @@
Author: Jo-Philipp Wich <jow@openwrt.org>
Date: Sat Apr 21 03:02:39 2012 +0000
gcc: add patch to make the getenv() spec function nonfatal if requested environment variable is unset
SVN-Revision: 31390
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -9396,8 +9396,10 @@ getenv_spec_function (int argc, const ch
}
if (!value)
- fatal_error (input_location,
- "environment variable %qs not defined", varname);
+ {
+ warning (input_location, "environment variable %qs not defined", varname);
+ value = "";
+ }
/* We have to escape every character of the environment variable so
they are not interpreted as active spec characters. A

View File

@ -0,0 +1,111 @@
From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001
From: Andrew McDonnell <bugs@andrewmcdonnell.net>
Date: Fri, 3 Oct 2014 19:09:00 +0930
Subject: Add .note.GNU-stack section
See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html
Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html
Re: [Patch, MIPS] Add .note.GNU-stack section
From: Steve Ellcey <sellcey at mips dot com>
On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote:
>
>
> On Wed, Sep 10, 2014 at 9:27 AM, <pinskia@gmail.com> wrote:
> This works except you did not update the assembly files in
> libgcc or glibc. We (Cavium) have the same patch in our tree
> for a few released versions.
> Mind just checking yours in then Andrew?
> Thanks!
> -eric
I talked to Andrew about what files he changed in GCC and created and
tested this new patch. Andrew also mentioned changing some assembly
files in glibc but I don't see any use of '.section .note.GNU-stack' in
any assembly files in glibc (for any platform) so I wasn't planning on
creating a glibc to add them to mips glibc assembly language files.
OK to check in this patch?
Steve Ellcey
sellcey@mips.com
2014-09-26 Steve Ellcey <sellcey@mips.com>
---
gcc/config/mips/mips.c | 3 +++
libgcc/config/mips/crti.S | 4 ++++
libgcc/config/mips/crtn.S | 3 +++
libgcc/config/mips/mips16.S | 4 ++++
libgcc/config/mips/vr4120-div.S | 4 ++++
5 files changed, 18 insertions(+)
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -22881,6 +22881,9 @@ mips_asm_file_end (void)
#define TARGET_ASM_FILE_END mips_asm_file_end
+#undef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-mips.h"
--- a/libgcc/config/mips/crti.S
+++ b/libgcc/config/mips/crti.S
@@ -24,6 +24,10 @@ see the files COPYING3 and COPYING.RUNTI
/* An executable stack is *not* required for these functions. */
#include "gnustack.h"
+
+/* An executable stack is *not* required for these functions. */
+ .section .note.GNU-stack,"",%progbits
+
/* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
--- a/libgcc/config/mips/crtn.S
+++ b/libgcc/config/mips/crtn.S
@@ -24,6 +24,9 @@ see the files COPYING3 and COPYING.RUNTI
/* An executable stack is *not* required for these functions. */
#include "gnustack.h"
+/* An executable stack is *not* required for these functions. */
+ .section .note.GNU-stack,"",%progbits
+
/* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
--- a/libgcc/config/mips/mips16.S
+++ b/libgcc/config/mips/mips16.S
@@ -51,6 +51,10 @@ see the files COPYING3 and COPYING.RUNTI
values using the soft-float calling convention, but do the actual
operation using the hard floating point instructions. */
+/* An executable stack is *not* required for these functions. */
+ .section .note.GNU-stack,"",%progbits
+ .previous
+
#if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64)
/* This file contains 32-bit assembly code. */
--- a/libgcc/config/mips/vr4120-div.S
+++ b/libgcc/config/mips/vr4120-div.S
@@ -29,6 +29,10 @@ see the files COPYING3 and COPYING.RUNTI
-mfix-vr4120. div and ddiv do not give the correct result when one
of the operands is negative. */
+/* An executable stack is *not* required for these functions. */
+ .section .note.GNU-stack,"",%progbits
+ .previous
+
.set nomips16
#define DIV \

View File

@ -0,0 +1,67 @@
From dda6b050cd74a352670787a294596a9c56c21327 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Fri, 4 May 2018 18:20:53 +0800
Subject: [PATCH] gotools: fix compilation when making cross compiler
libgo is "the runtime support library for the Go programming language.
This library is intended for use with the Go frontend."
gccgo will link target files with libgo.so which depends on libgcc_s.so.1, but
the linker will complain that it cannot find it. That's because shared libgcc
is not present in the install directory yet. libgo.so was made without problem
because gcc will emit -lgcc_s when compiled with -shared option. When gotools
were being made, it was supplied with -static-libgcc thus no link option was
provided. Check LIBGO in gcc/go/gcc-spec.c for how gccgo make a builtin spec
for linking with libgo.so
- GccgoCrossCompilation, https://github.com/golang/go/wiki/GccgoCrossCompilation
- Cross-building instructions, http://www.eglibc.org/archives/patches/msg00078.html
When 3-pass GCC compilation is used, shared libgcc runtime libraries will be
available after gcc pass2 completed and will meet the gotools link requirement
at gcc pass3
---
gotools/Makefile.am | 4 +++-
gotools/Makefile.in | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
--- a/gotools/Makefile.am
+++ b/gotools/Makefile.am
@@ -26,6 +26,7 @@ PWD_COMMAND = $${PWDCMD-pwd}
STAMP = echo timestamp >
libgodir = ../$(target_noncanonical)/libgo
+libgccdir = ../$(target_noncanonical)/libgcc
LIBGODEP = $(libgodir)/libgo.la
LIBGOTOOL = $(libgodir)/libgotool.a
@@ -41,7 +42,8 @@ GOCFLAGS = $(CFLAGS_FOR_TARGET)
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
AM_GOCFLAGS = -I $(libgodir)
-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
libgosrcdir = $(srcdir)/../libgo/go
--- a/gotools/Makefile.in
+++ b/gotools/Makefile.in
@@ -337,6 +337,7 @@ mkinstalldirs = $(SHELL) $(toplevel_srcd
PWD_COMMAND = $${PWDCMD-pwd}
STAMP = echo timestamp >
libgodir = ../$(target_noncanonical)/libgo
+libgccdir = ../$(target_noncanonical)/libgcc
LIBGODEP = $(libgodir)/libgo.la
LIBGOTOOL = $(libgodir)/libgotool.a
@NATIVE_FALSE@GOCOMPILER = $(GOC)
@@ -346,7 +347,8 @@ LIBGOTOOL = $(libgodir)/libgotool.a
GOCFLAGS = $(CFLAGS_FOR_TARGET)
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
AM_GOCFLAGS = -I $(libgodir)
-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
libgosrcdir = $(srcdir)/../libgo/go
cmdsrcdir = $(libgosrcdir)/cmd

View File

@ -0,0 +1,114 @@
From a6219e8e0719b14f474b0dcaa7bde2f4e57474f9 Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Wed, 17 Nov 2021 13:45:53 +0100
Subject: [PATCH] ranger: Fix up fold_using_range::range_of_address [PR103255]
If on &base->member the offset isn't constant or isn't zero and
-fdelete-null-pointer-checks and not -fwrapv-pointer and base has a range
that doesn't include NULL, we return the range of the base.
Usually it isn't a big deal, because for most pointers we just use
varying, range_zero and range_nonzero ranges and nothing beyond that,
but if a pointer is initialized from a constant, we actually track the
exact range and in that case this causes miscompilation.
As discussed on IRC, I think doing something like:
offset_int off2;
if (off_cst && off.is_constant (&off2))
{
tree cst = wide_int_to_tree (sizetype, off2 / BITS_PER_UNIT);
// adjust range r with POINTER_PLUS_EXPR cst
if (!range_includes_zero_p (&r))
return true;
}
// Fallback
r = range_nonzero (TREE_TYPE (gimple_assign_rhs1 (stmt)));
return true;
could work, given that most of the pointer ranges are just the simple ones
perhaps it is too much for little benefit.
2021-11-17 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/103255
* gimple-range.cc (fold_using_range::range_of_address): Return
range_nonzero rather than unadjusted base's range. Formatting fixes.
* gcc.c-torture/execute/pr103255.c: New test.
(cherry picked from commit c39cb6bf835ca12e590eaa6f90222e51be207c50)
---
gcc/gimple-range.cc | 16 +++++---
.../gcc.c-torture/execute/pr103255.c | 41 +++++++++++++++++++
2 files changed, 52 insertions(+), 5 deletions(-)
create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr103255.c
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -491,14 +491,20 @@ gimple_ranger::range_of_address (irange
}
/* If &X->a is equal to X, the range of X is the result. */
if (off_cst && known_eq (off, 0))
- return true;
+ return true;
else if (flag_delete_null_pointer_checks
&& !TYPE_OVERFLOW_WRAPS (TREE_TYPE (expr)))
{
- /* For -fdelete-null-pointer-checks -fno-wrapv-pointer we don't
- allow going from non-NULL pointer to NULL. */
- if(!range_includes_zero_p (&r))
- return true;
+ /* For -fdelete-null-pointer-checks -fno-wrapv-pointer we don't
+ allow going from non-NULL pointer to NULL. */
+ if (!range_includes_zero_p (&r))
+ {
+ /* We could here instead adjust r by off >> LOG2_BITS_PER_UNIT
+ using POINTER_PLUS_EXPR if off_cst and just fall back to
+ this. */
+ r = range_nonzero (TREE_TYPE (gimple_assign_rhs1 (stmt)));
+ return true;
+ }
}
/* If MEM_REF has a "positive" offset, consider it non-NULL
always, for -fdelete-null-pointer-checks also "negative"
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr103255.c
@@ -0,0 +1,41 @@
+/* PR tree-optimization/103255 */
+
+struct H
+{
+ unsigned a;
+ unsigned b;
+ unsigned c;
+};
+
+#if __SIZEOF_POINTER__ >= 4
+#define ADDR 0x400000
+#else
+#define ADDR 0x4000
+#endif
+#define OFF 0x20
+
+int
+main ()
+{
+ struct H *h = 0;
+ unsigned long o;
+ volatile int t = 1;
+
+ for (o = OFF; o <= OFF; o += 0x1000)
+ {
+ struct H *u;
+ u = (struct H *) (ADDR + o);
+ if (t)
+ {
+ h = u;
+ break;
+ }
+ }
+
+ if (h == 0)
+ return 0;
+ unsigned *tt = &h->b;
+ if ((__SIZE_TYPE__) tt != (ADDR + OFF + __builtin_offsetof (struct H, b)))
+ __builtin_abort ();
+ return 0;
+}

View File

@ -0,0 +1,24 @@
commit 81cc26c706b2bc8c8c1eb1a322e5c5157900836e
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun Oct 19 21:45:51 2014 +0000
gcc: do not assume that the Mac OS X filesystem is case insensitive
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 42973
--- a/include/filenames.h
+++ b/include/filenames.h
@@ -44,11 +44,6 @@ extern "C" {
# define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
# define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
#else /* not DOSish */
-# if defined(__APPLE__)
-# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
-# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
-# endif
-# endif /* __APPLE__ */
# define HAS_DRIVE_SPEC(f) (0)
# define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
# define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)

View File

@ -1,14 +1,13 @@
--- a/gcc/real.h
+++ b/gcc/real.h
@@ -70,9 +70,10 @@ struct GTY(()) real_value {
@@ -77,8 +77,10 @@ struct GTY(()) real_value {
+ (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */
/* Verify the guess. */
+#ifndef __LP64__
extern char test_real_width
[sizeof (REAL_VALUE_TYPE) <= REAL_WIDTH * sizeof (HOST_WIDE_INT) ? 1 : -1];
-
+#endif
/* Calculate the format for CONST_DOUBLE. We need as many slots as
are necessary to overlay a REAL_VALUE_TYPE on them. This could be
as many as four (32-bit HOST_WIDE_INT, 128-bit REAL_VALUE_TYPE).

View File

@ -0,0 +1,35 @@
commit 098bd91f5eae625c7d2ee621e10930fc4434e5e2
Author: Luka Perkov <luka@openwrt.org>
Date: Tue Feb 26 16:16:33 2013 +0000
gcc: don't build documentation
This closes #13039.
Signed-off-by: Luka Perkov <luka@openwrt.org>
SVN-Revision: 35807
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3355,18 +3355,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
doc/gccint.info: $(TEXI_GCCINT_FILES)
doc/cppinternals.info: $(TEXI_CPPINT_FILES)
-doc/%.info: %.texi
- if [ x$(BUILD_INFO) = xinfo ]; then \
- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
- -I $(gcc_docdir)/include -o $@ $<; \
- fi
+doc/%.info:
# Duplicate entry to handle renaming of gccinstall.info
-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
- if [ x$(BUILD_INFO) = xinfo ]; then \
- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
- -I $(gcc_docdir)/include -o $@ $<; \
- fi
+doc/gccinstall.info:
doc/cpp.dvi: $(TEXI_CPP_FILES)
doc/gcc.dvi: $(TEXI_GCC_FILES)

View File

@ -0,0 +1,46 @@
From ea650cae26da4a8fc04f0c4666f4dd776d0b5fc0 Mon Sep 17 00:00:00 2001
From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Date: Sun, 14 Nov 2021 21:54:25 -0800
Subject: [PATCH] configure: define TARGET_LIBC_GNUSTACK on musl
musl only uses PT_GNU_STACK to set default thread stack size and has no
executable stack support[0], so there is no reason not to emit the
.note.GNU-stack section on musl builds.
[0]: https://lore.kernel.org/all/20190423192534.GN23599@brightrain.aerifal.cx/T/#u
gcc/ChangeLog:
* configure: Regenerate.
* configure.ac: define TARGET_LIBC_GNUSTACK on musl
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
---
gcc/configure | 3 +++
gcc/configure.ac | 3 +++
2 files changed, 6 insertions(+)
--- a/gcc/configure
+++ b/gcc/configure
@@ -30954,6 +30954,9 @@ fi
# Check if the target LIBC handles PT_GNU_STACK.
gcc_cv_libc_gnustack=unknown
case "$target" in
+ mips*-*-linux-musl*)
+ gcc_cv_libc_gnustack=yes
+ ;;
mips*-*-linux*)
if test $glibc_version_major -gt 2 \
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6788,6 +6788,9 @@ fi
# Check if the target LIBC handles PT_GNU_STACK.
gcc_cv_libc_gnustack=unknown
case "$target" in
+ mips*-*-linux-musl*)
+ gcc_cv_libc_gnustack=yes
+ ;;
mips*-*-linux*)
GCC_GLIBC_VERSION_GTE_IFELSE([2], [31], [gcc_cv_libc_gnustack=yes], )
;;

View File

@ -0,0 +1,20 @@
Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790.
MIPS16 functions have a static assembler prologue which clobbers
registers v0 and v1. Add these register clobbers to function call
instructions.
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -3132,6 +3132,12 @@ mips_emit_call_insn (rtx pattern, rtx or
emit_insn (gen_update_got_version ());
}
+ if (TARGET_MIPS16 && TARGET_USE_GOT)
+ {
+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS16_PIC_TEMP);
+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS_PROLOGUE_TEMP (word_mode));
+ }
+
if (TARGET_MIPS16
&& TARGET_EXPLICIT_RELOCS
&& TARGET_CALL_CLOBBERED_GP)

View File

@ -0,0 +1,13 @@
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -978,7 +978,9 @@ proper position among the other output f
#endif
#ifndef LINK_SSP_SPEC
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if DEFAULT_LIBC == LIBC_MUSL
+#define LINK_SSP_SPEC "-lssp_nonshared"
+#elif defined(TARGET_LIBC_PROVIDES_SSP)
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit:}"
#else

View File

@ -0,0 +1,21 @@
commit ecf7671b769fe96f7b5134be442089f8bdba55d2
Author: Felix Fietkau <nbd@nbd.name>
Date: Thu Aug 4 20:29:45 2016 +0200
gcc: add a patch to generate better code with Os on mips
Also happens to reduce compressed code size a bit
Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -20041,7 +20041,7 @@ mips_option_override (void)
flag_pcc_struct_return = 0;
/* Decide which rtx_costs structure to use. */
- if (optimize_size)
+ if (0 && optimize_size)
mips_cost = &mips_rtx_cost_optimize_size;
else
mips_cost = &mips_rtx_cost_data[mips_tune];

View File

@ -0,0 +1,33 @@
commit 8570c4be394cff7282f332f97da2ff569a927ddb
Author: Imre Kaloz <kaloz@openwrt.org>
Date: Wed Feb 2 20:06:12 2011 +0000
fixup arm soft-float symbols
SVN-Revision: 25325
--- a/libgcc/config/arm/t-linux
+++ b/libgcc/config/arm/t-linux
@@ -1,6 +1,10 @@
LIB1ASMSRC = arm/lib1funcs.S
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
+ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
+ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
+ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
+ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
+ _arm_fixsfsi _arm_fixunssfsi
# Just for these, we omit the frame pointer since it makes such a big
# difference.
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -58,8 +58,6 @@
%{shared:-lc} \
%{!shared:%{profile:-lc_p}%{!profile:-lc}}"
-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
-
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
#define LINUX_TARGET_LINK_SPEC "%{h*} \

View File

@ -0,0 +1,44 @@
commit c96312958c0621e72c9b32da5bc224ffe2161384
Author: Felix Fietkau <nbd@openwrt.org>
Date: Mon Oct 19 23:26:09 2009 +0000
gcc: create a proper libgcc_pic.a static library for relinking (4.3.3+ for now, backport will follow)
SVN-Revision: 18086
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -930,11 +930,12 @@ $(libgcov-driver-objects): %$(objext): $
# Static libraries.
libgcc.a: $(libgcc-objects)
+libgcc_pic.a: $(libgcc-s-objects)
libgcov.a: $(libgcov-objects)
libunwind.a: $(libunwind-objects)
libgcc_eh.a: $(libgcc-eh-objects)
-libgcc.a libgcov.a libunwind.a libgcc_eh.a:
+libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
-rm -f $@
objects="$(objects)"; \
@@ -958,7 +959,7 @@ all: libunwind.a
endif
ifeq ($(enable_shared),yes)
-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
+all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
@@ -1164,6 +1165,10 @@ install-shared:
chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
+ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+
$(subst @multilib_dir@,$(MULTIDIR),$(subst \
@shlib_base_name@,libgcc_s,$(subst \
@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))

View File

@ -0,0 +1,28 @@
commit 7edc8ca5456d9743dd0075eb3cc5b04f4f24c8cc
Author: Imre Kaloz <kaloz@openwrt.org>
Date: Wed Feb 2 19:34:36 2011 +0000
add armv4 fixup patches
SVN-Revision: 25322
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -91,10 +91,15 @@
#define MUSL_DYNAMIC_LINKER \
"/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
+/* For armv4 we pass --fix-v4bx to linker to support EABI */
+#undef TARGET_FIX_V4BX_SPEC
+#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
+ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
+
/* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
use the GNU/Linux version, not the generic BPABI version. */
#undef LINK_SPEC
-#define LINK_SPEC EABI_LINK_SPEC \
+#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \
LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)

View File

@ -0,0 +1,54 @@
commit dcfc40358b5a3cae7320c17f8d1cebd5ad5540cd
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun Feb 12 20:25:47 2012 +0000
gcc 4.6: port over the missing patch 850-use_shared_libgcc.patch to prevent libgcc crap from leaking into every single binary
SVN-Revision: 30486
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -132,10 +132,6 @@
"%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \
LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
- do not use -lfloat. */
-#undef LIBGCC_SPEC
-
/* Clear the instruction cache from `beg' to `end'. This is
implemented in lib1funcs.S, so ensure an error if this definition
is used. */
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -66,6 +66,10 @@ see the files COPYING3 and COPYING.RUNTI
builtin_version ("CRuntime_Musl"); \
} while (0)
+#ifndef LIBGCC_SPEC
+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
+#endif
+
/* Determine which dynamic linker to use depending on whether GLIBC or
uClibc or Bionic or musl is the default C library and whether
-muclibc or -mglibc or -mbionic or -mmusl has been passed to change
--- a/libgcc/mkmap-symver.awk
+++ b/libgcc/mkmap-symver.awk
@@ -136,5 +136,5 @@ function output(lib) {
else if (inherit[lib])
printf("} %s;\n", inherit[lib]);
else
- printf ("\n local:\n\t*;\n};\n");
+ printf ("\n\t*;\n};\n");
}
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -62,6 +62,9 @@
#undef CPP_OS_DEFAULT_SPEC
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
+#undef LIBGCC_SPEC
+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
+
#undef LINK_SHLIB_SPEC
#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
%{static-pie:-static -pie --no-dynamic-linker -z text}"

View File

@ -0,0 +1,22 @@
commit 64661de100da1ec1061ef3e5e400285dce115e6b
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun May 10 13:16:35 2015 +0000
gcc: add some size optimization patches
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 45664
--- a/libgcc/config/t-libunwind
+++ b/libgcc/config/t-libunwind
@@ -2,8 +2,7 @@
HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
# Override the default value from t-slibgcc-elf-ver and mention -lunwind

View File

@ -0,0 +1,11 @@
--- a/gcc/config/rs6000/rs6000-logue.c
+++ b/gcc/config/rs6000/rs6000-logue.c
@@ -348,7 +348,7 @@ rs6000_savres_strategy (rs6000_stack_t *
/* Define cutoff for using out-of-line functions to save registers. */
if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
{
- if (!optimize_size)
+ if (1)
{
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;

View File

@ -0,0 +1,11 @@
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
#endif
#if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
-# define USE_TM_CLONE_REGISTRY 1
+# define USE_TM_CLONE_REGISTRY 0
#elif !defined(USE_TM_CLONE_REGISTRY)
# define USE_TM_CLONE_REGISTRY 0
#endif

View File

@ -0,0 +1,9 @@
--- a/libgcc/config/mips/t-mips16
+++ b/libgcc/config/mips/t-mips16
@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
# Version these symbols if building libgcc.so.
SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
+
+CRTSTUFF_T_CFLAGS += -mno-mips16
+CRTSTUFF_T_CFLAGS_S += -mno-mips16

View File

@ -0,0 +1,146 @@
commit 99368862e44740ff4fd33760893f04e14f9dbdf1
Author: Felix Fietkau <nbd@openwrt.org>
Date: Tue Jul 31 00:52:27 2007 +0000
Port the mbsd_multi patch from freewrt, which adds -fhonour-copts. This will emit warnings in packages that don't use our target cflags properly
SVN-Revision: 8256
This patch brings over a feature from MirBSD:
* -fhonour-copts
If this option is not given, it's warned (depending
on environment variables). This is to catch errors
of misbuilt packages which override CFLAGS themselves.
This patch was authored by Thorsten Glaser <tg at mirbsd.de>
with copyright assignment to the FSF in effect.
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -107,6 +107,9 @@ static dump_flags_t original_dump_flags;
/* Whether any standard preincluded header has been preincluded. */
static bool done_preinclude;
+/* Check if a port honours COPTS. */
+static int honour_copts = 0;
+
static void handle_OPT_d (const char *);
static void set_std_cxx98 (int);
static void set_std_cxx11 (int);
@@ -469,6 +472,12 @@ c_common_handle_option (size_t scode, co
flag_no_builtin = !value;
break;
+ case OPT_fhonour_copts:
+ if (c_language == clk_c) {
+ honour_copts++;
+ }
+ break;
+
case OPT_fconstant_string_class_:
constant_string_class_name = arg;
break;
@@ -1196,6 +1205,47 @@ c_common_init (void)
return false;
}
+ if (c_language == clk_c) {
+ char *ev = getenv ("GCC_HONOUR_COPTS");
+ int evv;
+ if (ev == NULL)
+ evv = -1;
+ else if ((*ev == '0') || (*ev == '\0'))
+ evv = 0;
+ else if (*ev == '1')
+ evv = 1;
+ else if (*ev == '2')
+ evv = 2;
+ else if (*ev == 's')
+ evv = -1;
+ else {
+ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
+ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
+ }
+ if (evv == 1) {
+ if (honour_copts == 0) {
+ error ("someone does not honour COPTS at all in lenient mode");
+ return false;
+ } else if (honour_copts != 1) {
+ warning (0, "someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ }
+ } else if (evv == 2) {
+ if (honour_copts == 0) {
+ error ("someone does not honour COPTS at all in strict mode");
+ return false;
+ } else if (honour_copts != 1) {
+ error ("someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ return false;
+ }
+ } else if (evv == 0) {
+ if (honour_copts != 1)
+ inform (UNKNOWN_LOCATION, "someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ }
+ }
+
return true;
}
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1663,6 +1663,9 @@ C++ ObjC++ Optimization Alias(fexception
fhonor-std
C++ ObjC++ WarnRemoved
+fhonour-copts
+C ObjC C++ ObjC++ RejectNegative
+
fhosted
C ObjC
Assume normal C execution environment.
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1698,6 +1698,9 @@ fguess-branch-probability
Common Var(flag_guess_branch_prob) Optimization
Enable guessing of branch probabilities.
+fhonour-copts
+Common RejectNegative
+
; Nonzero means ignore `#ident' directives. 0 means handle them.
; Generate position-independent code for executables if possible
; On SVR4 targets, it also controls whether or not to emit a
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -9055,6 +9055,17 @@ This option is only supported for C and
@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
@option{-Wno-pointer-sign}.
+@item -fhonour-copts
+@opindex fhonour-copts
+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
+given at least once, and warn if it is given more than once.
+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
+given exactly once.
+If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
+is not given exactly once.
+The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
+This flag and environment variable only affect the C language.
+
@item -Wstack-protector
@opindex Wstack-protector
@opindex Wno-stack-protector
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -2448,6 +2448,9 @@ common_handle_option (struct gcc_options
/* Currently handled in a prescan. */
break;
+ case OPT_fhonour_copts:
+ break;
+
case OPT_Werror:
dc->warning_as_error_requested = value;
break;

View File

@ -0,0 +1,22 @@
Author: Jo-Philipp Wich <jow@openwrt.org>
Date: Sat Apr 21 03:02:39 2012 +0000
gcc: add patch to make the getenv() spec function nonfatal if requested environment variable is unset
SVN-Revision: 31390
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -10100,8 +10100,10 @@ getenv_spec_function (int argc, const ch
}
if (!value)
- fatal_error (input_location,
- "environment variable %qs not defined", varname);
+ {
+ warning (input_location, "environment variable %qs not defined", varname);
+ value = "";
+ }
/* We have to escape every character of the environment variable so
they are not interpreted as active spec characters. A

View File

@ -0,0 +1,168 @@
From c0c62fa4256f805389f16ebfc4a60cf789129b50 Mon Sep 17 00:00:00 2001
From: BangLang Huang <banglang.huang@foxmail.com>
Date: Wed, 9 Nov 2016 10:36:49 +0800
Subject: [PATCH] libffi: fix MIPS softfloat build issue
Backported from github.com/libffi/libffi#272
Signed-off-by: BangLang Huang <banglang.huang@foxmail.com>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
libffi/src/mips/n32.S | 17 +++++++++++++++++
libffi/src/mips/o32.S | 17 +++++++++++++++++
2 files changed, 34 insertions(+)
--- a/libffi/src/mips/n32.S
+++ b/libffi/src/mips/n32.S
@@ -107,6 +107,16 @@ loadregs:
REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6.
+#ifdef __mips_soft_float
+ REG_L a0, 0*FFI_SIZEOF_ARG(t9)
+ REG_L a1, 1*FFI_SIZEOF_ARG(t9)
+ REG_L a2, 2*FFI_SIZEOF_ARG(t9)
+ REG_L a3, 3*FFI_SIZEOF_ARG(t9)
+ REG_L a4, 4*FFI_SIZEOF_ARG(t9)
+ REG_L a5, 5*FFI_SIZEOF_ARG(t9)
+ REG_L a6, 6*FFI_SIZEOF_ARG(t9)
+ REG_L a7, 7*FFI_SIZEOF_ARG(t9)
+#else
and t4, t6, ((1<<FFI_FLAG_BITS)-1)
REG_L a0, 0*FFI_SIZEOF_ARG(t9)
beqz t4, arg1_next
@@ -193,6 +203,7 @@ arg7_next:
arg8_doublep:
l.d $f19, 7*FFI_SIZEOF_ARG(t9)
arg8_next:
+#endif
callit:
# Load the function pointer
@@ -214,6 +225,7 @@ retint:
b epilogue
retfloat:
+#ifndef __mips_soft_float
bne t6, FFI_TYPE_FLOAT, retdouble
jal t9
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
@@ -272,6 +284,7 @@ retstruct_f_d:
s.s $f0, 0(t4)
s.d $f2, 8(t4)
b epilogue
+#endif
retstruct_d_soft:
bne t6, FFI_TYPE_STRUCT_D_SOFT, retstruct_f_soft
@@ -429,6 +442,7 @@ ffi_closure_N32:
REG_S a6, A6_OFF2($sp)
REG_S a7, A7_OFF2($sp)
+#ifndef __mips_soft_float
# Store all possible float/double registers.
s.d $f12, F12_OFF2($sp)
s.d $f13, F13_OFF2($sp)
@@ -438,6 +452,7 @@ ffi_closure_N32:
s.d $f17, F17_OFF2($sp)
s.d $f18, F18_OFF2($sp)
s.d $f19, F19_OFF2($sp)
+#endif
# Call ffi_closure_mips_inner_N32 to do the real work.
LA t9, ffi_closure_mips_inner_N32
@@ -458,6 +473,7 @@ cls_retint:
b cls_epilogue
cls_retfloat:
+#ifndef __mips_soft_float
bne v0, FFI_TYPE_FLOAT, cls_retdouble
l.s $f0, V0_OFF2($sp)
b cls_epilogue
@@ -500,6 +516,7 @@ cls_retstruct_f_d:
l.s $f0, V0_OFF2($sp)
l.d $f2, V1_OFF2($sp)
b cls_epilogue
+#endif
cls_retstruct_small2:
REG_L v0, V0_OFF2($sp)
--- a/libffi/src/mips/o32.S
+++ b/libffi/src/mips/o32.S
@@ -82,13 +82,16 @@ sixteen:
ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args
+#ifndef __mips_soft_float
bnez t0, pass_d # make it quick for int
+#endif
REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the
REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs.
REG_L a2, 2*FFI_SIZEOF_ARG($sp)
REG_L a3, 3*FFI_SIZEOF_ARG($sp)
b call_it
+#ifndef __mips_soft_float
pass_d:
bne t0, FFI_ARGS_D, pass_f
l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
@@ -130,6 +133,7 @@ pass_f_d:
# bne t0, FFI_ARGS_F_D, call_it
l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float
+#endif
call_it:
# Load the function pointer
@@ -158,14 +162,23 @@ retfloat:
bne t2, FFI_TYPE_FLOAT, retdouble
jalr t9
REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
s.s $f0, 0(t0)
+#else
+ REG_S v0, 0(t0)
+#endif
b epilogue
retdouble:
bne t2, FFI_TYPE_DOUBLE, noretval
jalr t9
REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
s.d $f0, 0(t0)
+#else
+ REG_S v1, 4(t0)
+ REG_S v0, 0(t0)
+#endif
b epilogue
noretval:
@@ -261,9 +274,11 @@ $LCFI7:
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT
+#ifndef __mips_soft_float
# Store all possible float/double registers.
s.d $f12, FA_0_0_OFF2($fp)
s.d $f14, FA_1_0_OFF2($fp)
+#endif
1:
# Call ffi_closure_mips_inner_O32 to do the work.
la t9, ffi_closure_mips_inner_O32
@@ -281,6 +296,7 @@ $LCFI7:
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT
+#ifndef __mips_soft_float
li $9, FFI_TYPE_FLOAT
l.s $f0, V0_OFF2($fp)
beq $8, $9, closure_done
@@ -288,6 +304,7 @@ $LCFI7:
li $9, FFI_TYPE_DOUBLE
l.d $f0, V0_OFF2($fp)
beq $8, $9, closure_done
+#endif
1:
REG_L $3, V1_OFF2($fp)
REG_L $2, V0_OFF2($fp)

View File

@ -0,0 +1,67 @@
From dda6b050cd74a352670787a294596a9c56c21327 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Fri, 4 May 2018 18:20:53 +0800
Subject: [PATCH] gotools: fix compilation when making cross compiler
libgo is "the runtime support library for the Go programming language.
This library is intended for use with the Go frontend."
gccgo will link target files with libgo.so which depends on libgcc_s.so.1, but
the linker will complain that it cannot find it. That's because shared libgcc
is not present in the install directory yet. libgo.so was made without problem
because gcc will emit -lgcc_s when compiled with -shared option. When gotools
were being made, it was supplied with -static-libgcc thus no link option was
provided. Check LIBGO in gcc/go/gcc-spec.c for how gccgo make a builtin spec
for linking with libgo.so
- GccgoCrossCompilation, https://github.com/golang/go/wiki/GccgoCrossCompilation
- Cross-building instructions, http://www.eglibc.org/archives/patches/msg00078.html
When 3-pass GCC compilation is used, shared libgcc runtime libraries will be
available after gcc pass2 completed and will meet the gotools link requirement
at gcc pass3
---
gotools/Makefile.am | 4 +++-
gotools/Makefile.in | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
--- a/gotools/Makefile.am
+++ b/gotools/Makefile.am
@@ -26,6 +26,7 @@ PWD_COMMAND = $${PWDCMD-pwd}
STAMP = echo timestamp >
libgodir = ../$(target_noncanonical)/libgo
+libgccdir = ../$(target_noncanonical)/libgcc
LIBGODEP = $(libgodir)/libgo.la
LIBGOTOOL = $(libgodir)/libgotool.a
@@ -41,7 +42,8 @@ GOCFLAGS = $(CFLAGS_FOR_TARGET)
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
AM_GOCFLAGS = -I $(libgodir)
-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
libgosrcdir = $(srcdir)/../libgo/go
--- a/gotools/Makefile.in
+++ b/gotools/Makefile.in
@@ -337,6 +337,7 @@ mkinstalldirs = $(SHELL) $(toplevel_srcd
PWD_COMMAND = $${PWDCMD-pwd}
STAMP = echo timestamp >
libgodir = ../$(target_noncanonical)/libgo
+libgccdir = ../$(target_noncanonical)/libgcc
LIBGODEP = $(libgodir)/libgo.la
LIBGOTOOL = $(libgodir)/libgotool.a
@NATIVE_FALSE@GOCOMPILER = $(GOC)
@@ -346,7 +347,8 @@ LIBGOTOOL = $(libgodir)/libgotool.a
GOCFLAGS = $(CFLAGS_FOR_TARGET)
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
AM_GOCFLAGS = -I $(libgodir)
-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
libgosrcdir = $(srcdir)/../libgo/go
cmdsrcdir = $(libgosrcdir)/cmd

View File

@ -0,0 +1,45 @@
commit 9c6e71079b46ad5433165feaa2001450f2017b56
Author: Przemysław Buczkowski <prem@prem.moe>
Date: Mon Aug 16 13:16:21 2021 +0100
GCC: Patch for Apple Silicon compatibility
This patch fixes a linker error occuring when compiling
the cross-compiler on macOS and ARM64 architecture.
Adapted from:
https://github.com/richfelker/musl-cross-make/issues/116#issuecomment-823612404
Change-Id: Ia3ee98a163bbb62689f42e2da83a5ef36beb0913
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4329
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -1236,7 +1236,7 @@ extern const char *aarch64_rewrite_mcpu
#define MCPU_TO_MARCH_SPEC_FUNCTIONS \
{ "rewrite_mcpu", aarch64_rewrite_mcpu },
-#if defined(__aarch64__)
+#if defined(__aarch64__) && ! defined(__APPLE__)
extern const char *host_detect_local_cpu (int argc, const char **argv);
#define HAVE_LOCAL_CPU_DETECT
# define EXTRA_SPEC_FUNCTIONS \
--- a/gcc/config/host-darwin.c
+++ b/gcc/config/host-darwin.c
@@ -22,6 +22,8 @@
#include "coretypes.h"
#include "diagnostic-core.h"
#include "config/host-darwin.h"
+#include "hosthooks.h"
+#include "hosthooks-def.h"
/* Yes, this is really supposed to work. */
/* This allows for a pagesize of 16384, which we have on Darwin20, but should
@@ -79,3 +81,5 @@ darwin_gt_pch_use_address (void *addr, s
return ret;
}
+
+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;

View File

@ -0,0 +1,73 @@
From: Jonathan Wakely <jwakely@redhat.com>
Date: Fri, 7 Jan 2022 15:21:03 +0000 (+0000)
Subject: libstdc++: Add -nostdinc++ for c++17 sources [PR100017]
X-Git-Tag: releases/gcc-11.3.0~445
X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=01a70ccd723eb9a479186fe37c972b0d0f8676cf
libstdc++: Add -nostdinc++ for c++17 sources [PR100017]
When building a build!=host compiler, the just-built gcc can't be used
to build the target libstdc++ (because it is built for the host triplet,
not the build triplet). The top-level configure.ac sets up the build
flags for libstdc++ (and other "raw_cxx" libs) like this:
GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX,
[gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs],
c++)
The -nostdinc++ flag is only used for the IN-TREE-TOOL, i.e. when using
the just-built gcc/xgcc compiler. This means that the cross-compiler
used to build libstdc++ will add its own libstdc++ headers to the
include path. That results in the #include <cfenv> in
src/c++17/floating_to_chars.cc and src/c++17/floating_from_chars.cc
doing #include_next <fenv.h> and finding the libstdc++ fenv.h wrapper
from the host compiler. Because that has the same include guard as the
<fenv.h> in the libstdc++ we're trying to build, we never reach the
underlying <fenv.h> from libc. That results in several errors of the
form:
error: 'fenv_t' has not been declared in '::'
The most correct fix would be to add -nostdinc++ to the
RAW_CXX_FOR_TARGET variable in configure.ac, or the
RAW_CXX_TARGET_EXPORTS variable in Makefile.tpl.
Another solution would be to make the libstdc++ <fenv.h> wrapper use
_GLIBCXX_INCLUDE_NEXT_C_HEADERS like our <stdlib.h> and other C header
wrappers.
For now though, the simplest and safest solution is to just add
-nostdinc++ to the CXXFLAGS used for src/c++17/*.cc, which is what this
does.
libstdc++-v3/ChangeLog:
PR libstdc++/100017
* src/c++17/Makefile.am (AM_CXXFLAGS): Add -nostdinc++.
* src/c++17/Makefile.in: Regenerate.
(cherry picked from commit 4fde88e5dd152fe866a97b12e0f8229970d15cb3)
---
--- a/libstdc++-v3/src/c++17/Makefile.am
+++ b/libstdc++-v3/src/c++17/Makefile.am
@@ -79,7 +79,7 @@ endif
# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
# as the occasion calls for it.
AM_CXXFLAGS = \
- -std=gnu++17 \
+ -std=gnu++17 -nostdinc++ \
$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
$(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) \
--- a/libstdc++-v3/src/c++17/Makefile.in
+++ b/libstdc++-v3/src/c++17/Makefile.in
@@ -455,7 +455,7 @@ libc__17convenience_la_SOURCES = $(sourc
# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
# as the occasion calls for it.
AM_CXXFLAGS = \
- -std=gnu++17 \
+ -std=gnu++17 -nostdinc++ \
$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
$(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) \

View File

@ -1,28 +0,0 @@
commit 1877bc9d8f2be143fbe530347a945850d0ecd234
Author: Steven Barth <cyrus@openwrt.org>
Date: Mon Jun 22 10:31:07 2015 +0000
gcc/musl: rework SSP-support
Make musl provide libssp_nonshared.a and make GCC link it unconditionally
if musl is used. This should be a no-op if SSP is disabled and seems to be
the only reliable way of dealing with SSP over all packages due to the mess
that is linkerflags handling in packages.
Signed-off-by: Steven Barth <steven@midlink.org>
SVN-Revision: 46108
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -861,7 +861,9 @@ proper position among the other output f
#endif
#ifndef LINK_SSP_SPEC
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if DEFAULT_LIBC == LIBC_MUSL
+#define LINK_SSP_SPEC "-lssp_nonshared"
+#elif defined(TARGET_LIBC_PROVIDES_SSP)
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit:}"
#else

View File

@ -1,34 +0,0 @@
From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 22 Apr 2015 14:20:01 +0000 (+0000)
Subject: unwind fix for musl
X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=a2e31d0681d8a47389b8a3552622fbd9827bcef4
unwind fix for musl
On behalf of szabolcs.nagy@arm.com
2015-04-22 Gregor Richards <gregor.richards@uwaterloo.ca>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* unwind-dw2-fde-dip.c (USE_PT_GNU_EH_FRAME): Define it on
Linux if target provides dl_iterate_phdr.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222328 138bc75d-0d04-0410-961f-82ee72b054a4
---
--- a/libgcc/unwind-dw2-fde-dip.c
+++ b/libgcc/unwind-dw2-fde-dip.c
@@ -65,6 +65,12 @@
#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
&& defined(TARGET_DL_ITERATE_PHDR) \
+ && defined(__linux__)
+# define USE_PT_GNU_EH_FRAME
+#endif
+
+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+ && defined(TARGET_DL_ITERATE_PHDR) \
&& (defined(__DragonFly__) || defined(__FreeBSD__))
# define ElfW __ElfN
# define USE_PT_GNU_EH_FRAME

View File

@ -0,0 +1,14 @@
diff -u --recursive gcc-8.4.0-vanilla/gcc/real.h gcc-8.4.0/gcc/real.h
--- gcc-8.4.0-vanilla/gcc/real.h 2020-03-04 02:30:01.000000000 -0600
+++ gcc-8.4.0/gcc/real.h 2022-05-18 17:02:22.708820427 -0500
@@ -70,8 +70,10 @@
+ (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */
/* Verify the guess. */
+#ifndef __LP64__
extern char test_real_width
[sizeof (REAL_VALUE_TYPE) <= REAL_WIDTH * sizeof (HOST_WIDE_INT) ? 1 : -1];
+#endif
/* Calculate the format for CONST_DOUBLE. We need as many slots as
are necessary to overlay a REAL_VALUE_TYPE on them. This could be

View File

@ -0,0 +1,35 @@
commit 098bd91f5eae625c7d2ee621e10930fc4434e5e2
Author: Luka Perkov <luka@openwrt.org>
Date: Tue Feb 26 16:16:33 2013 +0000
gcc: don't build documentation
This closes #13039.
Signed-off-by: Luka Perkov <luka@openwrt.org>
SVN-Revision: 35807
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3204,18 +3204,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
doc/gccint.info: $(TEXI_GCCINT_FILES)
doc/cppinternals.info: $(TEXI_CPPINT_FILES)
-doc/%.info: %.texi
- if [ x$(BUILD_INFO) = xinfo ]; then \
- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
- -I $(gcc_docdir)/include -o $@ $<; \
- fi
+doc/%.info:
# Duplicate entry to handle renaming of gccinstall.info
-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
- if [ x$(BUILD_INFO) = xinfo ]; then \
- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
- -I $(gcc_docdir)/include -o $@ $<; \
- fi
+doc/gccinstall.info:
doc/cpp.dvi: $(TEXI_CPP_FILES)
doc/gcc.dvi: $(TEXI_GCC_FILES)

View File

@ -0,0 +1,20 @@
Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790.
MIPS16 functions have a static assembler prologue which clobbers
registers v0 and v1. Add these register clobbers to function call
instructions.
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -3102,6 +3102,12 @@ mips_emit_call_insn (rtx pattern, rtx or
emit_insn (gen_update_got_version ());
}
+ if (TARGET_MIPS16 && TARGET_USE_GOT)
+ {
+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS16_PIC_TEMP);
+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS_PROLOGUE_TEMP (word_mode));
+ }
+
if (TARGET_MIPS16
&& TARGET_EXPLICIT_RELOCS
&& TARGET_CALL_CLOBBERED_GP)

View File

@ -0,0 +1,13 @@
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -868,7 +868,9 @@ proper position among the other output f
#endif
#ifndef LINK_SSP_SPEC
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if DEFAULT_LIBC == LIBC_MUSL
+#define LINK_SSP_SPEC "-lssp_nonshared"
+#elif defined(TARGET_LIBC_PROVIDES_SSP)
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit:}"
#else

View File

@ -0,0 +1,21 @@
commit ecf7671b769fe96f7b5134be442089f8bdba55d2
Author: Felix Fietkau <nbd@nbd.name>
Date: Thu Aug 4 20:29:45 2016 +0200
gcc: add a patch to generate better code with Os on mips
Also happens to reduce compressed code size a bit
Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -19847,7 +19847,7 @@ mips_option_override (void)
flag_pcc_struct_return = 0;
/* Decide which rtx_costs structure to use. */
- if (optimize_size)
+ if (0 && optimize_size)
mips_cost = &mips_rtx_cost_optimize_size;
else
mips_cost = &mips_rtx_cost_data[mips_tune];

View File

@ -0,0 +1,11 @@
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -155,7 +155,7 @@ extern tree arm_fp16_type_node;
/* Thumb-1 only. */
#define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
-#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN \
+#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
&& !TARGET_THUMB1)
#define TARGET_CRC32 (arm_arch_crc)

View File

@ -0,0 +1,33 @@
commit 8570c4be394cff7282f332f97da2ff569a927ddb
Author: Imre Kaloz <kaloz@openwrt.org>
Date: Wed Feb 2 20:06:12 2011 +0000
fixup arm soft-float symbols
SVN-Revision: 25325
--- a/libgcc/config/arm/t-linux
+++ b/libgcc/config/arm/t-linux
@@ -1,6 +1,10 @@
LIB1ASMSRC = arm/lib1funcs.S
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
+ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
+ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
+ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
+ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
+ _arm_fixsfsi _arm_fixunssfsi
# Just for these, we omit the frame pointer since it makes such a big
# difference.
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -58,8 +58,6 @@
%{shared:-lc} \
%{!shared:%{profile:-lc_p}%{!profile:-lc}}"
-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
-
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
#define LINUX_TARGET_LINK_SPEC "%{h*} \

View File

@ -0,0 +1,44 @@
commit c96312958c0621e72c9b32da5bc224ffe2161384
Author: Felix Fietkau <nbd@openwrt.org>
Date: Mon Oct 19 23:26:09 2009 +0000
gcc: create a proper libgcc_pic.a static library for relinking (4.3.3+ for now, backport will follow)
SVN-Revision: 18086
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -923,11 +923,12 @@ $(libgcov-driver-objects): %$(objext): $
# Static libraries.
libgcc.a: $(libgcc-objects)
+libgcc_pic.a: $(libgcc-s-objects)
libgcov.a: $(libgcov-objects)
libunwind.a: $(libunwind-objects)
libgcc_eh.a: $(libgcc-eh-objects)
-libgcc.a libgcov.a libunwind.a libgcc_eh.a:
+libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
-rm -f $@
objects="$(objects)"; \
@@ -948,7 +949,7 @@ all: libunwind.a
endif
ifeq ($(enable_shared),yes)
-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
+all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
@@ -1154,6 +1155,10 @@ install-shared:
chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
+ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+
$(subst @multilib_dir@,$(MULTIDIR),$(subst \
@shlib_base_name@,libgcc_s,$(subst \
@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))

View File

@ -50,5 +50,5 @@ Date: Sun Feb 12 20:25:47 2012 +0000
+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
+
#undef LINK_SHLIB_SPEC
#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
%{static-pie:-static -pie --no-dynamic-linker -z text}"

View File

@ -0,0 +1,22 @@
commit 64661de100da1ec1061ef3e5e400285dce115e6b
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun May 10 13:16:35 2015 +0000
gcc: add some size optimization patches
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 45664
--- a/libgcc/config/t-libunwind
+++ b/libgcc/config/t-libunwind
@@ -2,8 +2,7 @@
HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
# Override the default value from t-slibgcc-elf-ver and mention -lunwind

View File

@ -0,0 +1,11 @@
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -24780,7 +24780,7 @@ rs6000_savres_strategy (rs6000_stack_t *
/* Define cutoff for using out-of-line functions to save registers. */
if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
{
- if (!optimize_size)
+ if (1)
{
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;

View File

@ -0,0 +1,11 @@
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
#endif
#if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
-# define USE_TM_CLONE_REGISTRY 1
+# define USE_TM_CLONE_REGISTRY 0
#endif
/* We do not want to add the weak attribute to the declarations of these

View File

@ -0,0 +1,9 @@
--- a/libgcc/config/mips/t-mips16
+++ b/libgcc/config/mips/t-mips16
@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
# Version these symbols if building libgcc.so.
SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
+
+CRTSTUFF_T_CFLAGS += -mno-mips16
+CRTSTUFF_T_CFLAGS_S += -mno-mips16

View File

@ -17,7 +17,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -108,6 +108,9 @@ static int class_dump_flags;
@@ -107,6 +107,9 @@ static dump_flags_t original_dump_flags;
/* Whether any standard preincluded header has been preincluded. */
static bool done_preinclude;
@ -27,7 +27,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000
static void handle_OPT_d (const char *);
static void set_std_cxx98 (int);
static void set_std_cxx11 (int);
@@ -456,6 +459,12 @@ c_common_handle_option (size_t scode, co
@@ -459,6 +462,12 @@ c_common_handle_option (size_t scode, co
flag_no_builtin = !value;
break;
@ -40,7 +40,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000
case OPT_fconstant_string_class_:
constant_string_class_name = arg;
break;
@@ -1084,6 +1093,47 @@ c_common_init (void)
@@ -1125,6 +1134,47 @@ c_common_init (void)
return false;
}
@ -80,7 +80,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000
+ }
+ } else if (evv == 0) {
+ if (honour_copts != 1)
+ inform (0, "someone does not honour COPTS correctly, passed %d times",
+ inform (UNKNOWN_LOCATION, "someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ }
+ }
@ -90,7 +90,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1412,6 +1412,9 @@ C++ ObjC++ Optimization Alias(fexception
@@ -1469,6 +1469,9 @@ C++ ObjC++ Optimization Alias(fexception
fhonor-std
C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
@ -102,7 +102,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000
Assume normal C execution environment.
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1510,6 +1510,9 @@ fguess-branch-probability
@@ -1551,6 +1551,9 @@ fguess-branch-probability
Common Report Var(flag_guess_branch_prob) Optimization
Enable guessing of branch probabilities.
@ -114,7 +114,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000
; On SVR4 targets, it also controls whether or not to emit a
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1954,6 +1954,9 @@ common_handle_option (struct gcc_options
@@ -2073,6 +2073,9 @@ common_handle_option (struct gcc_options
opts, opts_set, loc, dc);
break;
@ -126,7 +126,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000
opts->x_warn_larger_than = value != -1;
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -6572,6 +6572,17 @@ This option is only supported for C and
@@ -7013,6 +7013,17 @@ This option is only supported for C and
@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
@option{-Wno-pointer-sign}.

View File

@ -7,7 +7,7 @@ Date: Sat Apr 21 03:02:39 2012 +0000
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -9281,8 +9281,10 @@ getenv_spec_function (int argc, const ch
@@ -9347,8 +9347,10 @@ getenv_spec_function (int argc, const ch
value = varname;
if (!value)

View File

@ -48,9 +48,9 @@ sellcey@mips.com
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -22567,6 +22567,9 @@ mips_promote_function_mode (const_tree t
#undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS
#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 2
@@ -22640,6 +22640,9 @@ mips_starting_frame_offset (void)
#undef TARGET_STARTING_FRAME_OFFSET
#define TARGET_STARTING_FRAME_OFFSET mips_starting_frame_offset
+#undef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack

View File

@ -0,0 +1,168 @@
From c0c62fa4256f805389f16ebfc4a60cf789129b50 Mon Sep 17 00:00:00 2001
From: BangLang Huang <banglang.huang@foxmail.com>
Date: Wed, 9 Nov 2016 10:36:49 +0800
Subject: [PATCH] libffi: fix MIPS softfloat build issue
Backported from github.com/libffi/libffi#272
Signed-off-by: BangLang Huang <banglang.huang@foxmail.com>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
libffi/src/mips/n32.S | 17 +++++++++++++++++
libffi/src/mips/o32.S | 17 +++++++++++++++++
2 files changed, 34 insertions(+)
--- a/libffi/src/mips/n32.S
+++ b/libffi/src/mips/n32.S
@@ -107,6 +107,16 @@ loadregs:
REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6.
+#ifdef __mips_soft_float
+ REG_L a0, 0*FFI_SIZEOF_ARG(t9)
+ REG_L a1, 1*FFI_SIZEOF_ARG(t9)
+ REG_L a2, 2*FFI_SIZEOF_ARG(t9)
+ REG_L a3, 3*FFI_SIZEOF_ARG(t9)
+ REG_L a4, 4*FFI_SIZEOF_ARG(t9)
+ REG_L a5, 5*FFI_SIZEOF_ARG(t9)
+ REG_L a6, 6*FFI_SIZEOF_ARG(t9)
+ REG_L a7, 7*FFI_SIZEOF_ARG(t9)
+#else
and t4, t6, ((1<<FFI_FLAG_BITS)-1)
REG_L a0, 0*FFI_SIZEOF_ARG(t9)
beqz t4, arg1_next
@@ -193,6 +203,7 @@ arg7_next:
arg8_doublep:
l.d $f19, 7*FFI_SIZEOF_ARG(t9)
arg8_next:
+#endif
callit:
# Load the function pointer
@@ -214,6 +225,7 @@ retint:
b epilogue
retfloat:
+#ifndef __mips_soft_float
bne t6, FFI_TYPE_FLOAT, retdouble
jal t9
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
@@ -272,6 +284,7 @@ retstruct_f_d:
s.s $f0, 0(t4)
s.d $f2, 8(t4)
b epilogue
+#endif
retstruct_d_soft:
bne t6, FFI_TYPE_STRUCT_D_SOFT, retstruct_f_soft
@@ -429,6 +442,7 @@ ffi_closure_N32:
REG_S a6, A6_OFF2($sp)
REG_S a7, A7_OFF2($sp)
+#ifndef __mips_soft_float
# Store all possible float/double registers.
s.d $f12, F12_OFF2($sp)
s.d $f13, F13_OFF2($sp)
@@ -438,6 +452,7 @@ ffi_closure_N32:
s.d $f17, F17_OFF2($sp)
s.d $f18, F18_OFF2($sp)
s.d $f19, F19_OFF2($sp)
+#endif
# Call ffi_closure_mips_inner_N32 to do the real work.
LA t9, ffi_closure_mips_inner_N32
@@ -458,6 +473,7 @@ cls_retint:
b cls_epilogue
cls_retfloat:
+#ifndef __mips_soft_float
bne v0, FFI_TYPE_FLOAT, cls_retdouble
l.s $f0, V0_OFF2($sp)
b cls_epilogue
@@ -500,6 +516,7 @@ cls_retstruct_f_d:
l.s $f0, V0_OFF2($sp)
l.d $f2, V1_OFF2($sp)
b cls_epilogue
+#endif
cls_retstruct_small2:
REG_L v0, V0_OFF2($sp)
--- a/libffi/src/mips/o32.S
+++ b/libffi/src/mips/o32.S
@@ -82,13 +82,16 @@ sixteen:
ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args
+#ifndef __mips_soft_float
bnez t0, pass_d # make it quick for int
+#endif
REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the
REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs.
REG_L a2, 2*FFI_SIZEOF_ARG($sp)
REG_L a3, 3*FFI_SIZEOF_ARG($sp)
b call_it
+#ifndef __mips_soft_float
pass_d:
bne t0, FFI_ARGS_D, pass_f
l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
@@ -130,6 +133,7 @@ pass_f_d:
# bne t0, FFI_ARGS_F_D, call_it
l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float
+#endif
call_it:
# Load the function pointer
@@ -158,14 +162,23 @@ retfloat:
bne t2, FFI_TYPE_FLOAT, retdouble
jalr t9
REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
s.s $f0, 0(t0)
+#else
+ REG_S v0, 0(t0)
+#endif
b epilogue
retdouble:
bne t2, FFI_TYPE_DOUBLE, noretval
jalr t9
REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
s.d $f0, 0(t0)
+#else
+ REG_S v1, 4(t0)
+ REG_S v0, 0(t0)
+#endif
b epilogue
noretval:
@@ -261,9 +274,11 @@ $LCFI7:
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT
+#ifndef __mips_soft_float
# Store all possible float/double registers.
s.d $f12, FA_0_0_OFF2($fp)
s.d $f14, FA_1_0_OFF2($fp)
+#endif
1:
# Call ffi_closure_mips_inner_O32 to do the work.
la t9, ffi_closure_mips_inner_O32
@@ -281,6 +296,7 @@ $LCFI7:
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT
+#ifndef __mips_soft_float
li $9, FFI_TYPE_FLOAT
l.s $f0, V0_OFF2($fp)
beq $8, $9, closure_done
@@ -288,6 +304,7 @@ $LCFI7:
li $9, FFI_TYPE_DOUBLE
l.d $f0, V0_OFF2($fp)
beq $8, $9, closure_done
+#endif
1:
REG_L $3, V1_OFF2($fp)
REG_L $2, V0_OFF2($fp)

View File

@ -34,33 +34,34 @@ at gcc pass3
+libgccdir = ../$(target_noncanonical)/libgcc
LIBGODEP = $(libgodir)/libgo.la
if NATIVE
@@ -38,7 +39,8 @@ endif
GOCFLAGS = $(CFLAGS_FOR_TARGET)
LIBGOTOOL = $(libgodir)/libgotool.a
@@ -41,7 +42,8 @@ GOCFLAGS = $(CFLAGS_FOR_TARGET)
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
AM_GOCFLAGS = -I $(libgodir)
-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
cmdsrcdir = $(srcdir)/../libgo/go/cmd
libgosrcdir = $(srcdir)/../libgo/go
--- a/gotools/Makefile.in
+++ b/gotools/Makefile.in
@@ -252,13 +252,15 @@ mkinstalldirs = $(SHELL) $(toplevel_srcd
@@ -263,6 +263,7 @@ mkinstalldirs = $(SHELL) $(toplevel_srcd
PWD_COMMAND = $${PWDCMD-pwd}
STAMP = echo timestamp >
libgodir = ../$(target_noncanonical)/libgo
+libgccdir = ../$(target_noncanonical)/libgcc
LIBGODEP = $(libgodir)/libgo.la
LIBGOTOOL = $(libgodir)/libgotool.a
@NATIVE_FALSE@GOCOMPILER = $(GOC)
# Use the compiler we just built.
@@ -271,7 +272,8 @@ LIBGOTOOL = $(libgodir)/libgotool.a
@NATIVE_TRUE@GOCOMPILER = $(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET)
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
AM_GOCFLAGS = -I $(libgodir)
-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
cmdsrcdir = $(srcdir)/../libgo/go/cmd
go_cmd_go_files = \
libgosrcdir = $(srcdir)/../libgo/go
cmdsrcdir = $(libgosrcdir)/cmd

View File

@ -1,32 +0,0 @@
commit b050f87d13b5dc7ed82feb9a90f4529de58bdf25
Author: Felix Fietkau <nbd@openwrt.org>
Date: Wed Feb 19 19:20:10 2014 +0000
gcc: prevent the use of LDRD/STRD on ARMv5TE
These instructions are for 64-bit load/store. On ARMv5TE, the CPU
requires addresses to be aligned to 64-bit. When misaligned, behavior is
undefined (effectively either loads the same word twice on LDRD, or
corrupts surrounding memory on STRD).
On ARMv6 and newer, unaligned access is safe.
Removing these instructions for ARMv5TE is necessary, because GCC
ignores alignment information in pointers and does unsafe optimizations
that have shown up as bugs in various places.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 39638
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -150,7 +150,7 @@ extern tree arm_fp16_type_node;
/* Thumb-1 only. */
#define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
-#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN \
+#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
&& !TARGET_THUMB1)
#define TARGET_CRC32 (arm_arch_crc)

View File

@ -1,18 +0,0 @@
commit d8c570a1531035c3e26bcd94741e5f5b9c36b5d9
Author: Felix Fietkau <nbd@openwrt.org>
Date: Mon Mar 5 00:51:01 2012 +0000
gcc: do not emit references to _savegpr_* and _restgpr_* on powerpc, as they are tricky to deal with wrt. libgcc. they cannot be linked dynamically
SVN-Revision: 30814
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -26981,7 +26981,7 @@ rs6000_savres_strategy (rs6000_stack_t *
/* Define cutoff for using out-of-line functions to save registers. */
if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
{
- if (!optimize_size)
+ if (1)
{
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;

View File

@ -1,22 +0,0 @@
commit 565988ab47bd9b96b50608564aee2104aeb4b7ae
Author: Felix Fietkau <nbd@nbd.name>
Date: Tue Dec 13 14:20:49 2016 +0100
gcc: rip out transactional memory related bloat from crtbegin
Slightly improves compression for each executable, saving about 4k from
the default ar71xx rootfs
Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
#endif
#if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
-# define USE_TM_CLONE_REGISTRY 1
+# define USE_TM_CLONE_REGISTRY 0
#endif
/* We do not want to add the weak attribute to the declarations of these

View File

@ -1,30 +0,0 @@
commit 9dc38e48f7a6f88b7ac7bfaced91f53660204e46
Author: Florian Fainelli <florian@openwrt.org>
Date: Fri Apr 5 12:36:06 2013 +0000
toolchain/gcc: .init and .fini need to pick one ISA
The .init and .fini sections are built by concatenating code
fragments. Putting mips16 code in the middle of a mips32 code block
doesn't work. Make gcc built the magic crt stuff in no-mips16 mode.
This is specific to 4.6-linaro but is probably portable to other gcc
flavors. Adding this to the t-libgcc-mips16 makefile fragment is a
hack not suitable for pushing upstream, but there is no mips/t-linux
or mips/t-uclibc and I am not going to touch gcc/configure for two
lines.
Signed-off-by: Jay Carlson <nop@nop.com>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
SVN-Revision: 36200
--- a/libgcc/config/mips/t-mips16
+++ b/libgcc/config/mips/t-mips16
@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
# Version these symbols if building libgcc.so.
SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
+
+CRTSTUFF_T_CFLAGS += -mno-mips16
+CRTSTUFF_T_CFLAGS_S += -mno-mips16

View File

@ -1,33 +0,0 @@
commit 548d9a008ff265e9eaa3c7e0e6e301c6bd5645e6
Author: Felix Fietkau <nbd@openwrt.org>
Date: Fri Dec 12 17:01:57 2014 +0000
gcc: don't clobber stamp-bits with a symlink to itself
Several versions of gcc have an issue in libstdc++v3 where the build may
clobber stamp-bits with a link to itself. This doesn't manifest itself
on all systems. On several Ubuntu systems, this doesn't appear to be a
problem, but it is an issue on Fedora 16 systems.
To fix the issue, we'll simply filter out stamp-bits from the symlinks
to be generated.
Note: gcc 4.4.7 is unaffected by this issue, so no fix is necessary
there.
Signed-off-by: John Szakmeister <john@szakmeister.net>
SVN-Revision: 43669
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -1474,7 +1474,7 @@ stamp-bits: ${bits_headers}
@$(STAMP) stamp-bits
stamp-bits-sup: stamp-bits ${bits_sup_headers}
- @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null
+ @-cd ${bits_builddir} && $(LN_S) $(filter-out stamp-bits,$?) . 2>/dev/null
@$(STAMP) stamp-bits-sup
stamp-c_base: ${c_base_headers}

View File

@ -1,181 +0,0 @@
commit 331735a357a73c7b8adc205241ac3cc6543d985e
Author: Felix Fietkau <nbd@openwrt.org>
Date: Tue Nov 17 12:38:22 2015 +0000
gcc: add a patch to 5.x that supports translation of __FILE__ paths
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 47490
Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47047
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -588,6 +588,10 @@ c_common_handle_option (size_t scode, co
add_path (xstrdup (arg), SYSTEM, 0, true);
break;
+ case OPT_iremap:
+ add_cpp_remap_path (arg);
+ break;
+
case OPT_iwithprefix:
add_prefixed_path (arg, SYSTEM);
break;
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1825,6 +1825,10 @@ iquote
C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs)
-iquote <dir> Add <dir> to the end of the quote include path.
+iremap
+C ObjC C++ ObjC++ Joined Separate
+-iremap <src:dst> Convert <src> to <dst> if it occurs as prefix in __FILE__.
+
iwithprefix
C ObjC C++ ObjC++ Joined Separate
-iwithprefix <dir> Add <dir> to the end of the system include path.
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -4272,6 +4272,7 @@ Refer to the GCC manual for full documen
@c man begin SYNOPSIS
cpp [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
[@option{-I}@var{dir}@dots{}] [@option{-iquote}@var{dir}@dots{}]
+ [@option{-iremap}@var{src}:@var{dst}]
[@option{-M}|@option{-MM}] [@option{-MG}] [@option{-MF} @var{filename}]
[@option{-MP}] [@option{-MQ} @var{target}@dots{}]
[@option{-MT} @var{target}@dots{}]
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
@@ -220,6 +220,12 @@ extensions @samp{.i}, @samp{.ii} or @sam
extensions that GCC uses for preprocessed files created by
@option{-save-temps}.
+@item -iremap @var{src}:@var{dst}
+@opindex iremap
+Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time.
+This option can be specified more than once. Processing stops at the first
+match.
+
@item -fdirectives-only
@opindex fdirectives-only
When preprocessing, handle directives, but do not expand macros.
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -11871,6 +11871,12 @@ by @option{-fplugin=@var{name}} instead
@option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
to be used by the user, but only passed by the driver.
+@item -iremap @var{src}:@var{dst}
+@opindex iremap
+Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time.
+This option can be specified more than once. Processing stops at the first
+match.
+
@item -L@var{dir}
@opindex L
Add directory @var{dir} to the list of directories to be searched
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -820,6 +820,9 @@ extern void cpp_set_lang (cpp_reader *,
/* Set the include paths. */
extern void cpp_set_include_chains (cpp_reader *, cpp_dir *, cpp_dir *, int);
+/* Provide src:dst pair for __FILE__ remapping. */
+extern void add_cpp_remap_path (const char *);
+
/* Call these to get pointers to the options, callback, and deps
structures for a given reader. These pointers are good until you
call cpp_finish on that reader. You can either edit the callbacks
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -227,6 +227,64 @@ static const char * const monthnames[] =
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
+static size_t remap_pairs;
+static char **remap_src;
+static char **remap_dst;
+
+void
+add_cpp_remap_path (const char *arg)
+{
+ const char *arg_dst;
+ size_t len;
+
+ arg_dst = strchr(arg, ':');
+ if (arg_dst == NULL)
+ {
+ fprintf(stderr, "Invalid argument for -iremap\n");
+ exit(1);
+ }
+
+ len = arg_dst - arg;
+ ++arg_dst;
+
+ remap_src = (char **) xrealloc(remap_src, sizeof(char *) * (remap_pairs + 1));
+ remap_dst = (char **) xrealloc(remap_dst, sizeof(char *) * (remap_pairs + 1));
+
+ remap_src[remap_pairs] = (char *) xmalloc(len + 1);
+ memcpy(remap_src[remap_pairs], arg, len);
+ remap_src[remap_pairs][len] = '\0';
+ remap_dst[remap_pairs] = xstrdup(arg_dst);
+ ++remap_pairs;
+}
+
+static const char *
+cpp_remap_file (const char *arg, char **tmp_name)
+{
+ char *result;
+ size_t i, len;
+
+ for (i = 0; i < remap_pairs; ++i)
+ {
+ len = strlen (remap_src[i]);
+ if (strncmp (remap_src[i], arg, len))
+ continue;
+ if (arg[len] == '\0')
+ return xstrdup (remap_dst[i]);
+ if (arg[len] != '/')
+ continue;
+ arg += len;
+ len = strlen (remap_dst[i]);
+ result = (char *) xmalloc (len + strlen (arg) + 1);
+ memcpy(result, remap_dst[i], len);
+ strcpy(result + len, arg);
+ *tmp_name = result;
+
+ return result;
+ }
+
+ return arg;
+}
+
/* Helper function for builtin_macro. Returns the text generated by
a builtin macro. */
const uchar *
@@ -290,6 +348,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
{
unsigned int len;
const char *name;
+ char *tmp_name = NULL;
uchar *buf;
if (node->value.builtin == BT_FILE)
@@ -301,6 +360,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
if (!name)
abort ();
}
+ name = cpp_remap_file (name, &tmp_name);
len = strlen (name);
buf = _cpp_unaligned_alloc (pfile, len * 2 + 3);
result = buf;
@@ -308,6 +368,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
buf = cpp_quote_string (buf + 1, (const unsigned char *) name, len);
*buf++ = '"';
*buf = '\0';
+ free (tmp_name);
}
break;

View File

@ -1,42 +0,0 @@
--- a/libitm/beginend.cc
+++ b/libitm/beginend.cc
@@ -431,7 +431,7 @@ GTM::gtm_transaction_cp::save(gtm_thread
// Save everything that we might have to restore on restarts or aborts.
jb = tx->jb;
undolog_size = tx->undolog.size();
- memcpy(&alloc_actions, &tx->alloc_actions, sizeof(alloc_actions));
+ alloc_actions = tx->alloc_actions;
user_actions_size = tx->user_actions.size();
id = tx->id;
prop = tx->prop;
@@ -449,7 +449,7 @@ GTM::gtm_transaction_cp::commit(gtm_thre
// commits of nested transactions. Allocation actions must be committed
// before committing the snapshot.
tx->jb = jb;
- memcpy(&tx->alloc_actions, &alloc_actions, sizeof(alloc_actions));
+ tx->alloc_actions = alloc_actions;
tx->id = id;
tx->prop = prop;
}
@@ -485,7 +485,7 @@ GTM::gtm_thread::rollback (gtm_transacti
prop = cp->prop;
if (cp->disp != abi_disp())
set_abi_disp(cp->disp);
- memcpy(&alloc_actions, &cp->alloc_actions, sizeof(alloc_actions));
+ alloc_actions = cp->alloc_actions;
nesting = cp->nesting;
}
else
--- a/libitm/method-ml.cc
+++ b/libitm/method-ml.cc
@@ -138,7 +138,9 @@ struct ml_mg : public method_group
// This store is only executed while holding the serial lock, so relaxed
// memory order is sufficient here. Same holds for the memset.
time.store(0, memory_order_relaxed);
- memset(orecs, 0, sizeof(atomic<gtm_word>) * L2O_ORECS);
+ void *p = orecs;
+ memset(p, 0, sizeof(atomic<gtm_word>) * L2O_ORECS);
+
}
};