1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-23 18:53:08 +02:00

gcc: add llvm-gcc and llvm from trunk (does not successfully compile a target yet, but gets close)

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18019 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd 2009-10-10 19:25:48 +00:00
parent bcf5f70a68
commit 1d8d224223
33 changed files with 4629 additions and 20 deletions

View File

@ -59,6 +59,10 @@ define Build/Configure
oldconfig
endef
ifdef CONFIG_GCC_VERSION_LLVM
TARGET_CFLAGS += -fnested-functions
endif
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \

View File

@ -46,6 +46,11 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
endif
endif
ifdef CONFIG_GCC_VERSION_LLVM
$(curdir)/builddirs += llvm
$(curdir)/gcc/prepare += $(curdir)/llvm/install
endif
ifneq ($(ARCH),)
$(TOOLCHAIN_DIR)/info.mk: .config
@for dir in $(TOOLCHAIN_DIR); do ( \

View File

@ -36,6 +36,9 @@ if !LINUX_2_4
config GCC_VERSION_4_4_1
bool "gcc 4.4.1"
config GCC_VERSION_LLVM
bool "llvm-gcc 4.2"
endif
endchoice

View File

@ -7,6 +7,7 @@ config GCC_VERSION
default "4.3.4" if GCC_VERSION_4_3_4
default "4.4.0" if GCC_VERSION_4_4_0
default "4.4.1" if GCC_VERSION_4_4_1
default "llvm" if GCC_VERSION_LLVM
default "4.1.2"
config GCC_VERSION_3
@ -31,6 +32,7 @@ config GCC_VERSION_4_1
config GCC_VERSION_4_2
bool
default y if GCC_VERSION_4_2_4
default y if GCC_VERSION_LLVM
config GCC_VERSION_4_3
bool

View File

@ -22,24 +22,38 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=gcc
PKG_VERSION:=$(call qstrip,$(CONFIG_GCC_VERSION))
GCC_VERSION:=$(PKG_VERSION)
GCC_DIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
ifdef CONFIG_GCC_VERSION_LLVM
PKG_SOURCE_VERSION:=c98c494b72ff875884c0c7286be67f16f9f6d7ab
PKG_REV:=83504
GCC_DIR:=llvm-gcc-4.2-r$(PKG_REV)
GCC_VERSION:=4.2.1
PKG_SOURCE:=$(GCC_DIR).tar.gz
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=git://repo.or.cz/llvm-gcc-4.2.git
PKG_SOURCE_SUBDIR:=$(GCC_DIR)
HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(GCC_DIR)
else
PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
ifeq ($(PKG_VERSION),3.4.6)
ifeq ($(PKG_VERSION),3.4.6)
PKG_MD5SUM:=4a21ac777d4b5617283ce488b808da7b
endif
ifeq ($(PKG_VERSION),4.1.2)
endif
ifeq ($(PKG_VERSION),4.1.2)
PKG_MD5SUM:=a4a3eb15c96030906d8494959eeda23c
endif
ifeq ($(PKG_VERSION),4.2.4)
endif
ifeq ($(PKG_VERSION),4.2.4)
PKG_MD5SUM:=d79f553e7916ea21c556329eacfeaa16
endif
ifeq ($(PKG_VERSION),4.3.3)
endif
ifeq ($(PKG_VERSION),4.3.3)
PKG_MD5SUM:=cc3c5565fdb9ab87a05ddb106ba0bd1f
endif
ifeq ($(PKG_VERSION),4.4.0)
endif
ifeq ($(PKG_VERSION),4.4.0)
PKG_MD5SUM:=cf5d787bee57f38168b74d65a7c0e6fd
endif
endif
PATCH_DIR=./patches/$(PKG_VERSION)
@ -71,6 +85,7 @@ GCC_CONFIGURE:= \
$(SOFT_FLOAT_CONFIG_OPTION) \
$(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
$(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 --with-abi=64) \
$(if $(CONFIG_GCC_VERSION_LLVM),--enable-llvm=$(BUILD_DIR_BASE)/host/llvm)
ifneq ($(CONFIG_GCC_VERSION_4_3)$(CONFIG_GCC_VERSION_4_4),)
GCC_BUILD_TARGET_LIBGCC:=y
@ -130,11 +145,12 @@ GCC_CONFIGURE_STAGE2:= \
GCC_MAKE:= \
export SHELL="$(BASH)"; \
$(MAKE) \
CFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
CXXFLAGS_FOR_TARGET="$(TARGET_CFLAGS)"
define Host/SetToolchainInfo
$(SED) 's,TARGET_CROSS=.*,TARGET_CROSS=$(REAL_GNU_TARGET_NAME)-,' $(TOOLCHAIN_DIR)/info.mk
$(SED) 's,GCC_VERSION=.*,GCC_VERSION=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
$(SED) 's,GCC_VERSION=.*,GCC_VERSION=$(GCC_VERSION),' $(TOOLCHAIN_DIR)/info.mk
endef
@ -175,7 +191,7 @@ define Stage1/Install
$(if $(GCC_BUILD_TARGET_LIBGCC),install-target-libgcc)
# XXX: glibc insists on linking against libgcc_eh
( cd $(TOOLCHAIN_DIR)/usr/lib/gcc/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION) ; \
( cd $(TOOLCHAIN_DIR)/usr/lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION) ; \
[ -e libgcc_eh.a ] || ln -sf libgcc.a libgcc_eh.a ; \
cp libgcc.a libgcc_initial.a; \
)
@ -231,7 +247,7 @@ endef
define Host/Prepare
$(call Host/SetToolchainInfo)
$(call Host/Prepare/Default)
ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
ln -snf $(GCC_DIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
$(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
$(SED) 's,\(version_string.. = "[0-9\.]*\).*\(";\),\1 (OpenWrt-2.0)\2,' $(HOST_BUILD_DIR)/gcc/version.c
$(SED) 's,\(bug_report_url.. = "\).*\(";\),\1<URL:https://dev.openwrt.org/>\2,' $(HOST_BUILD_DIR)/gcc/version.c

View File

@ -0,0 +1,200 @@
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -3893,7 +3893,7 @@ irix5* | irix6*)
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
lt_cv_deplibs_check_method=pass_all
;;
--- a/gcc/config/cris/linux.h
+++ b/gcc/config/cris/linux.h
@@ -74,7 +74,11 @@ Boston, MA 02110-1301, USA. */
#define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
#undef CRIS_SUBTARGET_VERSION
-#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
+#if UCLIBC_DEFAULT
+# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
+#else
+# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
+#endif
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -4283,7 +4283,7 @@ irix5* | irix6*)
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
lt_cv_deplibs_check_method=pass_all
;;
--- a/zlib/configure
+++ b/zlib/configure
@@ -3429,7 +3429,7 @@ irix5* | irix6*)
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
lt_cv_deplibs_check_method=pass_all
;;
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -3314,7 +3314,7 @@ irix5* | irix6*)
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
lt_cv_deplibs_check_method=pass_all
;;
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -3721,7 +3721,7 @@ irix5* | irix6*)
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
lt_cv_deplibs_check_method=pass_all
;;
--- a/libmudflap/configure
+++ b/libmudflap/configure
@@ -5394,7 +5394,7 @@ irix5* | irix6*)
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
lt_cv_deplibs_check_method=pass_all
;;
--- a/boehm-gc/configure
+++ b/boehm-gc/configure
@@ -4323,7 +4323,7 @@ irix5* | irix6*)
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
lt_cv_deplibs_check_method=pass_all
;;
--- a/libffi/configure
+++ b/libffi/configure
@@ -3460,7 +3460,7 @@ irix5* | irix6*)
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
lt_cv_deplibs_check_method=pass_all
;;
--- a/libssp/configure
+++ b/libssp/configure
@@ -4482,7 +4482,7 @@ irix5* | irix6*)
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
lt_cv_deplibs_check_method=pass_all
;;
--- a/contrib/regression/objs-gcc.sh
+++ b/contrib/regression/objs-gcc.sh
@@ -105,6 +105,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
then
make all-gdb all-dejagnu all-ld || exit 1
make install-gdb install-dejagnu install-ld || exit 1
+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
+ then
+ make all-gdb all-dejagnu all-ld || exit 1
+ make install-gdb install-dejagnu install-ld || exit 1
elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
make bootstrap || exit 1
make install || exit 1
--- a/libjava/classpath/ltconfig
+++ b/libjava/classpath/ltconfig
@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
case $host_os in
-linux-gnu*) ;;
+linux-gnu*|linux-uclibc*) ;;
linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac
@@ -1251,7 +1251,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
version_type=linux
need_lib_prefix=no
need_version=no
--- a/libjava/classpath/configure
+++ b/libjava/classpath/configure
@@ -5307,7 +5307,7 @@ irix5* | irix6*)
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
lt_cv_deplibs_check_method=pass_all
;;
--- a/libjava/configure
+++ b/libjava/configure
@@ -5424,7 +5424,7 @@ irix5* | irix6*)
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
lt_cv_deplibs_check_method=pass_all
;;
--- a/libtool.m4
+++ b/libtool.m4
@@ -739,7 +739,7 @@ irix5* | irix6*)
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
lt_cv_deplibs_check_method=pass_all
;;
--- a/ltconfig
+++ b/ltconfig
@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
case $host_os in
-linux-gnu*) ;;
+linux-gnu*|linux-uclibc*) ;;
linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac
@@ -1253,7 +1253,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
version_type=linux
need_lib_prefix=no
need_version=no

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,213 @@
--- a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
+++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
@@ -60,4 +60,49 @@ extern "C" __typeof(wcsxfrm_l) __wcsxfrm
extern "C" __typeof(wctype_l) __wctype_l;
#endif
+# define __nl_langinfo_l nl_langinfo_l
+# define __strcoll_l strcoll_l
+# define __strftime_l strftime_l
+# define __strtod_l strtod_l
+# define __strtof_l strtof_l
+# define __strtold_l strtold_l
+# define __strxfrm_l strxfrm_l
+# define __newlocale newlocale
+# define __freelocale freelocale
+# define __duplocale duplocale
+# define __uselocale uselocale
+
+# ifdef _GLIBCXX_USE_WCHAR_T
+# define __iswctype_l iswctype_l
+# define __towlower_l towlower_l
+# define __towupper_l towupper_l
+# define __wcscoll_l wcscoll_l
+# define __wcsftime_l wcsftime_l
+# define __wcsxfrm_l wcsxfrm_l
+# define __wctype_l wctype_l
+# endif
+
+#else
+# define __nl_langinfo_l(N, L) nl_langinfo((N))
+# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
+# define __strtod_l(S, E, L) strtod((S), (E))
+# define __strtof_l(S, E, L) strtof((S), (E))
+# define __strtold_l(S, E, L) strtold((S), (E))
+# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
+# warning should dummy __newlocale check for C|POSIX ?
+# define __newlocale(a, b, c) NULL
+# define __freelocale(a) ((void)0)
+# define __duplocale(a) __c_locale()
+//# define __uselocale ?
+//
+# ifdef _GLIBCXX_USE_WCHAR_T
+# define __iswctype_l(C, M, L) iswctype((C), (M))
+# define __towlower_l(C, L) towlower((C))
+# define __towupper_l(C, L) towupper((C))
+# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
+//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
+# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
+# define __wctype_l(S, L) wctype((S))
+# endif
+
#endif // GLIBC 2.3 and later
--- a/libstdc++-v3/config/locale/uclibc/c_locale.cc
+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
@@ -39,20 +39,6 @@
#include <langinfo.h>
#include <bits/c++locale_internal.h>
-#ifndef __UCLIBC_HAS_XLOCALE__
-#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
-#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
-#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
-#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
-#define __strtof_l(S, E, L) strtof((S), (E))
-#define __strtod_l(S, E, L) strtod((S), (E))
-#define __strtold_l(S, E, L) strtold((S), (E))
-#warning should dummy __newlocale check for C|POSIX ?
-#define __newlocale(a, b, c) NULL
-#define __freelocale(a) ((void)0)
-#define __duplocale(a) __c_locale()
-#endif
-
namespace std
{
template<>
--- a/libstdc++-v3/config/locale/uclibc/collate_members.cc
+++ b/libstdc++-v3/config/locale/uclibc/collate_members.cc
@@ -36,13 +36,6 @@
#include <locale>
#include <bits/c++locale_internal.h>
-#ifndef __UCLIBC_HAS_XLOCALE__
-#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
-#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
-#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
-#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
-#endif
-
namespace std
{
// These are basically extensions to char_traits, and perhaps should
--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
@@ -43,10 +43,6 @@
#warning tailor for stub locale support
#endif
-#ifndef __UCLIBC_HAS_XLOCALE__
-#define __nl_langinfo_l(N, L) nl_langinfo((N))
-#endif
-
namespace std
{
// Construct and return valid pattern consisting of some combination of:
--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
@@ -41,9 +41,6 @@
#ifdef __UCLIBC_MJN3_ONLY__
#warning tailor for stub locale support
#endif
-#ifndef __UCLIBC_HAS_XLOCALE__
-#define __nl_langinfo_l(N, L) nl_langinfo((N))
-#endif
namespace std
{
--- a/libstdc++-v3/config/locale/uclibc/time_members.cc
+++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
@@ -40,9 +40,6 @@
#ifdef __UCLIBC_MJN3_ONLY__
#warning tailor for stub locale support
#endif
-#ifndef __UCLIBC_HAS_XLOCALE__
-#define __nl_langinfo_l(N, L) nl_langinfo((N))
-#endif
namespace std
{
--- a/libstdc++-v3/config/locale/uclibc/ctype_members.cc
+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
@@ -38,13 +38,6 @@
#undef _LIBC
#include <bits/c++locale_internal.h>
-#ifndef __UCLIBC_HAS_XLOCALE__
-#define __wctype_l(S, L) wctype((S))
-#define __towupper_l(C, L) towupper((C))
-#define __towlower_l(C, L) towlower((C))
-#define __iswctype_l(C, M, L) iswctype((C), (M))
-#endif
-
namespace std
{
// NB: The other ctype<char> specializations are in src/locale.cc and
--- a/libstdc++-v3/config/locale/uclibc/messages_members.cc
+++ b/libstdc++-v3/config/locale/uclibc/messages_members.cc
@@ -39,13 +39,10 @@
#ifdef __UCLIBC_MJN3_ONLY__
#warning fix gettext stuff
#endif
-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
-extern "C" char *__dcgettext(const char *domainname,
- const char *msgid, int category);
#undef gettext
-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
+#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
#else
-#undef gettext
#define gettext(msgid) (msgid)
#endif
--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
@@ -36,15 +36,11 @@
#ifdef __UCLIBC_MJN3_ONLY__
#warning fix prototypes for *textdomain funcs
#endif
-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
-extern "C" char *__textdomain(const char *domainname);
-extern "C" char *__bindtextdomain(const char *domainname,
- const char *dirname);
-#else
-#undef __textdomain
-#undef __bindtextdomain
-#define __textdomain(D) ((void)0)
-#define __bindtextdomain(D,P) ((void)0)
+#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
+#undef textdomain
+#undef bindtextdomain
+#define textdomain(D) ((void)0)
+#define bindtextdomain(D,P) ((void)0)
#endif
// Non-virtual member functions.
@@ -70,7 +66,7 @@ extern "C" char *__bindtextdomain(const
messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
const char* __dir) const
{
- __bindtextdomain(__s.c_str(), __dir);
+ bindtextdomain(__s.c_str(), __dir);
return this->do_open(__s, __loc);
}
@@ -90,7 +86,7 @@ extern "C" char *__bindtextdomain(const
{
// No error checking is done, assume the catalog exists and can
// be used.
- __textdomain(__s.c_str());
+ textdomain(__s.c_str());
return 0;
}
--- a/libstdc++-v3/config/locale/uclibc/c_locale.h
+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
@@ -68,6 +68,7 @@ namespace __gnu_cxx
{
extern "C" __typeof(uselocale) __uselocale;
}
+#define __uselocale uselocale
#endif
namespace std

View File

@ -0,0 +1,48 @@
--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
@@ -401,7 +401,7 @@ namespace std
# ifdef __UCLIBC_HAS_XLOCALE__
_M_data->_M_decimal_point = __cloc->decimal_point_wc;
_M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
-# else
+# elif defined __UCLIBC_HAS_LOCALE__
_M_data->_M_decimal_point = __global_locale->decimal_point_wc;
_M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
# endif
@@ -556,7 +556,7 @@ namespace std
# ifdef __UCLIBC_HAS_XLOCALE__
_M_data->_M_decimal_point = __cloc->decimal_point_wc;
_M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
-# else
+# elif defined __UCLIBC_HAS_LOCALE__
_M_data->_M_decimal_point = __global_locale->decimal_point_wc;
_M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
# endif
--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
@@ -127,12 +127,25 @@ namespace std
{
// Named locale.
// NB: In the GNU model wchar_t is always 32 bit wide.
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning fix this... should be numeric
+#endif
+#ifdef __UCLIBC__
+# ifdef __UCLIBC_HAS_XLOCALE__
+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
+# elif defined __UCLIBC_HAS_LOCALE__
+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
+# endif
+#else
union { char *__s; wchar_t __w; } __u;
__u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
_M_data->_M_decimal_point = __u.__w;
__u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
_M_data->_M_thousands_sep = __u.__w;
+#endif
if (_M_data->_M_thousands_sep == L'\0')
_M_data->_M_grouping = "";

View File

@ -0,0 +1,347 @@
--- a/libstdc++-v3/config/locale/uclibc/c_locale.cc
+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
@@ -46,16 +46,13 @@ namespace std
__convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
const __c_locale& __cloc)
{
- if (!(__err & ios_base::failbit))
- {
- char* __sanity;
- errno = 0;
- float __f = __strtof_l(__s, &__sanity, __cloc);
- if (__sanity != __s && errno != ERANGE)
- __v = __f;
- else
- __err |= ios_base::failbit;
- }
+ char* __sanity;
+ errno = 0;
+ float __f = __strtof_l(__s, &__sanity, __cloc);
+ if (__sanity != __s && errno != ERANGE)
+ __v = __f;
+ else
+ __err |= ios_base::failbit;
}
template<>
@@ -63,16 +60,13 @@ namespace std
__convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
const __c_locale& __cloc)
{
- if (!(__err & ios_base::failbit))
- {
- char* __sanity;
- errno = 0;
- double __d = __strtod_l(__s, &__sanity, __cloc);
- if (__sanity != __s && errno != ERANGE)
- __v = __d;
- else
- __err |= ios_base::failbit;
- }
+ char* __sanity;
+ errno = 0;
+ double __d = __strtod_l(__s, &__sanity, __cloc);
+ if (__sanity != __s && errno != ERANGE)
+ __v = __d;
+ else
+ __err |= ios_base::failbit;
}
template<>
@@ -80,16 +74,13 @@ namespace std
__convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
const __c_locale& __cloc)
{
- if (!(__err & ios_base::failbit))
- {
- char* __sanity;
- errno = 0;
- long double __ld = __strtold_l(__s, &__sanity, __cloc);
- if (__sanity != __s && errno != ERANGE)
- __v = __ld;
- else
- __err |= ios_base::failbit;
- }
+ char* __sanity;
+ errno = 0;
+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
+ if (__sanity != __s && errno != ERANGE)
+ __v = __ld;
+ else
+ __err |= ios_base::failbit;
}
void
@@ -110,7 +101,7 @@ namespace std
void
locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
{
- if (_S_get_c_locale() != __cloc)
+ if (__cloc && _S_get_c_locale() != __cloc)
__freelocale(__cloc);
}
--- a/libstdc++-v3/config/locale/uclibc/ctype_members.cc
+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
@@ -33,9 +33,14 @@
// Written by Benjamin Kosnik <bkoz@redhat.com>
+#include <features.h>
+#ifdef __UCLIBC_HAS_LOCALE__
#define _LIBC
#include <locale>
#undef _LIBC
+#else
+#include <locale>
+#endif
#include <bits/c++locale_internal.h>
namespace std
@@ -138,20 +143,34 @@ namespace std
ctype<wchar_t>::
do_is(mask __m, wchar_t __c) const
{
- // Highest bitmask in ctype_base == 10, but extra in "C"
- // library for blank.
+ // The case of __m == ctype_base::space is particularly important,
+ // due to its use in many istream functions. Therefore we deal with
+ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
+ // is the mask corresponding to ctype_base::space. NB: an encoding
+ // change would not affect correctness!
bool __ret = false;
- const size_t __bitmasksize = 11;
- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
- if (__m & _M_bit[__bitcur]
- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
- {
- __ret = true;
- break;
- }
+ if (__m == _M_bit[5])
+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
+ else
+ {
+ // Highest bitmask in ctype_base == 10, but extra in "C"
+ // library for blank.
+ const size_t __bitmasksize = 11;
+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
+ if (__m & _M_bit[__bitcur])
+ {
+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
+ {
+ __ret = true;
+ break;
+ }
+ else if (__m == _M_bit[__bitcur])
+ break;
+ }
+ }
return __ret;
}
-
+
const wchar_t*
ctype<wchar_t>::
do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
@@ -47,18 +47,21 @@
template<typename _CharT>
messages<_CharT>::messages(size_t __refs)
: facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
- _M_name_messages(_S_get_c_name())
+ _M_name_messages(_S_get_c_name())
{ }
template<typename _CharT>
messages<_CharT>::messages(__c_locale __cloc, const char* __s,
size_t __refs)
- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
- _M_name_messages(__s)
+ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL)
{
- char* __tmp = new char[std::strlen(__s) + 1];
- std::strcpy(__tmp, __s);
+ const size_t __len = std::strlen(__s) + 1;
+ char* __tmp = new char[__len];
+ std::memcpy(__tmp, __s, __len);
_M_name_messages = __tmp;
+
+ // Last to avoid leaking memory if new throws.
+ _M_c_locale_messages = _S_clone_c_locale(__cloc);
}
template<typename _CharT>
--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
@@ -33,9 +33,14 @@
// Written by Benjamin Kosnik <bkoz@redhat.com>
+#include <features.h>
+#ifdef __UCLIBC_HAS_LOCALE__
#define _LIBC
#include <locale>
#undef _LIBC
+#else
+#include <locale>
+#endif
#include <bits/c++locale_internal.h>
#ifdef __UCLIBC_MJN3_ONLY__
@@ -206,7 +211,7 @@ namespace std
}
break;
default:
- ;
+ __ret = pattern();
}
return __ret;
}
--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
@@ -33,9 +33,14 @@
// Written by Benjamin Kosnik <bkoz@redhat.com>
+#include <features.h>
+#ifdef __UCLIBC_HAS_LOCALE__
#define _LIBC
#include <locale>
#undef _LIBC
+#else
+#include <locale>
+#endif
#include <bits/c++locale_internal.h>
#ifdef __UCLIBC_MJN3_ONLY__
--- a/libstdc++-v3/config/locale/uclibc/time_members.h
+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
@@ -37,25 +37,33 @@
template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs)
: facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
- _M_name_timepunct(_S_get_c_name())
+ _M_name_timepunct(_S_get_c_name())
{ _M_initialize_timepunct(); }
template<typename _CharT>
__timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
: facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
- _M_name_timepunct(_S_get_c_name())
+ _M_name_timepunct(_S_get_c_name())
{ _M_initialize_timepunct(); }
template<typename _CharT>
__timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
size_t __refs)
: facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
- _M_name_timepunct(__s)
+ _M_name_timepunct(NULL)
{
- char* __tmp = new char[std::strlen(__s) + 1];
- std::strcpy(__tmp, __s);
+ const size_t __len = std::strlen(__s) + 1;
+ char* __tmp = new char[__len];
+ std::memcpy(__tmp, __s, __len);
_M_name_timepunct = __tmp;
- _M_initialize_timepunct(__cloc);
+
+ try
+ { _M_initialize_timepunct(__cloc); }
+ catch(...)
+ {
+ delete [] _M_name_timepunct;
+ __throw_exception_again;
+ }
}
template<typename _CharT>
--- a/libstdc++-v3/config/locale/uclibc/c_locale.h
+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
@@ -39,21 +39,23 @@
#pragma GCC system_header
#include <cstring> // get std::strlen
-#include <cstdio> // get std::snprintf or std::sprintf
+#include <cstdio> // get std::vsnprintf or std::vsprintf
#include <clocale>
#include <langinfo.h> // For codecvt
#ifdef __UCLIBC_MJN3_ONLY__
#warning fix this
#endif
-#ifdef __UCLIBC_HAS_LOCALE__
+#ifdef _GLIBCXX_USE_ICONV
#include <iconv.h> // For codecvt using iconv, iconv_t
#endif
-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
-#include <libintl.h> // For messages
+#ifdef HAVE_LIBINTL_H
+#include <libintl.h> // For messages
#endif
+#include <cstdarg>
#ifdef __UCLIBC_MJN3_ONLY__
#warning what is _GLIBCXX_C_LOCALE_GNU for
+// psm: used in os/gnu-linux/ctype_noninline.h
#endif
#define _GLIBCXX_C_LOCALE_GNU 1
@@ -62,7 +64,7 @@
#endif
// #define _GLIBCXX_NUM_CATEGORIES 6
#define _GLIBCXX_NUM_CATEGORIES 0
-
+
#ifdef __UCLIBC_HAS_XLOCALE__
namespace __gnu_cxx
{
@@ -79,22 +81,24 @@ namespace std
typedef int* __c_locale;
#endif
- // Convert numeric value of type _Tv to string and return length of
- // string. If snprintf is available use it, otherwise fall back to
- // the unsafe sprintf which, in general, can be dangerous and should
+ // Convert numeric value of type double to string and return length of
+ // string. If vsnprintf is available use it, otherwise fall back to
+ // the unsafe vsprintf which, in general, can be dangerous and should
// be avoided.
- template<typename _Tv>
- int
- __convert_from_v(char* __out,
- const int __size __attribute__ ((__unused__)),
- const char* __fmt,
-#ifdef __UCLIBC_HAS_XCLOCALE__
- _Tv __v, const __c_locale& __cloc, int __prec)
+ inline int
+ __convert_from_v(const __c_locale&
+#ifndef __UCLIBC_HAS_XCLOCALE__
+ __cloc __attribute__ ((__unused__))
+#endif
+ ,
+ char* __out,
+ const int __size,
+ const char* __fmt, ...)
{
+ va_list __args;
+#ifdef __UCLIBC_HAS_XCLOCALE__
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
#else
- _Tv __v, const __c_locale&, int __prec)
- {
# ifdef __UCLIBC_HAS_LOCALE__
char* __old = std::setlocale(LC_ALL, NULL);
char* __sav = new char[std::strlen(__old) + 1];
@@ -103,7 +107,9 @@ namespace std
# endif
#endif
- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
+ va_start(__args, __fmt);
+ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
+ va_end(__args);
#ifdef __UCLIBC_HAS_XCLOCALE__
__gnu_cxx::__uselocale(__old);

View File

@ -0,0 +1,50 @@
# DP: Build and install libstdc++_pic.a library.
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -257,6 +257,12 @@ CXXLINK = $(LIBTOOL) --tag CXX --mode=li
$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
+install-exec-local:
+ifeq ($(enable_shared),yes)
+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o
+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
+endif
+
# Added bits to build debug library.
if GLIBCXX_BUILD_DEBUG
all-local: build_debug
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -657,7 +657,7 @@ info-am:
install-data-am: install-data-local
-install-exec-am: install-toolexeclibLTLIBRARIES
+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
install-info: install-info-am
@@ -690,6 +690,7 @@ uninstall-am: uninstall-info-am uninstal
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-data-local install-exec \
+ install-exec-local \
install-exec-am install-info install-info-am install-man \
install-strip install-toolexeclibLTLIBRARIES installcheck \
installcheck-am installdirs maintainer-clean \
@@ -799,6 +800,13 @@ build_debug: stamp-debug
install_debug:
(cd ${debugdir} && $(MAKE) \
toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
+
+install-exec-local:
+ifeq ($(enable_shared),yes)
+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o
+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
+endif
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,11 @@
--- a/boehm-gc/include/gc.h
+++ b/boehm-gc/include/gc.h
@@ -502,7 +502,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_of
#if defined(__linux__) || defined(__GLIBC__)
# include <features.h>
# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
- && !defined(__ia64__)
+ && !defined(__ia64__) && !defined(__UCLIBC__)
# ifndef GC_HAVE_BUILTIN_BACKTRACE
# define GC_HAVE_BUILTIN_BACKTRACE
# endif

View File

@ -0,0 +1,11 @@
--- a/libstdc++-v3/include/c_std/std_cstdio.h
+++ b/libstdc++-v3/include/c_std/std_cstdio.h
@@ -144,7 +144,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_END_NAMESPACE
-#if _GLIBCXX_USE_C99
+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
#undef snprintf
#undef vfscanf

View File

@ -0,0 +1,12 @@
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -7516,6 +7516,9 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <complex.h>
+#ifdef __UCLIBC__
+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
+#endif
int
main ()
{

View File

@ -0,0 +1,24 @@
--- a/libstdc++-v3/include/ext/rope
+++ b/libstdc++-v3/include/ext/rope
@@ -58,6 +58,9 @@
#include <bits/allocator.h>
#include <ext/hash_fun.h>
+/* cope w/ index defined as macro, SuSv3 proposal */
+#undef index
+
# ifdef __GC
# define __GC_CONST const
# else
--- a/libstdc++-v3/include/ext/ropeimpl.h
+++ b/libstdc++-v3/include/ext/ropeimpl.h
@@ -54,6 +54,9 @@
#include <ext/memory> // For uninitialized_copy_n
#include <ext/numeric> // For power
+/* cope w/ index defined as macro, SuSv3 proposal */
+#undef index
+
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
using std::size_t;

View File

@ -0,0 +1,47 @@
--- a/libmudflap/mf-hooks2.c
+++ b/libmudflap/mf-hooks2.c
@@ -427,7 +427,7 @@ WRAPPER2(void, bzero, void *s, size_t n)
{
TRACE ("%s\n", __PRETTY_FUNCTION__);
MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
- bzero (s, n);
+ memset (s, 0, n);
}
@@ -437,7 +437,7 @@ WRAPPER2(void, bcopy, const void *src, v
TRACE ("%s\n", __PRETTY_FUNCTION__);
MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
- bcopy (src, dest, n);
+ memmove (dest, src, n);
}
@@ -447,7 +447,7 @@ WRAPPER2(int, bcmp, const void *s1, cons
TRACE ("%s\n", __PRETTY_FUNCTION__);
MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
- return bcmp (s1, s2, n);
+ return n == 0 ? 0 : memcmp (s1, s2, n);
}
@@ -456,7 +456,7 @@ WRAPPER2(char *, index, const char *s, i
size_t n = strlen (s);
TRACE ("%s\n", __PRETTY_FUNCTION__);
MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
- return index (s, c);
+ return strchr (s, c);
}
@@ -465,7 +465,7 @@ WRAPPER2(char *, rindex, const char *s,
size_t n = strlen (s);
TRACE ("%s\n", __PRETTY_FUNCTION__);
MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
- return rindex (s, c);
+ return strrchr (s, c);
}
/* XXX: stpcpy, memccpy */

View File

@ -0,0 +1,34 @@
--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
@@ -32,7 +32,8 @@
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
-
+namespace std
+{
#ifdef __UCLIBC_MJN3_ONLY__
#warning fix prototypes for *textdomain funcs
#endif
@@ -115,3 +116,4 @@
this->_S_create_c_locale(this->_M_c_locale_messages, __s);
}
}
+}
--- a/libstdc++-v3/config/locale/uclibc/time_members.h
+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
@@ -33,7 +33,8 @@
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
-
+namespace std
+{
template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs)
: facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
@@ -74,3 +75,4 @@
delete _M_data;
_S_destroy_c_locale(_M_c_locale_timepunct);
}
+}

