Browse Source

Merge pull request #194 from bk138/gcc-signed-off

gcc package refined
sbyx 10 years ago
parent
commit
2c88c2424f

+ 115
- 0
devel/gcc/Makefile View File

@@ -0,0 +1,115 @@
1
+#
2
+# Copyright (C) 2008 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+#
8
+
9
+include $(TOPDIR)/rules.mk
10
+
11
+PKG_NAME:=gcc
12
+PKG_VERSION:=4.8.3
13
+PKG_RELEASE:=1
14
+PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$(PKG_VERSION) \
15
+     http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(PKG_VERSION) \
16
+    ftp://ftp.gnu.org/gnu/gcc/releases/gcc-$(PKG_VERSION)
17
+
18
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
19
+PKG_MD5SUM:=7c60f24fab389f77af203d2516ee110f
20
+PKG_INSTALL:=1
21
+PKG_FIXUP:=libtool
22
+PKG_BUILD_PARALLEL:=1
23
+
24
+include $(INCLUDE_DIR)/package.mk
25
+
26
+TARGET_LANGUAGES:="c,c++"
27
+BUGURL=https://dev.openwrt.org/
28
+PKGVERSION=OpenWrt GCC $(PKG_VERSION)
29
+
30
+# not using sstrip here as this fucks up the .so's somehow
31
+STRIP:=$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)strip
32
+RSTRIP:= \
33
+       NM="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)nm" \
34
+       STRIP="$(STRIP)" \
35
+       STRIP_KMOD="$(STRIP) --strip-debug" \
36
+       $(SCRIPT_DIR)/rstrip.sh
37
+
38
+
39
+define Package/gcc
40
+  SECTION:=devel
41
+  CATEGORY:=Development
42
+  TITLE:=gcc
43
+  MAINTAINER:=Christian Beier <cb@shoutrlabs.com>
44
+  DEPENDS:= +binutils +libstdcpp
45
+endef
46
+
47
+define Package/gcc/description
48
+	build a native toolchain for compiling on target
49
+endef
50
+
51
+
52
+define Build/Prepare
53
+	$(PKG_UNPACK)
54
+# 	we have to download additional stuff before patching
55
+	(cd $(PKG_BUILD_DIR) && ./contrib/download_prerequisites)
56
+	$(Build/Patch)
57
+endef
58
+
59
+
60
+define Build/Configure
61
+	(cd $(PKG_BUILD_DIR); rm -f config.cache; \
62
+		SHELL="$(BASH)" \
63
+		$(TARGET_CONFIGURE_OPTS) \
64
+		$(PKG_BUILD_DIR)/configure \
65
+			$(CONFIGURE_ARGS) \
66
+			--build=$(GNU_HOST_NAME) \
67
+			--host=$(REAL_GNU_TARGET_NAME) \
68
+			--target=$(REAL_GNU_TARGET_NAME) \
69
+			--enable-languages=$(TARGET_LANGUAGES) \
70
+			--with-bugurl=$(BUGURL) \
71
+			--with-pkgversion="$(PKGVERSION)" \
72
+			--enable-shared \
73
+			--disable-__cxa_atexit \
74
+			--enable-target-optspace \
75
+			--with-gnu-ld \
76
+			--disable-nls \
77
+			--disable-libmudflap \
78
+			--disable-multilib \
79
+			--disable-libgomp \
80
+			--disable-libquadmath \
81
+			--disable-libssp \
82
+			--disable-decimal-float \
83
+			--disable-libstdcxx-pch \
84
+			--with-host-libstdcxx=-lstdc++ \
85
+			--prefix=/usr \
86
+			--libexecdir=/usr/lib \
87
+			$(SOFT_FLOAT_CONFIG_OPTION) \
88
+			$(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
89
+			$(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
90
+			--with-abi=$(subst ",,$(CONFIG_MIPS64_ABI))) \
91
+	);
92
+endef
93
+
94
+define Build/Compile
95
+	export SHELL="$(BASH)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
96
+			DESTDIR="$(PKG_INSTALL_DIR)" $(MAKE_ARGS) all install
97
+endef
98
+
99
+define Package/gcc/install
100
+	$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
101
+	cp -ar $(PKG_INSTALL_DIR)/usr/include $(1)/usr
102
+	cp -a $(PKG_INSTALL_DIR)/usr/bin/{$(REAL_GNU_TARGET_NAME)-{g++,gcc},cpp,gcov} $(1)/usr/bin
103
+	ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/c++
104
+	ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/g++
105
+	ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++
106
+	ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/gcc
107
+	ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc-$(PKG_VERSION)
108
+	cp -ar $(PKG_INSTALL_DIR)/usr/lib/gcc $(1)/usr/lib
109
+	$(RM) $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/*.a
110
+	cp -ar $(TOOLCHAIN_DIR)/include $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
111
+	cp -a $(TOOLCHAIN_DIR)/lib/*.{o,so*} $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
112
+	cp -a $(TOOLCHAIN_DIR)/lib/*nonshared*.a  $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
113
+endef
114
+
115
+$(eval $(call BuildPackage,gcc))

+ 8
- 0
devel/gcc/README View File

@@ -0,0 +1,8 @@
1
+Native GCC that runs on target.
2
+
3
+To save disk space, this GCC only supports dynamic linking on the target box,
4
+there are no static libraries shipped.
5
+
6
+For now, this was only tested on a mips target. Others to be done...
7
+
8
+   Christian Beier <cb@shoutrlabs.com>

+ 15
- 0
devel/gcc/patches/002-dont-choke-when-building-32bit-on-64bit.patch View File

@@ -0,0 +1,15 @@
1
+diff --git a/gcc/real.h b/gcc/real.h
2
+index 2ff84f6..fbb4b0e 100644
3
+--- a/gcc/real.h
4
++++ b/gcc/real.h
5
+@@ -72,8 +72,10 @@ struct GTY(()) real_value {
6
+    + (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */
7
+ 
8
+ /* Verify the guess.  */
9
++#ifndef __LP64__
10
+ extern char test_real_width
11
+   [sizeof(REAL_VALUE_TYPE) <= REAL_WIDTH*sizeof(HOST_WIDE_INT) ? 1 : -1];
12
++#endif
13
+ 
14
+ /* Calculate the format for CONST_DOUBLE.  We need as many slots as
15
+    are necessary to overlay a REAL_VALUE_TYPE on them.  This could be

+ 38
- 0
devel/gcc/patches/003-mpfr-longlong-mips.patch View File

@@ -0,0 +1,38 @@
1
+diff -Naurd mpfr-2.4.2-a/mpfr-longlong.h mpfr-2.4.2-b/mpfr-longlong.h
2
+--- -a/mpfr-2.4.2/mpfr-longlong.h	2009-11-30 02:43:08.000000000 +0000
3
++++ -b/mpfr-2.4.2/mpfr-longlong.h	2009-12-18 12:04:29.000000000 +0000
4
+@@ -1011,7 +1011,15 @@
5
+ #endif /* __m88000__ */
6
+ 
7
+ #if defined (__mips) && W_TYPE_SIZE == 32
8
+-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
9
++#if (__GNUC__ >= 5) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
10
++#define umul_ppmm(w1, w0, u, v) \
11
++  do {									\
12
++    UDItype _r;							\
13
++    _r = (UDItype) u * v;						\
14
++    (w1) = _r >> 32;							\
15
++    (w0) = (USItype) _r;						\
16
++  } while (0)
17
++#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7
18
+ #define umul_ppmm(w1, w0, u, v) \
19
+   __asm__ ("multu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
20
+ #else
21
+@@ -1024,7 +1032,16 @@
22
+ #endif /* __mips */
23
+ 
24
+ #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
25
+-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
26
++#if (__GNUC__ >= 5) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
27
++typedef unsigned int UTItype __attribute__ ((mode (TI)));
28
++#define umul_ppmm(w1, w0, u, v) \
29
++  do {									\
30
++    UTItype _r;							\
31
++    _r = (UTItype) u * v;						\
32
++    (w1) = _r >> 64;							\
33
++    (w0) = (UDItype) _r;						\
34
++  } while (0)
35
++#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7
36
+ #define umul_ppmm(w1, w0, u, v) \
37
+   __asm__ ("dmultu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
38
+ #else

+ 23
- 0
devel/gcc/patches/010-documentation.patch View File

@@ -0,0 +1,23 @@
1
+--- a/gcc/Makefile.in
2
++++ b/gcc/Makefile.in
3
+@@ -4326,18 +4326,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
4
+ doc/gccint.info: $(TEXI_GCCINT_FILES)
5
+ doc/cppinternals.info: $(TEXI_CPPINT_FILES)
6
+ 
7
+-doc/%.info: %.texi
8
+-	if [ x$(BUILD_INFO) = xinfo ]; then \
9
+-		$(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
10
+-			-I $(gcc_docdir)/include -o $@ $<; \
11
+-	fi
12
++doc/%.info:
13
+ 
14
+ # Duplicate entry to handle renaming of gccinstall.info
15
+-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
16
+-	if [ x$(BUILD_INFO) = xinfo ]; then \
17
+-		$(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
18
+-			-I $(gcc_docdir)/include -o $@ $<; \
19
+-	fi
20
++doc/gccinstall.info:
21
+ 
22
+ doc/cpp.dvi: $(TEXI_CPP_FILES)
23
+ doc/gcc.dvi: $(TEXI_GCC_FILES)

+ 33
- 0
devel/gcc/patches/100-uclibc-conf.patch View File

@@ -0,0 +1,33 @@
1
+--- a/contrib/regression/objs-gcc.sh
2
++++ b/contrib/regression/objs-gcc.sh
3
+@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
4
+  then
5
+   make all-gdb all-dejagnu all-ld || exit 1
6
+   make install-gdb install-dejagnu install-ld || exit 1
7
++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
8
++ then
9
++  make all-gdb all-dejagnu all-ld || exit 1
10
++  make install-gdb install-dejagnu install-ld || exit 1
11
+ elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
12
+   make bootstrap || exit 1
13
+   make install || exit 1
14
+--- a/libjava/classpath/ltconfig
15
++++ b/libjava/classpath/ltconfig
16
+@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
17
+ 
18
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
19
+ case $host_os in
20
+-linux-gnu*) ;;
21
++linux-gnu*|linux-uclibc*) ;;
22
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
23
+ esac
24
+ 
25
+@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
26
+   ;;
27
+ 
28
+ # This must be Linux ELF.
29
+-linux-gnu*)
30
++linux*)
31
+   version_type=linux
32
+   need_lib_prefix=no
33
+   need_version=no

+ 321
- 0
devel/gcc/patches/200-musl.patch View File

@@ -0,0 +1,321 @@
1
+--- a/gcc/config.gcc
2
++++ b/gcc/config.gcc
3
+@@ -549,7 +549,7 @@ case ${target} in
4
+ esac
5
+ 
6
+ # Common C libraries.
7
+-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
8
++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
9
+ 
10
+ # Common parts for widely ported systems.
11
+ case ${target} in
12
+@@ -652,6 +652,9 @@ case ${target} in
13
+     *-*-*uclibc*)
14
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
15
+       ;;
16
++    *-*-*musl*)
17
++      tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
18
++      ;;
19
+     *)
20
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
21
+       ;;
22
+--- a/gcc/config/arm/linux-eabi.h
23
++++ b/gcc/config/arm/linux-eabi.h
24
+@@ -77,6 +77,10 @@
25
+     %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
26
+     %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
27
+ 
28
++/* musl has no "classic" (i.e. broken) mode */
29
++#undef  MUSL_DYNAMIC_LINKER
30
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
31
++
32
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
33
+    use the GNU/Linux version, not the generic BPABI version.  */
34
+ #undef  LINK_SPEC
35
+--- a/gcc/config/i386/linux.h
36
++++ b/gcc/config/i386/linux.h
37
+@@ -21,3 +21,4 @@ along with GCC; see the file COPYING3.
38
+ 
39
+ #define GNU_USER_LINK_EMULATION "elf_i386"
40
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
41
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
42
+--- a/gcc/config/i386/linux64.h
43
++++ b/gcc/config/i386/linux64.h
44
+@@ -30,3 +30,7 @@ see the files COPYING3 and COPYING.RUNTI
45
+ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
46
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
47
+ #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
48
++
49
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
50
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
51
++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
52
+--- a/gcc/config/linux.h
53
++++ b/gcc/config/linux.h
54
+@@ -32,10 +32,12 @@ see the files COPYING3 and COPYING.RUNTI
55
+ #define OPTION_GLIBC  (DEFAULT_LIBC == LIBC_GLIBC)
56
+ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
57
+ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
58
++#define OPTION_MUSL   (DEFAULT_LIBC == LIBC_MUSL)
59
+ #else
60
+ #define OPTION_GLIBC  (linux_libc == LIBC_GLIBC)
61
+ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
62
+ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
63
++#define OPTION_MUSL   (linux_libc == LIBC_MUSL)
64
+ #endif
65
+ 
66
+ #define GNU_USER_TARGET_OS_CPP_BUILTINS()			\
67
+@@ -53,18 +55,21 @@ see the files COPYING3 and COPYING.RUNTI
68
+    uClibc or Bionic is the default C library and whether
69
+    -muclibc or -mglibc or -mbionic has been passed to change the default.  */
70
+ 
71
+-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3)	\
72
+-  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
73
++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4)	\
74
++  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
75
+ 
76
+ #if DEFAULT_LIBC == LIBC_GLIBC
77
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
78
+-  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
79
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
80
++  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
81
+ #elif DEFAULT_LIBC == LIBC_UCLIBC
82
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
83
+-  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
84
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
85
++  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
86
+ #elif DEFAULT_LIBC == LIBC_BIONIC
87
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
88
+-  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
89
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
90
++  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
91
++#elif DEFAULT_LIBC == LIBC_MUSL
92
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
93
++  CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
94
+ #else
95
+ #error "Unsupported DEFAULT_LIBC"
96
+ #endif /* DEFAULT_LIBC */
97
+@@ -84,16 +89,16 @@ see the files COPYING3 and COPYING.RUNTI
98
+ 
99
+ #define GNU_USER_DYNAMIC_LINKER						\
100
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER,	\
101
+-			 BIONIC_DYNAMIC_LINKER)
102
++			 BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
103
+ #define GNU_USER_DYNAMIC_LINKER32					\
104
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
105
+-			 BIONIC_DYNAMIC_LINKER32)
106
++			 BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
107
+ #define GNU_USER_DYNAMIC_LINKER64					\
108
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
109
+-			 BIONIC_DYNAMIC_LINKER64)
110
++			 BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
111
+ #define GNU_USER_DYNAMIC_LINKERX32					\
112
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
113
+-			 BIONIC_DYNAMIC_LINKERX32)
114
++			 BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
115
+ 
116
+ /* Determine whether the entire c99 runtime
117
+    is present in the runtime library.  */
118
+--- a/gcc/config/linux.opt
119
++++ b/gcc/config/linux.opt
120
+@@ -30,3 +30,7 @@ Use GNU C library
121
+ muclibc
122
+ Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
123
+ Use uClibc C library
124
++
125
++mmusl
126
++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
127
++Use musl C library
128
+--- a/gcc/config/mips/linux.h
129
++++ b/gcc/config/mips/linux.h
130
+@@ -18,3 +18,5 @@ along with GCC; see the file COPYING3.
131
+ <http://www.gnu.org/licenses/>.  */
132
+ 
133
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
134
++
135
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
136
+--- a/gcc/config/rs6000/linux64.h
137
++++ b/gcc/config/rs6000/linux64.h
138
+@@ -364,17 +364,21 @@ extern int dot_symbols;
139
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
140
+ #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
141
+ #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
142
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
143
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
144
+ #if DEFAULT_LIBC == LIBC_UCLIBC
145
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
146
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
147
+ #elif DEFAULT_LIBC == LIBC_GLIBC
148
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
149
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
150
++#elif DEFAULT_LIBC == LIBC_MUSL
151
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
152
+ #else
153
+ #error "Unsupported DEFAULT_LIBC"
154
+ #endif
155
+ #define GNU_USER_DYNAMIC_LINKER32 \
156
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
157
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
158
+ #define GNU_USER_DYNAMIC_LINKER64 \
159
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
160
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
161
+ 
162
+ 
163
+ #define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
164
+--- a/gcc/config/rs6000/sysv4.h
165
++++ b/gcc/config/rs6000/sysv4.h
166
+@@ -789,15 +789,18 @@ extern int fixuplabelno;
167
+ 
168
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
169
+ #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
170
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
171
+ #if DEFAULT_LIBC == LIBC_UCLIBC
172
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
173
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
174
++#elif DEFAULT_LIBC == LIBC_MUSL
175
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
176
+ #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
177
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
178
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
179
+ #else
180
+ #error "Unsupported DEFAULT_LIBC"
181
+ #endif
182
+ #define GNU_USER_DYNAMIC_LINKER \
183
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
184
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
185
+ 
186
+ #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
187
+   %{rdynamic:-export-dynamic} \
188
+--- a/gcc/ginclude/stddef.h
189
++++ b/gcc/ginclude/stddef.h
190
+@@ -181,6 +181,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
191
+ #ifndef _GCC_SIZE_T
192
+ #ifndef _SIZET_
193
+ #ifndef __size_t
194
++#ifndef __DEFINED_size_t /* musl */
195
+ #define __size_t__	/* BeOS */
196
+ #define __SIZE_T__	/* Cray Unicos/Mk */
197
+ #define _SIZE_T
198
+@@ -197,6 +198,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
199
+ #define ___int_size_t_h
200
+ #define _GCC_SIZE_T
201
+ #define _SIZET_
202
++#define __DEFINED_size_t /* musl */
203
+ #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
204
+   || defined(__FreeBSD_kernel__)
205
+ /* __size_t is a typedef on FreeBSD 5, must not trash it. */
206
+@@ -214,6 +216,7 @@ typedef __SIZE_TYPE__ size_t;
207
+ typedef long ssize_t;
208
+ #endif /* __BEOS__ */
209
+ #endif /* !(defined (__GNUG__) && defined (size_t)) */
210
++#endif /* __DEFINED_size_t */
211
+ #endif /* __size_t */
212
+ #endif /* _SIZET_ */
213
+ #endif /* _GCC_SIZE_T */
214
+--- a/libgomp/config/posix/time.c
215
++++ b/libgomp/config/posix/time.c
216
+@@ -28,6 +28,8 @@
217
+    The following implementation uses the most simple POSIX routines.
218
+    If present, POSIX 4 clocks should be used instead.  */
219
+ 
220
++#define _POSIX_C_SOURCE 199309L /* for clocks */
221
++
222
+ #include "libgomp.h"
223
+ #include <unistd.h>
224
+ #if TIME_WITH_SYS_TIME
225
+--- a/libitm/config/arm/hwcap.cc
226
++++ b/libitm/config/arm/hwcap.cc
227
+@@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
228
+ 
229
+ #ifdef __linux__
230
+ #include <unistd.h>
231
++#ifdef __GLIBC__
232
+ #include <sys/fcntl.h>
233
++#else
234
++#include <fcntl.h>
235
++#endif
236
+ #include <elf.h>
237
+ 
238
+ static void __attribute__((constructor))
239
+--- a/libitm/config/linux/x86/tls.h
240
++++ b/libitm/config/linux/x86/tls.h
241
+@@ -25,16 +25,19 @@
242
+ #ifndef LIBITM_X86_TLS_H
243
+ #define LIBITM_X86_TLS_H 1
244
+ 
245
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
246
++#if defined(__GLIBC_PREREQ)
247
++#if __GLIBC_PREREQ(2, 10)
248
+ /* Use slots in the TCB head rather than __thread lookups.
249
+    GLIBC has reserved words 10 through 13 for TM.  */
250
+ #define HAVE_ARCH_GTM_THREAD 1
251
+ #define HAVE_ARCH_GTM_THREAD_DISP 1
252
+ #endif
253
++#endif
254
+ 
255
+ #include "config/generic/tls.h"
256
+ 
257
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
258
++#if defined(__GLIBC_PREREQ)
259
++#if __GLIBC_PREREQ(2, 10)
260
+ namespace GTM HIDDEN {
261
+ 
262
+ #ifdef __x86_64__
263
+@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a
264
+ 
265
+ } // namespace GTM
266
+ #endif /* >= GLIBC 2.10 */
267
++#endif
268
+ 
269
+ #endif // LIBITM_X86_TLS_H
270
+--- a/libstdc++-v3/configure.host
271
++++ b/libstdc++-v3/configure.host
272
+@@ -264,6 +264,13 @@ case "${host_os}" in
273
+     os_include_dir="os/bsd/freebsd"
274
+     ;;
275
+   gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
276
++    # check for musl by target
277
++    case "${host_os}" in
278
++      *-musl*)
279
++        os_include_dir="os/generic"
280
++        ;;
281
++      *)
282
++
283
+     if [ "$uclibc" = "yes" ]; then
284
+       os_include_dir="os/uclibc"
285
+     elif [ "$bionic" = "yes" ]; then
286
+@@ -272,6 +279,9 @@ case "${host_os}" in
287
+       os_include_dir="os/gnu-linux"
288
+     fi
289
+     ;;
290
++
291
++    esac
292
++    ;;
293
+   hpux*)
294
+     os_include_dir="os/hpux"
295
+     ;;
296
+--- a/gcc/config/mips/linux64.h
297
++++ b/gcc/config/mips/linux64.h
298
+@@ -27,6 +27,9 @@ along with GCC; see the file COPYING3.
299
+ #define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
300
+ #define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
301
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
302
++#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mips.so.1"
303
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips.so.1"
304
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips.so.1"
305
+ #define GNU_USER_DYNAMIC_LINKERN32 \
306
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
307
+-			 BIONIC_DYNAMIC_LINKERN32)
308
++			 BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
309
+--- a/gcc/config/sparc/linux64.h       2013-09-10 10:02:45.663973856 +0100
310
++++ b/gcc/config/sparc/linux64.h       2013-09-10 10:03:17.871972435 +0100
311
+@@ -104,6 +104,9 @@
312
+ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
313
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
314
+ 
315
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-sparc.so.1"
316
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-sparc.so.1"
317
++
318
+ #ifdef SPARC_BI_ARCH
319
+ 
320
+ #undef SUBTARGET_EXTRA_SPECS
321
+

+ 11
- 0
devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch View File

@@ -0,0 +1,11 @@
1
+--- a/gcc/config/arm/arm.h
2
++++ b/gcc/config/arm/arm.h
3
+@@ -271,7 +271,7 @@ extern void (*arm_lang_output_object_att
4
+ /* Thumb-1 only.  */
5
+ #define TARGET_THUMB1_ONLY		(TARGET_THUMB1 && !arm_arch_notm)
6
+ 
7
+-#define TARGET_LDRD			(arm_arch5e && ARM_DOUBLEWORD_ALIGN \
8
++#define TARGET_LDRD			(arm_arch6 && ARM_DOUBLEWORD_ALIGN \
9
+                                          && !TARGET_THUMB1)
10
+ 
11
+ /* The following two macros concern the ability to execute coprocessor

+ 25
- 0
devel/gcc/patches/810-arm-softfloat-libgcc.patch View File

@@ -0,0 +1,25 @@
1
+--- a/libgcc/config/arm/t-linux
2
++++ b/libgcc/config/arm/t-linux
3
+@@ -1,6 +1,10 @@
4
+ LIB1ASMSRC = arm/lib1funcs.S
5
+ LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
6
+-	_ctzsi2 _arm_addsubdf3 _arm_addsubsf3
7
++	_ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
8
++	_arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
9
++	_arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
10
++	_arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
11
++	_arm_fixsfsi _arm_fixunssfsi
12
+ 
13
+ # Just for these, we omit the frame pointer since it makes such a big
14
+ # difference.
15
+--- a/gcc/config/arm/linux-elf.h
16
++++ b/gcc/config/arm/linux-elf.h
17
+@@ -55,8 +55,6 @@
18
+    %{shared:-lc} \
19
+    %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
20
+ 
21
+-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
22
+-
23
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
24
+ 
25
+ #define LINUX_TARGET_LINK_SPEC  "%{h*} \

+ 36
- 0
devel/gcc/patches/820-libgcc_pic.patch View File

@@ -0,0 +1,36 @@
1
+--- a/libgcc/Makefile.in
2
++++ b/libgcc/Makefile.in
3
+@@ -865,11 +865,12 @@ $(libgcov-objects): %$(objext): $(srcdir
4
+ 
5
+ # Static libraries.
6
+ libgcc.a: $(libgcc-objects)
7
++libgcc_pic.a: $(libgcc-s-objects)
8
+ libgcov.a: $(libgcov-objects)
9
+ libunwind.a: $(libunwind-objects)
10
+ libgcc_eh.a: $(libgcc-eh-objects)
11
+ 
12
+-libgcc.a libgcov.a libunwind.a libgcc_eh.a:
13
++libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
14
+ 	-rm -f $@
15
+ 
16
+ 	objects="$(objects)";					\
17
+@@ -891,7 +892,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
18
+ endif
19
+ 
20
+ ifeq ($(enable_shared),yes)
21
+-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
22
++all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
23
+ ifneq ($(LIBUNWIND),)
24
+ all: libunwind$(SHLIB_EXT)
25
+ endif
26
+@@ -1058,6 +1059,10 @@ install-shared:
27
+ 	chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
28
+ 	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
29
+ 
30
++	$(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
31
++	chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
32
++	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
33
++
34
+ 	$(subst @multilib_dir@,$(MULTIDIR),$(subst \
35
+ 		@shlib_base_name@,libgcc_s,$(subst \
36
+ 		@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))

+ 13
- 0
devel/gcc/patches/830-arm_unbreak_armv4t.patch View File

@@ -0,0 +1,13 @@
1
+http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
2
+
3
+--- a/gcc/config/arm/linux-eabi.h
4
++++ b/gcc/config/arm/linux-eabi.h
5
+@@ -45,7 +45,7 @@
6
+    The ARM10TDMI core is the default for armv5t, so set
7
+    SUBTARGET_CPU_DEFAULT to achieve this.  */
8
+ #undef  SUBTARGET_CPU_DEFAULT
9
+-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
10
++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
11
+ 
12
+ /* TARGET_BIG_ENDIAN_DEFAULT is set in
13
+    config.gcc for big endian configurations.  */