View File

@ -0,0 +1,26 @@
This patch fixes a bug into ostream::operator<<(double) due to the wrong size
passed into the __convert_from_v method. The wrong size is then passed to
std::snprintf function, that, on uClibc, doens't handle sized 0 buffer.
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -1149,7 +1149,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
const int __cs_size = __fixed ? __max_exp + __prec + 4
: __max_digits * 2 + __prec;
char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
- __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf,
+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, __fbuf,
__prec, __v);
#endif
@@ -1789,7 +1789,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
// max_exponent10 + 1 for the integer part, + 2 for sign and '\0'.
const int __cs_size = numeric_limits<long double>::max_exponent10 + 3;
char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
- int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, "%.*Lf",
+ int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, "%.*Lf",
0, __units);
#endif
string_type __digits(__len, char_type());

View File

@ -0,0 +1,11 @@
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3001,7 +3001,7 @@ ifeq ($(LLVMOBJDIR),)
# LLVM LOCAL
libbackend.o : $(OBJS-common:.o=.c) $(out_file) $(out_cxx_file) \
insn-config.h insn-flags.h insn-codes.h insn-constants.h \
- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE)
+ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
-DTARGET_NAME=\"$(target_noncanonical)\" \
-DLOCALEDIR=\"$(localedir)\" \