+ 19
- 0
devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch View File

@@ -0,0 +1,19 @@
1
+--- a/gcc/config/arm/linux-eabi.h
2
++++ b/gcc/config/arm/linux-eabi.h
3
+@@ -81,10 +81,15 @@
4
+ #undef  MUSL_DYNAMIC_LINKER
5
+ #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
6
+ 
7
++/* For armv4 we pass --fix-v4bx to linker to support EABI */
8
++#undef TARGET_FIX_V4BX_SPEC
9
++#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
10
++  "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
11
++
12
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
13
+    use the GNU/Linux version, not the generic BPABI version.  */
14
+ #undef  LINK_SPEC
15
+-#define LINK_SPEC BE8_LINK_SPEC						\
16
++#define LINK_SPEC BE8_LINK_SPEC TARGET_FIX_V4BX_SPEC			\
17
+   LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC,				\
18
+ 		       LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
19
+ 

+ 47
- 0
devel/gcc/patches/850-use_shared_libgcc.patch View File

@@ -0,0 +1,47 @@
1
+--- a/gcc/config/arm/linux-eabi.h
2
++++ b/gcc/config/arm/linux-eabi.h
3
+@@ -114,10 +114,6 @@
4
+ #define ENDFILE_SPEC \
5
+   LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
6
+ 
7
+-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
8
+-   do not use -lfloat.  */
9
+-#undef LIBGCC_SPEC
10
+-
11
+ /* Clear the instruction cache from `beg' to `end'.  This is
12
+    implemented in lib1funcs.S, so ensure an error if this definition
13
+    is used.  */
14
+--- a/gcc/config/linux.h
15
++++ b/gcc/config/linux.h
16
+@@ -51,6 +51,10 @@ see the files COPYING3 and COPYING.RUNTI
17
+ 	builtin_assert ("system=posix");			\
18
+     } while (0)
19
+ 
20
++#ifndef LIBGCC_SPEC
21
++#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
22
++#endif
23
++
24
+ /* Determine which dynamic linker to use depending on whether GLIBC or
25
+    uClibc or Bionic is the default C library and whether
26
+    -muclibc or -mglibc or -mbionic has been passed to change the default.  */
27
+--- a/libgcc/mkmap-symver.awk
28
++++ b/libgcc/mkmap-symver.awk
29
+@@ -132,5 +132,5 @@ function output(lib) {
30
+   else if (inherit[lib])
31
+     printf("} %s;\n", inherit[lib]);
32
+   else
33
+-    printf ("\n  local:\n\t*;\n};\n");
34
++    printf ("\n\t*;\n};\n");
35
+ }
36
+--- a/gcc/config/rs6000/linux.h
37
++++ b/gcc/config/rs6000/linux.h
38
+@@ -61,6 +61,9 @@
39
+ #undef  CPLUSPLUS_CPP_SPEC
40
+ #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
41
+ 
42
++#undef LIBGCC_SPEC
43
++#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
44
++
45
+ #undef  LINK_SHLIB_SPEC
46
+ #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
47
+ 

+ 29
- 0
devel/gcc/patches/860-uclibc_use_eh_frame.patch View File

@@ -0,0 +1,29 @@
1
+--- a/libgcc/crtstuff.c
2
++++ b/libgcc/crtstuff.c
3
+@@ -100,15 +100,20 @@ call_ ## FUNC (void)					\
4
+ #if defined(OBJECT_FORMAT_ELF) \
5
+     && !defined(OBJECT_FORMAT_FLAT) \
6
+     && defined(HAVE_LD_EH_FRAME_HDR) \
7
+-    && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
8
+-    && defined(__GLIBC__) && __GLIBC__ >= 2
9
++    && !defined(inhibit_libc) && !defined(CRTSTUFFT_O)
10
+ #include <link.h>
11
+ /* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h.
12
+    But it doesn't use PT_GNU_EH_FRAME ELF segment currently.  */
13
+-# if !defined(__UCLIBC__) \
14
+-     && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
15
+-     || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
16
+-#  define USE_PT_GNU_EH_FRAME
17
++# if defined(__UCLIBC__)
18
++#  if (__UCLIBC_MAJOR__ > 0 || __UCLIBC_MINOR__ > 9 || \
19
++       (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ >= 33))
20
++#   define USE_PT_GNU_EH_FRAME
21
++#  endif
22
++# elif defined(__GLIBC__)
23
++#  if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
24
++       || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
25
++#   define USE_PT_GNU_EH_FRAME
26
++#  endif
27
+ # endif
28
+ #endif
29
+ 