View File

@ -0,0 +1,67 @@
By Lennert Buytenhek <buytenh@wantstofly.org>
Adds support for arm*b-linux* big-endian ARM targets
See http://gcc.gnu.org/PR16350
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -28,19 +28,33 @@
#undef TARGET_VERSION
#define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
+/*
+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
+ * (big endian) configurations.
+ */
+#if TARGET_BIG_ENDIAN_DEFAULT
+#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
+#define TARGET_ENDIAN_OPTION "mbig-endian"
+#define TARGET_LINKER_EMULATION "armelfb_linux"
+#else
+#define TARGET_ENDIAN_DEFAULT 0
+#define TARGET_ENDIAN_OPTION "mlittle-endian"
+#define TARGET_LINKER_EMULATION "armelf_linux"
+#endif
+
#undef TARGET_DEFAULT_FLOAT_ABI
#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (0)
+#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
#undef MULTILIB_DEFAULTS
#define MULTILIB_DEFAULTS \
- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
/* Now we define the strings used to build the spec file. */
#undef LIB_SPEC
@@ -61,7 +75,7 @@
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "} \
-X \
- %{mbig-endian:-EB}" \
+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
SUBTARGET_EXTRA_LINK_SPEC
#undef LINK_SPEC
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -764,6 +764,11 @@ arm*-*-linux*) # ARM GNU/Linux with EL
tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
tmake_file="${tmake_file} t-linux arm/t-arm"
case ${target} in
+ arm*b-*)
+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+ ;;
+ esac
+ case ${target} in
arm*-*-linux-*eabi)
tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"