+ 11
- 0
devel/gcc/patches/870-ppc_no_crtsavres.patch View File

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

+ 11
- 0
devel/gcc/patches/880-no_java_section.patch View File

@@ -0,0 +1,11 @@
1
+--- a/gcc/defaults.h
2
++++ b/gcc/defaults.h
3
+@@ -380,7 +380,7 @@ see the files COPYING3 and COPYING.RUNTI
4
+ /* If we have named section and we support weak symbols, then use the
5
+    .jcr section for recording java classes which need to be registered
6
+    at program start-up time.  */
7
+-#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
8
++#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
9
+ #ifndef JCR_SECTION_NAME
10
+ #define JCR_SECTION_NAME ".jcr"
11
+ #endif

+ 9
- 0
devel/gcc/patches/900-bad-mips16-crt.patch View File

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

+ 253
- 0
devel/gcc/patches/910-mbsd_multi.patch View File

@@ -0,0 +1,253 @@
1
+
2
+	This patch brings over a few features from MirBSD:
3
+	* -fhonour-copts
4
+	  If this option is not given, it's warned (depending
5
+	  on environment variables). This is to catch errors
6
+	  of misbuilt packages which override CFLAGS themselves.
7
+	* -Werror-maybe-reset
8
+	  Has the effect of -Wno-error if GCC_NO_WERROR is
9
+	  set and not '0', a no-operation otherwise. This is
10
+	  to be able to use -Werror in "make" but prevent
11
+	  GNU autoconf generated configure scripts from
12
+	  freaking out.
13
+	* Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
14
+	  the default for -O2/-Os, because they trigger gcc bugs
15
+	  and can delete code with security implications.
16
+
17
+	This patch was authored by Thorsten Glaser <tg at mirbsd.de>
18
+	with copyright assignment to the FSF in effect.
19
+
20
+--- a/gcc/c-family/c-opts.c
21
++++ b/gcc/c-family/c-opts.c
22
+@@ -104,6 +104,9 @@ static size_t include_cursor;
23
+ /* Whether any standard preincluded header has been preincluded.  */
24
+ static bool done_preinclude;
25
+ 
26
++/* Check if a port honours COPTS.  */
27
++static int honour_copts = 0;
28
++
29
+ static void handle_OPT_d (const char *);
30
+ static void set_std_cxx98 (int);
31
+ static void set_std_cxx11 (int);
32
+@@ -383,6 +386,9 @@ c_common_handle_option (size_t scode, co
33
+       cpp_opts->warn_endif_labels = value;
34
+       break;
35
+ 
36
++    case OPT_Werror_maybe_reset:
37
++      break;
38
++
39
+     case OPT_Winvalid_pch:
40
+       cpp_opts->warn_invalid_pch = value;
41
+       break;
42
+@@ -491,6 +497,12 @@ c_common_handle_option (size_t scode, co
43
+       flag_no_builtin = !value;
44
+       break;
45
+ 
46
++    case OPT_fhonour_copts:
47
++      if (c_language == clk_c) {
48
++        honour_copts++;
49
++      }
50
++      break;
51
++
52
+     case OPT_fconstant_string_class_:
53
+       constant_string_class_name = arg;
54
+       break;
55
+@@ -1027,6 +1039,47 @@ c_common_init (void)
56
+       return false;
57
+     }
58
+ 
59
++  if (c_language == clk_c) {
60
++    char *ev = getenv ("GCC_HONOUR_COPTS");
61
++    int evv;
62
++    if (ev == NULL)
63
++      evv = -1;
64
++    else if ((*ev == '0') || (*ev == '\0'))
65
++      evv = 0;
66
++    else if (*ev == '1')
67
++      evv = 1;
68
++    else if (*ev == '2')
69
++      evv = 2;
70
++    else if (*ev == 's')
71
++      evv = -1;
72
++    else {
73
++      warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
74
++      evv = 1; /* maybe depend this on something like MIRBSD_NATIVE?  */
75
++    }
76
++    if (evv == 1) {
77
++      if (honour_copts == 0) {
78
++        error ("someone does not honour COPTS at all in lenient mode");
79
++        return false;
80
++      } else if (honour_copts != 1) {
81
++        warning (0, "someone does not honour COPTS correctly, passed %d times",
82
++         honour_copts);
83
++      }
84
++    } else if (evv == 2) {
85
++      if (honour_copts == 0) {
86
++        error ("someone does not honour COPTS at all in strict mode");
87
++        return false;
88
++      } else if (honour_copts != 1) {
89
++        error ("someone does not honour COPTS correctly, passed %d times",
90
++         honour_copts);
91
++        return false;
92
++      }
93
++    } else if (evv == 0) {
94
++      if (honour_copts != 1)
95
++        inform (0, "someone does not honour COPTS correctly, passed %d times",
96
++         honour_copts);
97
++    }
98
++  }
99
++
100
+   return true;
101
+ }
102
+ 
103
+--- a/gcc/c-family/c.opt
104
++++ b/gcc/c-family/c.opt
105
+@@ -379,6 +379,10 @@ Werror-implicit-function-declaration
106
+ C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration)
107
+ This switch is deprecated; use -Werror=implicit-function-declaration instead
108
+ 
109
++Werror-maybe-reset
110
++C ObjC C++ ObjC++
111
++; Documented in common.opt
112
++
113
+ Wfloat-equal
114
+ C ObjC C++ ObjC++ Var(warn_float_equal) Warning
115
+ Warn if testing floating point numbers for equality
116
+@@ -949,6 +953,9 @@ C++ ObjC++ Optimization Alias(fexception
117
+ fhonor-std
118
+ C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
119
+ 
120
++fhonour-copts
121
++C ObjC C++ ObjC++ RejectNegative
122
++
123
+ fhosted
124
+ C ObjC
125
+ Assume normal C execution environment
126
+--- a/gcc/common.opt
127
++++ b/gcc/common.opt
128
+@@ -541,6 +541,10 @@ Werror=
129
+ Common Joined
130
+ Treat specified warning as error
131
+ 
132
++Werror-maybe-reset
133
++Common
134
++If environment variable GCC_NO_WERROR is set, act as -Wno-error
135
++
136
+ Wextra
137
+ Common Var(extra_warnings) Warning
138
+ Print extra (possibly unwanted) warnings
139
+@@ -1242,6 +1246,9 @@ fguess-branch-probability
140
+ Common Report Var(flag_guess_branch_prob) Optimization
141
+ Enable guessing of branch probabilities
142
+ 
143
++fhonour-copts
144
++Common RejectNegative
145
++
146
+ ; Nonzero means ignore `#ident' directives.  0 means handle them.
147
+ ; Generate position-independent code for executables if possible
148
+ ; On SVR4 targets, it also controls whether or not to emit a
149
+--- a/gcc/opts.c
150
++++ b/gcc/opts.c
151
+@@ -468,8 +468,6 @@ static const struct default_options defa
152
+     { OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 },
153
+ #endif
154
+     { OPT_LEVELS_2_PLUS, OPT_fregmove, NULL, 1 },
155
+-    { OPT_LEVELS_2_PLUS, OPT_fstrict_aliasing, NULL, 1 },
156
+-    { OPT_LEVELS_2_PLUS, OPT_fstrict_overflow, NULL, 1 },
157
+     { OPT_LEVELS_2_PLUS, OPT_freorder_blocks, NULL, 1 },
158
+     { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 },
159
+     { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 },
160
+@@ -488,6 +486,8 @@ static const struct default_options defa
161
+     { OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 },
162
+ 
163
+     /* -O3 optimizations.  */
164
++    { OPT_LEVELS_3_PLUS, OPT_fstrict_aliasing, NULL, 1 },
165
++    { OPT_LEVELS_3_PLUS, OPT_fstrict_overflow, NULL, 1 },
166
+     { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
167
+     { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
168
+     /* Inlining of functions reducing size is a good idea with -Os
169
+@@ -1423,6 +1423,17 @@ common_handle_option (struct gcc_options
170
+ 			       opts, opts_set, loc, dc);
171
+       break;
172
+ 
173
++    case OPT_Werror_maybe_reset:
174
++      {
175
++        char *ev = getenv ("GCC_NO_WERROR");
176
++        if ((ev != NULL) && (*ev != '0'))
177
++          warnings_are_errors = 0;
178
++      }
179
++      break;
180
++
181
++    case OPT_fhonour_copts:
182
++      break;
183
++
184
+     case OPT_Wlarger_than_:
185
+       opts->x_larger_than_size = value;
186
+       opts->x_warn_larger_than = value != -1;
187
+--- a/gcc/doc/cppopts.texi
188
++++ b/gcc/doc/cppopts.texi
189
+@@ -163,6 +163,11 @@ in older programs.  This warning is on b
190
+ Make all warnings into hard errors.  Source code which triggers warnings
191
+ will be rejected.
192
+ 
193
++ at item -Werror-maybe-reset
194
++ at opindex Werror-maybe-reset
195
++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
196
++variable is set to anything other than 0 or empty.
197
++
198
+ @item -Wsystem-headers
199
+ @opindex Wsystem-headers
200
+ Issue warnings for code in system headers.  These are normally unhelpful
201
+--- a/gcc/doc/invoke.texi
202
++++ b/gcc/doc/invoke.texi
203
+@@ -240,7 +240,7 @@ Objective-C and Objective-C++ Dialects}.
204
+ -Wconversion  -Wcoverage-mismatch  -Wno-cpp  -Wno-deprecated  @gol
205
+ -Wno-deprecated-declarations -Wdisabled-optimization  @gol
206
+ -Wno-div-by-zero -Wdouble-promotion -Wempty-body  -Wenum-compare @gol
207
+--Wno-endif-labels -Werror  -Werror=* @gol
208
++-Wno-endif-labels -Werror  -Werror=* -Werror-maybe-reset @gol
209
+ -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
210
+ -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
211
+ -Wformat-security  -Wformat-y2k @gol
212
+@@ -4808,6 +4808,22 @@ This option is only supported for C and
213
+ @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
214
+ @option{-Wno-pointer-sign}.
215
+ 
216
++ at item -Werror-maybe-reset
217
++ at opindex Werror-maybe-reset
218
++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
219
++variable is set to anything other than 0 or empty.
220
++
221
++ at item -fhonour-copts
222
++ at opindex fhonour-copts
223
++If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
224
++given at least once, and warn if it is given more than once.
225
++If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
226
++given exactly once.
227
++If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
228
++is not given exactly once.
229
++The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
230
++This flag and environment variable only affect the C language.
231
++
232
+ @item -Wstack-protector
233
+ @opindex Wstack-protector
234
+ @opindex Wno-stack-protector
235
+@@ -6919,7 +6935,7 @@ so, the first branch is redirected to ei
236
+ second branch or a point immediately following it, depending on whether
237
+ the condition is known to be true or false.
238
+ 
239
+-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
240
++Enabled at levels @option{-O3}.
241
+ 
242
+ @item -fsplit-wide-types
243
+ @opindex fsplit-wide-types
244
+--- a/gcc/java/jvspec.c
245
++++ b/gcc/java/jvspec.c
246
+@@ -626,6 +626,7 @@ lang_specific_pre_link (void)
247
+      class name.  Append dummy `.c' that can be stripped by set_input so %b
248
+      is correct.  */ 
249
+   set_input (concat (main_class_name, "main.c", NULL));
250
++  putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack!  */
251
+   err = do_spec (jvgenmain_spec);
252
+   if (err == 0)
253
+     {

+ 14
- 0
devel/gcc/patches/920-specs_nonfatal_getenv.patch View File

@@ -0,0 +1,14 @@
1
+--- a/gcc/gcc.c
2
++++ b/gcc/gcc.c
3
+@@ -8003,7 +8003,10 @@ getenv_spec_function (int argc, const ch
4
+ 
5
+   value = getenv (argv[0]);
6
+   if (!value)
7
+-    fatal_error ("environment variable %qs not defined", argv[0]);
8
++    {
9
++      warning (0, "environment variable %qs not defined", argv[0]);
10
++      value = "";
11
++    }
12
+ 
13
+   /* We have to escape every character of the environment variable so
14
+      they are not interpreted as active spec characters.  A