View File

@ -0,0 +1,72 @@
Hi,
The attached patch makes sure that we create smaller object code for
simple switch statements. We just make sure to flatten the switch
statement into an if-else chain, basically.
This fixes a size-regression as compared to gcc-3.4, as can be seen
below.
2007-04-15 Bernhard Fischer <..>
* stmt.c (expand_case): Do not create a complex binary tree when
optimizing for size but rather use the simple ordered list.
(emit_case_nodes): do not emit jumps to the default_label when
optimizing for size.
Not regtested so far.
Comments?
Attached is the test switch.c mentioned below.
$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do
gcc-$i -DCHAIN -Os -o switch-CHAIN-$i.o -c switch.c ;done
$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do
gcc-$i -UCHAIN -Os -o switch-$i.o -c switch.c ;done
$ size switch-*.o
text data bss dec hex filename
169 0 0 169 a9 switch-2.95.o
115 0 0 115 73 switch-3.3.o
103 0 0 103 67 switch-3.4.o
124 0 0 124 7c switch-4.0.o
124 0 0 124 7c switch-4.1.o
124 0 0 124 7c switch-4.2.orig-HEAD.o
95 0 0 95 5f switch-4.3-HEAD.o
124 0 0 124 7c switch-4.3.orig-HEAD.o
166 0 0 166 a6 switch-CHAIN-2.95.o
111 0 0 111 6f switch-CHAIN-3.3.o
95 0 0 95 5f switch-CHAIN-3.4.o
95 0 0 95 5f switch-CHAIN-4.0.o
95 0 0 95 5f switch-CHAIN-4.1.o
95 0 0 95 5f switch-CHAIN-4.2.orig-HEAD.o
95 0 0 95 5f switch-CHAIN-4.3-HEAD.o
95 0 0 95 5f switch-CHAIN-4.3.orig-HEAD.o
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="gcc-4.3.gcc-flatten-switch-stmt.00.diff"
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -2574,7 +2574,11 @@ expand_case (tree exp)
use_cost_table
= (TREE_CODE (orig_type) != ENUMERAL_TYPE
&& estimate_case_costs (case_list));
- balance_case_nodes (&case_list, NULL);
+ /* When optimizing for size, we want a straight list to avoid
+ jumps as much as possible. This basically creates an if-else
+ chain. */
+ if (!optimize_size)
+ balance_case_nodes (&case_list, NULL);
emit_case_nodes (index, case_list, default_label, index_type);
emit_jump (default_label);
}
@@ -3136,6 +3140,7 @@ emit_case_nodes (rtx index, case_node_pt
{
if (!node_has_low_bound (node, index_type))
{
+ if (!optimize_size) /* don't jl to the .default_label. */
emit_cmp_and_jump_insns (index,
convert_modes
(mode, imode,

View File

@ -0,0 +1,278 @@
This patch brings over a few features 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.
* -Werror-maybe-reset
Has the effect of -Wno-error if GCC_NO_WERROR is
set and not '0', a no-operation otherwise. This is
to be able to use -Werror in "make" but prevent
GNU autoconf generated configure scripts from
freaking out.
* Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
the default for -O2/-Os, because they trigger gcc bugs
and can delete code with security implications.
This patch was authored by Thorsten Glaser <tg@mirbsd.de>
with copyright assignment to the FSF in effect.
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -109,6 +109,9 @@ static size_t deferred_count;
/* Number of deferred options scanned for -include. */
static size_t include_cursor;
+/* Check if a port honours COPTS. */
+static int honour_copts = 0;
+
static void set_Wimplicit (int);
static void handle_OPT_d (const char *);
static void set_std_cxx98 (int);
@@ -502,6 +505,14 @@ c_common_handle_option (size_t scode, co
mesg_implicit_function_declaration = 2;
break;
+ case OPT_Werror_maybe_reset:
+ {
+ char *ev = getenv ("GCC_NO_WERROR");
+ if ((ev != NULL) && (*ev != '0'))
+ cpp_opts->warnings_are_errors = 0;
+ }
+ break;
+
case OPT_Wformat:
set_Wformat (value);
break;
@@ -778,6 +789,12 @@ c_common_handle_option (size_t scode, co
flag_exceptions = value;
break;
+ case OPT_fhonour_copts:
+ if (c_language == clk_c) {
+ honour_copts++;
+ }
+ break;
+
case OPT_fimplement_inlines:
flag_implement_inlines = value;
break;
@@ -1295,6 +1312,47 @@ c_common_init (void)
/* Has to wait until now so that cpplib has its hash table. */
init_pragma ();
+ 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 ("someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ }
+ }
+
return true;
}
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -220,6 +220,10 @@ C ObjC C++ ObjC++
Warn about extra tokens at the end of prepreprocessor directives
; APPLE LOCAL end -Wextra-tokens
+Werror-maybe-reset
+C ObjC C++ ObjC++
+; Documented in common.opt
+
Wfloat-equal
C ObjC C++ ObjC++ Var(warn_float_equal)
Warn if testing floating point numbers for equality
@@ -675,6 +679,9 @@ C++ ObjC++
fhonor-std
C++ ObjC++
+fhonour-copts
+C ObjC C++ ObjC++ RejectNegative
+
fhosted
C ObjC
Assume normal C execution environment
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -81,6 +81,10 @@ Werror=
Common Joined
Treat specified warning as error
+Werror-maybe-reset
+Common
+If environment variable GCC_NO_WERROR is set, act as -Wno-error
+
Wextra
Common
Print extra (possibly unwanted) warnings
@@ -607,6 +611,9 @@ Common Report Var(flag_guess_branch_prob
Enable guessing of branch probabilities
; APPLE LOCAL end optimization pragmas 3124235/3420242
+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/opts.c
+++ b/gcc/opts.c
@@ -507,9 +507,6 @@ void set_flags_from_O (unsigned int cmdl
#endif
flag_regmove = 1;
/* APPLE LOCAL optimization pragmas 3124235/3420242 */
- if (cmdline) flag_strict_aliasing = 1;
- flag_strict_overflow = 1;
- flag_delete_null_pointer_checks = 1;
flag_reorder_blocks = 1;
/* APPLE LOCAL optimization pragmas 3124235/3420242 */
if (cmdline) flag_reorder_functions = 1;
@@ -536,6 +533,9 @@ void set_flags_from_O (unsigned int cmdl
if (optimize >= 3)
{
+ if (cmdline) flag_strict_aliasing = 1;
+ flag_strict_overflow = 1;
+ flag_delete_null_pointer_checks = 1;
if (cmdline)
flag_inline_functions = 1;
flag_unswitch_loops = 1;
@@ -873,6 +873,17 @@ common_handle_option (size_t scode, cons
}
break;
+ case OPT_Werror_maybe_reset:
+ {
+ char *ev = getenv ("GCC_NO_WERROR");
+ if ((ev != NULL) && (*ev != '0'))
+ warnings_are_errors = 0;
+ }
+ break;
+
+ case OPT_fhonour_copts:
+ break;
+
case OPT_Wextra:
set_Wextra (value);
break;
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
@@ -166,6 +166,11 @@ in older programs. This warning is on b
Make all warnings into hard errors. Source code which triggers warnings
will be rejected.
+@item -Werror-maybe-reset
+@opindex Werror-maybe-reset
+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
+variable is set to anything other than 0 or empty.
+
@item -Wsystem-headers
@opindex Wsystem-headers
Issue warnings for code in system headers. These are normally unhelpful
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -282,7 +282,7 @@ Objective-C and Objective-C++ Dialects}.
-Wc++-compat -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol
-Wconversion -Wno-deprecated-declarations @gol
-Wdisabled-optimization -Wno-div-by-zero -Wno-endif-labels @gol
--Werror -Werror=* -Werror-implicit-function-declaration @gol
+-Werror -Werror-maybe-reset -Werror=* -Werror-implicit-function-declaration @gol
@c APPLE LOCAL default to Wformat-security 5764921
-Wfatal-errors -Wfloat-equal -Wno-format -Wformat=2 @gol
-Wno-format-extra-args -Wformat-nonliteral @gol
@@ -4031,6 +4031,22 @@ Note that specifying @option{-Werror=}@v
@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
imply anything.
+@item -Werror-maybe-reset
+@opindex Werror-maybe-reset
+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
+variable is set to anything other than 0 or empty.
+
+@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
This option is only active when @option{-fstack-protector} is active. It
@@ -5533,7 +5549,7 @@ second branch or a point immediately fol
the condition is known to be true or false.
@c APPLE LOCAL 4231761 -Oz
-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, @option{-Oz} (APPLE ONLY).
+Enabled at levels @option{-O3}, @option{-Oz} (APPLE ONLY).
@item -fcse-follow-jumps
@opindex fcse-follow-jumps
@@ -5659,7 +5675,7 @@ safely dereference null pointers. Use
for programs which depend on that behavior.
@c APPLE LOCAL 4231761 -Oz
-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, @option{-Oz} (APPLE ONLY).
+Enabled at levels @option{-O3}, @option{-Oz} (APPLE ONLY).
@item -fexpensive-optimizations
@opindex fexpensive-optimizations
@@ -6103,7 +6119,7 @@ allowed to alias. For an example, see t
@code{c_get_alias_set}.
@c APPLE LOCAL 4231761 -Oz
-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, @option{-Oz} (APPLE ONLY).
+Enabled at levels @option{-O3}, @option{-Oz} (APPLE ONLY).
@item -fstrict-overflow
@opindex fstrict-overflow
--- a/gcc/java/jvspec.c
+++ b/gcc/java/jvspec.c
@@ -632,6 +632,7 @@ lang_specific_pre_link (void)
class name. Append dummy `.c' that can be stripped by set_input so %b
is correct. */
set_input (concat (main_class_name, "main.c", NULL));
+ putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
err = do_spec (jvgenmain_spec);
if (err == 0)
{

View File

@ -0,0 +1,25 @@
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -63,7 +63,7 @@
%{shared:-lc} \
%{!shared:%{profile:-lc_p}%{!profile:-lc}}"
-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
+#define LIBGCC_SPEC "-lgcc"
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
--- a/gcc/config/arm/t-linux
+++ b/gcc/config/arm/t-linux
@@ -4,7 +4,10 @@ TARGET_LIBGCC2_CFLAGS = -fomit-frame-poi
LIBGCC2_DEBUG_CFLAGS = -g0
LIB1ASMSRC = arm/lib1funcs.asm
-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
+ _fixsfsi _fixunssfsi _floatdidf _floatundidf _floatdisf _floatundisf
# MULTILIB_OPTIONS = mhard-float/msoft-float
# MULTILIB_DIRNAMES = hard-float soft-float

View File

@ -0,0 +1,22 @@
http://bugs.uclibc.org/view.php?id=1588
--- a/gcc/config/rs6000/darwin-ldouble.c
+++ b/gcc/config/rs6000/darwin-ldouble.c
@@ -70,6 +70,8 @@ Software Foundation, 51 Franklin Street,
but GCC currently generates poor code when a union is used to turn
a long double into a pair of doubles. */
+#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__)
+
long double __gcc_qadd (double, double, double, double);
long double __gcc_qsub (double, double, double, double);
long double __gcc_qmul (double, double, double, double);
@@ -219,8 +221,6 @@ __gcc_qdiv (double a, double b, double c
return z.ldval;
}
-#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__)
-
long double __gcc_qneg (double, double);
int __gcc_qeq (double, double, double, double);
int __gcc_qne (double, double, double, double);

View File

@ -0,0 +1,32 @@
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -760,7 +760,7 @@ arm*-*-netbsd*)
extra_parts=""
use_collect2=yes
;;
-arm*-*-linux*) # ARM GNU/Linux with ELF
+arm*-linux*) # ARM GNU/Linux with ELF
tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
tmake_file="${tmake_file} t-linux arm/t-arm"
case ${target} in
@@ -769,7 +769,7 @@ arm*-*-linux*) # ARM GNU/Linux with EL
;;
esac
case ${target} in
- arm*-*-linux-*eabi)
+ arm*-linux-*eabi)
tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
# The BPABI long long divmod functions return a 128-bit value in
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -48,7 +48,8 @@
#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
#undef SUBTARGET_EXTRA_LINK_SPEC
-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi"
+#define SUBTARGET_EXTRA_LINK_SPEC \
+ " %{mbig-endian:-m armelfb_linux_eabi} %{mlittle-endian:-m armelf_linux_eabi} "
/* Use ld-linux.so.3 so that it will be possible to run "classic"
GNU/Linux binaries on an EABI system. */

View File

@ -0,0 +1,76 @@
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37014
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -307,8 +307,6 @@ do_jump (tree exp, rtx if_false_label, r
break;
}
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
case COMPOUND_EXPR:
/* Lowered by gimplify.c. */
gcc_unreachable ();
@@ -518,6 +516,7 @@ do_jump (tree exp, rtx if_false_label, r
if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
goto normal;
+ case TRUTH_ANDIF_EXPR:
if (if_false_label == NULL_RTX)
{
drop_through_label = gen_label_rtx ();
@@ -538,6 +537,7 @@ do_jump (tree exp, rtx if_false_label, r
if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
goto normal;
+ case TRUTH_ORIF_EXPR:
if (if_true_label == NULL_RTX)
{
drop_through_label = gen_label_rtx ();
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -8634,7 +8634,10 @@ expand_expr_real_1 (tree exp, rtx target
/* If no set-flag instruction, must generate a conditional store
into a temporary variable. Drop through and handle this
like && and ||. */
-
+ /* Although TRUTH_{AND,OR}IF_EXPR aren't present in GIMPLE, they
+ are occassionally created by folding during expansion. */
+ case TRUTH_ANDIF_EXPR:
+ case TRUTH_ORIF_EXPR:
if (! ignore
&& (target == 0
|| modifier == EXPAND_STACK_PARM
@@ -8832,8 +8835,6 @@ expand_expr_real_1 (tree exp, rtx target
case POSTDECREMENT_EXPR:
case LOOP_EXPR:
case EXIT_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
/* Lowered by gimplify.c. */
gcc_unreachable ();
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20080812-1.c
@@ -0,0 +1,21 @@
+/* PR middle-end/37014 */
+
+void bar (signed char *);
+
+void
+foo (int x, int y)
+{
+ int i;
+ signed char a[123], b[123], c;
+ for (i = 0; i < 123; i++)
+ {
+ int e = y - x;
+ int d = e < 0 ? -e : e;
+ c = d < 75;
+ a[y] = c;
+ b[y] = c;
+ y--;
+ }
+ bar (b);
+ bar (a);
+}

View File

@ -0,0 +1,49 @@
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34762
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -4817,7 +4817,7 @@ find_reloads_address (enum machine_mode
find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0),
&XEXP (tem, 0), opnum,
ADDR_TYPE (type), ind_levels, insn);
- if (tem != orig)
+ if (!rtx_equal_p (tem, orig))
push_reg_equiv_alt_mem (regno, tem);
}
/* We can avoid a reload if the register's equivalent memory
@@ -5617,7 +5617,7 @@ find_reloads_address_1 (enum machine_mod
RELOAD_OTHER,
ind_levels, insn);
- if (tem != orig)
+ if (!rtx_equal_p (tem, orig))
push_reg_equiv_alt_mem (regno, tem);
/* Then reload the memory location into a base
@@ -5684,7 +5684,7 @@ find_reloads_address_1 (enum machine_mod
find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0),
&XEXP (tem, 0), opnum, type,
ind_levels, insn);
- if (tem != orig)
+ if (!rtx_equal_p (tem, orig))
push_reg_equiv_alt_mem (regno, tem);
/* Put this inside a new increment-expression. */
x = gen_rtx_fmt_e (GET_CODE (x), GET_MODE (x), tem);
@@ -5876,7 +5876,7 @@ find_reloads_address_1 (enum machine_mod
find_reloads_address (GET_MODE (x), &x, XEXP (x, 0),
&XEXP (x, 0), opnum, ADDR_TYPE (type),
ind_levels, insn);
- if (x != tem)
+ if (!rtx_equal_p (x, tem))
push_reg_equiv_alt_mem (regno, x);
}
}
@@ -6104,7 +6104,7 @@ find_reloads_subreg_address (rtx x, int
XEXP (tem, 0), &XEXP (tem, 0),
opnum, type, ind_levels, insn);
/* ??? Do we need to handle nonzero offsets somehow? */
- if (!offset && tem != orig)
+ if (!offset && !rtx_equal_p (tem, orig))
push_reg_equiv_alt_mem (regno, tem);
/* For some processors an address may be valid in the

View File

@ -0,0 +1,28 @@
--- a/configure
+++ b/configure
@@ -1833,11 +1833,6 @@ case "${host}" in
# APPLE LOCAL begin dynamic-no-pic
i[3456789]86-*-darwin*)
host_makefile_frag="config/mh-x86-darwin"
- # gcc can default to x86_64 code generation, avoid that
- if test "${build}" = "${host}"; then
- CC="${CC-gcc} -m32"
- CXX="${CXX-g++} -m32"
- fi
;;
# APPLE LOCAL end dynamic-no-pic
powerpc-*-aix*)
--- a/configure.in
+++ b/configure.in
@@ -993,11 +993,6 @@ case "${host}" in
# APPLE LOCAL begin dynamic-no-pic
i[[3456789]]86-*-darwin*)
host_makefile_frag="config/mh-x86-darwin"
- # gcc can default to x86_64 code generation, avoid that
- if test "${build}" = "${host}"; then
- CC="${CC-gcc} -m32"
- CXX="${CXX-g++} -m32"
- fi
;;
# APPLE LOCAL end dynamic-no-pic
powerpc-*-aix*)

View File

@ -0,0 +1,16 @@
--- a/gcc/config/mips/llvm-mips-target.h
+++ b/gcc/config/mips/llvm-mips-target.h
@@ -27,11 +27,11 @@ extern bool llvm_mips_should_pass_aggreg
#define LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X, TY) \
llvm_mips_should_pass_aggregate_in_memory(X, TY)
+#endif /* LLVM_ABI_H */
+
/* LLVM_TARGET_NAME - This specifies the name of the target, which correlates to
* the llvm::InitializeXXXTarget() function.
*/
#define LLVM_TARGET_NAME Mips
-#endif /* LLVM_ABI_H */
-
/* LLVM LOCAL end (ENTIRE FILE!) */

44
toolchain/llvm/Makefile Normal file
View File

@ -0,0 +1,44 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=llvm
PKG_VERSION:=r83568
PKG_SOURCE_VERSION:=5687d8a26c08d089c60df2c92d048ab85bcdb2b9
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=git://repo.or.cz/llvm.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
BUILD_DIR_TOOLCHAIN:=$(BUILD_DIR_HOST)
include $(INCLUDE_DIR)/toolchain-build.mk
ifeq ($(HOST_OS),Darwin)
DARWIN_VERSION=$(shell sw_vers -productVersion)
DARWIN_MAJVERS=$(firstword $(subst ., ,$(DARWIN_VERSION)))
HOST_MAKE_FLAGS += \
DARWIN_VERSION=$(DARWIN_VERSION) \
DARWIN_MAJVERS=$(DARWIN_MAJVERS)
endif
HOST_CONFIGURE_ARGS += \
--enable-optimized --enable-assertions
define Host/Compile
@-$(MAKE) -C $(HOST_BUILD_DIR) $(HOST_MAKE_FLAGS) uninstall
$(MAKE) -C $(HOST_BUILD_DIR) $(HOST_MAKE_FLAGS)
endef
define Host/Install
rm -f $(BUILD_DIR_HOST)/llvm
ln -s llvm-$(PKG_VERSION) $(BUILD_DIR_HOST)/llvm
$(MAKE) -C $(HOST_BUILD_DIR) $(HOST_MAKE_FLAGS) install
endef
$(eval $(call HostBuild))

View File

@ -0,0 +1,19 @@
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -618,16 +618,6 @@ ifdef UNIVERSAL
# Building universal cannot compute dependencies automatically.
DISABLE_AUTO_DEPENDENCIES=1
-else
- ifeq ($(TARGET_OS),Darwin)
- ifeq ($(ARCH),x86_64)
- TargetCommonOpts = -m64
- else
- ifeq ($(ARCH),x86)
- TargetCommonOpts = -m32
- endif
- endif
- endif
endif
ifeq ($(HOST_OS),SunOS)

View File

@ -0,0 +1,16 @@
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -506,11 +506,13 @@ endif
#--------------------------------------------------------------------
ifeq ($(HOST_OS),Darwin)
+ ifndef DARWIN_VERSION
DARWIN_VERSION := `sw_vers -productVersion`
# Strip a number like 10.4.7 to 10.4
DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
# Get "4" out of 10.4 for later pieces in the makefile.
DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
+ endif
SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress \
-dynamiclib

View File

@ -0,0 +1,11 @@
--- a/libc/stdio/_stdio.c
+++ b/libc/stdio/_stdio.c
@@ -121,7 +121,7 @@ static FILE _stdio_streams[] = {
__FLAG_NBF|__FLAG_WRITEONLY, \
2, \
NULL, \
- NULL, \
+ 0, \
0 )
};