aboutsummaryrefslogtreecommitdiff
path: root/meta-aarch64
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <marcin.juszkiewicz@linaro.org>2013-03-13 14:48:36 +0100
committerMarcin Juszkiewicz <marcin.juszkiewicz@linaro.org>2013-03-13 14:48:36 +0100
commit6b59c31786601954bea74dab202bd7c11c145c73 (patch)
treee12b7456e39c21e6e0c63d931cf2b6dd8f465c24 /meta-aarch64
parent1a6882cd52df06a592e5aba7d2347f1d5f71e727 (diff)
downloadmeta-linaro-6b59c31786601954bea74dab202bd7c11c145c73.tar.gz
move to meta-aarch64/ as preparation to merge into meta-linaro repo
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Diffstat (limited to 'meta-aarch64')
-rw-r--r--meta-aarch64/conf/layer.conf14
-rw-r--r--meta-aarch64/conf/machine/genericarmv8.conf37
-rw-r--r--meta-aarch64/conf/machine/include/arm64/arch-armv8.inc22
-rw-r--r--meta-aarch64/recipes-core/netbase/files/genericarmv8/interfaces34
-rw-r--r--meta-aarch64/recipes-core/netbase/netbase_5.0.bbappend3
-rw-r--r--meta-aarch64/recipes-core/packagegroups/packagegroup-core-sdk.bbappend16
-rw-r--r--meta-aarch64/recipes-devtools/binutils/binutils-cross-canadian.inc22
-rw-r--r--meta-aarch64/recipes-devtools/binutils/binutils-cross-canadian_git.bb3
-rw-r--r--meta-aarch64/recipes-devtools/binutils/binutils-cross.inc27
-rw-r--r--meta-aarch64/recipes-devtools/binutils/binutils-cross_git.bb3
-rw-r--r--meta-aarch64/recipes-devtools/binutils/binutils-crosssdk_git.bb14
-rw-r--r--meta-aarch64/recipes-devtools/binutils/binutils-git.inc26
-rw-r--r--meta-aarch64/recipes-devtools/binutils/binutils.inc136
-rw-r--r--meta-aarch64/recipes-devtools/binutils/binutils/relocatable_sdk.patch22
-rw-r--r--meta-aarch64/recipes-devtools/binutils/binutils_git.bb35
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/0001-Makefile.in-vis_hide-gen-hide-list-Do-not-make-defin.patch93
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/0001-crtstuff.c-USE_PT_GNU_EH_FRAME-Define-for-systems-us.patch49
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/100-uclibc-conf.patch39
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/200-uclibc-locale.patch2810
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/203-uclibc-locale-no__x.patch235
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/204-uclibc-locale-wchar_fix.patch54
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/205-uclibc-locale-update.patch521
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/301-missing-execinfo_h.patch15
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/302-c99-snprintf.patch15
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/303-c99-complex-ugly-hack.patch16
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/304-index_macro.patch30
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/305-libmudflap-susv3-legacy.patch51
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/306-libstdc++-namespace.patch40
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/64bithack.patch63
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/740-sh-pr24836.patch31
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/800-arm-bigendian.patch36
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/COLLECT_GCC_OPTIONS.patch25
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/GLIBC_DYNAMIC_LINKER.patch165
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/arm-hard-float-loader.patch48
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/cpp-honor-sysroot.patch40
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/define_insn_reservation.patch118
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/disable_relax_pic_calls_flag.patch48
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/disablesdt.patch32
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/fix-g++-sysroot.patch428
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/fortran-cross-compile-hack.patch32
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch33
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch116
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/gcc-argument-list-too-long.patch33
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/gcc-armv4-pass-fix-v4bx-to-ld.patch31
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/gcc-poison-dir-extend.patch27
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/gcc-poison-system-directories.patch223
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/gcc-uclibc-locale-ctype_touplow_t.patch72
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/libgcc-sjlj-check.patch61
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/libtool.patch29
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/mips64-default-n64.patch19
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/optional_libstdc.patch86
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/ppc_no_crtsavres.patch72
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/ppc_with_cpu.patch752
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/ppce5500-e6500-support.patch713
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/pr32219.patch72
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/rs6000-tables.patch135
-rw-r--r--meta-aarch64/recipes-devtools/gcc/files/use-defaults.h-and-t-oe-in-B.patch77
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-4.7.inc141
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-aarch64-4.7.inc146
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-common.inc96
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-configure-common.inc130
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-configure-cross.inc28
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-configure-runtime.inc59
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-configure-sdk.inc47
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-configure-target.inc7
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-cross-canadian.inc8
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-cross-canadian_aarch64-4.7.bb26
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-cross-initial.inc79
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-cross-initial_aarch64-4.7.bb2
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-cross.inc102
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-cross4.inc3
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-cross_aarch64-4.7.bb14
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-crosssdk-initial.inc8
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-crosssdk-initial_aarch64-4.7.bb4
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-crosssdk.inc10
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-crosssdk_aarch64-4.7.bb2
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-package-cross.inc47
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-package-runtime.inc80
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-package-sdk.inc68
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-package-target.inc142
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc-runtime_aarch64-4.7.bb8
-rw-r--r--meta-aarch64/recipes-devtools/gcc/gcc_aarch64-4.7.bb5
-rw-r--r--meta-aarch64/recipes-devtools/gcc/libgcc_aarch64-4.7.bb72
-rw-r--r--meta-aarch64/recipes-devtools/gdb/gdb-common.inc72
-rw-r--r--meta-aarch64/recipes-devtools/gdb/gdb-cross-canadian_git.bb6
-rw-r--r--meta-aarch64/recipes-devtools/gdb/gdb-cross.inc12
-rw-r--r--meta-aarch64/recipes-devtools/gdb/gdb-cross_git.bb5
-rw-r--r--meta-aarch64/recipes-devtools/gdb/gdb.inc12
-rw-r--r--meta-aarch64/recipes-devtools/gdb/gdb/gdbserver-cflags-last.diff25
-rw-r--r--meta-aarch64/recipes-devtools/gdb/gdb/kill_arm_map_symbols.patch26
-rw-r--r--meta-aarch64/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch1426
-rw-r--r--meta-aarch64/recipes-devtools/gdb/gdb/sim-install-6.6.patch21
-rw-r--r--meta-aarch64/recipes-devtools/gdb/gdb_git.bb7
-rw-r--r--meta-aarch64/recipes-devtools/php/.php.inc.swpbin0 -> 20480 bytes
-rw-r--r--meta-aarch64/recipes-devtools/php/php.inc127
-rw-r--r--meta-aarch64/recipes-devtools/php/php/0001-php-don-t-use-broken-wrapper-for-mkdir.patch26
-rw-r--r--meta-aarch64/recipes-devtools/php/php/acinclude-xml2-config.patch18
-rw-r--r--meta-aarch64/recipes-devtools/php/php/fix-fpm-cross-compile.patch38
-rw-r--r--meta-aarch64/recipes-devtools/php/php/iconv.patch27
-rw-r--r--meta-aarch64/recipes-devtools/php/php/imap-fix-autofoo.patch41
-rw-r--r--meta-aarch64/recipes-devtools/php/php/pear-makefile.patch13
-rw-r--r--meta-aarch64/recipes-devtools/php/php/phar-makefile.patch26
-rw-r--r--meta-aarch64/recipes-devtools/php/php/php-fpm-apache.conf6
-rw-r--r--meta-aarch64/recipes-devtools/php/php/php-fpm.conf510
-rw-r--r--meta-aarch64/recipes-devtools/php/php/php-m4-divert.patch83
-rw-r--r--meta-aarch64/recipes-devtools/php/php/php_exec_native.patch11
-rw-r--r--meta-aarch64/recipes-devtools/php/php_5.3.19.bb22
-rw-r--r--meta-aarch64/recipes-extended/ltp/files/ltp-arm64.patch752
-rw-r--r--meta-aarch64/recipes-extended/ltp/ltp_20120903.bbappend3
-rw-r--r--meta-aarch64/recipes-extra/dwarfutils/dwarf.inc12
-rw-r--r--meta-aarch64/recipes-extra/dwarfutils/dwarfdump/fix-dump.patch25
-rw-r--r--meta-aarch64/recipes-extra/dwarfutils/dwarfdump2/fix-dump.patch27
-rw-r--r--meta-aarch64/recipes-extra/dwarfutils/dwarfdump2_20121130.bb22
-rw-r--r--meta-aarch64/recipes-extra/dwarfutils/dwarfdump_20121130.bb22
-rw-r--r--meta-aarch64/recipes-extra/dwarfutils/dwarfgen_20121130.bb13
-rw-r--r--meta-aarch64/recipes-extra/dwarfutils/libdwarf/fix-gennames.patch22
-rw-r--r--meta-aarch64/recipes-extra/dwarfutils/libdwarf_20121130.bb13
-rw-r--r--meta-aarch64/recipes-extra/google-glog/google-glog_svn.bb17
-rw-r--r--meta-aarch64/recipes-extra/google-perftools/gperftools_2.0.bb11
-rw-r--r--meta-aarch64/recipes-extra/hiphopvm/files/disable-not-available-for-aarch64.patch21
-rw-r--r--meta-aarch64/recipes-extra/hiphopvm/hiphopvm_git.bb61
-rw-r--r--meta-aarch64/recipes-extra/libevent/files/LICENSE.txt74
-rw-r--r--meta-aarch64/recipes-extra/libevent/files/libevent-1.4.14.fb-changes.diff611
-rw-r--r--meta-aarch64/recipes-extra/libevent/libevent-fb_1.4.14b.bb20
-rw-r--r--meta-aarch64/recipes-extra/libmcrypt/libmcrypt_2.5.8.bb22
-rw-r--r--meta-aarch64/recipes-extra/libmemcached/libmemcached.inc10
-rw-r--r--meta-aarch64/recipes-extra/libmemcached/libmemcached_1.0.7.bb8
-rw-r--r--meta-aarch64/recipes-extra/libunwind/files/aarch64.patch19
-rw-r--r--meta-aarch64/recipes-extra/libunwind/libunwind.inc12
-rw-r--r--meta-aarch64/recipes-extra/libunwind/libunwind_1.1.bb8
-rw-r--r--meta-aarch64/recipes-extra/memcached/memcached_1.4.15.bb19
-rw-r--r--meta-aarch64/recipes-extra/meta-toolchain-hhvm/meta-toolchain-hhvm.bb4
-rw-r--r--meta-aarch64/recipes-extra/meta-toolchain-hhvm/packagegroup-core-standalone-hhvm-sdk-target.bb55
-rw-r--r--meta-aarch64/recipes-extra/onig/files/do-not-use-system-headers.patch34
-rw-r--r--meta-aarch64/recipes-extra/onig/onig_5.9.3.bbappend3
-rw-r--r--meta-aarch64/recipes-extra/tbb/tbb/cross-compile.patch25
-rw-r--r--meta-aarch64/recipes-extra/tbb/tbb/tbb.pc11
-rw-r--r--meta-aarch64/recipes-extra/tbb/tbb/tbb41-aarch64.patch233
-rw-r--r--meta-aarch64/recipes-extra/tbb/tbb_4.1.bb31
-rw-r--r--meta-aarch64/recipes-kernel/linux/linux-linaro_git.bb56
-rw-r--r--meta-aarch64/recipes-kernel/sysprof/sysprof_git.bbappend1
-rw-r--r--meta-aarch64/recipes-multimedia/pulseaudio/files/0001-libatomic_ops-Aarch64-basic-port.patch232
-rw-r--r--meta-aarch64/recipes-multimedia/pulseaudio/libatomics-ops_7.2.bbappend5
-rw-r--r--meta-aarch64/recipes-multimedia/v4l2apps/files/openat.patch35
-rw-r--r--meta-aarch64/recipes-multimedia/v4l2apps/v4l-utils_0.8.8.bbappend3
-rw-r--r--meta-aarch64/recipes-qt/qt4/files/aarch64.patch36
-rw-r--r--meta-aarch64/recipes-qt/qt4/qt4-x11-free_4.8.4.bbappend5
-rw-r--r--meta-aarch64/recipes-sato/webkit/files/aarch64.patch35
-rw-r--r--meta-aarch64/recipes-sato/webkit/webkit-gtk_1.8.3.bbappend5
-rw-r--r--meta-aarch64/recipes-support/emacs/emacs_23.4.bbappend1
-rw-r--r--meta-aarch64/recipes-support/gd/gd_2.0.35+2.0.36rc1.bbappend1
-rw-r--r--meta-aarch64/recipes/images/micro-base-image.bb19
152 files changed, 14547 insertions, 0 deletions
diff --git a/meta-aarch64/conf/layer.conf b/meta-aarch64/conf/layer.conf
new file mode 100644
index 00000000..e3bbaaec
--- /dev/null
+++ b/meta-aarch64/conf/layer.conf
@@ -0,0 +1,14 @@
+BBPATH .= ":${LAYERDIR}"
+BBFILES += "\
+ ${LAYERDIR}/recipes*/*/*.bb \
+ ${LAYERDIR}/recipes*/*/*.bbappend \
+ "
+
+BBFILE_COLLECTIONS += "aarch64"
+BBFILE_PATTERN_aarch64 := "^${LAYERDIR}/"
+BBFILE_PRIORITY_aarch64 = "20"
+
+# do not error out on bbappends for missing recipes (mysql5)
+BB_DANGLINGAPPENDS_WARNONLY = "true"
+
+LAYERDEPENDS_aarch64 = "linaro"
diff --git a/meta-aarch64/conf/machine/genericarmv8.conf b/meta-aarch64/conf/machine/genericarmv8.conf
new file mode 100644
index 00000000..6d84e0d8
--- /dev/null
+++ b/meta-aarch64/conf/machine/genericarmv8.conf
@@ -0,0 +1,37 @@
+#@TYPE: Machine
+#@NAME: generic armv8 machine
+#@DESCRIPTION: generic machine to be used by linaro-media-create
+
+require conf/machine/include/arm64/arch-armv8.inc
+
+PREFERRED_PROVIDER_virtual/xserver ?= "xserver-xorg"
+
+XSERVER ?= "xserver-xorg \
+ mesa-dri-driver-swrast \
+ xf86-input-evdev \
+ xf86-input-mouse \
+ xf86-video-fbdev \
+ xf86-input-keyboard"
+
+MACHINE_FEATURES = ""
+
+# Don't include kernels in standard images
+RDEPENDS_kernel-base = ""
+
+PREFERRED_PROVIDER_virtual/kernel ?= "linux-linaro"
+
+KERNEL_IMAGETYPE = "Image"
+
+# We have to disable SERIAL_CONSOLE due to auto-serial-console
+#SERIAL_CONSOLE = "115200 ttyAMA0"
+
+# Force auto-serial-console to be used by all image types
+# Ideally this would be part of core oe or as a bbclassappend,
+# but as we don't have an easy way to append a class, defining
+# it here
+EXTRA_IMAGE_FEATURES += "autoserial"
+PACKAGE_GROUP_autoserial = "auto-serial-console"
+
+# we do not want to have getty running on tty1 as we run
+# auto-serial-console there
+USE_VT = "0"
diff --git a/meta-aarch64/conf/machine/include/arm64/arch-armv8.inc b/meta-aarch64/conf/machine/include/arm64/arch-armv8.inc
new file mode 100644
index 00000000..75aee422
--- /dev/null
+++ b/meta-aarch64/conf/machine/include/arm64/arch-armv8.inc
@@ -0,0 +1,22 @@
+DEFAULTTUNE ?= "aarch64"
+
+ARMPKGARCH ?= "aarch64"
+
+TUNEVALID[aarch64] = "Enable instructions for aarch64"
+TUNECONFLICTS[aarch64] = ""
+MACHINEOVERRIDES .= "${@bb.utils.contains("TUNE_FEATURES", "aarch64", ":aarch64", "" ,d)}"
+
+# Little Endian base configs
+AVAILTUNES += "aarch64"
+TUNE_FEATURES_tune-aarch64 ?= "aarch64"
+
+TUNE_ARCH = "aarch64"
+TUNE_PKGARCH = "aarch64"
+
+PACKAGE_EXTRA_ARCHS += "aarch64"
+
+# toolchain bits which were in conf/site.conf
+
+GCCVERSION ?= "linaro-4.7"
+SDKGCCVERSION ?= "linaro-4.7"
+BINUVERSION ?= "2.23.51%"
diff --git a/meta-aarch64/recipes-core/netbase/files/genericarmv8/interfaces b/meta-aarch64/recipes-core/netbase/files/genericarmv8/interfaces
new file mode 100644
index 00000000..95989579
--- /dev/null
+++ b/meta-aarch64/recipes-core/netbase/files/genericarmv8/interfaces
@@ -0,0 +1,34 @@
+# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
+
+# The loopback interface
+auto lo
+iface lo inet loopback
+
+# Wireless interfaces
+iface wlan0 inet dhcp
+ wireless_mode managed
+ wireless_essid any
+ wpa-driver wext
+ wpa-conf /etc/wpa_supplicant.conf
+
+iface atml0 inet dhcp
+
+# Wired or wireless interfaces
+auto eth0
+iface eth0 inet static
+ address 192.168.168.2
+ netmask 255.255.255.0
+ network 192.168.168.0
+ gateway 192.168.168.1
+
+# Ethernet/RNDIS gadget (g_ether)
+# ... or on host side, usbnet and random hwaddr
+iface usb0 inet static
+ address 192.168.7.2
+ netmask 255.255.255.0
+ network 192.168.7.0
+ gateway 192.168.7.1
+
+# Bluetooth networking
+iface bnep0 inet dhcp
+
diff --git a/meta-aarch64/recipes-core/netbase/netbase_5.0.bbappend b/meta-aarch64/recipes-core/netbase/netbase_5.0.bbappend
new file mode 100644
index 00000000..13abdad8
--- /dev/null
+++ b/meta-aarch64/recipes-core/netbase/netbase_5.0.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+PRINC = "1"
diff --git a/meta-aarch64/recipes-core/packagegroups/packagegroup-core-sdk.bbappend b/meta-aarch64/recipes-core/packagegroups/packagegroup-core-sdk.bbappend
new file mode 100644
index 00000000..5d50b629
--- /dev/null
+++ b/meta-aarch64/recipes-core/packagegroups/packagegroup-core-sdk.bbappend
@@ -0,0 +1,16 @@
+INCPR = "1"
+
+RDEPENDS_packagegroup-core-sdk = "\
+ packagegroup-core-buildessential \
+ coreutils \
+ ccache \
+ diffutils \
+ intltool \
+ perl-module-re \
+ perl-module-text-wrap \
+ findutils \
+ quilt \
+ less \
+ ldd \
+ file \
+ tcl"
diff --git a/meta-aarch64/recipes-devtools/binutils/binutils-cross-canadian.inc b/meta-aarch64/recipes-devtools/binutils/binutils-cross-canadian.inc
new file mode 100644
index 00000000..4658badf
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/binutils/binutils-cross-canadian.inc
@@ -0,0 +1,22 @@
+inherit cross-canadian
+
+DESCRIPTION = "A GNU collection of cross-canadian binary utilities for ${TARGET_ARCH} target"
+PN = "binutils-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+BPN = "binutils"
+
+DEPENDS = "flex-native bison-native virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-libc nativesdk-zlib nativesdk-gettext"
+EXTRA_OECONF += "--with-sysroot=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS} \
+ "
+do_install () {
+ autotools_do_install
+
+ # We're not interested in the libs or headers, these would come from the
+ # nativesdk or target version of the binutils recipe
+ rm -rf ${D}${prefix}/${TARGET_SYS}
+ rm -f ${D}${libdir}/libbfd*
+ rm -f ${D}${libdir}/libiberty*
+ rm -f ${D}${libdir}/libopcodes*
+ rm -f ${D}${includedir}/*.h
+}
+
+BBCLASSEXTEND = ""
diff --git a/meta-aarch64/recipes-devtools/binutils/binutils-cross-canadian_git.bb b/meta-aarch64/recipes-devtools/binutils/binutils-cross-canadian_git.bb
new file mode 100644
index 00000000..ec600bda
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/binutils/binutils-cross-canadian_git.bb
@@ -0,0 +1,3 @@
+require binutils.inc
+require binutils-git.inc
+require binutils-cross-canadian.inc
diff --git a/meta-aarch64/recipes-devtools/binutils/binutils-cross.inc b/meta-aarch64/recipes-devtools/binutils/binutils-cross.inc
new file mode 100644
index 00000000..300a1d39
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/binutils/binutils-cross.inc
@@ -0,0 +1,27 @@
+inherit cross
+PROVIDES = "virtual/${TARGET_PREFIX}binutils"
+
+INHIBIT_DEFAULT_DEPS = "1"
+INHIBIT_AUTOTOOLS_DEPS = "1"
+
+EXTRA_OECONF += "--with-sysroot=${STAGING_DIR_TARGET} \
+ --disable-install-libbfd \
+ --enable-poison-system-directories \
+ "
+do_install () {
+ oe_runmake 'DESTDIR=${D}' install
+
+ # We don't really need these, so we'll remove them...
+ rm -rf ${D}${STAGING_DIR_NATIVE}${libdir_native}/libiberty.a
+ rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}
+ rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/lib/ldscripts
+ rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/share/info
+ rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/share/locale
+ rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/share/man
+ rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/share || :
+ rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir}/gcc-lib || :
+ rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir}64/gcc-lib || :
+ rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir} || :
+ rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir}64 || :
+ rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${prefix} || :
+}
diff --git a/meta-aarch64/recipes-devtools/binutils/binutils-cross_git.bb b/meta-aarch64/recipes-devtools/binutils/binutils-cross_git.bb
new file mode 100644
index 00000000..25de7dbd
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/binutils/binutils-cross_git.bb
@@ -0,0 +1,3 @@
+require binutils.inc
+require binutils-git.inc
+require binutils-cross.inc
diff --git a/meta-aarch64/recipes-devtools/binutils/binutils-crosssdk_git.bb b/meta-aarch64/recipes-devtools/binutils/binutils-crosssdk_git.bb
new file mode 100644
index 00000000..af754602
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/binutils/binutils-crosssdk_git.bb
@@ -0,0 +1,14 @@
+require binutils-cross_git.bb
+
+inherit crosssdk
+
+PR = "r1"
+
+PROVIDES = "virtual/${TARGET_PREFIX}binutils-crosssdk"
+
+
+SRC_URI += "file://relocatable_sdk.patch"
+
+do_configure_prepend () {
+ sed -i 's#/usr/local/lib /lib /usr/lib#${SDKPATHNATIVE}/lib ${SDKPATHNATIVE}/usr/lib /usr/local/lib /lib /usr/lib#' ${S}/ld/configure.tgt
+}
diff --git a/meta-aarch64/recipes-devtools/binutils/binutils-git.inc b/meta-aarch64/recipes-devtools/binutils/binutils-git.inc
new file mode 100644
index 00000000..bef26c53
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/binutils/binutils-git.inc
@@ -0,0 +1,26 @@
+#FILESPATHPKG =. "binutils-git:"
+SRCREV = "0ba0fddb32272c8e561b9c12688c639a1218c864"
+LICENSE = "GPLv3"
+
+PV = "2.23.51.20130109+gitr${SRCPV}"
+PR = "r0"
+
+S = "${WORKDIR}/git"
+
+SRC_URI = "git://sourceware.org/git/binutils.git;branch=master;protocol=git \
+"
+
+DEFAULT_PREFERENCE = "1"
+
+LIC_FILES_CHKSUM="\
+ file://src-release;endline=17;md5=4830a9ef968f3b18dd5e9f2c00db2d35\
+ file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
+ file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674\
+ file://COPYING3;md5=d32239bcb673463ab874e80d47fae504\
+ file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6\
+ file://gas/COPYING;md5=d32239bcb673463ab874e80d47fae504\
+ file://include/COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
+ file://include/COPYING3;md5=d32239bcb673463ab874e80d47fae504\
+ file://libiberty/COPYING.LIB;md5=a916467b91076e631dd8edb7424769c7\
+ file://bfd/COPYING;md5=d32239bcb673463ab874e80d47fae504\
+ "
diff --git a/meta-aarch64/recipes-devtools/binutils/binutils.inc b/meta-aarch64/recipes-devtools/binutils/binutils.inc
new file mode 100644
index 00000000..ee748a40
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/binutils/binutils.inc
@@ -0,0 +1,136 @@
+SUMMARY = "A GNU collection of binary utilities"
+DESCRIPTION = "The GNU Binutils are a collection of binary tools. \
+The main ones are ld (GNU Linker), and as (GNU Assembler). This \
+package also includes addition tools such as addr2line (Converts \
+addresses into filenames and line numbers), ar (utility for creating, \
+modifying and extracting archives), nm (list symbols in object \
+files), objcopy (copy and translate object files), objdump (Display \
+object information), and other tools and related libraries."
+HOMEPAGE = "http://www.gnu.org/software/binutils/"
+BUGTRACKER = "http://sourceware.org/bugzilla/"
+SECTION = "devel"
+LICENSE = "GPLv3"
+
+DEPENDS = "flex-native bison-native zlib-native"
+
+inherit autotools gettext multilib_header
+
+PACKAGES += "${PN}-symlinks"
+
+FILES_${PN} = " \
+ ${bindir}/${TARGET_PREFIX}* \
+ ${libdir}/lib*-*.so \
+ ${prefix}/${TARGET_SYS}/bin/*"
+
+FILES_${PN}-dev = " \
+ ${includedir} \
+ ${libdir}/*.la \
+ ${libdir}/libbfd.so \
+ ${libdir}/libopcodes.so"
+
+FILES_${PN}-symlinks = " \
+ ${bindir}/addr2line \
+ ${bindir}/as \
+ ${bindir}/c++filt \
+ ${bindir}/embedspu \
+ ${bindir}/gprof \
+ ${bindir}/ld \
+ ${bindir}/ld.bfd \
+ ${bindir}/ld.gold \
+ ${bindir}/nm \
+ ${bindir}/objcopy \
+ ${bindir}/objdump \
+ ${bindir}/ranlib \
+ ${bindir}/readelf \
+ ${bindir}/elfedit \
+ ${bindir}/size \
+ ${bindir}/strip"
+
+FILES_${PN}-dbg += "${prefix}/${TARGET_SYS}/bin/.debug"
+
+B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
+
+EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \
+ --disable-werror \
+ --enable-plugins \
+ ${@base_contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default --enable-threads', '', d)} \
+ ${@base_contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)}"
+
+# This is necessary due to a bug in the binutils Makefiles
+# EXTRA_OEMAKE = "configure-build-libiberty all"
+
+export AR = "${HOST_PREFIX}ar"
+export AS = "${HOST_PREFIX}as"
+export LD = "${HOST_PREFIX}ld"
+export NM = "${HOST_PREFIX}nm"
+export RANLIB = "${HOST_PREFIX}ranlib"
+export OBJCOPY = "${HOST_PREFIX}objcopy"
+export OBJDUMP = "${HOST_PREFIX}objdump"
+
+export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
+export AS_FOR_TARGET = "${TARGET_PREFIX}as"
+export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
+export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
+export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
+
+export CC_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
+export CXX_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
+
+export CC_FOR_BUILD = "LD_LIBRARY_PATH= ${BUILD_CC}"
+export CPP_FOR_BUILD = "${BUILD_CPP}"
+export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS}"
+
+do_configure () {
+ (cd ${S}; gnu-configize) || die "Failed to run gnu-configize"
+ oe_runconf
+#
+# must prime config.cache to ensure the build of libiberty
+#
+ mkdir -p ${B}/build-${BUILD_SYS}
+ for i in ${CONFIG_SITE}; do
+ cat $i >> ${B}/build-${BUILD_SYS}/config.cache
+ done
+}
+
+do_install () {
+ autotools_do_install
+
+ # We don't really need these, so we'll remove them...
+ rm -rf ${D}${libdir}/ldscripts
+
+ # Fix the /usr/${TARGET_SYS}/bin/* links
+ for l in ${D}${prefix}/${TARGET_SYS}/bin/*; do
+ rm -f $l
+ ln -sf `echo ${prefix}/${TARGET_SYS}/bin \
+ | tr -s / \
+ | sed -e 's,^/,,' -e 's,[^/]*,..,g'`${bindir}/${TARGET_PREFIX}`basename $l` $l
+ done
+
+ # Install the libiberty header
+ install -d ${D}${includedir}
+ install -m 644 ${S}/include/ansidecl.h ${D}${includedir}
+ install -m 644 ${S}/include/libiberty.h ${D}${includedir}
+
+ cd ${D}${bindir}
+
+ # Symlinks for ease of running these on the native target
+ for p in ${TARGET_PREFIX}* ; do
+ ln -sf $p `echo $p | sed -e s,${TARGET_PREFIX},,`
+ done
+
+ rm -f ${D}${bindir}/ar ${D}${bindir}/strings
+
+ oe_multilib_header bfd.h
+}
+
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "100"
+
+ALTERNATIVE_${PN}-symlinks = "ar strings"
+
+ALTERNATIVE_LINK_NAME[ar] = "${bindir}/ar"
+ALTERNATIVE_TARGET[ar] = "${bindir}/${TARGET_PREFIX}ar"
+
+ALTERNATIVE_LINK_NAME[strings] = "${bindir}/strings"
+ALTERNATIVE_TARGET[strings] = "${bindir}/${TARGET_PREFIX}strings"
diff --git a/meta-aarch64/recipes-devtools/binutils/binutils/relocatable_sdk.patch b/meta-aarch64/recipes-devtools/binutils/binutils/relocatable_sdk.patch
new file mode 100644
index 00000000..33f9e68b
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/binutils/binutils/relocatable_sdk.patch
@@ -0,0 +1,22 @@
+Upstream-Status: Inappropriate [SDK specific]
+
+This patch will modify the ELF linker scripts so that the crosssdk linker will
+generate binaries with a 4096 bytes PT_INTERP section. When the binaries will
+be relocated, at SDK install time, the interpreter path can be easily changed
+by the relocating script.
+
+Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
+
+Index: binutils-2.22/ld/scripttempl/elf.sc
+===================================================================
+--- binutils-2.22.orig/ld/scripttempl/elf.sc
++++ binutils-2.22/ld/scripttempl/elf.sc
+@@ -116,7 +116,7 @@ if test -n "${COMMONPAGESIZE}"; then
+ DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
+ fi
+ if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
+- INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
++ INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp); . = 0x1000; }"
+ fi
+ if test -z "$PLT"; then
+ IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }"
diff --git a/meta-aarch64/recipes-devtools/binutils/binutils_git.bb b/meta-aarch64/recipes-devtools/binutils/binutils_git.bb
new file mode 100644
index 00000000..f5cf76af
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/binutils/binutils_git.bb
@@ -0,0 +1,35 @@
+require binutils.inc
+require binutils-git.inc
+
+DEPENDS += "flex bison zlib"
+
+EXTRA_OECONF += "--with-sysroot=/ \
+ --enable-install-libbfd \
+ --enable-shared \
+ "
+
+EXTRA_OECONF_virtclass-native = "--enable-target=all --enable-64-bit-bfd --enable-install-libbfd"
+
+do_install_virtclass-native () {
+ autotools_do_install
+
+ # Install the libiberty header
+ install -d ${D}${includedir}
+ install -m 644 ${S}/include/ansidecl.h ${D}${includedir}
+ install -m 644 ${S}/include/libiberty.h ${D}${includedir}
+
+ # We only want libiberty, libbfd and libopcodes
+ rm -rf ${D}${bindir}
+ rm -rf ${D}${prefix}/${TARGET_SYS}
+ rm -rf ${D}${prefix}/lib/ldscripts
+ rm -rf ${D}${prefix}/share/info
+ rm -rf ${D}${prefix}/share/locale
+ rm -rf ${D}${prefix}/share/man
+ rmdir ${D}${prefix}/share || :
+ rmdir ${D}/${libdir}/gcc-lib || :
+ rmdir ${D}/${libdir}64/gcc-lib || :
+ rmdir ${D}/${libdir} || :
+ rmdir ${D}/${libdir}64 || :
+}
+
+BBCLASSEXTEND = "native"
diff --git a/meta-aarch64/recipes-devtools/gcc/files/0001-Makefile.in-vis_hide-gen-hide-list-Do-not-make-defin.patch b/meta-aarch64/recipes-devtools/gcc/files/0001-Makefile.in-vis_hide-gen-hide-list-Do-not-make-defin.patch
new file mode 100644
index 00000000..b6f8f943
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/0001-Makefile.in-vis_hide-gen-hide-list-Do-not-make-defin.patch
@@ -0,0 +1,93 @@
+From b78f422ee83d279a83c62491b252cfec5b94e92a Mon Sep 17 00:00:00 2001
+From: jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Wed, 22 Aug 2012 08:36:23 +0000
+Subject: [PATCH] * Makefile.in (vis_hide, gen-hide-list): Do not make
+ definitions depend on --enable-shared.
+ ($(lib1asmfuncs-o)): Use %.vis files independent of
+ --enable-shared. * static-object.mk
+ ($(base)$(objext), $(base).vis)
+ ($(base)_s$(objext)): Use same rules for visibility
+ handling as in shared-object.mk.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190588 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ libgcc/ChangeLog | 10 ++++++++++
+ libgcc/Makefile.in | 16 ++++------------
+ libgcc/static-object.mk | 10 ++++++++--
+ 3 files changed, 22 insertions(+), 14 deletions(-)
+
+Upstream-Status: Backport
+
+-Khem
+05-Sep-2012
+
+Index: gcc-4_7-branch/libgcc/Makefile.in
+===================================================================
+--- gcc-4_7-branch.orig/libgcc/Makefile.in 2012-08-21 22:33:20.000000000 -0700
++++ gcc-4_7-branch/libgcc/Makefile.in 2012-09-05 17:30:28.572998745 -0700
+@@ -362,6 +362,7 @@
+ ifneq ($(LIBUNWIND),)
+ install-libunwind = install-libunwind
+ endif
++endif
+
+ # For -fvisibility=hidden. We need both a -fvisibility=hidden on
+ # the command line, and a #define to prevent libgcc2.h etc from
+@@ -385,11 +386,8 @@
+ gen-hide-list = echo > $@
+ endif
+
+-else
+-# Not enable_shared.
++ifneq ($(enable_shared),yes)
+ iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
+-vis_hide =
+-gen-hide-list = echo > \$@
+ endif
+
+ LIB2ADD += enable-execute-stack.c
+@@ -438,7 +436,6 @@
+ $(LIB2_DIVMOD_FUNCS))
+
+ # Build "libgcc1" (assembly) components.
+-ifeq ($(enable_shared),yes)
+
+ lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
+ $(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC) %.vis
+@@ -450,14 +447,9 @@
+ lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
+ $(lib1asmfuncs-s-o): %_s$(objext): $(srcdir)/config/$(LIB1ASMSRC)
+ $(gcc_s_compile) -DL$* -xassembler-with-cpp -c $<
+-libgcc-s-objects += $(lib1asmfuncs-s-o)
+-
+-else
++ifeq ($(enable_shared),yes)
+
+-lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
+-$(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC)
+- $(gcc_compile) -DL$* -xassembler-with-cpp -c $<
+-libgcc-objects += $(lib1asmfuncs-o)
++libgcc-s-objects += $(lib1asmfuncs-s-o)
+
+ endif
+
+Index: gcc-4_7-branch/libgcc/static-object.mk
+===================================================================
+--- gcc-4_7-branch.orig/libgcc/static-object.mk 2012-08-21 22:33:20.000000000 -0700
++++ gcc-4_7-branch/libgcc/static-object.mk 2012-09-05 17:30:28.572998745 -0700
+@@ -24,7 +24,13 @@
+ endif
+ endif
+
+-$(base)$(objext): $o
+- $(gcc_compile) -c -xassembler-with-cpp $<
++$(base)$(objext): $o $(base).vis
++ $(gcc_compile) -c -xassembler-with-cpp -include $*.vis $<
++
++$(base).vis: $(base)_s$(objext)
++ $(gen-hide-list)
++
++$(base)_s$(objext): $o
++ $(gcc_s_compile) -c -xassembler-with-cpp $<
+
+ endif
diff --git a/meta-aarch64/recipes-devtools/gcc/files/0001-crtstuff.c-USE_PT_GNU_EH_FRAME-Define-for-systems-us.patch b/meta-aarch64/recipes-devtools/gcc/files/0001-crtstuff.c-USE_PT_GNU_EH_FRAME-Define-for-systems-us.patch
new file mode 100644
index 00000000..15034f7d
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/0001-crtstuff.c-USE_PT_GNU_EH_FRAME-Define-for-systems-us.patch
@@ -0,0 +1,49 @@
+From 935475158f45b9c55a54647543c0402b4b3043ae Mon Sep 17 00:00:00 2001
+From: jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Sun, 19 Aug 2012 15:11:40 +0000
+Subject: [PATCH] * crtstuff.c (USE_PT_GNU_EH_FRAME): Define for
+ systems using glibc even if inhibit_libc.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190517 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ libgcc/ChangeLog | 5 +++++
+ libgcc/crtstuff.c | 16 +++++++++++++++-
+ 2 files changed, 20 insertions(+), 1 deletion(-)
+
+Upstream-Status: Backport
+
+-Khem 05-Sep-2012
+Index: gcc-4_7-branch/libgcc/crtstuff.c
+===================================================================
+--- gcc-4_7-branch.orig/libgcc/crtstuff.c 2012-08-21 22:33:20.000000000 -0700
++++ gcc-4_7-branch/libgcc/crtstuff.c 2012-09-05 17:28:49.248994968 -0700
+@@ -1,7 +1,7 @@
+ /* Specialized bits of code needed to support construction and
+ destruction of file-scope objects in C++ code.
+ Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+- 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
++ 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012
+ Free Software Foundation, Inc.
+ Contributed by Ron Guilmette (rfg@monkeys.com).
+
+@@ -113,6 +113,20 @@
+ # define USE_PT_GNU_EH_FRAME
+ # endif
+ #endif
++
++#if defined(OBJECT_FORMAT_ELF) \
++ && !defined(OBJECT_FORMAT_FLAT) \
++ && defined(HAVE_LD_EH_FRAME_HDR) \
++ && !defined(CRTSTUFFT_O) \
++ && defined(inhibit_libc) \
++ && (defined(__GLIBC__) || defined(__gnu_linux__) || defined(__GNU__))
++/* On systems using glibc, an inhibit_libc build of libgcc is only
++ part of a bootstrap process. Build the same crt*.o as would be
++ built with headers present, so that it is not necessary to build
++ glibc more than once for the bootstrap to converge. */
++# define USE_PT_GNU_EH_FRAME
++#endif
++
+ #if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME)
+ # define USE_EH_FRAME_REGISTRY
+ #endif
diff --git a/meta-aarch64/recipes-devtools/gcc/files/100-uclibc-conf.patch b/meta-aarch64/recipes-devtools/gcc/files/100-uclibc-conf.patch
new file mode 100644
index 00000000..b2981e07
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/100-uclibc-conf.patch
@@ -0,0 +1,39 @@
+Upstream-Status: Pending
+
+Index: gcc-4.6.0/contrib/regression/objs-gcc.sh
+===================================================================
+--- gcc-4.6.0.orig/contrib/regression/objs-gcc.sh
++++ gcc-4.6.0/contrib/regression/objs-gcc.sh
+@@ -106,6 +106,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
+Index: gcc-4.6.0/libjava/classpath/ltconfig
+===================================================================
+--- gcc-4.6.0.orig/libjava/classpath/ltconfig
++++ gcc-4.6.0/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
+
+@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
diff --git a/meta-aarch64/recipes-devtools/gcc/files/200-uclibc-locale.patch b/meta-aarch64/recipes-devtools/gcc/files/200-uclibc-locale.patch
new file mode 100644
index 00000000..df22c544
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/200-uclibc-locale.patch
@@ -0,0 +1,2810 @@
+Upstream-Status: Pending
+
+Index: gcc-4_7-branch/libstdc++-v3/acinclude.m4
+===================================================================
+--- gcc-4_7-branch.orig/libstdc++-v3/acinclude.m4 2012-04-10 10:19:50.395337128 -0700
++++ gcc-4_7-branch/libstdc++-v3/acinclude.m4 2012-04-10 10:30:37.327368356 -0700
+@@ -1924,6 +1924,9 @@
+ # Default to "generic".
+ if test $enable_clocale_flag = auto; then
+ case ${target_os} in
++ *-uclibc*)
++ enable_clocale_flag=uclibc
++ ;;
+ linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
+ enable_clocale_flag=gnu
+ ;;
+@@ -2085,6 +2088,40 @@
+ CTIME_CC=config/locale/generic/time_members.cc
+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
+ ;;
++ uclibc)
++ AC_MSG_RESULT(uclibc)
++
++ # Declare intention to use gettext, and add support for specific
++ # languages.
++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
++ ALL_LINGUAS="de fr"
++
++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
++ USE_NLS=yes
++ fi
++ # Export the build objects.
++ for ling in $ALL_LINGUAS; do \
++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
++ done
++ AC_SUBST(glibcxx_MOFILES)
++ AC_SUBST(glibcxx_POFILES)
++
++ CLOCALE_H=config/locale/uclibc/c_locale.h
++ CLOCALE_CC=config/locale/uclibc/c_locale.cc
++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
++ CMESSAGES_H=config/locale/uclibc/messages_members.h
++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
++ CMONEY_CC=config/locale/uclibc/monetary_members.cc
++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
++ CTIME_H=config/locale/uclibc/time_members.h
++ CTIME_CC=config/locale/uclibc/time_members.cc
++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
++ ;;
+ esac
+
+ # This is where the testsuite looks for locale catalogs, using the
+Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2012-04-10 10:30:37.327368356 -0700
+@@ -0,0 +1,63 @@
++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
++
++// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++// Written by Jakub Jelinek <jakub@redhat.com>
++
++#include <bits/c++config.h>
++#include <clocale>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning clean this up
++#endif
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++
++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
++extern "C" __typeof(strcoll_l) __strcoll_l;
++extern "C" __typeof(strftime_l) __strftime_l;
++extern "C" __typeof(strtod_l) __strtod_l;
++extern "C" __typeof(strtof_l) __strtof_l;
++extern "C" __typeof(strtold_l) __strtold_l;
++extern "C" __typeof(strxfrm_l) __strxfrm_l;
++extern "C" __typeof(newlocale) __newlocale;
++extern "C" __typeof(freelocale) __freelocale;
++extern "C" __typeof(duplocale) __duplocale;
++extern "C" __typeof(uselocale) __uselocale;
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++extern "C" __typeof(iswctype_l) __iswctype_l;
++extern "C" __typeof(towlower_l) __towlower_l;
++extern "C" __typeof(towupper_l) __towupper_l;
++extern "C" __typeof(wcscoll_l) __wcscoll_l;
++extern "C" __typeof(wcsftime_l) __wcsftime_l;
++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
++extern "C" __typeof(wctype_l) __wctype_l;
++#endif
++
++#endif // GLIBC 2.3 and later
+Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c_locale.cc
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c_locale.cc 2012-04-10 10:30:37.327368356 -0700
+@@ -0,0 +1,160 @@
++// Wrapper for underlying C-language localization -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.8 Standard locale categories.
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#include <cerrno> // For errno
++#include <locale>
++#include <stdexcept>
++#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<>
++ void
++ __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;
++ }
++ }
++
++ template<>
++ void
++ __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;
++ }
++ }
++
++ template<>
++ void
++ __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;
++ }
++ }
++
++ void
++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
++ __c_locale __old)
++ {
++ __cloc = __newlocale(1 << LC_ALL, __s, __old);
++#ifdef __UCLIBC_HAS_XLOCALE__
++ if (!__cloc)
++ {
++ // This named locale is not supported by the underlying OS.
++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
++ "name not valid"));
++ }
++#endif
++ }
++
++ void
++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
++ {
++ if (_S_get_c_locale() != __cloc)
++ __freelocale(__cloc);
++ }
++
++ __c_locale
++ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
++ { return __duplocale(__cloc); }
++} // namespace std
++
++namespace __gnu_cxx
++{
++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
++ {
++ "LC_CTYPE",
++ "LC_NUMERIC",
++ "LC_TIME",
++ "LC_COLLATE",
++ "LC_MONETARY",
++ "LC_MESSAGES",
++#if _GLIBCXX_NUM_CATEGORIES != 0
++ "LC_PAPER",
++ "LC_NAME",
++ "LC_ADDRESS",
++ "LC_TELEPHONE",
++ "LC_MEASUREMENT",
++ "LC_IDENTIFICATION"
++#endif
++ };
++}
++
++namespace std
++{
++ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
++} // namespace std
+Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c_locale.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/c_locale.h 2012-04-10 10:30:37.327368356 -0700
+@@ -0,0 +1,117 @@
++// Wrapper for underlying C-language localization -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.8 Standard locale categories.
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#ifndef _C_LOCALE_H
++#define _C_LOCALE_H 1
++
++#pragma GCC system_header
++
++#include <cstring> // get std::strlen
++#include <cstdio> // get std::snprintf or std::sprintf
++#include <clocale>
++#include <langinfo.h> // For codecvt
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix this
++#endif
++#ifdef __UCLIBC_HAS_LOCALE__
++#include <iconv.h> // For codecvt using iconv, iconv_t
++#endif
++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
++#include <libintl.h> // For messages
++#endif
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning what is _GLIBCXX_C_LOCALE_GNU for
++#endif
++#define _GLIBCXX_C_LOCALE_GNU 1
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix categories
++#endif
++// #define _GLIBCXX_NUM_CATEGORIES 6
++#define _GLIBCXX_NUM_CATEGORIES 0
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++namespace __gnu_cxx
++{
++ extern "C" __typeof(uselocale) __uselocale;
++}
++#endif
++
++namespace std
++{
++#ifdef __UCLIBC_HAS_XLOCALE__
++ typedef __locale_t __c_locale;
++#else
++ 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
++ // 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)
++ {
++ __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];
++ std::strcpy(__sav, __old);
++ std::setlocale(LC_ALL, "C");
++# endif
++#endif
++
++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
++
++#ifdef __UCLIBC_HAS_XCLOCALE__
++ __gnu_cxx::__uselocale(__old);
++#elif defined __UCLIBC_HAS_LOCALE__
++ std::setlocale(LC_ALL, __sav);
++ delete [] __sav;
++#endif
++ return __ret;
++ }
++}
++
++#endif
+Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2012-04-10 10:30:37.327368356 -0700
+@@ -0,0 +1,308 @@
++// std::codecvt implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.1.5 - Template class codecvt
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#include <locale>
++#include <cstdlib> // For MB_CUR_MAX
++#include <climits> // For MB_LEN_MAX
++#include <bits/c++locale_internal.h>
++
++namespace std
++{
++ // Specializations.
++#ifdef _GLIBCXX_USE_WCHAR_T
++ codecvt_base::result
++ codecvt<wchar_t, char, mbstate_t>::
++ do_out(state_type& __state, const intern_type* __from,
++ const intern_type* __from_end, const intern_type*& __from_next,
++ extern_type* __to, extern_type* __to_end,
++ extern_type*& __to_next) const
++ {
++ result __ret = ok;
++ state_type __tmp_state(__state);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++
++ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
++ // in case we fall back to wcrtomb and then continue, in a loop.
++ // NB: wcsnrtombs is a GNU extension
++ for (__from_next = __from, __to_next = __to;
++ __from_next < __from_end && __to_next < __to_end
++ && __ret == ok;)
++ {
++ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
++ __from_end - __from_next);
++ if (!__from_chunk_end)
++ __from_chunk_end = __from_end;
++
++ __from = __from_next;
++ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
++ __from_chunk_end - __from_next,
++ __to_end - __to_next, &__state);
++ if (__conv == static_cast<size_t>(-1))
++ {
++ // In case of error, in order to stop at the exact place we
++ // have to start again from the beginning with a series of
++ // wcrtomb.
++ for (; __from < __from_next; ++__from)
++ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
++ __state = __tmp_state;
++ __ret = error;
++ }
++ else if (__from_next && __from_next < __from_chunk_end)
++ {
++ __to_next += __conv;
++ __ret = partial;
++ }
++ else
++ {
++ __from_next = __from_chunk_end;
++ __to_next += __conv;
++ }
++
++ if (__from_next < __from_end && __ret == ok)
++ {
++ extern_type __buf[MB_LEN_MAX];
++ __tmp_state = __state;
++ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
++ if (__conv > static_cast<size_t>(__to_end - __to_next))
++ __ret = partial;
++ else
++ {
++ memcpy(__to_next, __buf, __conv);
++ __state = __tmp_state;
++ __to_next += __conv;
++ ++__from_next;
++ }
++ }
++ }
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++
++ return __ret;
++ }
++
++ codecvt_base::result
++ codecvt<wchar_t, char, mbstate_t>::
++ do_in(state_type& __state, const extern_type* __from,
++ const extern_type* __from_end, const extern_type*& __from_next,
++ intern_type* __to, intern_type* __to_end,
++ intern_type*& __to_next) const
++ {
++ result __ret = ok;
++ state_type __tmp_state(__state);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++
++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
++ // in case we store a L'\0' and then continue, in a loop.
++ // NB: mbsnrtowcs is a GNU extension
++ for (__from_next = __from, __to_next = __to;
++ __from_next < __from_end && __to_next < __to_end
++ && __ret == ok;)
++ {
++ const extern_type* __from_chunk_end;
++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
++ __from_end
++ - __from_next));
++ if (!__from_chunk_end)
++ __from_chunk_end = __from_end;
++
++ __from = __from_next;
++ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
++ __from_chunk_end - __from_next,
++ __to_end - __to_next, &__state);
++ if (__conv == static_cast<size_t>(-1))
++ {
++ // In case of error, in order to stop at the exact place we
++ // have to start again from the beginning with a series of
++ // mbrtowc.
++ for (;; ++__to_next, __from += __conv)
++ {
++ __conv = mbrtowc(__to_next, __from, __from_end - __from,
++ &__tmp_state);
++ if (__conv == static_cast<size_t>(-1)
++ || __conv == static_cast<size_t>(-2))
++ break;
++ }
++ __from_next = __from;
++ __state = __tmp_state;
++ __ret = error;
++ }
++ else if (__from_next && __from_next < __from_chunk_end)
++ {
++ // It is unclear what to return in this case (see DR 382).
++ __to_next += __conv;
++ __ret = partial;
++ }
++ else
++ {
++ __from_next = __from_chunk_end;
++ __to_next += __conv;
++ }
++
++ if (__from_next < __from_end && __ret == ok)
++ {
++ if (__to_next < __to_end)
++ {
++ // XXX Probably wrong for stateful encodings
++ __tmp_state = __state;
++ ++__from_next;
++ *__to_next++ = L'\0';
++ }
++ else
++ __ret = partial;
++ }
++ }
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++
++ return __ret;
++ }
++
++ int
++ codecvt<wchar_t, char, mbstate_t>::
++ do_encoding() const throw()
++ {
++ // XXX This implementation assumes that the encoding is
++ // stateless and is either single-byte or variable-width.
++ int __ret = 0;
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++ if (MB_CUR_MAX == 1)
++ __ret = 1;
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++ return __ret;
++ }
++
++ int
++ codecvt<wchar_t, char, mbstate_t>::
++ do_max_length() const throw()
++ {
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++ // XXX Probably wrong for stateful encodings.
++ int __ret = MB_CUR_MAX;
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++ return __ret;
++ }
++
++ int
++ codecvt<wchar_t, char, mbstate_t>::
++ do_length(state_type& __state, const extern_type* __from,
++ const extern_type* __end, size_t __max) const
++ {
++ int __ret = 0;
++ state_type __tmp_state(__state);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++
++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
++ // in case we advance past it and then continue, in a loop.
++ // NB: mbsnrtowcs is a GNU extension
++
++ // A dummy internal buffer is needed in order for mbsnrtocws to consider
++ // its fourth parameter (it wouldn't with NULL as first parameter).
++ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
++ * __max));
++ while (__from < __end && __max)
++ {
++ const extern_type* __from_chunk_end;
++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
++ __end
++ - __from));
++ if (!__from_chunk_end)
++ __from_chunk_end = __end;
++
++ const extern_type* __tmp_from = __from;
++ size_t __conv = mbsnrtowcs(__to, &__from,
++ __from_chunk_end - __from,
++ __max, &__state);
++ if (__conv == static_cast<size_t>(-1))
++ {
++ // In case of error, in order to stop at the exact place we
++ // have to start again from the beginning with a series of
++ // mbrtowc.
++ for (__from = __tmp_from;; __from += __conv)
++ {
++ __conv = mbrtowc(NULL, __from, __end - __from,
++ &__tmp_state);
++ if (__conv == static_cast<size_t>(-1)
++ || __conv == static_cast<size_t>(-2))
++ break;
++ }
++ __state = __tmp_state;
++ __ret += __from - __tmp_from;
++ break;
++ }
++ if (!__from)
++ __from = __from_chunk_end;
++
++ __ret += __from - __tmp_from;
++ __max -= __conv;
++
++ if (__from < __end && __max)
++ {
++ // XXX Probably wrong for stateful encodings
++ __tmp_state = __state;
++ ++__from;
++ ++__ret;
++ --__max;
++ }
++ }
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++
++ return __ret;
++ }
++#endif
++}
+Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/collate_members.cc
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/collate_members.cc 2012-04-10 10:30:37.327368356 -0700
+@@ -0,0 +1,80 @@
++// std::collate implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#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
++ // be put there instead of here.
++ template<>
++ int
++ collate<char>::_M_compare(const char* __one, const char* __two) const
++ {
++ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
++ }
++
++ template<>
++ size_t
++ collate<char>::_M_transform(char* __to, const char* __from,
++ size_t __n) const
++ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ template<>
++ int
++ collate<wchar_t>::_M_compare(const wchar_t* __one,
++ const wchar_t* __two) const
++ {
++ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
++ }
++
++ template<>
++ size_t
++ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
++ size_t __n) const
++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
++#endif
++}
+Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/ctype_members.cc
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2012-04-10 10:30:37.331368420 -0700
+@@ -0,0 +1,300 @@
++// std::ctype implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#define _LIBC
++#include <locale>
++#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
++ // various /config/os/* files.
++ template<>
++ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
++ : ctype<char>(0, false, __refs)
++ {
++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
++ {
++ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
++ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
++#ifdef __UCLIBC_HAS_XLOCALE__
++ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
++ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
++ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
++#endif
++ }
++ }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ ctype<wchar_t>::__wmask_type
++ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
++ {
++ __wmask_type __ret;
++ switch (__m)
++ {
++ case space:
++ __ret = __wctype_l("space", _M_c_locale_ctype);
++ break;
++ case print:
++ __ret = __wctype_l("print", _M_c_locale_ctype);
++ break;
++ case cntrl:
++ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
++ break;
++ case upper:
++ __ret = __wctype_l("upper", _M_c_locale_ctype);
++ break;
++ case lower:
++ __ret = __wctype_l("lower", _M_c_locale_ctype);
++ break;
++ case alpha:
++ __ret = __wctype_l("alpha", _M_c_locale_ctype);
++ break;
++ case digit:
++ __ret = __wctype_l("digit", _M_c_locale_ctype);
++ break;
++ case punct:
++ __ret = __wctype_l("punct", _M_c_locale_ctype);
++ break;
++ case xdigit:
++ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
++ break;
++ case alnum:
++ __ret = __wctype_l("alnum", _M_c_locale_ctype);
++ break;
++ case graph:
++ __ret = __wctype_l("graph", _M_c_locale_ctype);
++ break;
++ default:
++ __ret = __wmask_type();
++ }
++ return __ret;
++ }
++
++ wchar_t
++ ctype<wchar_t>::do_toupper(wchar_t __c) const
++ { return __towupper_l(__c, _M_c_locale_ctype); }
++
++ const wchar_t*
++ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
++ {
++ while (__lo < __hi)
++ {
++ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
++ ++__lo;
++ }
++ return __hi;
++ }
++
++ wchar_t
++ ctype<wchar_t>::do_tolower(wchar_t __c) const
++ { return __towlower_l(__c, _M_c_locale_ctype); }
++
++ const wchar_t*
++ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
++ {
++ while (__lo < __hi)
++ {
++ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
++ ++__lo;
++ }
++ return __hi;
++ }
++
++ bool
++ ctype<wchar_t>::
++ do_is(mask __m, wchar_t __c) const
++ {
++ // Highest bitmask in ctype_base == 10, but extra in "C"
++ // library for blank.
++ 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;
++ }
++ return __ret;
++ }
++
++ const wchar_t*
++ ctype<wchar_t>::
++ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
++ {
++ for (; __lo < __hi; ++__vec, ++__lo)
++ {
++ // Highest bitmask in ctype_base == 10, but extra in "C"
++ // library for blank.
++ const size_t __bitmasksize = 11;
++ mask __m = 0;
++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
++ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
++ __m |= _M_bit[__bitcur];
++ *__vec = __m;
++ }
++ return __hi;
++ }
++
++ const wchar_t*
++ ctype<wchar_t>::
++ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
++ {
++ while (__lo < __hi && !this->do_is(__m, *__lo))
++ ++__lo;
++ return __lo;
++ }
++
++ const wchar_t*
++ ctype<wchar_t>::
++ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
++ {
++ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
++ ++__lo;
++ return __lo;
++ }
++
++ wchar_t
++ ctype<wchar_t>::
++ do_widen(char __c) const
++ { return _M_widen[static_cast<unsigned char>(__c)]; }
++
++ const char*
++ ctype<wchar_t>::
++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
++ {
++ while (__lo < __hi)
++ {
++ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
++ ++__lo;
++ ++__dest;
++ }
++ return __hi;
++ }
++
++ char
++ ctype<wchar_t>::
++ do_narrow(wchar_t __wc, char __dfault) const
++ {
++ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
++ return _M_narrow[__wc];
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_ctype);
++#endif
++ const int __c = wctob(__wc);
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++ return (__c == EOF ? __dfault : static_cast<char>(__c));
++ }
++
++ const wchar_t*
++ ctype<wchar_t>::
++ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
++ char* __dest) const
++ {
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_ctype);
++#endif
++ if (_M_narrow_ok)
++ while (__lo < __hi)
++ {
++ if (*__lo >= 0 && *__lo < 128)
++ *__dest = _M_narrow[*__lo];
++ else
++ {
++ const int __c = wctob(*__lo);
++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
++ }
++ ++__lo;
++ ++__dest;
++ }
++ else
++ while (__lo < __hi)
++ {
++ const int __c = wctob(*__lo);
++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
++ ++__lo;
++ ++__dest;
++ }
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++ return __hi;
++ }
++
++ void
++ ctype<wchar_t>::_M_initialize_ctype()
++ {
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_ctype);
++#endif
++ wint_t __i;
++ for (__i = 0; __i < 128; ++__i)
++ {
++ const int __c = wctob(__i);
++ if (__c == EOF)
++ break;
++ else
++ _M_narrow[__i] = static_cast<char>(__c);
++ }
++ if (__i == 128)
++ _M_narrow_ok = true;
++ else
++ _M_narrow_ok = false;
++ for (size_t __j = 0;
++ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
++ _M_widen[__j] = btowc(__j);
++
++ for (size_t __k = 0; __k <= 11; ++__k)
++ {
++ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
++ }
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#endif
++ }
++#endif // _GLIBCXX_USE_WCHAR_T
++}
+Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/messages_members.cc
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/messages_members.cc 2012-04-10 10:30:37.331368420 -0700
+@@ -0,0 +1,100 @@
++// std::messages implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#include <locale>
++#include <bits/c++locale_internal.h>
++
++#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)
++#else
++#undef gettext
++#define gettext(msgid) (msgid)
++#endif
++
++namespace std
++{
++ // Specializations.
++ template<>
++ string
++ messages<char>::do_get(catalog, int, int, const string& __dfault) const
++ {
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_messages);
++ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
++ __uselocale(__old);
++ return string(__msg);
++#elif defined __UCLIBC_HAS_LOCALE__
++ char* __old = strdup(setlocale(LC_ALL, NULL));
++ setlocale(LC_ALL, _M_name_messages);
++ const char* __msg = gettext(__dfault.c_str());
++ setlocale(LC_ALL, __old);
++ free(__old);
++ return string(__msg);
++#else
++ const char* __msg = gettext(__dfault.c_str());
++ return string(__msg);
++#endif
++ }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ template<>
++ wstring
++ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
++ {
++# ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(_M_c_locale_messages);
++ char* __msg = gettext(_M_convert_to_char(__dfault));
++ __uselocale(__old);
++ return _M_convert_from_char(__msg);
++# elif defined __UCLIBC_HAS_LOCALE__
++ char* __old = strdup(setlocale(LC_ALL, NULL));
++ setlocale(LC_ALL, _M_name_messages);
++ char* __msg = gettext(_M_convert_to_char(__dfault));
++ setlocale(LC_ALL, __old);
++ free(__old);
++ return _M_convert_from_char(__msg);
++# else
++ char* __msg = gettext(_M_convert_to_char(__dfault));
++ return _M_convert_from_char(__msg);
++# endif
++ }
++#endif
++}
+Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/messages_members.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/messages_members.h 2012-04-10 10:30:37.331368420 -0700
+@@ -0,0 +1,118 @@
++// std::messages implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.7.1.2 messages functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#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)
++#endif
++
++ // Non-virtual member functions.
++ 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())
++ { }
++
++ 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)
++ {
++ char* __tmp = new char[std::strlen(__s) + 1];
++ std::strcpy(__tmp, __s);
++ _M_name_messages = __tmp;
++ }
++
++ template<typename _CharT>
++ typename messages<_CharT>::catalog
++ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
++ const char* __dir) const
++ {
++ __bindtextdomain(__s.c_str(), __dir);
++ return this->do_open(__s, __loc);
++ }
++
++ // Virtual member functions.
++ template<typename _CharT>
++ messages<_CharT>::~messages()
++ {
++ if (_M_name_messages != _S_get_c_name())
++ delete [] _M_name_messages;
++ _S_destroy_c_locale(_M_c_locale_messages);
++ }
++
++ template<typename _CharT>
++ typename messages<_CharT>::catalog
++ messages<_CharT>::do_open(const basic_string<char>& __s,
++ const locale&) const
++ {
++ // No error checking is done, assume the catalog exists and can
++ // be used.
++ __textdomain(__s.c_str());
++ return 0;
++ }
++
++ template<typename _CharT>
++ void
++ messages<_CharT>::do_close(catalog) const
++ { }
++
++ // messages_byname
++ template<typename _CharT>
++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
++ : messages<_CharT>(__refs)
++ {
++ if (this->_M_name_messages != locale::facet::_S_get_c_name())
++ delete [] this->_M_name_messages;
++ char* __tmp = new char[std::strlen(__s) + 1];
++ std::strcpy(__tmp, __s);
++ this->_M_name_messages = __tmp;
++
++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
++ {
++ this->_S_destroy_c_locale(this->_M_c_locale_messages);
++ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
++ }
++ }
+Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2012-04-10 10:30:37.331368420 -0700
+@@ -0,0 +1,692 @@
++// std::moneypunct implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#define _LIBC
++#include <locale>
++#undef _LIBC
++#include <bits/c++locale_internal.h>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning optimize this for uclibc
++#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:
++ // space none symbol sign value
++ money_base::pattern
++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
++ {
++ pattern __ret;
++
++ // This insanely complicated routine attempts to construct a valid
++ // pattern for use with monyepunct. A couple of invariants:
++
++ // if (__precedes) symbol -> value
++ // else value -> symbol
++
++ // if (__space) space
++ // else none
++
++ // none == never first
++ // space never first or last
++
++ // Any elegant implementations of this are welcome.
++ switch (__posn)
++ {
++ case 0:
++ case 1:
++ // 1 The sign precedes the value and symbol.
++ __ret.field[0] = sign;
++ if (__space)
++ {
++ // Pattern starts with sign.
++ if (__precedes)
++ {
++ __ret.field[1] = symbol;
++ __ret.field[3] = value;
++ }
++ else
++ {
++ __ret.field[1] = value;
++ __ret.field[3] = symbol;
++ }
++ __ret.field[2] = space;
++ }
++ else
++ {
++ // Pattern starts with sign and ends with none.
++ if (__precedes)
++ {
++ __ret.field[1] = symbol;
++ __ret.field[2] = value;
++ }
++ else
++ {
++ __ret.field[1] = value;
++ __ret.field[2] = symbol;
++ }
++ __ret.field[3] = none;
++ }
++ break;
++ case 2:
++ // 2 The sign follows the value and symbol.
++ if (__space)
++ {
++ // Pattern either ends with sign.
++ if (__precedes)
++ {
++ __ret.field[0] = symbol;
++ __ret.field[2] = value;
++ }
++ else
++ {
++ __ret.field[0] = value;
++ __ret.field[2] = symbol;
++ }
++ __ret.field[1] = space;
++ __ret.field[3] = sign;
++ }
++ else
++ {
++ // Pattern ends with sign then none.
++ if (__precedes)
++ {
++ __ret.field[0] = symbol;
++ __ret.field[1] = value;
++ }
++ else
++ {
++ __ret.field[0] = value;
++ __ret.field[1] = symbol;
++ }
++ __ret.field[2] = sign;
++ __ret.field[3] = none;
++ }
++ break;
++ case 3:
++ // 3 The sign immediately precedes the symbol.
++ if (__precedes)
++ {
++ __ret.field[0] = sign;
++ __ret.field[1] = symbol;
++ if (__space)
++ {
++ __ret.field[2] = space;
++ __ret.field[3] = value;
++ }
++ else
++ {
++ __ret.field[2] = value;
++ __ret.field[3] = none;
++ }
++ }
++ else
++ {
++ __ret.field[0] = value;
++ if (__space)
++ {
++ __ret.field[1] = space;
++ __ret.field[2] = sign;
++ __ret.field[3] = symbol;
++ }
++ else
++ {
++ __ret.field[1] = sign;
++ __ret.field[2] = symbol;
++ __ret.field[3] = none;
++ }
++ }
++ break;
++ case 4:
++ // 4 The sign immediately follows the symbol.
++ if (__precedes)
++ {
++ __ret.field[0] = symbol;
++ __ret.field[1] = sign;
++ if (__space)
++ {
++ __ret.field[2] = space;
++ __ret.field[3] = value;
++ }
++ else
++ {
++ __ret.field[2] = value;
++ __ret.field[3] = none;
++ }
++ }
++ else
++ {
++ __ret.field[0] = value;
++ if (__space)
++ {
++ __ret.field[1] = space;
++ __ret.field[2] = symbol;
++ __ret.field[3] = sign;
++ }
++ else
++ {
++ __ret.field[1] = symbol;
++ __ret.field[2] = sign;
++ __ret.field[3] = none;
++ }
++ }
++ break;
++ default:
++ ;
++ }
++ return __ret;
++ }
++
++ template<>
++ void
++ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
++ const char*)
++ {
++ if (!_M_data)
++ _M_data = new __moneypunct_cache<char, true>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_data->_M_decimal_point = '.';
++ _M_data->_M_thousands_sep = ',';
++ _M_data->_M_grouping = "";
++ _M_data->_M_grouping_size = 0;
++ _M_data->_M_curr_symbol = "";
++ _M_data->_M_curr_symbol_size = 0;
++ _M_data->_M_positive_sign = "";
++ _M_data->_M_positive_sign_size = 0;
++ _M_data->_M_negative_sign = "";
++ _M_data->_M_negative_sign_size = 0;
++ _M_data->_M_frac_digits = 0;
++ _M_data->_M_pos_format = money_base::_S_default_pattern;
++ _M_data->_M_neg_format = money_base::_S_default_pattern;
++
++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
++ }
++ else
++ {
++ // Named locale.
++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
++ __cloc));
++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
++ __cloc));
++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
++
++ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
++ if (!__nposn)
++ _M_data->_M_negative_sign = "()";
++ else
++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
++ __cloc);
++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
++
++ // _Intl == true
++ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
++ __cloc));
++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
++ __pposn);
++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
++ __nposn);
++ }
++ }
++
++ template<>
++ void
++ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
++ const char*)
++ {
++ if (!_M_data)
++ _M_data = new __moneypunct_cache<char, false>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_data->_M_decimal_point = '.';
++ _M_data->_M_thousands_sep = ',';
++ _M_data->_M_grouping = "";
++ _M_data->_M_grouping_size = 0;
++ _M_data->_M_curr_symbol = "";
++ _M_data->_M_curr_symbol_size = 0;
++ _M_data->_M_positive_sign = "";
++ _M_data->_M_positive_sign_size = 0;
++ _M_data->_M_negative_sign = "";
++ _M_data->_M_negative_sign_size = 0;
++ _M_data->_M_frac_digits = 0;
++ _M_data->_M_pos_format = money_base::_S_default_pattern;
++ _M_data->_M_neg_format = money_base::_S_default_pattern;
++
++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
++ }
++ else
++ {
++ // Named locale.
++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
++ __cloc));
++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
++ __cloc));
++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
++
++ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
++ if (!__nposn)
++ _M_data->_M_negative_sign = "()";
++ else
++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
++ __cloc);
++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
++
++ // _Intl == false
++ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
++ __pposn);
++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
++ __nposn);
++ }
++ }
++
++ template<>
++ moneypunct<char, true>::~moneypunct()
++ { delete _M_data; }
++
++ template<>
++ moneypunct<char, false>::~moneypunct()
++ { delete _M_data; }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ template<>
++ void
++ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
++#ifdef __UCLIBC_HAS_XLOCALE__
++ const char*)
++#else
++ const char* __name)
++#endif
++ {
++ if (!_M_data)
++ _M_data = new __moneypunct_cache<wchar_t, true>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_data->_M_decimal_point = L'.';
++ _M_data->_M_thousands_sep = L',';
++ _M_data->_M_grouping = "";
++ _M_data->_M_grouping_size = 0;
++ _M_data->_M_curr_symbol = L"";
++ _M_data->_M_curr_symbol_size = 0;
++ _M_data->_M_positive_sign = L"";
++ _M_data->_M_positive_sign_size = 0;
++ _M_data->_M_negative_sign = L"";
++ _M_data->_M_negative_sign_size = 0;
++ _M_data->_M_frac_digits = 0;
++ _M_data->_M_pos_format = money_base::_S_default_pattern;
++ _M_data->_M_neg_format = money_base::_S_default_pattern;
++
++ // Use ctype::widen code without the facet...
++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
++ _M_data->_M_atoms[__i] =
++ static_cast<wchar_t>(money_base::_S_atoms[__i]);
++ }
++ else
++ {
++ // Named locale.
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(__cloc);
++#else
++ // Switch to named locale so that mbsrtowcs will work.
++ char* __old = strdup(setlocale(LC_ALL, NULL));
++ setlocale(LC_ALL, __name);
++#endif
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix this... should be monetary
++#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;
++# else
++ _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_MONETARY_DECIMAL_POINT_WC, __cloc);
++ _M_data->_M_decimal_point = __u.__w;
++
++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
++ _M_data->_M_thousands_sep = __u.__w;
++#endif
++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++
++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
++
++ wchar_t* __wcs_ps = 0;
++ wchar_t* __wcs_ns = 0;
++ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
++ try
++ {
++ mbstate_t __state;
++ size_t __len = strlen(__cpossign);
++ if (__len)
++ {
++ ++__len;
++ memset(&__state, 0, sizeof(mbstate_t));
++ __wcs_ps = new wchar_t[__len];
++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
++ _M_data->_M_positive_sign = __wcs_ps;
++ }
++ else
++ _M_data->_M_positive_sign = L"";
++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
++
++ __len = strlen(__cnegsign);
++ if (!__nposn)
++ _M_data->_M_negative_sign = L"()";
++ else if (__len)
++ {
++ ++__len;
++ memset(&__state, 0, sizeof(mbstate_t));
++ __wcs_ns = new wchar_t[__len];
++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
++ _M_data->_M_negative_sign = __wcs_ns;
++ }
++ else
++ _M_data->_M_negative_sign = L"";
++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
++
++ // _Intl == true.
++ __len = strlen(__ccurr);
++ if (__len)
++ {
++ ++__len;
++ memset(&__state, 0, sizeof(mbstate_t));
++ wchar_t* __wcs = new wchar_t[__len];
++ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
++ _M_data->_M_curr_symbol = __wcs;
++ }
++ else
++ _M_data->_M_curr_symbol = L"";
++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
++ }
++ catch (...)
++ {
++ delete _M_data;
++ _M_data = 0;
++ delete __wcs_ps;
++ delete __wcs_ns;
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#else
++ setlocale(LC_ALL, __old);
++ free(__old);
++#endif
++ __throw_exception_again;
++ }
++
++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
++ __cloc));
++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
++ __pposn);
++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
++ __nposn);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#else
++ setlocale(LC_ALL, __old);
++ free(__old);
++#endif
++ }
++ }
++
++ template<>
++ void
++ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
++#ifdef __UCLIBC_HAS_XLOCALE__
++ const char*)
++#else
++ const char* __name)
++#endif
++ {
++ if (!_M_data)
++ _M_data = new __moneypunct_cache<wchar_t, false>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_data->_M_decimal_point = L'.';
++ _M_data->_M_thousands_sep = L',';
++ _M_data->_M_grouping = "";
++ _M_data->_M_grouping_size = 0;
++ _M_data->_M_curr_symbol = L"";
++ _M_data->_M_curr_symbol_size = 0;
++ _M_data->_M_positive_sign = L"";
++ _M_data->_M_positive_sign_size = 0;
++ _M_data->_M_negative_sign = L"";
++ _M_data->_M_negative_sign_size = 0;
++ _M_data->_M_frac_digits = 0;
++ _M_data->_M_pos_format = money_base::_S_default_pattern;
++ _M_data->_M_neg_format = money_base::_S_default_pattern;
++
++ // Use ctype::widen code without the facet...
++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
++ _M_data->_M_atoms[__i] =
++ static_cast<wchar_t>(money_base::_S_atoms[__i]);
++ }
++ else
++ {
++ // Named locale.
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __c_locale __old = __uselocale(__cloc);
++#else
++ // Switch to named locale so that mbsrtowcs will work.
++ char* __old = strdup(setlocale(LC_ALL, NULL));
++ setlocale(LC_ALL, __name);
++#endif
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix this... should be monetary
++#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;
++# else
++ _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_MONETARY_DECIMAL_POINT_WC, __cloc);
++ _M_data->_M_decimal_point = __u.__w;
++
++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
++ _M_data->_M_thousands_sep = __u.__w;
++#endif
++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++
++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
++
++ wchar_t* __wcs_ps = 0;
++ wchar_t* __wcs_ns = 0;
++ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
++ try
++ {
++ mbstate_t __state;
++ size_t __len;
++ __len = strlen(__cpossign);
++ if (__len)
++ {
++ ++__len;
++ memset(&__state, 0, sizeof(mbstate_t));
++ __wcs_ps = new wchar_t[__len];
++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
++ _M_data->_M_positive_sign = __wcs_ps;
++ }
++ else
++ _M_data->_M_positive_sign = L"";
++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
++
++ __len = strlen(__cnegsign);
++ if (!__nposn)
++ _M_data->_M_negative_sign = L"()";
++ else if (__len)
++ {
++ ++__len;
++ memset(&__state, 0, sizeof(mbstate_t));
++ __wcs_ns = new wchar_t[__len];
++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
++ _M_data->_M_negative_sign = __wcs_ns;
++ }
++ else
++ _M_data->_M_negative_sign = L"";
++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
++
++ // _Intl == true.
++ __len = strlen(__ccurr);
++ if (__len)
++ {
++ ++__len;
++ memset(&__state, 0, sizeof(mbstate_t));
++ wchar_t* __wcs = new wchar_t[__len];
++ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
++ _M_data->_M_curr_symbol = __wcs;
++ }
++ else
++ _M_data->_M_curr_symbol = L"";
++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
++ }
++ catch (...)
++ {
++ delete _M_data;
++ _M_data = 0;
++ delete __wcs_ps;
++ delete __wcs_ns;
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#else
++ setlocale(LC_ALL, __old);
++ free(__old);
++#endif
++ __throw_exception_again;
++ }
++
++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
++ __pposn);
++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
++ __nposn);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __uselocale(__old);
++#else
++ setlocale(LC_ALL, __old);
++ free(__old);
++#endif
++ }
++ }
++
++ template<>
++ moneypunct<wchar_t, true>::~moneypunct()
++ {
++ if (_M_data->_M_positive_sign_size)
++ delete [] _M_data->_M_positive_sign;
++ if (_M_data->_M_negative_sign_size
++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
++ delete [] _M_data->_M_negative_sign;
++ if (_M_data->_M_curr_symbol_size)
++ delete [] _M_data->_M_curr_symbol;
++ delete _M_data;
++ }
++
++ template<>
++ moneypunct<wchar_t, false>::~moneypunct()
++ {
++ if (_M_data->_M_positive_sign_size)
++ delete [] _M_data->_M_positive_sign;
++ if (_M_data->_M_negative_sign_size
++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
++ delete [] _M_data->_M_negative_sign;
++ if (_M_data->_M_curr_symbol_size)
++ delete [] _M_data->_M_curr_symbol;
++ delete _M_data;
++ }
++#endif
++}
+Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2012-04-10 10:30:37.331368420 -0700
+@@ -0,0 +1,160 @@
++// std::numpunct implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#define _LIBC
++#include <locale>
++#undef _LIBC
++#include <bits/c++locale_internal.h>
++
++#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
++{
++ template<>
++ void
++ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
++ {
++ if (!_M_data)
++ _M_data = new __numpunct_cache<char>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_data->_M_grouping = "";
++ _M_data->_M_grouping_size = 0;
++ _M_data->_M_use_grouping = false;
++
++ _M_data->_M_decimal_point = '.';
++ _M_data->_M_thousands_sep = ',';
++
++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
++ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
++
++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
++ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
++ }
++ else
++ {
++ // Named locale.
++ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
++ __cloc));
++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
++ __cloc));
++
++ // Check for NULL, which implies no grouping.
++ if (_M_data->_M_thousands_sep == '\0')
++ _M_data->_M_grouping = "";
++ else
++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++ }
++
++ // NB: There is no way to extact this info from posix locales.
++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
++ _M_data->_M_truename = "true";
++ _M_data->_M_truename_size = 4;
++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
++ _M_data->_M_falsename = "false";
++ _M_data->_M_falsename_size = 5;
++ }
++
++ template<>
++ numpunct<char>::~numpunct()
++ { delete _M_data; }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ template<>
++ void
++ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
++ {
++ if (!_M_data)
++ _M_data = new __numpunct_cache<wchar_t>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_data->_M_grouping = "";
++ _M_data->_M_grouping_size = 0;
++ _M_data->_M_use_grouping = false;
++
++ _M_data->_M_decimal_point = L'.';
++ _M_data->_M_thousands_sep = L',';
++
++ // Use ctype::widen code without the facet...
++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
++ _M_data->_M_atoms_out[__i] =
++ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
++
++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
++ _M_data->_M_atoms_in[__j] =
++ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
++ }
++ else
++ {
++ // Named locale.
++ // NB: In the GNU model wchar_t is always 32 bit wide.
++ 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;
++
++ if (_M_data->_M_thousands_sep == L'\0')
++ _M_data->_M_grouping = "";
++ else
++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++ }
++
++ // NB: There is no way to extact this info from posix locales.
++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
++ _M_data->_M_truename = L"true";
++ _M_data->_M_truename_size = 4;
++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
++ _M_data->_M_falsename = L"false";
++ _M_data->_M_falsename_size = 5;
++ }
++
++ template<>
++ numpunct<wchar_t>::~numpunct()
++ { delete _M_data; }
++ #endif
++}
+Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/time_members.cc
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/time_members.cc 2012-04-10 10:30:37.331368420 -0700
+@@ -0,0 +1,406 @@
++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++#include <locale>
++#include <bits/c++locale_internal.h>
++
++#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
++{
++ template<>
++ void
++ __timepunct<char>::
++ _M_put(char* __s, size_t __maxlen, const char* __format,
++ const tm* __tm) const
++ {
++#ifdef __UCLIBC_HAS_XLOCALE__
++ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
++ _M_c_locale_timepunct);
++#else
++ char* __old = strdup(setlocale(LC_ALL, NULL));
++ setlocale(LC_ALL, _M_name_timepunct);
++ const size_t __len = strftime(__s, __maxlen, __format, __tm);
++ setlocale(LC_ALL, __old);
++ free(__old);
++#endif
++ // Make sure __s is null terminated.
++ if (__len == 0)
++ __s[0] = '\0';
++ }
++
++ template<>
++ void
++ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
++ {
++ if (!_M_data)
++ _M_data = new __timepunct_cache<char>;
++
++ if (!__cloc)
++ {
++ // "C" locale
++ _M_c_locale_timepunct = _S_get_c_locale();
++
++ _M_data->_M_date_format = "%m/%d/%y";
++ _M_data->_M_date_era_format = "%m/%d/%y";
++ _M_data->_M_time_format = "%H:%M:%S";
++ _M_data->_M_time_era_format = "%H:%M:%S";
++ _M_data->_M_date_time_format = "";
++ _M_data->_M_date_time_era_format = "";
++ _M_data->_M_am = "AM";
++ _M_data->_M_pm = "PM";
++ _M_data->_M_am_pm_format = "";
++
++ // Day names, starting with "C"'s Sunday.
++ _M_data->_M_day1 = "Sunday";
++ _M_data->_M_day2 = "Monday";
++ _M_data->_M_day3 = "Tuesday";
++ _M_data->_M_day4 = "Wednesday";
++ _M_data->_M_day5 = "Thursday";
++ _M_data->_M_day6 = "Friday";
++ _M_data->_M_day7 = "Saturday";
++
++ // Abbreviated day names, starting with "C"'s Sun.
++ _M_data->_M_aday1 = "Sun";
++ _M_data->_M_aday2 = "Mon";
++ _M_data->_M_aday3 = "Tue";
++ _M_data->_M_aday4 = "Wed";
++ _M_data->_M_aday5 = "Thu";
++ _M_data->_M_aday6 = "Fri";
++ _M_data->_M_aday7 = "Sat";
++
++ // Month names, starting with "C"'s January.
++ _M_data->_M_month01 = "January";
++ _M_data->_M_month02 = "February";
++ _M_data->_M_month03 = "March";
++ _M_data->_M_month04 = "April";
++ _M_data->_M_month05 = "May";
++ _M_data->_M_month06 = "June";
++ _M_data->_M_month07 = "July";
++ _M_data->_M_month08 = "August";
++ _M_data->_M_month09 = "September";
++ _M_data->_M_month10 = "October";
++ _M_data->_M_month11 = "November";
++ _M_data->_M_month12 = "December";
++
++ // Abbreviated month names, starting with "C"'s Jan.
++ _M_data->_M_amonth01 = "Jan";
++ _M_data->_M_amonth02 = "Feb";
++ _M_data->_M_amonth03 = "Mar";
++ _M_data->_M_amonth04 = "Apr";
++ _M_data->_M_amonth05 = "May";
++ _M_data->_M_amonth06 = "Jun";
++ _M_data->_M_amonth07 = "Jul";
++ _M_data->_M_amonth08 = "Aug";
++ _M_data->_M_amonth09 = "Sep";
++ _M_data->_M_amonth10 = "Oct";
++ _M_data->_M_amonth11 = "Nov";
++ _M_data->_M_amonth12 = "Dec";
++ }
++ else
++ {
++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
++
++ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
++ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
++ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
++ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
++ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
++ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
++ __cloc);
++ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
++ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
++ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
++
++ // Day names, starting with "C"'s Sunday.
++ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
++ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
++ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
++ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
++ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
++ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
++ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
++
++ // Abbreviated day names, starting with "C"'s Sun.
++ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
++ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
++ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
++ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
++ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
++ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
++ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
++
++ // Month names, starting with "C"'s January.
++ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
++ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
++ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
++ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
++ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
++ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
++ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
++ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
++ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
++ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
++ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
++ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
++
++ // Abbreviated month names, starting with "C"'s Jan.
++ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
++ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
++ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
++ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
++ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
++ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
++ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
++ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
++ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
++ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
++ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
++ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
++ }
++ }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ template<>
++ void
++ __timepunct<wchar_t>::
++ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
++ const tm* __tm) const
++ {
++#ifdef __UCLIBC_HAS_XLOCALE__
++ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
++ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
++ _M_c_locale_timepunct);
++#else
++ char* __old = strdup(setlocale(LC_ALL, NULL));
++ setlocale(LC_ALL, _M_name_timepunct);
++ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
++ setlocale(LC_ALL, __old);
++ free(__old);
++#endif
++ // Make sure __s is null terminated.
++ if (__len == 0)
++ __s[0] = L'\0';
++ }
++
++ template<>
++ void
++ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
++ {
++ if (!_M_data)
++ _M_data = new __timepunct_cache<wchar_t>;
++
++#warning wide time stuff
++// if (!__cloc)
++ {
++ // "C" locale
++ _M_c_locale_timepunct = _S_get_c_locale();
++
++ _M_data->_M_date_format = L"%m/%d/%y";
++ _M_data->_M_date_era_format = L"%m/%d/%y";
++ _M_data->_M_time_format = L"%H:%M:%S";
++ _M_data->_M_time_era_format = L"%H:%M:%S";
++ _M_data->_M_date_time_format = L"";
++ _M_data->_M_date_time_era_format = L"";
++ _M_data->_M_am = L"AM";
++ _M_data->_M_pm = L"PM";
++ _M_data->_M_am_pm_format = L"";
++
++ // Day names, starting with "C"'s Sunday.
++ _M_data->_M_day1 = L"Sunday";
++ _M_data->_M_day2 = L"Monday";
++ _M_data->_M_day3 = L"Tuesday";
++ _M_data->_M_day4 = L"Wednesday";
++ _M_data->_M_day5 = L"Thursday";
++ _M_data->_M_day6 = L"Friday";
++ _M_data->_M_day7 = L"Saturday";
++
++ // Abbreviated day names, starting with "C"'s Sun.
++ _M_data->_M_aday1 = L"Sun";
++ _M_data->_M_aday2 = L"Mon";
++ _M_data->_M_aday3 = L"Tue";
++ _M_data->_M_aday4 = L"Wed";
++ _M_data->_M_aday5 = L"Thu";
++ _M_data->_M_aday6 = L"Fri";
++ _M_data->_M_aday7 = L"Sat";
++
++ // Month names, starting with "C"'s January.
++ _M_data->_M_month01 = L"January";
++ _M_data->_M_month02 = L"February";
++ _M_data->_M_month03 = L"March";
++ _M_data->_M_month04 = L"April";
++ _M_data->_M_month05 = L"May";
++ _M_data->_M_month06 = L"June";
++ _M_data->_M_month07 = L"July";
++ _M_data->_M_month08 = L"August";
++ _M_data->_M_month09 = L"September";
++ _M_data->_M_month10 = L"October";
++ _M_data->_M_month11 = L"November";
++ _M_data->_M_month12 = L"December";
++
++ // Abbreviated month names, starting with "C"'s Jan.
++ _M_data->_M_amonth01 = L"Jan";
++ _M_data->_M_amonth02 = L"Feb";
++ _M_data->_M_amonth03 = L"Mar";
++ _M_data->_M_amonth04 = L"Apr";
++ _M_data->_M_amonth05 = L"May";
++ _M_data->_M_amonth06 = L"Jun";
++ _M_data->_M_amonth07 = L"Jul";
++ _M_data->_M_amonth08 = L"Aug";
++ _M_data->_M_amonth09 = L"Sep";
++ _M_data->_M_amonth10 = L"Oct";
++ _M_data->_M_amonth11 = L"Nov";
++ _M_data->_M_amonth12 = L"Dec";
++ }
++#if 0
++ else
++ {
++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
++
++ union { char *__s; wchar_t *__w; } __u;
++
++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
++ _M_data->_M_date_format = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
++ _M_data->_M_date_era_format = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
++ _M_data->_M_time_format = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
++ _M_data->_M_time_era_format = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
++ _M_data->_M_date_time_format = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
++ _M_data->_M_date_time_era_format = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
++ _M_data->_M_am = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
++ _M_data->_M_pm = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
++ _M_data->_M_am_pm_format = __u.__w;
++
++ // Day names, starting with "C"'s Sunday.
++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
++ _M_data->_M_day1 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
++ _M_data->_M_day2 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
++ _M_data->_M_day3 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
++ _M_data->_M_day4 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
++ _M_data->_M_day5 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
++ _M_data->_M_day6 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
++ _M_data->_M_day7 = __u.__w;
++
++ // Abbreviated day names, starting with "C"'s Sun.
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
++ _M_data->_M_aday1 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
++ _M_data->_M_aday2 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
++ _M_data->_M_aday3 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
++ _M_data->_M_aday4 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
++ _M_data->_M_aday5 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
++ _M_data->_M_aday6 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
++ _M_data->_M_aday7 = __u.__w;
++
++ // Month names, starting with "C"'s January.
++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
++ _M_data->_M_month01 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
++ _M_data->_M_month02 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
++ _M_data->_M_month03 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
++ _M_data->_M_month04 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
++ _M_data->_M_month05 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
++ _M_data->_M_month06 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
++ _M_data->_M_month07 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
++ _M_data->_M_month08 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
++ _M_data->_M_month09 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
++ _M_data->_M_month10 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
++ _M_data->_M_month11 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
++ _M_data->_M_month12 = __u.__w;
++
++ // Abbreviated month names, starting with "C"'s Jan.
++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
++ _M_data->_M_amonth01 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
++ _M_data->_M_amonth02 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
++ _M_data->_M_amonth03 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
++ _M_data->_M_amonth04 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
++ _M_data->_M_amonth05 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
++ _M_data->_M_amonth06 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
++ _M_data->_M_amonth07 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
++ _M_data->_M_amonth08 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
++ _M_data->_M_amonth09 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
++ _M_data->_M_amonth10 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
++ _M_data->_M_amonth11 = __u.__w;
++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
++ _M_data->_M_amonth12 = __u.__w;
++ }
++#endif // 0
++ }
++#endif
++}
+Index: gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/time_members.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/libstdc++-v3/config/locale/uclibc/time_members.h 2012-04-10 10:30:37.331368420 -0700
+@@ -0,0 +1,68 @@
++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING. If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction. Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License. This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.5.1.2 - time_get functions
++// ISO C++ 14882: 22.2.5.3.2 - time_put functions
++//
++
++// Written by Benjamin Kosnik <bkoz@redhat.com>
++
++ 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_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_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)
++ {
++ char* __tmp = new char[std::strlen(__s) + 1];
++ std::strcpy(__tmp, __s);
++ _M_name_timepunct = __tmp;
++ _M_initialize_timepunct(__cloc);
++ }
++
++ template<typename _CharT>
++ __timepunct<_CharT>::~__timepunct()
++ {
++ if (_M_name_timepunct != _S_get_c_name())
++ delete [] _M_name_timepunct;
++ delete _M_data;
++ _S_destroy_c_locale(_M_c_locale_timepunct);
++ }
+Index: gcc-4_7-branch/libstdc++-v3/configure
+===================================================================
+--- gcc-4_7-branch.orig/libstdc++-v3/configure 2012-04-10 10:19:50.383337127 -0700
++++ gcc-4_7-branch/libstdc++-v3/configure 2012-04-10 10:30:37.347368481 -0700
+@@ -15736,6 +15736,9 @@
+ # Default to "generic".
+ if test $enable_clocale_flag = auto; then
+ case ${target_os} in
++ *-uclibc*)
++ enable_clocale_flag=uclibc
++ ;;
+ linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
+ enable_clocale_flag=gnu
+ ;;
+@@ -15990,6 +15993,78 @@
+ CTIME_CC=config/locale/generic/time_members.cc
+ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
+ ;;
++ uclibc)
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: uclibc" >&5
++$as_echo "uclibc" >&6; }
++
++ # Declare intention to use gettext, and add support for specific
++ # languages.
++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
++ ALL_LINGUAS="de fr"
++
++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
++ # Extract the first word of "msgfmt", so it can be a program name with args.
++set dummy msgfmt; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_check_msgfmt+set}" = set; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$check_msgfmt"; then
++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++ ac_cv_prog_check_msgfmt="yes"
++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++ break 2
++ fi
++done
++ done
++IFS=$as_save_IFS
++
++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
++fi
++fi
++check_msgfmt=$ac_cv_prog_check_msgfmt
++if test -n "$check_msgfmt"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $check_msgfmt" >&5
++$as_echo "$check_msgfmt" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
++ USE_NLS=yes
++ fi
++ # Export the build objects.
++ for ling in $ALL_LINGUAS; do \
++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
++ done
++
++
++
++ CLOCALE_H=config/locale/uclibc/c_locale.h
++ CLOCALE_CC=config/locale/uclibc/c_locale.cc
++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
++ CMESSAGES_H=config/locale/uclibc/messages_members.h
++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
++ CMONEY_CC=config/locale/uclibc/monetary_members.cc
++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
++ CTIME_H=config/locale/uclibc/time_members.h
++ CTIME_CC=config/locale/uclibc/time_members.cc
++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
++ ;;
+ esac
+
+ # This is where the testsuite looks for locale catalogs, using the
+Index: gcc-4_7-branch/libstdc++-v3/include/c_compatibility/wchar.h
+===================================================================
+--- gcc-4_7-branch.orig/libstdc++-v3/include/c_compatibility/wchar.h 2012-04-10 10:19:50.303337124 -0700
++++ gcc-4_7-branch/libstdc++-v3/include/c_compatibility/wchar.h 2012-04-10 10:30:37.347368481 -0700
+@@ -101,7 +101,9 @@
+ using std::wmemcpy;
+ using std::wmemmove;
+ using std::wmemset;
++#if _GLIBCXX_HAVE_WCSFTIME
+ using std::wcsftime;
++#endif
+
+ #if _GLIBCXX_USE_C99
+ using std::wcstold;
+Index: gcc-4_7-branch/libstdc++-v3/include/c_std/cwchar
+===================================================================
+--- gcc-4_7-branch.orig/libstdc++-v3/include/c_std/cwchar 2012-04-10 10:19:50.295337124 -0700
++++ gcc-4_7-branch/libstdc++-v3/include/c_std/cwchar 2012-04-10 10:30:37.347368481 -0700
+@@ -177,7 +177,9 @@
+ using ::wcscoll;
+ using ::wcscpy;
+ using ::wcscspn;
++#if _GLIBCXX_HAVE_WCSFTIME
+ using ::wcsftime;
++#endif
+ using ::wcslen;
+ using ::wcsncat;
+ using ::wcsncmp;
diff --git a/meta-aarch64/recipes-devtools/gcc/files/203-uclibc-locale-no__x.patch b/meta-aarch64/recipes-devtools/gcc/files/203-uclibc-locale-no__x.patch
new file mode 100644
index 00000000..c602e913
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/203-uclibc-locale-no__x.patch
@@ -0,0 +1,235 @@
+Upstream-Status: Pending
+
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
++++ gcc-4.6.0/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
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc
++++ gcc-4.6.0/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<>
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc
++++ gcc-4.6.0/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
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc
++++ gcc-4.6.0/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:
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc
++++ gcc-4.6.0/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
+ {
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc
++++ gcc-4.6.0/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
+ {
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc
++++ gcc-4.6.0/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
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc
++++ gcc-4.6.0/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
+
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h
++++ gcc-4.6.0/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;
+ }
+
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h
++++ gcc-4.6.0/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
diff --git a/meta-aarch64/recipes-devtools/gcc/files/204-uclibc-locale-wchar_fix.patch b/meta-aarch64/recipes-devtools/gcc/files/204-uclibc-locale-wchar_fix.patch
new file mode 100644
index 00000000..896d2a57
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/204-uclibc-locale-wchar_fix.patch
@@ -0,0 +1,54 @@
+Upstream-Status: Pending
+
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc
++++ gcc-4.6.0/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
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc
++++ gcc-4.6.0/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 = "";
diff --git a/meta-aarch64/recipes-devtools/gcc/files/205-uclibc-locale-update.patch b/meta-aarch64/recipes-devtools/gcc/files/205-uclibc-locale-update.patch
new file mode 100644
index 00000000..743017b4
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/205-uclibc-locale-update.patch
@@ -0,0 +1,521 @@
+Upstream-Status: Pending
+
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc
++++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
+@@ -39,23 +39,20 @@
+ #include <langinfo.h>
+ #include <bits/c++locale_internal.h>
+
+-namespace std
+-{
++_GLIBCXX_BEGIN_NAMESPACE(std)
++
+ template<>
+ void
+ __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,17 +101,18 @@ 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);
+ }
+
+ __c_locale
+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
+ { return __duplocale(__cloc); }
+-} // namespace std
+
+-namespace __gnu_cxx
+-{
++_GLIBCXX_END_NAMESPACE
++
++_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
++
+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
+ {
+ "LC_CTYPE",
+@@ -138,9 +130,11 @@ namespace __gnu_cxx
+ "LC_IDENTIFICATION"
+ #endif
+ };
+-}
+
+-namespace std
+-{
++_GLIBCXX_END_NAMESPACE
++
++_GLIBCXX_BEGIN_NAMESPACE(std)
++
+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
+-} // namespace std
++
++_GLIBCXX_END_NAMESPACE
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc
++++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
+@@ -33,16 +33,20 @@
+
+ // 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
+-{
++_GLIBCXX_BEGIN_NAMESPACE(std)
++
+ // NB: The other ctype<char> specializations are in src/locale.cc and
+ // various /config/os/* files.
+- template<>
+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
+ : ctype<char>(0, false, __refs)
+ {
+@@ -57,6 +61,8 @@ namespace std
+ #endif
+ }
+ }
++ ctype_byname<char>::~ctype_byname()
++ { }
+
+ #ifdef _GLIBCXX_USE_WCHAR_T
+ ctype<wchar_t>::__wmask_type
+@@ -138,17 +144,33 @@ 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;
+ }
+
+@@ -290,4 +312,5 @@ namespace std
+ #endif
+ }
+ #endif // _GLIBCXX_USE_WCHAR_T
+-}
++
++_GLIBCXX_END_NAMESPACE
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h
++++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
+@@ -53,12 +53,16 @@
+ 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>
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc
++++ gcc-4.6.0/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;
+ }
+@@ -390,7 +395,9 @@ namespace std
+ __c_locale __old = __uselocale(__cloc);
+ #else
+ // Switch to named locale so that mbsrtowcs will work.
+- char* __old = strdup(setlocale(LC_ALL, NULL));
++ char* __old = setlocale(LC_ALL, NULL);
++ const size_t __llen = strlen(__old) + 1;
++ char* __sav = new char[__llen];
+ setlocale(LC_ALL, __name);
+ #endif
+
+@@ -477,8 +484,8 @@ namespace std
+ #ifdef __UCLIBC_HAS_XLOCALE__
+ __uselocale(__old);
+ #else
+- setlocale(LC_ALL, __old);
+- free(__old);
++ setlocale(LC_ALL, __sav);
++ delete [] __sav;
+ #endif
+ __throw_exception_again;
+ }
+@@ -498,8 +505,8 @@ namespace std
+ #ifdef __UCLIBC_HAS_XLOCALE__
+ __uselocale(__old);
+ #else
+- setlocale(LC_ALL, __old);
+- free(__old);
++ setlocale(LC_ALL, __sav);
++ delete [] __sav;
+ #endif
+ }
+ }
+@@ -545,8 +552,11 @@ namespace std
+ __c_locale __old = __uselocale(__cloc);
+ #else
+ // Switch to named locale so that mbsrtowcs will work.
+- char* __old = strdup(setlocale(LC_ALL, NULL));
+- setlocale(LC_ALL, __name);
++ char* __old = setlocale(LC_ALL, NULL);
++ const size_t __llen = strlen(__old) + 1;
++ char* __sav = new char[__llen];
++ memcpy(__sav, __old, __llen);
++ setlocale(LC_ALL, __name);
+ #endif
+
+ #ifdef __UCLIBC_MJN3_ONLY__
+@@ -633,8 +643,8 @@ namespace std
+ #ifdef __UCLIBC_HAS_XLOCALE__
+ __uselocale(__old);
+ #else
+- setlocale(LC_ALL, __old);
+- free(__old);
++ setlocale(LC_ALL, __sav);
++ delete [] __sav;
+ #endif
+ __throw_exception_again;
+ }
+@@ -653,8 +663,8 @@ namespace std
+ #ifdef __UCLIBC_HAS_XLOCALE__
+ __uselocale(__old);
+ #else
+- setlocale(LC_ALL, __old);
+- free(__old);
++ setlocale(LC_ALL, __sav);
++ delete [] __sav;
+ #endif
+ }
+ }
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc
++++ gcc-4.6.0/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__
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h
++++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
+@@ -50,12 +50,21 @@
+ __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>
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c_locale.h
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h
++++ gcc-4.6.0/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
+
+@@ -78,23 +80,25 @@ namespace std
+ #else
+ 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);
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc
++++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.cc
+@@ -53,11 +53,14 @@ namespace std
+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
+ _M_c_locale_timepunct);
+ #else
+- char* __old = strdup(setlocale(LC_ALL, NULL));
++ char* __old = setlocale(LC_ALL, NULL);
++ const size_t __llen = strlen(__old) + 1;
++ char* __sav = new char[__llen];
++ memcpy(__sav, __old, __llen);
+ setlocale(LC_ALL, _M_name_timepunct);
+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
+- setlocale(LC_ALL, __old);
+- free(__old);
++ setlocale(LC_ALL, __sav);
++ delete [] __sav;
+ #endif
+ // Make sure __s is null terminated.
+ if (__len == 0)
+@@ -207,11 +210,14 @@ namespace std
+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
+ _M_c_locale_timepunct);
+ #else
+- char* __old = strdup(setlocale(LC_ALL, NULL));
++ char* __old = setlocale(LC_ALL, NULL);
++ const size_t __llen = strlen(__old) + 1;
++ char* __sav = new char[__llen];
++ memcpy(__sav, __old, __llen);
+ setlocale(LC_ALL, _M_name_timepunct);
+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
+- setlocale(LC_ALL, __old);
+- free(__old);
++ setlocale(LC_ALL, __sav);
++ delete [] __sav;
+ #endif
+ // Make sure __s is null terminated.
+ if (__len == 0)
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
++++ gcc-4.6.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
+@@ -31,6 +31,9 @@
+
+ #include <bits/c++config.h>
+ #include <clocale>
++#include <cstdlib>
++#include <cstring>
++#include <cstddef>
+
+ #ifdef __UCLIBC_MJN3_ONLY__
+ #warning clean this up
diff --git a/meta-aarch64/recipes-devtools/gcc/files/301-missing-execinfo_h.patch b/meta-aarch64/recipes-devtools/gcc/files/301-missing-execinfo_h.patch
new file mode 100644
index 00000000..9589822b
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/301-missing-execinfo_h.patch
@@ -0,0 +1,15 @@
+Upstream-Status: Pending
+
+Index: gcc-4.6.0/boehm-gc/include/gc.h
+===================================================================
+--- gcc-4.6.0.orig/boehm-gc/include/gc.h
++++ gcc-4.6.0/boehm-gc/include/gc.h
+@@ -503,7 +503,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
diff --git a/meta-aarch64/recipes-devtools/gcc/files/302-c99-snprintf.patch b/meta-aarch64/recipes-devtools/gcc/files/302-c99-snprintf.patch
new file mode 100644
index 00000000..9becc15e
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/302-c99-snprintf.patch
@@ -0,0 +1,15 @@
+Upstream-Status: Pending
+
+Index: gcc-4_7-branch/libstdc++-v3/include/c_std/cstdio
+===================================================================
+--- gcc-4_7-branch.orig/libstdc++-v3/include/c_std/cstdio 2012-04-10 10:19:49.603337089 -0700
++++ gcc-4_7-branch/libstdc++-v3/include/c_std/cstdio 2012-04-10 10:30:59.863369565 -0700
+@@ -140,7 +140,7 @@
+ using ::vsprintf;
+ } // namespace std
+
+-#if _GLIBCXX_USE_C99
++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
+
+ #undef snprintf
+ #undef vfscanf
diff --git a/meta-aarch64/recipes-devtools/gcc/files/303-c99-complex-ugly-hack.patch b/meta-aarch64/recipes-devtools/gcc/files/303-c99-complex-ugly-hack.patch
new file mode 100644
index 00000000..d69c5469
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/303-c99-complex-ugly-hack.patch
@@ -0,0 +1,16 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+Index: gcc-4_7-branch/libstdc++-v3/configure
+===================================================================
+--- gcc-4_7-branch.orig/libstdc++-v3/configure 2012-04-10 10:30:37.347368481 -0700
++++ gcc-4_7-branch/libstdc++-v3/configure 2012-04-10 10:31:22.787370652 -0700
+@@ -18767,6 +18767,9 @@
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* 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 ()
+ {
diff --git a/meta-aarch64/recipes-devtools/gcc/files/304-index_macro.patch b/meta-aarch64/recipes-devtools/gcc/files/304-index_macro.patch
new file mode 100644
index 00000000..f1037652
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/304-index_macro.patch
@@ -0,0 +1,30 @@
+Upstream-Status: Pending
+
+Index: gcc-4.6.0/libstdc++-v3/include/ext/rope
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/include/ext/rope
++++ gcc-4.6.0/libstdc++-v3/include/ext/rope
+@@ -54,6 +54,9 @@
+ #include <bits/gthr.h>
+ #include <tr1/functional>
+
++/* cope w/ index defined as macro, SuSv3 proposal */
++#undef index
++
+ # ifdef __GC
+ # define __GC_CONST const
+ # else
+Index: gcc-4.6.0/libstdc++-v3/include/ext/ropeimpl.h
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/include/ext/ropeimpl.h
++++ gcc-4.6.0/libstdc++-v3/include/ext/ropeimpl.h
+@@ -49,6 +49,9 @@
+ #include <ext/memory> // For uninitialized_copy_n
+ #include <ext/numeric> // For power
+
++/* cope w/ index defined as macro, SuSv3 proposal */
++#undef index
++
+ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+ {
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/meta-aarch64/recipes-devtools/gcc/files/305-libmudflap-susv3-legacy.patch b/meta-aarch64/recipes-devtools/gcc/files/305-libmudflap-susv3-legacy.patch
new file mode 100644
index 00000000..10d09a7f
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/305-libmudflap-susv3-legacy.patch
@@ -0,0 +1,51 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+Index: gcc-4_7-branch/libmudflap/mf-hooks2.c
+===================================================================
+--- gcc-4_7-branch.orig/libmudflap/mf-hooks2.c 2012-04-10 10:19:49.391337079 -0700
++++ gcc-4_7-branch/libmudflap/mf-hooks2.c 2012-04-10 10:31:53.191372119 -0700
+@@ -424,7 +424,7 @@
+ {
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
+- bzero (s, n);
++ memset (s, 0, n);
+ }
+
+
+@@ -434,7 +434,7 @@
+ 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);
+ }
+
+
+@@ -444,7 +444,7 @@
+ 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);
+ }
+
+
+@@ -453,7 +453,7 @@
+ 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);
+ }
+
+
+@@ -462,7 +462,7 @@
+ 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 */
diff --git a/meta-aarch64/recipes-devtools/gcc/files/306-libstdc++-namespace.patch b/meta-aarch64/recipes-devtools/gcc/files/306-libstdc++-namespace.patch
new file mode 100644
index 00000000..e99bf960
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/306-libstdc++-namespace.patch
@@ -0,0 +1,40 @@
+Upstream-Status: Pending
+
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/messages_members.h
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h
++++ gcc-4.6.0/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
+@@ -116,3 +117,4 @@
+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
+ }
+ }
++}
+Index: gcc-4.6.0/libstdc++-v3/config/locale/uclibc/time_members.h
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h
++++ gcc-4.6.0/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),
+@@ -75,3 +76,4 @@
+ delete _M_data;
+ _S_destroy_c_locale(_M_c_locale_timepunct);
+ }
++}
diff --git a/meta-aarch64/recipes-devtools/gcc/files/64bithack.patch b/meta-aarch64/recipes-devtools/gcc/files/64bithack.patch
new file mode 100644
index 00000000..f4756695
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/64bithack.patch
@@ -0,0 +1,63 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+GCC has internal multilib handling code but it assumes a very specific rigid directory
+layout. The build system implementation of multilib layout is very generic and allows
+complete customisation of the library directories.
+
+This patch is a partial solution to allow any custom directories to be passed into gcc
+and handled correctly. It forces gcc to use the base_libdir (which is the current
+directory, "."). We need to do this for each multilib that is configured as we don't
+know which compiler options may be being passed into the compiler. Since we have a compiler
+per mulitlib at this point that isn't an issue.
+
+The one problem is the target compiler is only going to work for the default multlilib at
+this point. Ideally we'd figure out which multilibs were being enabled with which paths
+and be able to patch these entries with a complete set of correct paths but this we
+don't have such code at this point. This is something the target gcc recipe should do
+and override these platform defaults in its build config.
+
+RP 15/8/11
+
+Index: trunk/gcc/config/i386/t-linux64
+===================================================================
+--- trunk.orig/gcc/config/i386/t-linux64 2012-02-22 09:44:48.000000000 -0800
++++ trunk/gcc/config/i386/t-linux64 2012-02-22 12:31:01.836462957 -0800
+@@ -33,7 +33,6 @@
+ #
+ comma=,
+ MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
+-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
+-MULTILIB_OSDIRNAMES = m64=../lib64
+-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
+-MULTILIB_OSDIRNAMES+= mx32=../libx32
++MULTILIB_DIRNAMES = . .
++MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
++
+Index: trunk/gcc/config/mips/t-linux64
+===================================================================
+--- trunk.orig/gcc/config/mips/t-linux64 2012-02-22 09:44:58.000000000 -0800
++++ trunk/gcc/config/mips/t-linux64 2012-02-22 12:32:01.132465823 -0800
+@@ -17,5 +17,5 @@
+ # <http://www.gnu.org/licenses/>.
+
+ MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
+-MULTILIB_DIRNAMES = n32 32 64
+-MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64
++MULTILIB_DIRNAMES = . . .
++MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
+Index: trunk/gcc/config/rs6000/t-linux64
+===================================================================
+--- trunk.orig/gcc/config/rs6000/t-linux64 2012-02-22 09:44:54.000000000 -0800
++++ trunk/gcc/config/rs6000/t-linux64 2012-02-22 12:28:17.960454968 -0800
+@@ -27,9 +27,9 @@
+ # MULTILIB_OSDIRNAMES according to what is found on the target.
+
+ MULTILIB_OPTIONS = m64/m32 msoft-float
+-MULTILIB_DIRNAMES = 64 32 nof
++MULTILIB_DIRNAMES = . . .
+ MULTILIB_EXTRA_OPTS = fPIC mstrict-align
+ MULTILIB_EXCEPTIONS = m64/msoft-float
+ MULTILIB_EXCLUSIONS = m64/!m32/msoft-float
+-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib) nof
++MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
+ MULTILIB_MATCHES = $(MULTILIB_MATCHES_FLOAT)
diff --git a/meta-aarch64/recipes-devtools/gcc/files/740-sh-pr24836.patch b/meta-aarch64/recipes-devtools/gcc/files/740-sh-pr24836.patch
new file mode 100644
index 00000000..1406f87f
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/740-sh-pr24836.patch
@@ -0,0 +1,31 @@
+Upstream-Status: Pending
+
+http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836
+
+Index: gcc-4_7-branch/gcc/configure.ac
+===================================================================
+--- gcc-4_7-branch.orig/gcc/configure.ac 2012-04-10 10:22:05.787343661 -0700
++++ gcc-4_7-branch/gcc/configure.ac 2012-04-10 10:32:18.415373343 -0700
+@@ -3065,7 +3065,7 @@
+ tls_first_minor=14
+ tls_as_opt="-m64 -Aesame --fatal-warnings"
+ ;;
+- sh-*-* | sh[34]-*-*)
++ sh-*-* | sh[34]*-*-*)
+ conftest_s='
+ .section ".tdata","awT",@progbits
+ foo: .long 25
+Index: gcc-4_7-branch/gcc/configure
+===================================================================
+--- gcc-4_7-branch.orig/gcc/configure 2012-04-10 10:22:05.803343691 -0700
++++ gcc-4_7-branch/gcc/configure 2012-04-10 10:32:18.419373328 -0700
+@@ -23481,7 +23481,7 @@
+ tls_first_minor=14
+ tls_as_opt="-m64 -Aesame --fatal-warnings"
+ ;;
+- sh-*-* | sh[34]-*-*)
++ sh-*-* | sh[34]*-*-*)
+ conftest_s='
+ .section ".tdata","awT",@progbits
+ foo: .long 25
diff --git a/meta-aarch64/recipes-devtools/gcc/files/800-arm-bigendian.patch b/meta-aarch64/recipes-devtools/gcc/files/800-arm-bigendian.patch
new file mode 100644
index 00000000..ac301bd8
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/800-arm-bigendian.patch
@@ -0,0 +1,36 @@
+Upstream-Status: Pending
+
+By Lennert Buytenhek <buytenh@wantstofly.org>
+Adds support for arm*b-linux* big-endian ARM targets
+
+See http://gcc.gnu.org/PR16350
+
+Index: gcc-4_7-branch/gcc/config/arm/linux-elf.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/arm/linux-elf.h 2012-04-10 10:19:49.171337068 -0700
++++ gcc-4_7-branch/gcc/config/arm/linux-elf.h 2012-04-10 10:32:36.819374226 -0700
+@@ -48,7 +48,7 @@
+
+ #undef MULTILIB_DEFAULTS
+ #define MULTILIB_DEFAULTS \
+- { "marm", "mlittle-endian", "mfloat-abi=hard", "mno-thumb-interwork" }
++ { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=hard", "mno-thumb-interwork" }
+
+ /* Now we define the strings used to build the spec file. */
+ #undef LIB_SPEC
+Index: gcc-4_7-branch/gcc/config.gcc
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config.gcc 2012-04-10 10:19:49.159337069 -0700
++++ gcc-4_7-branch/gcc/config.gcc 2012-04-10 10:32:36.823374222 -0700
+@@ -842,6 +842,11 @@
+ esac
+ tmake_file="${tmake_file} 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"
diff --git a/meta-aarch64/recipes-devtools/gcc/files/COLLECT_GCC_OPTIONS.patch b/meta-aarch64/recipes-devtools/gcc/files/COLLECT_GCC_OPTIONS.patch
new file mode 100644
index 00000000..f5982983
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/COLLECT_GCC_OPTIONS.patch
@@ -0,0 +1,25 @@
+Upstream-Status: Pending
+
+#This patck added --sysroot into COLLECT_GCC_OPTIONS which is used to
+#invoke collect2.
+
+Index: gcc-4_7-branch/gcc/gcc.c
+===================================================================
+--- gcc-4_7-branch.orig/gcc/gcc.c 2012-04-10 10:37:49.487389409 -0700
++++ gcc-4_7-branch/gcc/gcc.c 2012-04-10 10:38:50.831392259 -0700
+@@ -3995,6 +3995,15 @@
+ sizeof ("COLLECT_GCC_OPTIONS=") - 1);
+
+ first_time = TRUE;
++#ifdef HAVE_LD_SYSROOT
++ if (target_system_root_changed && target_system_root)
++ {
++ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
++ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
++ obstack_grow (&collect_obstack, "'", 1);
++ first_time = FALSE;
++ }
++#endif
+ for (i = 0; (int) i < n_switches; i++)
+ {
+ const char *const *args;
diff --git a/meta-aarch64/recipes-devtools/gcc/files/GLIBC_DYNAMIC_LINKER.patch b/meta-aarch64/recipes-devtools/gcc/files/GLIBC_DYNAMIC_LINKER.patch
new file mode 100644
index 00000000..38c361e0
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/GLIBC_DYNAMIC_LINKER.patch
@@ -0,0 +1,165 @@
+This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
+relative to SYSTEMLIBS_DIR which can be set in generated headers
+This breaks the assumption of hardcoded multilib in gcc
+Change is only for the supported architectures in OE including
+SH, spart, alpha for possible future support (if any)
+
+Removes the do_headerfix task in metadata
+
+Signed-off-by: Khem Raj
+Upstream-Status: Inappropriate [OE configuration]
+
+Index: git/gcc/config/alpha/linux-elf.h
+===================================================================
+--- git.orig/gcc/config/alpha/linux-elf.h 2012-07-08 11:16:26.199320624 -0700
++++ git/gcc/config/alpha/linux-elf.h 2012-07-08 11:19:51.059330624 -0700
+@@ -24,8 +24,8 @@
+ #define EXTRA_SPECS \
+ { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
+
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
++#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+ #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
+ #elif DEFAULT_LIBC == LIBC_GLIBC
+Index: git/gcc/config/arm/linux-eabi.h
+===================================================================
+--- git.orig/gcc/config/arm/linux-eabi.h 2012-07-08 11:16:26.000000000 -0700
++++ git/gcc/config/arm/linux-eabi.h 2012-07-08 11:20:40.947333288 -0700
+@@ -62,7 +62,7 @@
+ /* Use ld-linux.so.3 so that it will be possible to run "classic"
+ GNU/Linux binaries on an EABI system. */
+ #undef GLIBC_DYNAMIC_LINKER
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.3"
+
+ /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
+ use the GNU/Linux version, not the generic BPABI version. */
+Index: git/gcc/config/arm/linux-elf.h
+===================================================================
+--- git.orig/gcc/config/arm/linux-elf.h 2012-07-08 11:16:31.903320900 -0700
++++ git/gcc/config/arm/linux-elf.h 2012-07-08 11:21:37.619335646 -0700
+@@ -59,7 +59,7 @@
+
+ #define LIBGCC_SPEC "-lgcc"
+
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
+
+ #define LINUX_TARGET_LINK_SPEC "%{h*} \
+ %{static:-Bstatic} \
+Index: git/gcc/config/i386/linux.h
+===================================================================
+--- git.orig/gcc/config/i386/linux.h 2012-07-08 11:16:26.267320627 -0700
++++ git/gcc/config/i386/linux.h 2012-07-08 11:23:26.727340361 -0700
+@@ -21,4 +21,4 @@
+ <http://www.gnu.org/licenses/>. */
+
+ #define GNU_USER_LINK_EMULATION "elf_i386"
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
+Index: git/gcc/config/i386/linux64.h
+===================================================================
+--- git.orig/gcc/config/i386/linux64.h 2012-07-08 11:16:26.267320627 -0700
++++ git/gcc/config/i386/linux64.h 2012-07-08 11:23:13.255340316 -0700
+@@ -28,6 +28,6 @@
+ #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
+ #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
+
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
++#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
++#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
+Index: git/gcc/config/mips/linux.h
+===================================================================
+--- git.orig/gcc/config/mips/linux.h 2012-07-08 11:16:26.307320629 -0700
++++ git/gcc/config/mips/linux.h 2012-07-08 11:23:56.063342214 -0700
+@@ -18,4 +18,4 @@
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld.so.1"
+Index: git/gcc/config/mips/linux64.h
+===================================================================
+--- git.orig/gcc/config/mips/linux64.h 2012-07-08 11:16:26.307320629 -0700
++++ git/gcc/config/mips/linux64.h 2012-07-08 11:24:52.207345073 -0700
+@@ -23,10 +23,10 @@
+ #define GNU_USER_LINK_EMULATION64 "elf64%{EB:b}%{EL:l}tsmip"
+ #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
+
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
+-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1"
+-#define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
+-#define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
++#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
++#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld.so.1"
++#define GLIBC_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld.so.1"
++#define UCLIBC_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
+ #define GNU_USER_DYNAMIC_LINKERN32 \
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
+Index: git/gcc/config/rs6000/linux64.h
+===================================================================
+--- git.orig/gcc/config/rs6000/linux64.h 2012-07-08 11:16:26.335320630 -0700
++++ git/gcc/config/rs6000/linux64.h 2012-07-08 11:26:05.867348369 -0700
+@@ -358,10 +358,10 @@
+ #undef LINK_OS_DEFAULT_SPEC
+ #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
+
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
+-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
+-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
+-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
++#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
++#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64.so.1"
++#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
++#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+ #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
+ #elif DEFAULT_LIBC == LIBC_GLIBC
+Index: git/gcc/config/sh/linux.h
+===================================================================
+--- git.orig/gcc/config/sh/linux.h 2012-07-08 11:16:26.363320632 -0700
++++ git/gcc/config/sh/linux.h 2012-07-08 11:26:29.375350165 -0700
+@@ -45,7 +45,7 @@
+
+ #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
+
+ #undef SUBTARGET_LINK_EMUL_SUFFIX
+ #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
+Index: git/gcc/config/sparc/linux.h
+===================================================================
+--- git.orig/gcc/config/sparc/linux.h 2012-07-08 11:16:26.371320632 -0700
++++ git/gcc/config/sparc/linux.h 2012-07-08 11:27:00.439351163 -0700
+@@ -84,7 +84,7 @@
+ When the -shared link option is used a final link is not being
+ done. */
+
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
+
+ #undef LINK_SPEC
+ #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
+Index: git/gcc/config/sparc/linux64.h
+===================================================================
+--- git.orig/gcc/config/sparc/linux64.h 2012-07-08 11:16:26.371320632 -0700
++++ git/gcc/config/sparc/linux64.h 2012-07-08 11:27:23.571352396 -0700
+@@ -93,8 +93,8 @@
+ When the -shared link option is used a final link is not being
+ done. */
+
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
+
+ #ifdef SPARC_BI_ARCH
+
diff --git a/meta-aarch64/recipes-devtools/gcc/files/arm-hard-float-loader.patch b/meta-aarch64/recipes-devtools/gcc/files/arm-hard-float-loader.patch
new file mode 100644
index 00000000..dfa0d191
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/arm-hard-float-loader.patch
@@ -0,0 +1,48 @@
+This patch is still being discussed by probably is almost
+final version. We add the OE notion of multilib on top
+
+Upstream-Status: Backport [ adapted ]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: gcc-4_7-branch/gcc/config/arm/linux-eabi.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/arm/linux-eabi.h 2012-04-30 15:28:31.891863845 -0700
++++ gcc-4_7-branch/gcc/config/arm/linux-eabi.h 2012-04-30 15:37:11.531888994 -0700
+@@ -32,7 +32,8 @@
+ while (false)
+
+ /* We default to a soft-float ABI so that binaries can run on all
+- target hardware. */
++ target hardware. If you override this to use the hard-float ABI then
++ change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well. */
+ #undef TARGET_DEFAULT_FLOAT_ABI
+ #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
+
+@@ -59,10 +60,23 @@
+ #undef SUBTARGET_EXTRA_LINK_SPEC
+ #define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION
+
+-/* Use ld-linux.so.3 so that it will be possible to run "classic"
+- GNU/Linux binaries on an EABI system. */
++/* GNU/Linux on ARM currently supports three dynamic linkers:
++ - ld-linux.so.2 - for the legacy ABI
++ - ld-linux.so.3 - for the EABI-derived soft-float ABI
++ - ld-linux-armhf.so.3 - for the EABI-derived hard-float ABI.
++ All the dynamic linkers live in /lib.
++ We default to soft-float, but this can be overridden by changing both
++ GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
++
+ #undef GLIBC_DYNAMIC_LINKER
+-#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.3"
++#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3"
++#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3"
++#define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
++
++ #define GLIBC_DYNAMIC_LINKER \
++ "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
++ %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
++ %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
+
+ /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
+ use the GNU/Linux version, not the generic BPABI version. */
diff --git a/meta-aarch64/recipes-devtools/gcc/files/cpp-honor-sysroot.patch b/meta-aarch64/recipes-devtools/gcc/files/cpp-honor-sysroot.patch
new file mode 100644
index 00000000..73106774
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/cpp-honor-sysroot.patch
@@ -0,0 +1,40 @@
+Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
+preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location
+rather than the --sysroot option specified on the commandline. If access to that directory is
+permission denied (unreadable), gcc will error.
+
+This happens when ccache is in use due to the fact it uses preprocessed source files.
+
+The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix,
+-isystem, -isysroot happen and the correct sysroot is used.
+
+[YOCTO #2074]
+
+Upstream-Status: Pending
+
+RP 2012/04/13
+
+Index: gcc-4_6-branch/gcc/gcc.c
+===================================================================
+--- gcc-4_6-branch.orig/gcc/gcc.c 2012-04-13 12:24:37.939671140 +0000
++++ gcc-4_6-branch/gcc/gcc.c 2012-04-13 12:24:54.439670688 +0000
+@@ -953,7 +953,7 @@
+ %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
+ {".i", "@cpp-output", 0, 0, 0},
+ {"@cpp-output",
+- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
++ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+ {".s", "@assembler", 0, 0, 0},
+ {"@assembler",
+ "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
+Index: gcc-4_6-branch/gcc/cp/lang-specs.h
+===================================================================
+--- gcc-4_6-branch.orig/gcc/cp/lang-specs.h 2012-04-13 12:25:01.019670594 +0000
++++ gcc-4_6-branch/gcc/cp/lang-specs.h 2012-04-13 12:25:07.567670180 +0000
+@@ -64,5 +64,5 @@
+ {".ii", "@c++-cpp-output", 0, 0, 0},
+ {"@c++-cpp-output",
+ "%{!M:%{!MM:%{!E:\
+- cc1plus -fpreprocessed %i %(cc1_options) %2\
++ cc1plus -fpreprocessed %i %I %(cc1_options) %2\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
diff --git a/meta-aarch64/recipes-devtools/gcc/files/define_insn_reservation.patch b/meta-aarch64/recipes-devtools/gcc/files/define_insn_reservation.patch
new file mode 100644
index 00000000..2b0ff677
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/define_insn_reservation.patch
@@ -0,0 +1,118 @@
+Upstream-Status: Backport
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+From aab806a131efe9706396692ecc67d324371e39bc Mon Sep 17 00:00:00 2001
+From: edmarwjr <edmarwjr@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 22 Jun 2012 20:13:23 +0000
+Subject: [PATCH] 2012-06-22 Edmar Wienskoski <edmar@freescale.com>
+
+ * config/rs6000/rs6000.md (define_attr "type"): New type popcnt.
+ (popcntb<mode>2): Add attribute type popcnt.
+ (popcntd<mode>2): Ditto.
+ * config/rs6000/power4.md (define_insn_reservation): Add type popcnt.
+ * config/rs6000/power5.md (define_insn_reservation): Ditto.
+ * config/rs6000/power7.md (define_insn_reservation): Ditto.
+ * config/rs6000/476.md (define_insn_reservation): Ditto.
+ * config/rs6000/power6.md (define_insn_reservation): New
+ reservation for popcnt instructions.
+
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188901 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ gcc/ChangeLog | 12 ++++++++++++
+ gcc/config/rs6000/476.md | 2 +-
+ gcc/config/rs6000/power5.md | 2 +-
+ gcc/config/rs6000/power6.md | 5 +++++
+ gcc/config/rs6000/power7.md | 2 +-
+ gcc/config/rs6000/rs6000.md | 10 +++++++---
+ 6 files changed, 27 insertions(+), 6 deletions(-)
+
+Index: gcc-4_7-branch/gcc/config/rs6000/476.md
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/476.md 2012-07-05 23:49:07.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/476.md 2012-07-06 19:50:30.078779999 -0700
+@@ -71,7 +71,7 @@
+ ppc476_i_pipe|ppc476_lj_pipe")
+
+ (define_insn_reservation "ppc476-complex-integer" 1
+- (and (eq_attr "type" "cmp,cr_logical,delayed_cr,cntlz,isel,isync,sync,trap")
++ (and (eq_attr "type" "cmp,cr_logical,delayed_cr,cntlz,isel,isync,sync,trap,popcnt")
+ (eq_attr "cpu" "ppc476"))
+ "ppc476_issue,\
+ ppc476_i_pipe")
+Index: gcc-4_7-branch/gcc/config/rs6000/power5.md
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/power5.md 2012-07-05 23:49:07.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/power5.md 2012-07-06 19:50:30.078779999 -0700
+@@ -142,7 +142,7 @@
+ ; Integer latency is 2 cycles
+ (define_insn_reservation "power5-integer" 2
+ (and (eq_attr "type" "integer,insert_dword,shift,trap,\
+- var_shift_rotate,cntlz,exts,isel")
++ var_shift_rotate,cntlz,exts,isel,popcnt")
+ (eq_attr "cpu" "power5"))
+ "iq_power5")
+
+Index: gcc-4_7-branch/gcc/config/rs6000/power6.md
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/power6.md 2012-07-05 23:49:07.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/power6.md 2012-07-06 19:50:30.078779999 -0700
+@@ -216,6 +216,11 @@
+ (eq_attr "cpu" "power6"))
+ "FXU_power6")
+
++(define_insn_reservation "power6-popcnt" 1
++ (and (eq_attr "type" "popcnt")
++ (eq_attr "cpu" "power6"))
++ "FXU_power6")
++
+ (define_insn_reservation "power6-insert" 1
+ (and (eq_attr "type" "insert_word")
+ (eq_attr "cpu" "power6"))
+Index: gcc-4_7-branch/gcc/config/rs6000/power7.md
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/power7.md 2012-07-05 23:49:07.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/power7.md 2012-07-06 19:50:30.078779999 -0700
+@@ -150,7 +150,7 @@
+ ; FX Unit
+ (define_insn_reservation "power7-integer" 1
+ (and (eq_attr "type" "integer,insert_word,insert_dword,shift,trap,\
+- var_shift_rotate,exts,isel")
++ var_shift_rotate,exts,isel,popcnt")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,FXU_power7")
+
+Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.md
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.md 2012-07-06 19:44:38.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/rs6000.md 2012-07-06 19:50:30.078779999 -0700
+@@ -144,7 +144,7 @@
+
+ ;; Define an insn type attribute. This is used in function unit delay
+ ;; computations.
+-(define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,vecdouble,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel"
++(define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,vecdouble,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel,popcnt"
+ (const_string "integer"))
+
+ ;; Define floating point instruction sub-types for use with Xfpu.md
+@@ -2329,13 +2329,17 @@
+ (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
+ UNSPEC_POPCNTB))]
+ "TARGET_POPCNTB"
+- "popcntb %0,%1")
++ "popcntb %0,%1"
++ [(set_attr "length" "4")
++ (set_attr "type" "popcnt")])
+
+ (define_insn "popcntd<mode>2"
+ [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
+ (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
+ "TARGET_POPCNTD"
+- "popcnt<wd> %0,%1")
++ "popcnt<wd> %0,%1"
++ [(set_attr "length" "4")
++ (set_attr "type" "popcnt")])
+
+ (define_expand "popcount<mode>2"
+ [(set (match_operand:GPR 0 "gpc_reg_operand" "")
diff --git a/meta-aarch64/recipes-devtools/gcc/files/disable_relax_pic_calls_flag.patch b/meta-aarch64/recipes-devtools/gcc/files/disable_relax_pic_calls_flag.patch
new file mode 100644
index 00000000..bc01cd91
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/disable_relax_pic_calls_flag.patch
@@ -0,0 +1,48 @@
+Upstream-Status: Inappropriate [configuration]
+
+GCC: disable MASK_RELAX_PIC_CALLS bit
+
+The new feature added after 4.3.3
+"http://www.pubbs.net/200909/gcc/94048-patch-add-support-for-rmipsjalr.html"
+will cause cc1plus eat up all the system memory when build webkit-gtk.
+The function mips_get_pic_call_symbol keeps on recursively calling itself.
+Disable this feature to walk aside the bug.
+
+Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
+
+Index: gcc-4_7-branch/gcc/configure
+===================================================================
+--- gcc-4_7-branch.orig/gcc/configure 2012-04-10 10:37:09.351387437 -0700
++++ gcc-4_7-branch/gcc/configure 2012-04-10 10:37:57.211389779 -0700
+@@ -25837,13 +25837,6 @@
+ rm -f conftest.*
+ fi
+ fi
+- if test $gcc_cv_as_ld_jalr_reloc = yes; then
+- if test x$target_cpu_default = x; then
+- target_cpu_default=MASK_RELAX_PIC_CALLS
+- else
+- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
+- fi
+- fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
+ $as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
+
+Index: gcc-4_7-branch/gcc/configure.ac
+===================================================================
+--- gcc-4_7-branch.orig/gcc/configure.ac 2012-04-10 10:37:09.339387366 -0700
++++ gcc-4_7-branch/gcc/configure.ac 2012-04-10 10:37:57.215389769 -0700
+@@ -4027,13 +4027,6 @@
+ rm -f conftest.*
+ fi
+ fi
+- if test $gcc_cv_as_ld_jalr_reloc = yes; then
+- if test x$target_cpu_default = x; then
+- target_cpu_default=MASK_RELAX_PIC_CALLS
+- else
+- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
+- fi
+- fi
+ AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
+
+ AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
diff --git a/meta-aarch64/recipes-devtools/gcc/files/disablesdt.patch b/meta-aarch64/recipes-devtools/gcc/files/disablesdt.patch
new file mode 100644
index 00000000..8946afc1
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/disablesdt.patch
@@ -0,0 +1,32 @@
+We don't list dtrace in DEPENDS so we shouldn't be depending on this header.
+It may or may not exist from preivous builds though. To be determinstic, disable
+sdt.h usage always. This avoids build failures if the header is removed after configure
+but before libgcc is compiled for example.
+
+RP 2012/8/7
+
+Upstream-Status: Inappropriate [hack]
+
+Index: git/gcc/configure
+===================================================================
+--- git.orig/gcc/configure 2012-08-07 21:18:42.319247701 +0000
++++ git/gcc/configure 2012-08-07 21:19:08.939247082 +0000
+@@ -26758,12 +26758,12 @@
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
+ $as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
+ have_sys_sdt_h=no
+-if test -f $target_header_dir/sys/sdt.h; then
+- have_sys_sdt_h=yes
+-
+-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
+-
+-fi
++#if test -f $target_header_dir/sys/sdt.h; then
++# have_sys_sdt_h=yes
++#
++#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
++#
++#fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
+ $as_echo "$have_sys_sdt_h" >&6; }
+
diff --git a/meta-aarch64/recipes-devtools/gcc/files/fix-g++-sysroot.patch b/meta-aarch64/recipes-devtools/gcc/files/fix-g++-sysroot.patch
new file mode 100644
index 00000000..aad234c6
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/fix-g++-sysroot.patch
@@ -0,0 +1,428 @@
+backport
+
+http://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg26013.html
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: gcc-4.7.2/gcc/configure.ac
+===================================================================
+--- gcc-4.7.2.orig/gcc/configure.ac 2012-09-20 07:42:30.284941174 -0700
++++ gcc-4.7.2/gcc/configure.ac 2012-09-20 07:55:23.148970564 -0700
+@@ -118,6 +118,72 @@
+ local_prefix=/usr/local
+ fi
+
++AC_ARG_WITH([native-system-header-dir],
++ [ --with-native-system-header-dir=dir
++ use dir as the directory to look for standard
++ system header files in. Defaults to /usr/include.],
++[
++ case ${with_native_system_header_dir} in
++ yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;;
++ /* | [[A-Za-z]]:[[\\/]]*) ;;
++ *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;;
++ esac
++ configured_native_system_header_dir="${withval}"
++], [configured_native_system_header_dir=])
++
++AC_ARG_WITH(build-sysroot,
++ [AS_HELP_STRING([--with-build-sysroot=sysroot],
++ [use sysroot as the system root during the build])],
++ [if test x"$withval" != x ; then
++ SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
++ fi],
++ [SYSROOT_CFLAGS_FOR_TARGET=])
++AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
++
++AC_ARG_WITH(sysroot,
++[AS_HELP_STRING([[--with-sysroot[=DIR]]],
++ [search for usr/lib, usr/include, et al, within DIR])],
++[
++ case ${with_sysroot} in
++ /) ;;
++ */) with_sysroot=`echo $with_sysroot | sed 's,/$,,'` ;;
++ esac
++ case ${with_sysroot} in
++ yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
++ *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
++ esac
++
++ TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
++ CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
++
++ if test "x$prefix" = xNONE; then
++ test_prefix=/usr/local
++ else
++ test_prefix=$prefix
++ fi
++ if test "x$exec_prefix" = xNONE; then
++ test_exec_prefix=$test_prefix
++ else
++ test_exec_prefix=$exec_prefix
++ fi
++ case ${TARGET_SYSTEM_ROOT} in
++ "${test_prefix}"|"${test_prefix}/"*|\
++ "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
++ '${prefix}'|'${prefix}/'*|\
++ '${exec_prefix}'|'${exec_prefix}/'*)
++ t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
++ TARGET_SYSTEM_ROOT_DEFINE="$t"
++ ;;
++ esac
++], [
++ TARGET_SYSTEM_ROOT=
++ TARGET_SYSTEM_ROOT_DEFINE=
++ CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
++])
++AC_SUBST(TARGET_SYSTEM_ROOT)
++AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
++AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
++
+ # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
+ # passed in by the toplevel make and thus we'd get different behavior
+ # depending on where we built the sources.
+@@ -149,7 +215,9 @@
+ if test "${with_sysroot+set}" = set; then
+ gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
+ if test "${gcc_gxx_without_sysroot}"; then
+- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ if test x${with_sysroot} != x/; then
++ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ fi
+ gcc_gxx_include_dir_add_sysroot=1
+ fi
+ fi
+@@ -733,68 +801,6 @@
+ ], [enable_shared=yes])
+ AC_SUBST(enable_shared)
+
+-AC_ARG_WITH([native-system-header-dir],
+- [ --with-native-system-header-dir=dir
+- use dir as the directory to look for standard
+- system header files in. Defaults to /usr/include.],
+-[
+- case ${with_native_system_header_dir} in
+- yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;;
+- /* | [[A-Za-z]]:[[\\/]]*) ;;
+- *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;;
+- esac
+- configured_native_system_header_dir="${withval}"
+-], [configured_native_system_header_dir=])
+-
+-AC_ARG_WITH(build-sysroot,
+- [AS_HELP_STRING([--with-build-sysroot=sysroot],
+- [use sysroot as the system root during the build])],
+- [if test x"$withval" != x ; then
+- SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
+- fi],
+- [SYSROOT_CFLAGS_FOR_TARGET=])
+-AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
+-
+-AC_ARG_WITH(sysroot,
+-[AS_HELP_STRING([[--with-sysroot[=DIR]]],
+- [search for usr/lib, usr/include, et al, within DIR])],
+-[
+- case ${with_sysroot} in
+- yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
+- *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
+- esac
+-
+- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
+- CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
+-
+- if test "x$prefix" = xNONE; then
+- test_prefix=/usr/local
+- else
+- test_prefix=$prefix
+- fi
+- if test "x$exec_prefix" = xNONE; then
+- test_exec_prefix=$test_prefix
+- else
+- test_exec_prefix=$exec_prefix
+- fi
+- case ${TARGET_SYSTEM_ROOT} in
+- "${test_prefix}"|"${test_prefix}/"*|\
+- "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
+- '${prefix}'|'${prefix}/'*|\
+- '${exec_prefix}'|'${exec_prefix}/'*)
+- t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
+- TARGET_SYSTEM_ROOT_DEFINE="$t"
+- ;;
+- esac
+-], [
+- TARGET_SYSTEM_ROOT=
+- TARGET_SYSTEM_ROOT_DEFINE=
+- CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
+-])
+-AC_SUBST(TARGET_SYSTEM_ROOT)
+-AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+-AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
+-
+ AC_ARG_WITH(specs,
+ [AS_HELP_STRING([--with-specs=SPECS],
+ [add SPECS to driver command-line processing])],
+Index: gcc-4.7.2/gcc/configure
+===================================================================
+--- gcc-4.7.2.orig/gcc/configure 2012-09-20 07:42:30.284941174 -0700
++++ gcc-4.7.2/gcc/configure 2012-09-20 07:55:31.788970893 -0700
+@@ -757,10 +757,6 @@
+ REPORT_BUGS_TO
+ PKGVERSION
+ CONFIGURE_SPECS
+-CROSS_SYSTEM_HEADER_DIR
+-TARGET_SYSTEM_ROOT_DEFINE
+-TARGET_SYSTEM_ROOT
+-SYSROOT_CFLAGS_FOR_TARGET
+ enable_shared
+ enable_fixed_point
+ enable_decimal_float
+@@ -798,6 +794,10 @@
+ CFLAGS
+ CC
+ GENINSRC
++CROSS_SYSTEM_HEADER_DIR
++TARGET_SYSTEM_ROOT_DEFINE
++TARGET_SYSTEM_ROOT
++SYSROOT_CFLAGS_FOR_TARGET
+ target_subdir
+ host_subdir
+ build_subdir
+@@ -859,6 +859,9 @@
+ enable_option_checking
+ with_build_libsubdir
+ with_local_prefix
++with_native_system_header_dir
++with_build_sysroot
++with_sysroot
+ with_gxx_include_dir
+ with_cpp_install_dir
+ enable_generated_files_in_srcdir
+@@ -883,9 +886,6 @@
+ enable_objc_gc
+ with_dwarf2
+ enable_shared
+-with_native_system_header_dir
+-with_build_sysroot
+-with_sysroot
+ with_specs
+ with_pkgversion
+ with_bugurl
+@@ -1639,6 +1639,12 @@
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-build-libsubdir=DIR Directory where to find libraries for build system
+ --with-local-prefix=DIR specifies directory to put local include
++ --with-native-system-header-dir=dir
++ use dir as the directory to look for standard
++ system header files in. Defaults to /usr/include.
++ --with-build-sysroot=sysroot
++ use sysroot as the system root during the build
++ --with-sysroot[=DIR] search for usr/lib, usr/include, et al, within DIR
+ --with-gxx-include-dir=DIR
+ specifies directory to put g++ header files
+ --with-cpp-install-dir=DIR
+@@ -1651,12 +1657,6 @@
+ --with-as arrange to use the specified as (full pathname)
+ --with-stabs arrange to use stabs instead of host debug format
+ --with-dwarf2 force the default debug format to be DWARF 2
+- --with-native-system-header-dir=dir
+- use dir as the directory to look for standard
+- system header files in. Defaults to /usr/include.
+- --with-build-sysroot=sysroot
+- use sysroot as the system root during the build
+- --with-sysroot[=DIR] search for usr/lib, usr/include, et al, within DIR
+ --with-specs=SPECS add SPECS to driver command-line processing
+ --with-pkgversion=PKG Use PKG in the version string in place of "GCC"
+ --with-bugurl=URL Direct users to URL to report a bug
+@@ -3288,6 +3288,82 @@
+ local_prefix=/usr/local
+ fi
+
++
++# Check whether --with-native-system-header-dir was given.
++if test "${with_native_system_header_dir+set}" = set; then :
++ withval=$with_native_system_header_dir;
++ case ${with_native_system_header_dir} in
++ yes|no) as_fn_error "bad value ${withval} given for --with-native-system-header-dir" "$LINENO" 5 ;;
++ /* | [A-Za-z]:[\\/]*) ;;
++ *) as_fn_error "--with-native-system-header-dir argument ${withval} must be an absolute directory" "$LINENO" 5 ;;
++ esac
++ configured_native_system_header_dir="${withval}"
++
++else
++ configured_native_system_header_dir=
++fi
++
++
++
++# Check whether --with-build-sysroot was given.
++if test "${with_build_sysroot+set}" = set; then :
++ withval=$with_build_sysroot; if test x"$withval" != x ; then
++ SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
++ fi
++else
++ SYSROOT_CFLAGS_FOR_TARGET=
++fi
++
++
++
++
++# Check whether --with-sysroot was given.
++if test "${with_sysroot+set}" = set; then :
++ withval=$with_sysroot;
++ case ${with_sysroot} in
++ /) ;;
++ */) with_sysroot=`echo $with_sysroot | sed 's,/$,,'` ;;
++ esac
++ case ${with_sysroot} in
++ yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
++ *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
++ esac
++
++ TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
++ CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
++
++ if test "x$prefix" = xNONE; then
++ test_prefix=/usr/local
++ else
++ test_prefix=$prefix
++ fi
++ if test "x$exec_prefix" = xNONE; then
++ test_exec_prefix=$test_prefix
++ else
++ test_exec_prefix=$exec_prefix
++ fi
++ case ${TARGET_SYSTEM_ROOT} in
++ "${test_prefix}"|"${test_prefix}/"*|\
++ "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
++ '${prefix}'|'${prefix}/'*|\
++ '${exec_prefix}'|'${exec_prefix}/'*)
++ t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
++ TARGET_SYSTEM_ROOT_DEFINE="$t"
++ ;;
++ esac
++
++else
++
++ TARGET_SYSTEM_ROOT=
++ TARGET_SYSTEM_ROOT_DEFINE=
++ CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
++
++fi
++
++
++
++
++
+ # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
+ # passed in by the toplevel make and thus we'd get different behavior
+ # depending on where we built the sources.
+@@ -3321,7 +3397,9 @@
+ if test "${with_sysroot+set}" = set; then
+ gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
+ if test "${gcc_gxx_without_sysroot}"; then
+- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ if test x${with_sysroot} != x/; then
++ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ fi
+ gcc_gxx_include_dir_add_sysroot=1
+ fi
+ fi
+@@ -7220,78 +7298,6 @@
+
+
+
+-# Check whether --with-native-system-header-dir was given.
+-if test "${with_native_system_header_dir+set}" = set; then :
+- withval=$with_native_system_header_dir;
+- case ${with_native_system_header_dir} in
+- yes|no) as_fn_error "bad value ${withval} given for --with-native-system-header-dir" "$LINENO" 5 ;;
+- /* | [A-Za-z]:[\\/]*) ;;
+- *) as_fn_error "--with-native-system-header-dir argument ${withval} must be an absolute directory" "$LINENO" 5 ;;
+- esac
+- configured_native_system_header_dir="${withval}"
+-
+-else
+- configured_native_system_header_dir=
+-fi
+-
+-
+-
+-# Check whether --with-build-sysroot was given.
+-if test "${with_build_sysroot+set}" = set; then :
+- withval=$with_build_sysroot; if test x"$withval" != x ; then
+- SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
+- fi
+-else
+- SYSROOT_CFLAGS_FOR_TARGET=
+-fi
+-
+-
+-
+-
+-# Check whether --with-sysroot was given.
+-if test "${with_sysroot+set}" = set; then :
+- withval=$with_sysroot;
+- case ${with_sysroot} in
+- yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
+- *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
+- esac
+-
+- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
+- CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
+-
+- if test "x$prefix" = xNONE; then
+- test_prefix=/usr/local
+- else
+- test_prefix=$prefix
+- fi
+- if test "x$exec_prefix" = xNONE; then
+- test_exec_prefix=$test_prefix
+- else
+- test_exec_prefix=$exec_prefix
+- fi
+- case ${TARGET_SYSTEM_ROOT} in
+- "${test_prefix}"|"${test_prefix}/"*|\
+- "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
+- '${prefix}'|'${prefix}/'*|\
+- '${exec_prefix}'|'${exec_prefix}/'*)
+- t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
+- TARGET_SYSTEM_ROOT_DEFINE="$t"
+- ;;
+- esac
+-
+-else
+-
+- TARGET_SYSTEM_ROOT=
+- TARGET_SYSTEM_ROOT_DEFINE=
+- CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
+-
+-fi
+-
+-
+-
+-
+-
+-
+ # Check whether --with-specs was given.
+ if test "${with_specs+set}" = set; then :
+ withval=$with_specs; CONFIGURE_SPECS=$withval
+@@ -18013,7 +18019,7 @@
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 18016 "configure"
++#line 18022 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -18119,7 +18125,7 @@
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 18122 "configure"
++#line 18128 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
diff --git a/meta-aarch64/recipes-devtools/gcc/files/fortran-cross-compile-hack.patch b/meta-aarch64/recipes-devtools/gcc/files/fortran-cross-compile-hack.patch
new file mode 100644
index 00000000..2773b42c
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/fortran-cross-compile-hack.patch
@@ -0,0 +1,32 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used
+ used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross
+ directory.
+
+Index: gcc-4_7-branch/libgfortran/configure
+===================================================================
+--- gcc-4_7-branch.orig/libgfortran/configure 2012-04-10 10:17:24.055330044 -0700
++++ gcc-4_7-branch/libgfortran/configure 2012-04-10 10:42:26.159402591 -0700
+@@ -12689,7 +12689,7 @@
+
+ # We need gfortran to compile parts of the library
+ #AC_PROG_FC(gfortran)
+-FC="$GFORTRAN"
++#FC="$GFORTRAN"
+ ac_ext=${ac_fc_srcext-f}
+ ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+Index: gcc-4_7-branch/libgfortran/configure.ac
+===================================================================
+--- gcc-4_7-branch.orig/libgfortran/configure.ac 2012-04-10 10:17:24.063330046 -0700
++++ gcc-4_7-branch/libgfortran/configure.ac 2012-04-10 10:42:26.159402591 -0700
+@@ -227,7 +227,7 @@
+
+ # We need gfortran to compile parts of the library
+ #AC_PROG_FC(gfortran)
+-FC="$GFORTRAN"
++#FC="$GFORTRAN"
+ AC_PROG_FC(gfortran)
+
+ # extra LD Flags which are required for targets
diff --git a/meta-aarch64/recipes-devtools/gcc/files/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta-aarch64/recipes-devtools/gcc/files/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
new file mode 100644
index 00000000..964c4bbb
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -0,0 +1,33 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+---
+ configure | 2 +-
+ configure.ac | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+Index: gcc-4_7-branch/configure.ac
+===================================================================
+--- gcc-4_7-branch.orig/configure.ac 2012-04-10 10:19:50.923337154 -0700
++++ gcc-4_7-branch/configure.ac 2012-04-10 10:19:54.911337344 -0700
+@@ -2825,7 +2825,7 @@
+ # for target_alias and gcc doesn't manage it consistently.
+ target_configargs="--cache-file=./config.cache ${target_configargs}"
+
+-FLAGS_FOR_TARGET=
++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
+ case " $target_configdirs " in
+ *" newlib "*)
+ case " $target_configargs " in
+Index: gcc-4_7-branch/configure
+===================================================================
+--- gcc-4_7-branch.orig/configure 2012-04-10 10:19:50.911337153 -0700
++++ gcc-4_7-branch/configure 2012-04-10 10:19:54.915337349 -0700
+@@ -7368,7 +7368,7 @@
+ # for target_alias and gcc doesn't manage it consistently.
+ target_configargs="--cache-file=./config.cache ${target_configargs}"
+
+-FLAGS_FOR_TARGET=
++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
+ case " $target_configdirs " in
+ *" newlib "*)
+ case " $target_configargs " in
diff --git a/meta-aarch64/recipes-devtools/gcc/files/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta-aarch64/recipes-devtools/gcc/files/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
new file mode 100644
index 00000000..ff136e19
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
@@ -0,0 +1,116 @@
+Upstream-Status: Pending
+
+Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.
+
+This alternative patch is better because it lets you just use CFLAGS_FOR_TARGET to set the compilation flags for libgcc. Since bootstrapped target libraries are never compiled with the native compiler, it makes little sense to use different flags for stage1 and later stages. And it also makes little sense to use a different variable than CFLAGS_FOR_TARGET.
+
+Other changes I had to do include:
+
+- moving the creation of default CFLAGS_FOR_TARGET from Makefile.am to configure.ac, because otherwise the BOOT_CFLAGS are substituted into CFLAGS_FOR_TARGET (which is "-O2 -g $(CFLAGS)") via $(CFLAGS). It is also cleaner this way though.
+
+- passing the right CFLAGS to configure scripts as exported environment variables
+
+I also stopped passing LIBCFLAGS to configure scripts since they are unused in the whole src tree. And I updated the documentation as H-P reminded me to do.
+
+Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3?
+
+Paolo
+
+2008-02-19 Paolo Bonzini <bonzini@gnu.org>
+
+ PR bootstrap/32009
+ PR bootstrap/32161
+
+ * configure.ac (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Compute here.
+ * configure: Regenerate.
+
+ * Makefile.def: Define stage_libcflags for all bootstrap stages.
+ * Makefile.tpl (BOOT_LIBCFLAGS, STAGE2_LIBCFLAGS, STAGE3_LIBCFLAGS,
+ STAGE4_LIBCFLAGS): New.
+ (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Subst from autoconf, without
+ $(SYSROOT_CFLAGS_FOR_TARGET) and $(DEBUG_PREFIX_CFLAGS_FOR_TARGET).
+ (BASE_TARGET_EXPORTS): Append them here to C{,XX}FLAGS.
+ (EXTRA_TARGET_FLAGS): Append them here to {LIB,}C{,XX}FLAGS.
+ (configure-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags
+ for target modules. Don't export LIBCFLAGS.
+ (all-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags; pass
+ $(BASE_FLAGS_TO_PASS) where [+args+] was passed, and [+args+] after
+ the overridden CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
+ (invocations of `all'): Replace $(TARGET_FLAGS_TO_PASS) with
+ $(EXTRA_TARGET_FLAGS), $(FLAGS_TO_PASS) with $(EXTRA_HOST_FLAGS).
+ * Makefile.in: Regenerate.
+
+config:
+2008-02-19 Paolo Bonzini <bonzini@gnu.org>
+
+ PR bootstrap/32009
+ * mh-ppc-darwin (BOOT_CFLAGS): Reenable.
+
+gcc:
+2008-02-19 Paolo Bonzini <bonzini@gnu.org>
+
+ PR bootstrap/32009
+ * doc/install.texi: Correct references to CFLAGS, replacing them
+ with BOOT_CFLAGS. Document flags used during bootstrap for
+ target libraries.
+
+
+---
+ Makefile.def | 25
+ Makefile.in | 1845 ++++++++++++++++++++++++++++++-------------------
+ Makefile.tpl | 91 +-
+ config/mh-ppc-darwin | 3
+ configure | 36
+ configure.ac | 32
+ gcc/Makefile.in | 2
+ gcc/configure | 6
+ gcc/configure.ac | 3
+ gcc/doc/install.texi | 56 -
+ libiberty/Makefile.in | 162 ++--
+ libiberty/configure | 46 -
+ libiberty/configure.ac | 43 -
+ 13 files changed, 1454 insertions(+), 896 deletions(-)
+
+Index: gcc-4_7-branch/configure
+===================================================================
+--- gcc-4_7-branch.orig/configure 2012-04-10 10:22:05.807343683 -0700
++++ gcc-4_7-branch/configure 2012-04-10 10:37:24.243388086 -0700
+@@ -6695,6 +6695,38 @@
+
+
+
++# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
++# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
++# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
++# We want to ensure that TARGET libraries (which we know are built with
++# gcc) are built with "-O2 -g", so include those options when setting
++# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
++if test "x$CFLAGS_FOR_TARGET" = x; then
++ CFLAGS_FOR_TARGET=$CFLAGS
++ case " $CFLAGS " in
++ *" -O2 "*) ;;
++ *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
++ esac
++ case " $CFLAGS " in
++ *" -g "* | *" -g3 "*) ;;
++ *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
++ esac
++fi
++
++
++if test "x$CXXFLAGS_FOR_TARGET" = x; then
++ CXXFLAGS_FOR_TARGET=$CXXFLAGS
++ case " $CXXFLAGS " in
++ *" -O2 "*) ;;
++ *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
++ esac
++ case " $CXXFLAGS " in
++ *" -g "* | *" -g3 "*) ;;
++ *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
++ esac
++fi
++
++
+ # Handle --with-headers=XXX. If the value is not "yes", the contents of
+ # the named directory are copied to $(tooldir)/sys-include.
+ if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
diff --git a/meta-aarch64/recipes-devtools/gcc/files/gcc-argument-list-too-long.patch b/meta-aarch64/recipes-devtools/gcc/files/gcc-argument-list-too-long.patch
new file mode 100644
index 00000000..70d3c53a
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/gcc-argument-list-too-long.patch
@@ -0,0 +1,33 @@
+There would be an "Argument list too long" error when the
+build directory is longer than 200, this is caused by:
+
+headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`
+
+The PLUGIN_HEADERS is too long before sort, so the "echo" can't handle
+it, use the $(sort list) of GNU make which can handle the too long list
+would fix the problem, the header would be short enough after sorted.
+The "tr ' ' '\012'" was used for translating the space to "\n", the
+$(sort list) doesn't need this.
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+
+Upstream-Status: Pending
+---
+ gcc/Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -4553,7 +4553,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
+ # We keep the directory structure for files in config or c-family and .def
+ # files. All other files are flattened to a single directory.
+ $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
+- headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`; \
++ headers="$(sort $(PLUGIN_HEADERS))"; \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
+ for file in $$headers; do \
+ if [ -f $$file ] ; then \
+--
+1.7.10.2
+
diff --git a/meta-aarch64/recipes-devtools/gcc/files/gcc-armv4-pass-fix-v4bx-to-ld.patch b/meta-aarch64/recipes-devtools/gcc/files/gcc-armv4-pass-fix-v4bx-to-ld.patch
new file mode 100644
index 00000000..7e03a3a8
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/gcc-armv4-pass-fix-v4bx-to-ld.patch
@@ -0,0 +1,31 @@
+The LINK_SPEC for linux gets overwritten by linux-eabi.h which
+means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result
+the option is not passed to linker when chosing march=armv4
+This patch redefines this in linux-eabi.h and reinserts it
+for eabi defaulting toolchains.
+
+We might want to send it upstream
+
+Upstream-Status: Pending
+
+-Khem
+Index: gcc-4_7-branch/gcc/config/arm/linux-eabi.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/arm/linux-eabi.h 2012-08-21 22:54:12.448453417 -0700
++++ gcc-4_7-branch/gcc/config/arm/linux-eabi.h 2012-08-21 23:05:18.008478722 -0700
+@@ -78,10 +78,14 @@
+ %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
+ %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
+
++/* For armv4 we pass --fix-v4bx to linker to support EABI */
++#undef TARGET_FIX_V4BX_SPEC
++#define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
++
+ /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
+ use the GNU/Linux version, not the generic BPABI version. */
+ #undef LINK_SPEC
+-#define LINK_SPEC BE8_LINK_SPEC \
++#define LINK_SPEC BE8_LINK_SPEC TARGET_FIX_V4BX_SPEC \
+ LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
+ LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
+
diff --git a/meta-aarch64/recipes-devtools/gcc/files/gcc-poison-dir-extend.patch b/meta-aarch64/recipes-devtools/gcc/files/gcc-poison-dir-extend.patch
new file mode 100644
index 00000000..607129a6
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/gcc-poison-dir-extend.patch
@@ -0,0 +1,27 @@
+Upstream-Status: Pending
+
+Add /sw/include and /opt/include based on the original
+zecke-no-host-includes.patch patch. The original patch checked for
+/usr/include, /sw/include and /opt/include and then triggered a failure and
+aborted.
+
+Instead, we add the two missing items to the current scan. If the user
+wants this to be a failure, they can add "-Werror=poison-system-directories".
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+Index: gcc-4_7-branch/gcc/incpath.c
+===================================================================
+--- gcc-4_7-branch.orig/gcc/incpath.c 2012-04-10 10:37:09.343387385 -0700
++++ gcc-4_7-branch/gcc/incpath.c 2012-04-10 10:37:18.975387919 -0700
+@@ -371,7 +371,9 @@
+ {
+ if ((!strncmp (p->name, "/usr/include", 12))
+ || (!strncmp (p->name, "/usr/local/include", 18))
+- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
++ || (!strncmp (p->name, "/usr/X11R6/include", 18))
++ || (!strncmp (p->name, "/sw/include", 11))
++ || (!strncmp (p->name, "/opt/include", 12)))
+ warning (OPT_Wpoison_system_directories,
+ "include location \"%s\" is unsafe for "
+ "cross-compilation",
diff --git a/meta-aarch64/recipes-devtools/gcc/files/gcc-poison-system-directories.patch b/meta-aarch64/recipes-devtools/gcc/files/gcc-poison-system-directories.patch
new file mode 100644
index 00000000..82a55c9b
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/gcc-poison-system-directories.patch
@@ -0,0 +1,223 @@
+Upstream-Status: Inappropriate [distribution: codesourcery]
+
+ gcc/
+ 2008-07-02 Joseph Myers <joseph@codesourcery.com>
+ * c-incpath.c: Include toplev.h.
+ (merge_include_chains): Use warning instead of cpp_error for
+ system directory poisoning diagnostic.
+ * Makefile.in (c-incpath.o): Depend on toplev.h.
+ * gcc.c (LINK_COMMAND_SPEC): Pass
+ --error-poison-system-directories if
+ -Werror=poison-system-directories.
+
+ 2007-06-13 Joseph Myers <joseph@codesourcery.com>
+ * common.opt (--Wno-poison-system-directories): New.
+ * doc/invoke.texi (-Wno-poison-system-directories): Document.
+ * c-incpath.c: Include flags.h.
+ (merge_include_chains): Check flag_poison_system_directories.
+ * gcc.c (LINK_COMMAND_SPEC): Pass --no-poison-system-directories
+ to linker if -Wno-poison-system-directories.
+ * Makefile.in (c-incpath.o): Depend on $(FLAGS_H).
+
+ 2007-03-20 Daniel Jacobowitz <dan@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+ * configure.ac (--enable-poison-system-directories): New option.
+ * configure, config.in: Regenerate.
+ * c-incpath.c (merge_include_chains): If
+ ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of
+ /usr/include, /usr/local/include or /usr/X11R6/include.
+
+Index: gcc-4.7.2/gcc/common.opt
+===================================================================
+--- gcc-4.7.2.orig/gcc/common.opt 2012-08-06 07:34:27.000000000 -0700
++++ gcc-4.7.2/gcc/common.opt 2012-09-20 07:40:54.708937540 -0700
+@@ -582,6 +582,10 @@
+ Common Var(warn_padded) Warning
+ Warn when padding is required to align structure members
+
++Wpoison-system-directories
++Common Var(flag_poison_system_directories) Init(1) Warning
++Warn for -I and -L options using system directories if cross compiling
++
+ Wshadow
+ Common Var(warn_shadow) Warning
+ Warn when one local variable shadows another
+Index: gcc-4.7.2/gcc/config.in
+===================================================================
+--- gcc-4.7.2.orig/gcc/config.in 2012-09-20 00:23:55.000000000 -0700
++++ gcc-4.7.2/gcc/config.in 2012-09-20 07:40:54.708937540 -0700
+@@ -144,6 +144,12 @@
+ #endif
+
+
++/* Define to warn for use of native system header directories */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_POISON_SYSTEM_DIRECTORIES
++#endif
++
++
+ /* Define if you want all operations on RTL (the basic data structure of the
+ optimizer and back end) to be checked for dynamic type safety at runtime.
+ This is quite expensive. */
+Index: gcc-4.7.2/gcc/configure.ac
+===================================================================
+--- gcc-4.7.2.orig/gcc/configure.ac 2012-09-20 07:30:27.000000000 -0700
++++ gcc-4.7.2/gcc/configure.ac 2012-09-20 07:40:54.708937540 -0700
+@@ -4989,6 +4989,16 @@
+ [specify that runtime libraries should be
+ installed in a compiler-specific directory])])
+
++AC_ARG_ENABLE([poison-system-directories],
++ AS_HELP_STRING([--enable-poison-system-directories],
++ [warn for use of native system header directories]),,
++ [enable_poison_system_directories=no])
++if test "x${enable_poison_system_directories}" = "xyes"; then
++ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
++ [1],
++ [Define to warn for use of native system header directories])
++fi
++
+ # Substitute configuration variables
+ AC_SUBST(subdirs)
+ AC_SUBST(srcdir)
+Index: gcc-4.7.2/gcc/doc/invoke.texi
+===================================================================
+--- gcc-4.7.2.orig/gcc/doc/invoke.texi 2012-09-14 13:45:27.000000000 -0700
++++ gcc-4.7.2/gcc/doc/invoke.texi 2012-09-20 07:40:54.712937541 -0700
+@@ -260,6 +260,7 @@
+ -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
+ -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
+ -Wpointer-arith -Wno-pointer-to-int-cast @gol
++-Wno-poison-system-directories @gol
+ -Wredundant-decls @gol
+ -Wreturn-type -Wsequence-point -Wshadow @gol
+ -Wsign-compare -Wsign-conversion -Wstack-protector @gol
+@@ -3879,6 +3880,14 @@
+ for most targets, it is made up of code and thus requires the stack
+ to be made executable in order for the program to work properly.
+
++@item -Wno-poison-system-directories
++@opindex Wno-poison-system-directories
++Do not warn for @option{-I} or @option{-L} options using system
++directories such as @file{/usr/include} when cross compiling. This
++option is intended for use in chroot environments when such
++directories contain the correct headers and libraries for the target
++system rather than the host.
++
+ @item -Wfloat-equal
+ @opindex Wfloat-equal
+ @opindex Wno-float-equal
+Index: gcc-4.7.2/gcc/gcc.c
+===================================================================
+--- gcc-4.7.2.orig/gcc/gcc.c 2012-08-06 07:34:27.000000000 -0700
++++ gcc-4.7.2/gcc/gcc.c 2012-09-20 07:40:54.716937541 -0700
+@@ -673,6 +673,8 @@
+ %{flto} %{flto=*} %l " LINK_PIE_SPEC \
+ "%X %{o*} %{e*} %{N} %{n} %{r}\
+ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
++ %{Wno-poison-system-directories:--no-poison-system-directories}\
++ %{Werror=poison-system-directories:--error-poison-system-directories}\
+ %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
+ %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
+ %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
+Index: gcc-4.7.2/gcc/incpath.c
+===================================================================
+--- gcc-4.7.2.orig/gcc/incpath.c 2012-01-26 15:34:58.000000000 -0800
++++ gcc-4.7.2/gcc/incpath.c 2012-09-20 07:40:54.716937541 -0700
+@@ -361,6 +361,24 @@
+ }
+ fprintf (stderr, _("End of search list.\n"));
+ }
++
++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
++ if (flag_poison_system_directories)
++ {
++ struct cpp_dir *p;
++
++ for (p = heads[QUOTE]; p; p = p->next)
++ {
++ if ((!strncmp (p->name, "/usr/include", 12))
++ || (!strncmp (p->name, "/usr/local/include", 18))
++ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
++ warning (OPT_Wpoison_system_directories,
++ "include location \"%s\" is unsafe for "
++ "cross-compilation",
++ p->name);
++ }
++ }
++#endif
+ }
+
+ /* Use given -I paths for #include "..." but not #include <...>, and
+Index: gcc-4.7.2/gcc/Makefile.in
+===================================================================
+--- gcc-4.7.2.orig/gcc/Makefile.in 2012-08-06 07:34:27.000000000 -0700
++++ gcc-4.7.2/gcc/Makefile.in 2012-09-20 07:40:54.716937541 -0700
+@@ -2065,7 +2065,7 @@
+
+ incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
+ intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
+- $(MACHMODE_H)
++ $(MACHMODE_H) $(FLAGS_H) toplev.h
+
+ CFLAGS-prefix.o += -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s)
+ prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h prefix.h \
+Index: gcc-4.7.2/gcc/configure
+===================================================================
+--- gcc-4.7.2.orig/gcc/configure 2012-09-20 07:30:27.000000000 -0700
++++ gcc-4.7.2/gcc/configure 2012-09-20 07:41:08.548938066 -0700
+@@ -914,6 +914,7 @@
+ with_system_zlib
+ enable_maintainer_mode
+ enable_version_specific_runtime_libs
++enable_poison_system_directories
+ enable_plugin
+ enable_libquadmath_support
+ with_linker_hash_style
+@@ -1627,6 +1628,8 @@
+ --enable-version-specific-runtime-libs
+ specify that runtime libraries should be installed
+ in a compiler-specific directory
++ --enable-poison-system-directories
++ warn for use of native system header directories
+ --enable-plugin enable plugin support
+ --disable-libquadmath-support
+ disable libquadmath support for Fortran
+@@ -18010,7 +18013,7 @@
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 18013 "configure"
++#line 18016 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -18116,7 +18119,7 @@
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 18119 "configure"
++#line 18122 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -27129,6 +27132,19 @@
+ fi
+
+
++# Check whether --enable-poison-system-directories was given.
++if test "${enable_poison_system_directories+set}" = set; then :
++ enableval=$enable_poison_system_directories;
++else
++ enable_poison_system_directories=no
++fi
++
++if test "x${enable_poison_system_directories}" = "xyes"; then
++
++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
++
++fi
++
+ # Substitute configuration variables
+
+
diff --git a/meta-aarch64/recipes-devtools/gcc/files/gcc-uclibc-locale-ctype_touplow_t.patch b/meta-aarch64/recipes-devtools/gcc/files/gcc-uclibc-locale-ctype_touplow_t.patch
new file mode 100644
index 00000000..1648b3b9
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/gcc-uclibc-locale-ctype_touplow_t.patch
@@ -0,0 +1,72 @@
+Upstream-Status: Pending
+
+Index: gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.h
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/generic/c_locale.h
++++ gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.h
+@@ -41,13 +41,22 @@
+
+ #include <clocale>
+
++#ifdef __UCLIBC__
++#include <features.h>
++#include <ctype.h>
++#endif
++
+ #define _GLIBCXX_NUM_CATEGORIES 0
+
+ namespace std _GLIBCXX_VISIBILITY(default)
+ {
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
++#ifdef __UCLIBC__
++ typedef __ctype_touplow_t* __c_locale;
++#else
+ typedef int* __c_locale;
++#endif
+
+ // Convert numeric value of type double and long double to string and
+ // return length of string. If vsnprintf is available use it, otherwise
+Index: gcc-4.6.0/libstdc++-v3/config/os/gnu-linux/ctype_base.h
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/os/gnu-linux/ctype_base.h
++++ gcc-4.6.0/libstdc++-v3/config/os/gnu-linux/ctype_base.h
+@@ -34,6 +34,11 @@
+
+ // Information as gleaned from /usr/include/ctype.h
+
++#ifdef __UCLIBC__
++#include <features.h>
++#include <ctype.h>
++#endif
++
+ namespace std _GLIBCXX_VISIBILITY(default)
+ {
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+@@ -42,7 +47,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ struct ctype_base
+ {
+ // Non-standard typedefs.
++#ifdef __UCLIBC__
++ typedef const __ctype_touplow_t* __to_type;
++#else
+ typedef const int* __to_type;
++#endif
+
+ // NB: Offsets into ctype<char>::_M_table force a particular size
+ // on the mask type. Because of this, we don't use an enum.
+Index: gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.cc
+===================================================================
+--- gcc-4.6.0.orig/libstdc++-v3/config/locale/generic/c_locale.cc
++++ gcc-4.6.0/libstdc++-v3/config/locale/generic/c_locale.cc
+@@ -264,5 +264,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
+ #ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
+ #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
+ extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
++#ifdef __UCLIBC__
++// This is because __c_locale is of type __ctype_touplow_t* which is short on uclibc. for glibc its int*
++_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPs, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPs);
++#else
+ _GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
++#endif
+ #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
diff --git a/meta-aarch64/recipes-devtools/gcc/files/libgcc-sjlj-check.patch b/meta-aarch64/recipes-devtools/gcc/files/libgcc-sjlj-check.patch
new file mode 100644
index 00000000..c2fe7921
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/libgcc-sjlj-check.patch
@@ -0,0 +1,61 @@
+ac_fn_c_try_compile doesnt seem to keep the intermediate files
+which are needed for sjlj test to pass since it greps into the
+generated file. So we run the compiler command using AC_TRY_COMMAND
+which then generates the needed .s file
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+Index: trunk/libgcc/configure
+===================================================================
+--- trunk.orig/libgcc/configure 2012-03-01 22:59:10.112444433 -0800
++++ trunk/libgcc/configure 2012-03-01 22:59:50.424446325 -0800
+@@ -4525,17 +4525,19 @@
+ }
+
+ _ACEOF
+-CFLAGS_hold=$CFLAGS
+-CFLAGS="--save-temps -fexceptions"
+ libgcc_cv_lib_sjlj_exceptions=unknown
+-if ac_fn_c_try_compile; then :
++if { ac_try='${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&5'
++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; }; then
+ if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
+ libgcc_cv_lib_sjlj_exceptions=yes
+ elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
+ libgcc_cv_lib_sjlj_exceptions=no
+ fi
+ fi
+-CFLAGS=$CFLAGS_hold
+ rm -f conftest*
+
+ fi
+Index: trunk/libgcc/configure.ac
+===================================================================
+--- trunk.orig/libgcc/configure.ac 2012-03-01 22:59:10.128444406 -0800
++++ trunk/libgcc/configure.ac 2012-03-01 22:59:50.428446373 -0800
+@@ -209,16 +209,14 @@
+ bar();
+ }
+ ])])
+-CFLAGS_hold=$CFLAGS
+-CFLAGS="--save-temps -fexceptions"
+ libgcc_cv_lib_sjlj_exceptions=unknown
+-AS_IF([ac_fn_c_try_compile],
+- [if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
++if AC_TRY_COMMAND(${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
++ if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
+ libgcc_cv_lib_sjlj_exceptions=yes
+ elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
+ libgcc_cv_lib_sjlj_exceptions=no
+- fi])
+-CFLAGS=$CFLAGS_hold
++ fi
++fi
+ rm -f conftest*
+ ])
+
diff --git a/meta-aarch64/recipes-devtools/gcc/files/libtool.patch b/meta-aarch64/recipes-devtools/gcc/files/libtool.patch
new file mode 100644
index 00000000..9580b23d
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/libtool.patch
@@ -0,0 +1,29 @@
+libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
+when running on am x86_64 build host.
+
+This patch stops this speading to libdir in the libstdc++.la file within libtool.
+Aguably, it shouldn't be passing this into libtool in the first place but
+for now this resolves the nastiest problems this causes.
+
+func_normal_abspath would resolve an empty path to `pwd` so we need
+to filter the zero case.
+
+RP 2012/8/24
+
+Upstream-Status: Pending
+
+Index: git/ltmain.sh
+===================================================================
+--- git.orig/ltmain.sh 2012-08-24 11:45:58.597087961 +0000
++++ git/ltmain.sh 2012-08-24 12:18:37.961042581 +0000
+@@ -6359,6 +6359,10 @@
+ func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+ install_libdir="$1"
++ if test -n "$install_libdir"; then
++ func_normal_abspath "$install_libdir"
++ install_libdir=$func_normal_abspath_result
++ fi
+
+ oldlibs=
+ if test -z "$rpath"; then
diff --git a/meta-aarch64/recipes-devtools/gcc/files/mips64-default-n64.patch b/meta-aarch64/recipes-devtools/gcc/files/mips64-default-n64.patch
new file mode 100644
index 00000000..a42569e0
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/mips64-default-n64.patch
@@ -0,0 +1,19 @@
+MIPS64 defaults to n32 ABI, this patch makes it
+so that it defaults to N64 ABI
+
+Upstream-Status: Inappropriate [OE config specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Index: gcc-4_7-branch/gcc/config.gcc
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config.gcc 2012-04-22 19:30:21.000000000 -0700
++++ gcc-4_7-branch/gcc/config.gcc 2012-04-22 21:09:57.783403173 -0700
+@@ -1750,7 +1750,7 @@
+ mips64*-*-linux* | mipsisa64*-*-linux*)
+ tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h"
+ tmake_file="${tmake_file} mips/t-linux64"
+- tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
++ tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_64"
+ case ${target} in
+ mips64el-st-linux-gnu)
+ tm_file="${tm_file} mips/st.h"
diff --git a/meta-aarch64/recipes-devtools/gcc/files/optional_libstdc.patch b/meta-aarch64/recipes-devtools/gcc/files/optional_libstdc.patch
new file mode 100644
index 00000000..6e7536b6
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/optional_libstdc.patch
@@ -0,0 +1,86 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++
+will not run correctly since by default the linker will try to link against libstdc++
+which shouldn't exist yet. We need an option to disable -lstdc++
+option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc
+driver. This patch adds such an option which only disables the -lstdc++.
+
+A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to
+do this officially, the likely answer is don't build libstdc++ separately.
+
+RP 29/6/10
+
+Index: gcc-4_7-branch/gcc/cp/g++spec.c
+===================================================================
+--- gcc-4_7-branch.orig/gcc/cp/g++spec.c 2012-04-10 10:17:24.647330074 -0700
++++ gcc-4_7-branch/gcc/cp/g++spec.c 2012-04-10 10:37:49.479389235 -0700
+@@ -127,6 +127,7 @@
+ switch (decoded_options[i].opt_index)
+ {
+ case OPT_nostdlib:
++ case OPT_nostdlib__:
+ case OPT_nodefaultlibs:
+ library = -1;
+ break;
+Index: gcc-4_7-branch/gcc/doc/invoke.texi
+===================================================================
+--- gcc-4_7-branch.orig/gcc/doc/invoke.texi 2012-04-10 10:37:09.343387385 -0700
++++ gcc-4_7-branch/gcc/doc/invoke.texi 2012-04-10 10:37:49.483389340 -0700
+@@ -194,7 +194,7 @@
+ -fno-pretty-templates @gol
+ -frepo -fno-rtti -fstats -ftemplate-depth=@var{n} @gol
+ -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
+--fno-default-inline -fvisibility-inlines-hidden @gol
++-nostdlib++ -fno-default-inline -fvisibility-inlines-hidden @gol
+ -fvisibility-ms-compat @gol
+ -Wabi -Wconversion-null -Wctor-dtor-privacy @gol
+ -Wdelete-non-virtual-dtor -Wnarrowing -Wnoexcept @gol
+@@ -445,7 +445,7 @@
+ @gccoptlist{@var{object-file-name} -l@var{library} @gol
+ -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
+ -s -static -static-libgcc -static-libstdc++ -shared @gol
+--shared-libgcc -symbolic @gol
++-shared-libgcc -symbolic -nostdlib++ @gol
+ -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
+ -u @var{symbol}}
+
+@@ -9438,6 +9438,11 @@
+ libc. These entry points should be supplied through some other
+ mechanism when this option is specified.
+
++@item -nostdlib++
++@opindex nostdlib++
++Do not use the standard system C++ runtime libraries when linking.
++Only the libraries you specify will be passed to the linker.
++
+ @cindex @option{-lgcc}, use with @option{-nostdlib}
+ @cindex @option{-nostdlib} and unresolved references
+ @cindex unresolved references and @option{-nostdlib}
+Index: gcc-4_7-branch/gcc/c-family/c.opt
+===================================================================
+--- gcc-4_7-branch.orig/gcc/c-family/c.opt 2012-04-10 10:17:24.667330076 -0700
++++ gcc-4_7-branch/gcc/c-family/c.opt 2012-04-10 10:37:49.483389340 -0700
+@@ -1171,6 +1171,10 @@
+ C++ ObjC++
+ Do not search standard system include directories for C++
+
++nostdlib++
++Driver
++Do not link standard C++ runtime library
++
+ o
+ C ObjC C++ ObjC++ Joined Separate
+ ; Documented in common.opt
+Index: gcc-4_7-branch/gcc/gcc.c
+===================================================================
+--- gcc-4_7-branch.orig/gcc/gcc.c 2012-04-10 10:37:09.343387385 -0700
++++ gcc-4_7-branch/gcc/gcc.c 2012-04-10 10:37:49.487389409 -0700
+@@ -681,6 +681,7 @@
+ %(mflib) " STACK_SPLIT_SPEC "\
+ %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
+ %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
++ %{!nostdlib++:}\
+ %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
+ #endif
+
diff --git a/meta-aarch64/recipes-devtools/gcc/files/ppc_no_crtsavres.patch b/meta-aarch64/recipes-devtools/gcc/files/ppc_no_crtsavres.patch
new file mode 100644
index 00000000..92a5d9e1
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/ppc_no_crtsavres.patch
@@ -0,0 +1,72 @@
+Upstream-Status: Backport
+
+Signed-off-by: Khem Raj
+
+Source-url: http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01362.html
+
+Currently, powerpc-linux gcc -Os -mno-multiple uses out-of-linux gpr
+save and restore functions when saving/restoring just one gpr. That's
+quite silly since the function call requires more instructions and is
+slower than an inline save/restore. The only case where it might win
+is when no fprs are restored and the restore function can tear down
+the frame and exit (also loading up lr on ppc64). I guess that's how
+GP_SAVE_INLINE came to be like it is, ie. it's optimised for the
+common case using ldm in the prologue and no fprs. Still, it isn't
+difficult to choose the best combination in all cases, but it does
+mean different logic is needed for restores. I could have implemented
+GP_RESTORE_INLINE and FP_RESORE_INLINE macros but it seemed simpler to
+just move everything into the one place the macros are invoked. AIX
+and Darwin register cutoff doesn't change with this patch.
+
+This patch also enables out-of-line restores in cases that were
+previously disabled due to using inline saves.
+
+Bootstrapped and regression tested powerpc-linux. OK to apply?
+
+ * aix.h (FP_SAVE_INLINE, GP_SAVE_INLINE): Delete.
+ * darwin.h (FP_SAVE_INLINE, GP_SAVE_INLINE): Delete.
+ * sysv4.h (FP_SAVE_INLINE, GP_SAVE_INLINE, V_SAVE_INLINE): Delete.
+ * config/rs6000/rs6000.c (V_SAVE_INLINE): Delete.
+ (rs6000_savres_strategy): Reimplement GP/FP/V_SAVE_INLINE logic.
+ For ELF targets, use out-of-line restores for -Os and any number
+ of regs if the restore exits, and out-of-line gp save for two or
+ more regs. Use save_reg_p to test for holes in reg restore set.
+ Replace "#if" with "if".
+
+Index: gcc-4_7-branch/gcc/config/rs6000/aix.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/aix.h 2012-09-07 12:35:35.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/aix.h 2012-09-07 15:27:55.215290315 -0700
+@@ -207,11 +207,6 @@
+ { "link_syscalls", LINK_SYSCALLS_SPEC }, \
+ { "link_libg", LINK_LIBG_SPEC }
+
+-/* Define cutoff for using external functions to save floating point. */
+-#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
+-/* And similarly for general purpose registers. */
+-#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32)
+-
+ #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
+
+ /* No version of AIX fully supports AltiVec or 64-bit instructions in
+Index: gcc-4_7-branch/gcc/config/rs6000/darwin.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/darwin.h 2012-09-07 12:35:35.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/darwin.h 2012-09-07 15:27:55.223290316 -0700
+@@ -173,16 +173,6 @@
+ (RS6000_ALIGN (crtl->outgoing_args_size, 16) \
+ + (STACK_POINTER_OFFSET))
+
+-/* Define cutoff for using out-of-line functions to save registers.
+- Currently on Darwin, we implement FP and GPR out-of-line-saves plus the
+- special routine for 'save everything'. */
+-
+-#undef FP_SAVE_INLINE
+-#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) > 60 && (FIRST_REG) < 64)
+-
+-#undef GP_SAVE_INLINE
+-#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) > 29 && (FIRST_REG) < 32)
+-
+ /* Darwin uses a function call if everything needs to be saved/restored. */
+
+ #undef WORLD_SAVE_P
diff --git a/meta-aarch64/recipes-devtools/gcc/files/ppc_with_cpu.patch b/meta-aarch64/recipes-devtools/gcc/files/ppc_with_cpu.patch
new file mode 100644
index 00000000..5ca12a68
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/ppc_with_cpu.patch
@@ -0,0 +1,752 @@
+Upstream-Status: Backport
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+From 7630308303ea21c318bd57c35590fc4f249a30d8 Mon Sep 17 00:00:00 2001
+From: hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Wed, 16 May 2012 08:43:41 +0000
+Subject: [PATCH] * config/rs6000/rs6000-opts.h (enum processor_type):
+ Add PROCESSOR_PPC8548. *
+ config/rs6000/rs6000-cpus.def: Reference it for cpu="8548".
+ * config/rs6000/rs6000.md (cpu attribute
+ definition): Add ppc8548. * config/rs6000/8540.md:
+ indicate that the units/patterns apply to ppc8548
+ as well.
+
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Rename
+ default_cpu into implicit_cpu, conveying what --with-cpu was passed at
+ configure time. Treat implicit_cpu as have_CPU. Pick defaults for SPE
+ related flags, check that what is queried is supported by the selected
+ configuration. Rework the single/double_float and MASK_STRING resets to
+ hit for all the E500 cores (854x + E500MC variants). Select the ppc8540
+ costs for PROCESSOR_PPC8548 as well.
+ (rs6000_issue_rate): case CPU_PPC8548 together with CPU_PPC8540.
+ (rs6000_use_sched_lookahead): Likewise, rewriting function as a case
+ statement instead of a sequence of ifs.
+
+ * config/rs6000/rs6000.h (TARGET_E500): Remove.
+ (TARGET_NO_LWSYNC): Adjust accordingly.
+ * config/rs6000/e500.h (TARGET_E500): Remove.
+ (CHECK_E500_OPTIONS): Adjust accordingly.
+ * config/rs6000/eabispe.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Remove.
+ (TARGET_DEFAULT): Reformat definition to match the one in linuxspe.h.
+ * config/rs6000/linuxspe.h: Likewise.
+ * config/rs6000/vxworks.h: Remove bogus TARGET_E500 overrides and
+ superfluous comments.
+ * config/rs6000/e500-double.h: Remove.
+
+ * config.gcc (pick a default with_cpu): For powerpc*-*-*spe*,
+ default to with_cpu=8548 if --enable-e500-double, and to 8540
+ otherwise.
+ (set misc flags section): For powerpc*|rs6000*, remove inclusion
+ of e500-double.h for --enable-e500-double.
+
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187581 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ gcc/ChangeLog | 37 +++++++++
+ gcc/config.gcc | 12 +--
+ gcc/config/rs6000/8540.md | 50 ++++++------
+ gcc/config/rs6000/e500-double.h | 24 ------
+ gcc/config/rs6000/e500.h | 10 +--
+ gcc/config/rs6000/eabispe.h | 17 +---
+ gcc/config/rs6000/linuxspe.h | 16 +---
+ gcc/config/rs6000/rs6000-cpus.def | 3 +-
+ gcc/config/rs6000/rs6000-opts.h | 1 +
+ gcc/config/rs6000/rs6000.c | 155 +++++++++++++++++++++++--------------
+ gcc/config/rs6000/rs6000.h | 7 +-
+ gcc/config/rs6000/rs6000.md | 2 +-
+ gcc/config/rs6000/rtems.h | 14 ----
+ gcc/config/rs6000/vxworks.h | 11 ---
+ 14 files changed, 178 insertions(+), 181 deletions(-)
+
+Index: gcc-4_7-branch/gcc/config.gcc
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config.gcc 2012-07-06 19:43:53.000000000 -0700
++++ gcc-4_7-branch/gcc/config.gcc 2012-07-06 19:44:38.000000000 -0700
+@@ -2876,6 +2876,13 @@
+ mips*-*-vxworks)
+ with_arch=mips2
+ ;;
++ powerpc*-*-*spe*)
++ if test x$enable_e500_double = xyes; then
++ with_cpu=8548
++ else
++ with_cpu=8540
++ fi
++ ;;
+ sparc-leon*-*)
+ with_cpu=v8;
+ ;;
+@@ -3564,11 +3571,6 @@
+ c_target_objs="${c_target_objs} rs6000-c.o"
+ cxx_target_objs="${cxx_target_objs} rs6000-c.o"
+ tmake_file="rs6000/t-rs6000 ${tmake_file}"
+-
+- if test x$enable_e500_double = xyes
+- then
+- tm_file="$tm_file rs6000/e500-double.h"
+- fi
+ ;;
+
+ sh[123456ble]*-*-* | sh-*-*)
+Index: gcc-4_7-branch/gcc/config/rs6000/8540.md
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/8540.md 2012-07-05 23:49:07.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/8540.md 2012-07-06 19:44:38.466780001 -0700
+@@ -87,18 +87,18 @@
+ (and (eq_attr "type" "integer,insert_word,insert_dword,cmp,compare,\
+ delayed_compare,var_delayed_compare,fast_compare,\
+ shift,trap,var_shift_rotate,cntlz,exts,isel")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
+
+ (define_insn_reservation "ppc8540_two" 1
+ (and (eq_attr "type" "two")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire,\
+ ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
+
+ (define_insn_reservation "ppc8540_three" 1
+ (and (eq_attr "type" "three")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire,\
+ ppc8540_issue+ppc8540_su_stage0+ppc8540_retire,\
+ ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
+@@ -106,13 +106,13 @@
+ ;; Branch. Actually this latency time is not used by the scheduler.
+ (define_insn_reservation "ppc8540_branch" 1
+ (and (eq_attr "type" "jmpreg,branch,isync")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_bu,ppc8540_retire")
+
+ ;; Multiply
+ (define_insn_reservation "ppc8540_multiply" 4
+ (and (eq_attr "type" "imul,imul2,imul3,imul_compare")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0,ppc8540_mu_stage1,\
+ ppc8540_mu_stage2,ppc8540_mu_stage3+ppc8540_retire")
+
+@@ -122,57 +122,57 @@
+ ;; time.
+ (define_insn_reservation "ppc8540_divide" 14
+ (and (eq_attr "type" "idiv")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0+ppc8540_mu_div,\
+ ppc8540_mu_div*13")
+
+ ;; CR logical
+ (define_insn_reservation "ppc8540_cr_logical" 1
+ (and (eq_attr "type" "cr_logical,delayed_cr")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_bu,ppc8540_retire")
+
+ ;; Mfcr
+ (define_insn_reservation "ppc8540_mfcr" 1
+ (and (eq_attr "type" "mfcr")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_su1_stage0+ppc8540_retire")
+
+ ;; Mtcrf
+ (define_insn_reservation "ppc8540_mtcrf" 1
+ (and (eq_attr "type" "mtcr")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_su1_stage0+ppc8540_retire")
+
+ ;; Mtjmpr
+ (define_insn_reservation "ppc8540_mtjmpr" 1
+ (and (eq_attr "type" "mtjmpr,mfjmpr")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
+
+ ;; Loads
+ (define_insn_reservation "ppc8540_load" 3
+ (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,\
+ load_l,sync")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_lsu,nothing,ppc8540_retire")
+
+ ;; Stores.
+ (define_insn_reservation "ppc8540_store" 3
+ (and (eq_attr "type" "store,store_ux,store_u,store_c")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_lsu,nothing,ppc8540_retire")
+
+ ;; Simple FP
+ (define_insn_reservation "ppc8540_simple_float" 1
+ (and (eq_attr "type" "fpsimple")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
+
+ ;; FP
+ (define_insn_reservation "ppc8540_float" 4
+ (and (eq_attr "type" "fp")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0,ppc8540_mu_stage1,\
+ ppc8540_mu_stage2,ppc8540_mu_stage3+ppc8540_retire")
+
+@@ -180,44 +180,44 @@
+ ;; because of the result automata will be huge.
+ (define_insn_reservation "ppc8540_float_vector_divide" 29
+ (and (eq_attr "type" "vecfdiv")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0+ppc8540_mu_div,\
+ ppc8540_mu_div*28")
+
+ ;; Brinc
+ (define_insn_reservation "ppc8540_brinc" 1
+ (and (eq_attr "type" "brinc")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
+
+ ;; Simple vector
+ (define_insn_reservation "ppc8540_simple_vector" 1
+ (and (eq_attr "type" "vecsimple")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_su1_stage0+ppc8540_retire")
+
+ ;; Simple vector compare
+ (define_insn_reservation "ppc8540_simple_vector_compare" 1
+ (and (eq_attr "type" "veccmpsimple")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_su_stage0+ppc8540_retire")
+
+ ;; Vector compare
+ (define_insn_reservation "ppc8540_vector_compare" 1
+ (and (eq_attr "type" "veccmp")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_su1_stage0+ppc8540_retire")
+
+ ;; evsplatfi evsplati
+ (define_insn_reservation "ppc8540_vector_perm" 1
+ (and (eq_attr "type" "vecperm")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_su1_stage0+ppc8540_retire")
+
+ ;; Vector float
+ (define_insn_reservation "ppc8540_float_vector" 4
+ (and (eq_attr "type" "vecfloat")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0,ppc8540_mu_stage1,\
+ ppc8540_mu_stage2,ppc8540_mu_stage3+ppc8540_retire")
+
+@@ -226,25 +226,25 @@
+ ;; of miu_stage3 here because we use the average latency time.
+ (define_insn_reservation "ppc8540_vector_divide" 14
+ (and (eq_attr "type" "vecdiv")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0+ppc8540_mu_div,\
+ ppc8540_mu_div*13")
+
+ ;; Complex vector.
+ (define_insn_reservation "ppc8540_complex_vector" 4
+ (and (eq_attr "type" "veccomplex")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_mu_stage0,ppc8540_mu_stage1,\
+ ppc8540_mu_stage2,ppc8540_mu_stage3+ppc8540_retire")
+
+ ;; Vector load
+ (define_insn_reservation "ppc8540_vector_load" 3
+ (and (eq_attr "type" "vecload")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_lsu,nothing,ppc8540_retire")
+
+ ;; Vector store
+ (define_insn_reservation "ppc8540_vector_store" 3
+ (and (eq_attr "type" "vecstore")
+- (eq_attr "cpu" "ppc8540"))
++ (eq_attr "cpu" "ppc8540,ppc8548"))
+ "ppc8540_decode,ppc8540_issue+ppc8540_lsu,nothing,ppc8540_retire")
+Index: gcc-4_7-branch/gcc/config/rs6000/e500-double.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/e500-double.h 2012-07-05 23:49:07.000000000 -0700
++++ /dev/null 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+-/* Target definitions for E500 with double precision FP.
+- Copyright (C) 2004, 2006, 2007, 2011 Free Software Foundation, Inc.
+- Contributed by Aldy Hernandez (aldyh@redhat.com).
+-
+- This file is part of GCC.
+-
+- GCC is free software; you can redistribute it and/or modify it
+- under the terms of the GNU General Public License as published
+- by the Free Software Foundation; either version 3, or (at your
+- option) any later version.
+-
+- GCC is distributed in the hope that it will be useful, but WITHOUT
+- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+- License for more details.
+-
+- You should have received a copy of the GNU General Public License
+- along with GCC; see the file COPYING3. If not see
+- <http://www.gnu.org/licenses/>. */
+-
+-#undef SUB3TARGET_OVERRIDE_OPTIONS
+-#define SUB3TARGET_OVERRIDE_OPTIONS \
+- if (!global_options_set.x_rs6000_float_gprs) \
+- rs6000_float_gprs = 2;
+Index: gcc-4_7-branch/gcc/config/rs6000/e500.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/e500.h 2012-07-05 23:49:07.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/e500.h 2012-07-06 19:44:38.466780001 -0700
+@@ -19,7 +19,6 @@
+
+ #undef TARGET_SPE_ABI
+ #undef TARGET_SPE
+-#undef TARGET_E500
+ #undef TARGET_FPRS
+ #undef TARGET_E500_SINGLE
+ #undef TARGET_E500_DOUBLE
+@@ -27,21 +26,20 @@
+
+ #define TARGET_SPE_ABI rs6000_spe_abi
+ #define TARGET_SPE rs6000_spe
+-#define TARGET_E500 (rs6000_cpu == PROCESSOR_PPC8540)
+ #define TARGET_FPRS (rs6000_float_gprs == 0)
+ #define TARGET_E500_SINGLE (TARGET_HARD_FLOAT && rs6000_float_gprs == 1)
+ #define TARGET_E500_DOUBLE (TARGET_HARD_FLOAT && rs6000_float_gprs == 2)
+ #define CHECK_E500_OPTIONS \
+ do { \
+- if (TARGET_E500 || TARGET_SPE || TARGET_SPE_ABI \
++ if (TARGET_SPE || TARGET_SPE_ABI \
+ || TARGET_E500_SINGLE || TARGET_E500_DOUBLE) \
+ { \
+ if (TARGET_ALTIVEC) \
+- error ("AltiVec and E500 instructions cannot coexist"); \
++ error ("AltiVec and SPE instructions cannot coexist"); \
+ if (TARGET_VSX) \
+- error ("VSX and E500 instructions cannot coexist"); \
++ error ("VSX and SPE instructions cannot coexist"); \
+ if (TARGET_64BIT) \
+- error ("64-bit E500 not supported"); \
++ error ("64-bit SPE not supported"); \
+ if (TARGET_HARD_FLOAT && TARGET_FPRS) \
+ error ("E500 and FPRs not supported"); \
+ } \
+Index: gcc-4_7-branch/gcc/config/rs6000/eabispe.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/eabispe.h 2012-07-05 23:49:07.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/eabispe.h 2012-07-06 19:44:38.466780001 -0700
+@@ -21,21 +21,8 @@
+ <http://www.gnu.org/licenses/>. */
+
+ #undef TARGET_DEFAULT
+-#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI \
+- | MASK_STRICT_ALIGN)
+-
+-#undef SUBSUBTARGET_OVERRIDE_OPTIONS
+-#define SUBSUBTARGET_OVERRIDE_OPTIONS \
+- if (!global_options_set.x_rs6000_cpu_index) \
+- rs6000_cpu = PROCESSOR_PPC8540; \
+- if (!global_options_set.x_rs6000_spe_abi) \
+- rs6000_spe_abi = 1; \
+- if (!global_options_set.x_rs6000_float_gprs) \
+- rs6000_float_gprs = 1; \
+- if (!global_options_set.x_rs6000_spe) \
+- rs6000_spe = 1; \
+- if (target_flags & MASK_64BIT) \
+- error ("-m64 not supported in this configuration")
++#define TARGET_DEFAULT \
++ (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_STRICT_ALIGN | MASK_EABI)
+
+ #undef ASM_DEFAULT_SPEC
+ #define ASM_DEFAULT_SPEC "-mppc -mspe -me500"
+Index: gcc-4_7-branch/gcc/config/rs6000/linuxspe.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/linuxspe.h 2012-07-05 23:52:14.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/linuxspe.h 2012-07-06 19:44:38.466780001 -0700
+@@ -22,20 +22,8 @@
+
+ /* Override rs6000.h and sysv4.h definition. */
+ #undef TARGET_DEFAULT
+-#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_STRICT_ALIGN)
+-
+-#undef SUBSUBTARGET_OVERRIDE_OPTIONS
+-#define SUBSUBTARGET_OVERRIDE_OPTIONS \
+- if (!global_options_set.x_rs6000_cpu_index) \
+- rs6000_cpu = PROCESSOR_PPC8540; \
+- if (!global_options_set.x_rs6000_spe_abi) \
+- rs6000_spe_abi = 1; \
+- if (!global_options_set.x_rs6000_float_gprs) \
+- rs6000_float_gprs = 1; \
+- if (!global_options_set.x_rs6000_spe) \
+- rs6000_spe = 1; \
+- if (target_flags & MASK_64BIT) \
+- error ("-m64 not supported in this configuration")
++#define TARGET_DEFAULT \
++ (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_STRICT_ALIGN)
+
+ #undef ASM_DEFAULT_SPEC
+ #define ASM_DEFAULT_SPEC "-mppc -mspe -me500"
+Index: gcc-4_7-branch/gcc/config/rs6000/rs6000-cpus.def
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000-cpus.def 2012-07-06 19:43:53.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/rs6000-cpus.def 2012-07-06 19:44:38.000000000 -0700
+@@ -76,8 +76,7 @@
+ RS6000_CPU ("823", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT)
+ RS6000_CPU ("8540", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN
+ | MASK_ISEL)
+-/* 8548 has a dummy entry for now. */
+-RS6000_CPU ("8548", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN
++RS6000_CPU ("8548", PROCESSOR_PPC8548, POWERPC_BASE_MASK | MASK_STRICT_ALIGN
+ | MASK_ISEL)
+ RS6000_CPU ("a2", PROCESSOR_PPCA2,
+ POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64 | MASK_POPCNTB
+Index: gcc-4_7-branch/gcc/config/rs6000/rs6000-opts.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000-opts.h 2012-07-06 19:43:53.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/rs6000-opts.h 2012-07-06 19:44:38.000000000 -0700
+@@ -49,6 +49,7 @@
+ PROCESSOR_PPC7400,
+ PROCESSOR_PPC7450,
+ PROCESSOR_PPC8540,
++ PROCESSOR_PPC8548,
+ PROCESSOR_PPCE300C2,
+ PROCESSOR_PPCE300C3,
+ PROCESSOR_PPCE500MC,
+Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.c
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.c 2012-07-06 19:43:53.194780001 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/rs6000.c 2012-07-06 19:44:38.000000000 -0700
+@@ -2597,7 +2597,10 @@
+ {
+ bool ret = true;
+ bool have_cpu = false;
+- const char *default_cpu = OPTION_TARGET_CPU_DEFAULT;
++
++ /* The default cpu requested at configure time, if any. */
++ const char *implicit_cpu = OPTION_TARGET_CPU_DEFAULT;
++
+ int set_masks;
+ int cpu_index;
+ int tune_index;
+@@ -2616,11 +2619,6 @@
+ warning (0, "-malign-power is not supported for 64-bit Darwin;"
+ " it is incompatible with the installed C and C++ libraries");
+
+- if (global_options_set.x_rs6000_spe_abi
+- && rs6000_spe_abi
+- && !TARGET_SPE_ABI)
+- error ("not configured for SPE ABI");
+-
+ /* Numerous experiment shows that IRA based loop pressure
+ calculation works better for RTL loop invariant motion on targets
+ with enough (>= 32) registers. It is an expensive optimization.
+@@ -2656,7 +2654,8 @@
+ /* Process the -mcpu=<xxx> and -mtune=<xxx> argument. If the user changed
+ the cpu in a target attribute or pragma, but did not specify a tuning
+ option, use the cpu for the tuning option rather than the option specified
+- with -mtune on the command line. */
++ with -mtune on the command line. Process a '--with-cpu' configuration
++ request as an implicit --cpu. */
+ if (rs6000_cpu_index >= 0)
+ {
+ cpu_index = rs6000_cpu_index;
+@@ -2669,10 +2668,12 @@
+ }
+ else
+ {
+- if (!default_cpu)
+- default_cpu = (TARGET_POWERPC64 ? "powerpc64" : "powerpc");
++ const char *default_cpu =
++ (implicit_cpu ? implicit_cpu
++ : (TARGET_POWERPC64 ? "powerpc64" : "powerpc"));
+
+ rs6000_cpu_index = cpu_index = rs6000_cpu_name_lookup (default_cpu);
++ have_cpu = implicit_cpu != 0;
+ }
+
+ gcc_assert (cpu_index >= 0);
+@@ -2703,6 +2704,42 @@
+ gcc_assert (tune_index >= 0);
+ rs6000_cpu = processor_target_table[tune_index].processor;
+
++ /* Pick defaults for SPE related control flags. Do this early to make sure
++ that the TARGET_ macros are representative ASAP. */
++ {
++ int spe_capable_cpu =
++ (rs6000_cpu == PROCESSOR_PPC8540
++ || rs6000_cpu == PROCESSOR_PPC8548);
++
++ if (!global_options_set.x_rs6000_spe_abi)
++ rs6000_spe_abi = spe_capable_cpu;
++
++ if (!global_options_set.x_rs6000_spe)
++ rs6000_spe = spe_capable_cpu;
++
++ if (!global_options_set.x_rs6000_float_gprs)
++ rs6000_float_gprs =
++ (rs6000_cpu == PROCESSOR_PPC8540 ? 1
++ : rs6000_cpu == PROCESSOR_PPC8548 ? 2
++ : 0);
++ }
++
++ if (global_options_set.x_rs6000_spe_abi
++ && rs6000_spe_abi
++ && !TARGET_SPE_ABI)
++ error ("not configured for SPE ABI");
++
++ if (global_options_set.x_rs6000_spe
++ && rs6000_spe
++ && !TARGET_SPE)
++ error ("not configured for SPE instruction set");
++
++ if (main_target_opt != NULL
++ && ((main_target_opt->x_rs6000_spe_abi != rs6000_spe_abi)
++ || (main_target_opt->x_rs6000_spe != rs6000_spe)
++ || (main_target_opt->x_rs6000_float_gprs != rs6000_float_gprs)))
++ error ("target attribute or pragma changes SPE ABI");
++
+ if (rs6000_cpu == PROCESSOR_PPCE300C2 || rs6000_cpu == PROCESSOR_PPCE300C3
+ || rs6000_cpu == PROCESSOR_PPCE500MC || rs6000_cpu == PROCESSOR_PPCE500MC64)
+ {
+@@ -2938,35 +2975,44 @@
+ SUB3TARGET_OVERRIDE_OPTIONS;
+ #endif
+
+- if (TARGET_E500 || rs6000_cpu == PROCESSOR_PPCE500MC
+- || rs6000_cpu == PROCESSOR_PPCE500MC64)
++ /* For the E500 family of cores, reset the single/double FP flags to let us
++ check that they remain constant across attributes or pragmas. Also,
++ clear a possible request for string instructions, not supported and which
++ we might have silently queried above for -Os.
++
++ For other families, clear ISEL in case it was set implicitly.
++ */
++
++ switch (rs6000_cpu)
+ {
+- /* The e500 and e500mc do not have string instructions, and we set
+- MASK_STRING above when optimizing for size. */
+- if ((target_flags & MASK_STRING) != 0)
+- target_flags = target_flags & ~MASK_STRING;
+- }
+- else if (global_options_set.x_rs6000_cpu_index)
+- {
+- /* For the powerpc-eabispe configuration, we set all these by
+- default, so let's unset them if we manually set another
+- CPU that is not the E500. */
+- if (main_target_opt != NULL
+- && ((main_target_opt->x_rs6000_spe_abi != rs6000_spe_abi)
+- || (main_target_opt->x_rs6000_spe != rs6000_spe)
+- || (main_target_opt->x_rs6000_float_gprs != rs6000_float_gprs)))
+- error ("target attribute or pragma changes SPE ABI");
+- else
+- {
+- if (!global_options_set.x_rs6000_spe_abi)
+- rs6000_spe_abi = 0;
+- if (!global_options_set.x_rs6000_spe)
+- rs6000_spe = 0;
+- if (!global_options_set.x_rs6000_float_gprs)
+- rs6000_float_gprs = 0;
+- }
+- if (!(target_flags_explicit & MASK_ISEL))
++ case PROCESSOR_PPC8540:
++ case PROCESSOR_PPC8548:
++ case PROCESSOR_PPCE500MC:
++ case PROCESSOR_PPCE500MC64:
++
++ rs6000_single_float = TARGET_E500_SINGLE || TARGET_E500_DOUBLE;
++ rs6000_double_float = TARGET_E500_DOUBLE;
++
++ target_flags &= ~MASK_STRING;
++
++ break;
++
++ default:
++
++ if (have_cpu && !(target_flags_explicit & MASK_ISEL))
+ target_flags &= ~MASK_ISEL;
++
++ break;
++ }
++
++ if (main_target_opt)
++ {
++ if (main_target_opt->x_rs6000_single_float != rs6000_single_float)
++ error ("target attribute or pragma changes single precision floating "
++ "point");
++ if (main_target_opt->x_rs6000_double_float != rs6000_double_float)
++ error ("target attribute or pragma changes double precision floating "
++ "point");
+ }
+
+ /* Detect invalid option combinations with E500. */
+@@ -3193,6 +3239,7 @@
+ break;
+
+ case PROCESSOR_PPC8540:
++ case PROCESSOR_PPC8548:
+ rs6000_cost = &ppc8540_cost;
+ break;
+
+@@ -3265,26 +3312,6 @@
+ && rs6000_single_float == 0 && rs6000_double_float == 0)
+ rs6000_single_float = rs6000_double_float = 1;
+
+- /* Reset single and double FP flags if target is E500. */
+- if (TARGET_E500)
+- {
+- rs6000_single_float = rs6000_double_float = 0;
+- if (TARGET_E500_SINGLE)
+- rs6000_single_float = 1;
+- if (TARGET_E500_DOUBLE)
+- rs6000_single_float = rs6000_double_float = 1;
+- }
+-
+- if (main_target_opt)
+- {
+- if (main_target_opt->x_rs6000_single_float != rs6000_single_float)
+- error ("target attribute or pragma changes single precision floating "
+- "point");
+- if (main_target_opt->x_rs6000_double_float != rs6000_double_float)
+- error ("target attribute or pragma changes double precision floating "
+- "point");
+- }
+-
+ /* If not explicitly specified via option, decide whether to generate indexed
+ load/store instructions. */
+ if (TARGET_AVOID_XFORM == -1)
+@@ -22816,6 +22843,7 @@
+ case CPU_PPC750:
+ case CPU_PPC7400:
+ case CPU_PPC8540:
++ case CPU_PPC8548:
+ case CPU_CELL:
+ case CPU_PPCE300C2:
+ case CPU_PPCE300C3:
+@@ -22846,11 +22874,18 @@
+ static int
+ rs6000_use_sched_lookahead (void)
+ {
+- if (rs6000_cpu_attr == CPU_PPC8540)
+- return 4;
+- if (rs6000_cpu_attr == CPU_CELL)
+- return (reload_completed ? 8 : 0);
+- return 0;
++ switch (rs6000_cpu_attr)
++ {
++ case CPU_PPC8540:
++ case CPU_PPC8548:
++ return 4;
++
++ case CPU_CELL:
++ return (reload_completed ? 8 : 0);
++
++ default:
++ return 0;
++ }
+ }
+
+ /* We are choosing insn from the ready queue. Return nonzero if INSN can be chosen. */
+Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.h 2012-07-06 19:43:53.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/rs6000.h 2012-07-06 19:44:38.000000000 -0700
+@@ -457,7 +457,6 @@
+
+ #define TARGET_SPE_ABI 0
+ #define TARGET_SPE 0
+-#define TARGET_E500 0
+ #define TARGET_ISEL64 (TARGET_ISEL && TARGET_POWERPC64)
+ #define TARGET_FPRS 1
+ #define TARGET_E500_SINGLE 0
+@@ -500,11 +499,11 @@
+ || TARGET_ALTIVEC \
+ || TARGET_VSX)))
+
++/* E500 cores only support plain "sync", not lwsync. */
++#define TARGET_NO_LWSYNC (rs6000_cpu == PROCESSOR_PPC8540 \
++ || rs6000_cpu == PROCESSOR_PPC8548)
+
+
+-/* E500 processors only support plain "sync", not lwsync. */
+-#define TARGET_NO_LWSYNC TARGET_E500
+-
+ /* Which machine supports the various reciprocal estimate instructions. */
+ #define TARGET_FRES (TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT \
+ && TARGET_FPRS && TARGET_SINGLE_FLOAT)
+Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.md
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.md 2012-07-06 19:43:53.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/rs6000.md 2012-07-06 19:44:38.000000000 -0700
+@@ -166,7 +166,7 @@
+ ;; Processor type -- this attribute must exactly match the processor_type
+ ;; enumeration in rs6000.h.
+
+-(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2,titan"
++(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2,titan"
+ (const (symbol_ref "rs6000_cpu_attr")))
+
+
+Index: gcc-4_7-branch/gcc/config/rs6000/rtems.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/rtems.h 2012-07-05 23:49:07.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/rtems.h 2012-07-06 19:44:38.470780001 -0700
+@@ -55,17 +55,3 @@
+ #undef SUBSUBTARGET_EXTRA_SPECS
+ #define SUBSUBTARGET_EXTRA_SPECS \
+ { "cpp_os_rtems", CPP_OS_RTEMS_SPEC }
+-
+-#undef SUBSUBTARGET_OVERRIDE_OPTIONS
+-#define SUBSUBTARGET_OVERRIDE_OPTIONS \
+- do { \
+- if (TARGET_E500) \
+- { \
+- if (TARGET_HARD_FLOAT && !global_options_set.x_rs6000_float_gprs) \
+- rs6000_float_gprs = 1; \
+- if (rs6000_float_gprs != 0 && !global_options_set.x_rs6000_spe) \
+- rs6000_spe = 1; \
+- if (rs6000_spe && !global_options_set.x_rs6000_spe_abi) \
+- rs6000_spe_abi = 1; \
+- } \
+- } while(0)
+Index: gcc-4_7-branch/gcc/config/rs6000/vxworks.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/vxworks.h 2012-07-05 23:49:07.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/vxworks.h 2012-07-06 19:44:38.470780001 -0700
+@@ -122,19 +122,8 @@
+
+ #undef ABI_STACK_BOUNDARY
+
+-/* Make -mcpu=8540 imply SPE. ISEL is automatically enabled, the
+- others must be done by hand. Handle -mrtp. Disable -fPIC
+- for -mrtp - the VxWorks PIC model is not compatible with it. */
+ #undef SUBSUBTARGET_OVERRIDE_OPTIONS
+ #define SUBSUBTARGET_OVERRIDE_OPTIONS \
+- do { \
+- if (TARGET_E500) \
+- { \
+- rs6000_spe = 1; \
+- rs6000_spe_abi = 1; \
+- rs6000_float_gprs = 1; \
+- } \
+- \
+ if (!global_options_set.x_g_switch_value) \
+ g_switch_value = SDATA_DEFAULT_SIZE; \
+ VXWORKS_OVERRIDE_OPTIONS; \
diff --git a/meta-aarch64/recipes-devtools/gcc/files/ppce5500-e6500-support.patch b/meta-aarch64/recipes-devtools/gcc/files/ppce5500-e6500-support.patch
new file mode 100644
index 00000000..e3341fc0
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/ppce5500-e6500-support.patch
@@ -0,0 +1,713 @@
+Upstream-Status: Backport
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+From b770074cee13445eba1bf4e99649c5ceac9a4b5a Mon Sep 17 00:00:00 2001
+From: edmarwjr <edmarwjr@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Tue, 5 Jun 2012 16:05:16 +0000
+Subject: [PATCH] 2012-06-01 Edmar Wienskoski <edmar@freescale.com>
+
+ * config/rs6000/e5500.md: New file.
+ * config/rs6000/e6500.md: New file.
+ * config/rs6000/rs6000.c (processor_costs): Add new costs for
+ e5500 and e6500.
+ (rs6000_option_override_internal): Altivec and Spe options not
+ allowed with e5500. Spe options not allowed with e6500. Increase
+ move inline limit for e5500 and e6500. Disable string instructions
+ for e5500 and e6500. Enable branch targets alignment for e5500 and
+ e6500. Initialize rs6000_cost for e5500 and e6500.
+ (rs6000_adjust_cost): Add extra scheduling cycles between compare
+ and brnach for e5500 and e6500.
+ (rs6000_issue_rate): Set issue rate for e5500 and e6500.
+ * config/rs6000/rs6000-cpus.def: Add cpu definitions for e5500 and
+ e6500.
+ * config/rs6000/rs6000.h (ASM_CPU_SPEC): Add e5500 and e6500.
+ * config/rs6000/rs6000.md (define_attr "cpu"): Add ppce5500 and
+ ppce6500.
+ Include e5500.md and e6500.md.
+ * config/rs6000/rs6000-opt.h (processor_type): Add
+ PROCESSOR_PPCE5500 and PROCESSOR_PPCE6500.
+ * config.gcc (cpu_is_64bit): Add new cores e5500, e6500.
+ (powerpc*-*-*): Add new cores e5500, e6500.
+ * doc/invoke.texi: (item -mcpu): Add e5500 and e6500 to list of cpus.
+
+gcc/testsuite
+2012-06-01 Edmar Wienskoski <edmar@freescale.com>
+
+ * gcc.dg/tree-ssa/vector-3.c: Adjust regular expression.
+
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188244 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ gcc/ChangeLog | 26 ++++
+ gcc/config.gcc | 6 +-
+ gcc/config/rs6000/e5500.md | 176 ++++++++++++++++++++++++
+ gcc/config/rs6000/e6500.md | 213 ++++++++++++++++++++++++++++++
+ gcc/config/rs6000/rs6000-cpus.def | 4 +
+ gcc/config/rs6000/rs6000-opts.h | 2 +
+ gcc/config/rs6000/rs6000.c | 68 +++++++++-
+ gcc/config/rs6000/rs6000.h | 2 +
+ gcc/config/rs6000/rs6000.md | 4 +-
+ gcc/doc/invoke.texi | 12 +-
+ gcc/testsuite/ChangeLog | 4 +
+ gcc/testsuite/gcc.dg/tree-ssa/vector-3.c | 2 +-
+ 12 files changed, 506 insertions(+), 13 deletions(-)
+ create mode 100644 gcc/config/rs6000/e5500.md
+ create mode 100644 gcc/config/rs6000/e6500.md
+
+Index: gcc-4_7-branch/gcc/config.gcc
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config.gcc 2012-07-06 19:52:30.000000000 -0700
++++ gcc-4_7-branch/gcc/config.gcc 2012-07-06 19:53:26.350779999 -0700
+@@ -413,7 +413,7 @@
+ extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h"
+ need_64bit_hwint=yes
+ case x$with_cpu in
+- xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[34567]|xpower6x|xrs64a|xcell|xa2|xe500mc64)
++ xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[34567]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|Xe6500)
+ cpu_is_64bit=yes
+ ;;
+ esac
+@@ -3361,8 +3361,8 @@
+ | 401 | 403 | 405 | 405fp | 440 | 440fp | 464 | 464fp \
+ | 476 | 476fp | 505 | 601 | 602 | 603 | 603e | ec603e \
+ | 604 | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 \
+- | a2 | e300c[23] | 854[08] | e500mc | e500mc64 | titan\
+- | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell)
++ | a2 | e300c[23] | 854[08] | e500mc | e500mc64 | e5500 | e6500 \
++ | titan | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell)
+ # OK
+ ;;
+ *)
+Index: gcc-4_7-branch/gcc/config/rs6000/e5500.md
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/gcc/config/rs6000/e5500.md 2012-07-06 19:53:26.350779999 -0700
+@@ -0,0 +1,176 @@
++;; Pipeline description for Freescale PowerPC e5500 core.
++;; Copyright (C) 2012 Free Software Foundation, Inc.
++;; Contributed by Edmar Wienskoski (edmar@freescale.com)
++;;
++;; This file is part of GCC.
++;;
++;; GCC is free software; you can redistribute it and/or modify it
++;; under the terms of the GNU General Public License as published
++;; by the Free Software Foundation; either version 3, or (at your
++;; option) any later version.
++;;
++;; GCC is distributed in the hope that it will be useful, but WITHOUT
++;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
++;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
++;; License for more details.
++;;
++;; You should have received a copy of the GNU General Public License
++;; along with GCC; see the file COPYING3. If not see
++;; <http://www.gnu.org/licenses/>.
++;;
++;; e5500 64-bit SFX(2), CFX, LSU, FPU, BU
++;; Max issue 3 insns/clock cycle (includes 1 branch)
++
++(define_automaton "e5500_most,e5500_long")
++(define_cpu_unit "e5500_decode_0,e5500_decode_1" "e5500_most")
++
++;; SFX.
++(define_cpu_unit "e5500_sfx_0,e5500_sfx_1" "e5500_most")
++
++;; CFX.
++(define_cpu_unit "e5500_cfx_stage0,e5500_cfx_stage1" "e5500_most")
++
++;; Non-pipelined division.
++(define_cpu_unit "e5500_cfx_div" "e5500_long")
++
++;; LSU.
++(define_cpu_unit "e5500_lsu" "e5500_most")
++
++;; FPU.
++(define_cpu_unit "e5500_fpu" "e5500_long")
++
++;; BU.
++(define_cpu_unit "e5500_bu" "e5500_most")
++
++;; The following units are used to make the automata deterministic.
++(define_cpu_unit "present_e5500_decode_0" "e5500_most")
++(define_cpu_unit "present_e5500_sfx_0" "e5500_most")
++(presence_set "present_e5500_decode_0" "e5500_decode_0")
++(presence_set "present_e5500_sfx_0" "e5500_sfx_0")
++
++;; Some useful abbreviations.
++(define_reservation "e5500_decode"
++ "e5500_decode_0|e5500_decode_1+present_e5500_decode_0")
++(define_reservation "e5500_sfx"
++ "e5500_sfx_0|e5500_sfx_1+present_e5500_sfx_0")
++
++;; SFX.
++(define_insn_reservation "e5500_sfx" 1
++ (and (eq_attr "type" "integer,insert_word,insert_dword,delayed_compare,\
++ shift,cntlz,exts")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_sfx")
++
++(define_insn_reservation "e5500_sfx2" 2
++ (and (eq_attr "type" "cmp,compare,fast_compare,trap")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_sfx")
++
++(define_insn_reservation "e5500_delayed" 2
++ (and (eq_attr "type" "var_shift_rotate,var_delayed_compare")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_sfx*2")
++
++(define_insn_reservation "e5500_two" 2
++ (and (eq_attr "type" "two")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_decode+e5500_sfx,e5500_sfx")
++
++(define_insn_reservation "e5500_three" 3
++ (and (eq_attr "type" "three")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,(e5500_decode+e5500_sfx)*2,e5500_sfx")
++
++;; SFX - Mfcr.
++(define_insn_reservation "e5500_mfcr" 4
++ (and (eq_attr "type" "mfcr")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_sfx_0*4")
++
++;; SFX - Mtcrf.
++(define_insn_reservation "e5500_mtcrf" 1
++ (and (eq_attr "type" "mtcr")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_sfx_0")
++
++;; SFX - Mtjmpr.
++(define_insn_reservation "e5500_mtjmpr" 1
++ (and (eq_attr "type" "mtjmpr,mfjmpr")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_sfx")
++
++;; CFX - Multiply.
++(define_insn_reservation "e5500_multiply" 4
++ (and (eq_attr "type" "imul")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_cfx_stage0,e5500_cfx_stage1")
++
++(define_insn_reservation "e5500_multiply_i" 5
++ (and (eq_attr "type" "imul2,imul3,imul_compare")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_cfx_stage0,\
++ e5500_cfx_stage0+e5500_cfx_stage1,e5500_cfx_stage1")
++
++;; CFX - Divide.
++(define_insn_reservation "e5500_divide" 16
++ (and (eq_attr "type" "idiv")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_cfx_stage0+e5500_cfx_div,\
++ e5500_cfx_div*15")
++
++(define_insn_reservation "e5500_divide_d" 26
++ (and (eq_attr "type" "ldiv")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_cfx_stage0+e5500_cfx_div,\
++ e5500_cfx_div*25")
++
++;; LSU - Loads.
++(define_insn_reservation "e5500_load" 3
++ (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,\
++ load_l,sync")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_lsu")
++
++(define_insn_reservation "e5500_fpload" 4
++ (and (eq_attr "type" "fpload,fpload_ux,fpload_u")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_lsu")
++
++;; LSU - Stores.
++(define_insn_reservation "e5500_store" 3
++ (and (eq_attr "type" "store,store_ux,store_u,store_c")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_lsu")
++
++(define_insn_reservation "e5500_fpstore" 3
++ (and (eq_attr "type" "fpstore,fpstore_ux,fpstore_u")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_lsu")
++
++;; FP.
++(define_insn_reservation "e5500_float" 7
++ (and (eq_attr "type" "fpsimple,fp,fpcompare,dmul")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_fpu")
++
++(define_insn_reservation "e5500_sdiv" 20
++ (and (eq_attr "type" "sdiv")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_fpu*20")
++
++(define_insn_reservation "e5500_ddiv" 35
++ (and (eq_attr "type" "ddiv")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_fpu*35")
++
++;; BU.
++(define_insn_reservation "e5500_branch" 1
++ (and (eq_attr "type" "jmpreg,branch,isync")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_bu")
++
++;; BU - CR logical.
++(define_insn_reservation "e5500_cr_logical" 1
++ (and (eq_attr "type" "cr_logical,delayed_cr")
++ (eq_attr "cpu" "ppce5500"))
++ "e5500_decode,e5500_bu")
+Index: gcc-4_7-branch/gcc/config/rs6000/e6500.md
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/gcc/config/rs6000/e6500.md 2012-07-06 19:53:26.354779999 -0700
+@@ -0,0 +1,213 @@
++;; Pipeline description for Freescale PowerPC e6500 core.
++;; Copyright (C) 2012 Free Software Foundation, Inc.
++;; Contributed by Edmar Wienskoski (edmar@freescale.com)
++;;
++;; This file is part of GCC.
++;;
++;; GCC is free software; you can redistribute it and/or modify it
++;; under the terms of the GNU General Public License as published
++;; by the Free Software Foundation; either version 3, or (at your
++;; option) any later version.
++;;
++;; GCC is distributed in the hope that it will be useful, but WITHOUT
++;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
++;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
++;; License for more details.
++;;
++;; You should have received a copy of the GNU General Public License
++;; along with GCC; see the file COPYING3. If not see
++;; <http://www.gnu.org/licenses/>.
++;;
++;; e6500 64-bit SFX(2), CFX, LSU, FPU, BU, VSFX, VCFX, VFPU, VPERM
++;; Max issue 3 insns/clock cycle (includes 1 branch)
++
++(define_automaton "e6500_most,e6500_long,e6500_vec")
++(define_cpu_unit "e6500_decode_0,e6500_decode_1" "e6500_most")
++
++;; SFX.
++(define_cpu_unit "e6500_sfx_0,e6500_sfx_1" "e6500_most")
++
++;; CFX.
++(define_cpu_unit "e6500_cfx_stage0,e6500_cfx_stage1" "e6500_most")
++
++;; Non-pipelined division.
++(define_cpu_unit "e6500_cfx_div" "e6500_long")
++
++;; LSU.
++(define_cpu_unit "e6500_lsu" "e6500_most")
++
++;; FPU.
++(define_cpu_unit "e6500_fpu" "e6500_long")
++
++;; BU.
++(define_cpu_unit "e6500_bu" "e6500_most")
++
++;; Altivec unit
++(define_cpu_unit "e6500_vec,e6500_vecperm" "e6500_vec")
++
++;; The following units are used to make the automata deterministic.
++(define_cpu_unit "present_e6500_decode_0" "e6500_most")
++(define_cpu_unit "present_e6500_sfx_0" "e6500_most")
++(presence_set "present_e6500_decode_0" "e6500_decode_0")
++(presence_set "present_e6500_sfx_0" "e6500_sfx_0")
++
++;; Some useful abbreviations.
++(define_reservation "e6500_decode"
++ "e6500_decode_0|e6500_decode_1+present_e6500_decode_0")
++(define_reservation "e6500_sfx"
++ "e6500_sfx_0|e6500_sfx_1+present_e6500_sfx_0")
++
++;; SFX.
++(define_insn_reservation "e6500_sfx" 1
++ (and (eq_attr "type" "integer,insert_word,insert_dword,delayed_compare,\
++ shift,cntlz,exts")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_sfx")
++
++(define_insn_reservation "e6500_sfx2" 2
++ (and (eq_attr "type" "cmp,compare,fast_compare,trap")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_sfx")
++
++(define_insn_reservation "e6500_delayed" 2
++ (and (eq_attr "type" "var_shift_rotate,var_delayed_compare")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_sfx*2")
++
++(define_insn_reservation "e6500_two" 2
++ (and (eq_attr "type" "two")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_decode+e6500_sfx,e6500_sfx")
++
++(define_insn_reservation "e6500_three" 3
++ (and (eq_attr "type" "three")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,(e6500_decode+e6500_sfx)*2,e6500_sfx")
++
++;; SFX - Mfcr.
++(define_insn_reservation "e6500_mfcr" 4
++ (and (eq_attr "type" "mfcr")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_sfx_0*4")
++
++;; SFX - Mtcrf.
++(define_insn_reservation "e6500_mtcrf" 1
++ (and (eq_attr "type" "mtcr")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_sfx_0")
++
++;; SFX - Mtjmpr.
++(define_insn_reservation "e6500_mtjmpr" 1
++ (and (eq_attr "type" "mtjmpr,mfjmpr")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_sfx")
++
++;; CFX - Multiply.
++(define_insn_reservation "e6500_multiply" 4
++ (and (eq_attr "type" "imul")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_cfx_stage0,e6500_cfx_stage1")
++
++(define_insn_reservation "e6500_multiply_i" 5
++ (and (eq_attr "type" "imul2,imul3,imul_compare")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_cfx_stage0,\
++ e6500_cfx_stage0+e6500_cfx_stage1,e6500_cfx_stage1")
++
++;; CFX - Divide.
++(define_insn_reservation "e6500_divide" 16
++ (and (eq_attr "type" "idiv")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_cfx_stage0+e6500_cfx_div,\
++ e6500_cfx_div*15")
++
++(define_insn_reservation "e6500_divide_d" 26
++ (and (eq_attr "type" "ldiv")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_cfx_stage0+e6500_cfx_div,\
++ e6500_cfx_div*25")
++
++;; LSU - Loads.
++(define_insn_reservation "e6500_load" 3
++ (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,\
++ load_l,sync")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_lsu")
++
++(define_insn_reservation "e6500_fpload" 4
++ (and (eq_attr "type" "fpload,fpload_ux,fpload_u")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_lsu")
++
++(define_insn_reservation "e6500_vecload" 4
++ (and (eq_attr "type" "vecload")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_lsu")
++
++;; LSU - Stores.
++(define_insn_reservation "e6500_store" 3
++ (and (eq_attr "type" "store,store_ux,store_u,store_c")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_lsu")
++
++(define_insn_reservation "e6500_fpstore" 3
++ (and (eq_attr "type" "fpstore,fpstore_ux,fpstore_u")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_lsu")
++
++(define_insn_reservation "e6500_vecstore" 4
++ (and (eq_attr "type" "vecstore")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_lsu")
++
++;; FP.
++(define_insn_reservation "e6500_float" 7
++ (and (eq_attr "type" "fpsimple,fp,fpcompare,dmul")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_fpu")
++
++(define_insn_reservation "e6500_sdiv" 20
++ (and (eq_attr "type" "sdiv")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_fpu*20")
++
++(define_insn_reservation "e6500_ddiv" 35
++ (and (eq_attr "type" "ddiv")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_fpu*35")
++
++;; BU.
++(define_insn_reservation "e6500_branch" 1
++ (and (eq_attr "type" "jmpreg,branch,isync")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_bu")
++
++;; BU - CR logical.
++(define_insn_reservation "e6500_cr_logical" 1
++ (and (eq_attr "type" "cr_logical,delayed_cr")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_bu")
++
++;; VSFX.
++(define_insn_reservation "e6500_vecsimple" 1
++ (and (eq_attr "type" "vecsimple,veccmp")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_vec")
++
++;; VCFX.
++(define_insn_reservation "e6500_veccomplex" 4
++ (and (eq_attr "type" "veccomplex")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_vec")
++
++;; VFPU.
++(define_insn_reservation "e6500_vecfloat" 6
++ (and (eq_attr "type" "vecfloat")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_vec")
++
++;; VPERM.
++(define_insn_reservation "e6500_vecperm" 2
++ (and (eq_attr "type" "vecperm")
++ (eq_attr "cpu" "ppce6500"))
++ "e6500_decode,e6500_vecperm")
+Index: gcc-4_7-branch/gcc/config/rs6000/rs6000-cpus.def
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000-cpus.def 2012-07-06 19:52:30.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/rs6000-cpus.def 2012-07-06 19:53:26.354779999 -0700
+@@ -87,6 +87,10 @@
+ | MASK_ISEL)
+ RS6000_CPU ("e500mc64", PROCESSOR_PPCE500MC64,
+ POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GFXOPT | MASK_ISEL)
++RS6000_CPU ("e5500", PROCESSOR_PPCE5500, POWERPC_BASE_MASK | MASK_POWERPC64
++ | MASK_PPC_GFXOPT | MASK_ISEL)
++RS6000_CPU ("e6500", PROCESSOR_PPCE6500, POWERPC_7400_MASK | MASK_POWERPC64
++ | MASK_MFCRF | MASK_ISEL)
+ RS6000_CPU ("860", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT)
+ RS6000_CPU ("970", PROCESSOR_POWER4,
+ POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64)
+Index: gcc-4_7-branch/gcc/config/rs6000/rs6000-opts.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000-opts.h 2012-07-06 19:52:30.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/rs6000-opts.h 2012-07-06 19:53:26.354779999 -0700
+@@ -54,6 +54,8 @@
+ PROCESSOR_PPCE300C3,
+ PROCESSOR_PPCE500MC,
+ PROCESSOR_PPCE500MC64,
++ PROCESSOR_PPCE5500,
++ PROCESSOR_PPCE6500,
+ PROCESSOR_POWER4,
+ PROCESSOR_POWER5,
+ PROCESSOR_POWER6,
+Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.c
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.c 2012-07-06 19:52:30.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/rs6000.c 2012-07-06 19:53:26.354779999 -0700
+@@ -755,6 +755,44 @@
+ 1, /* prefetch streams /*/
+ };
+
++/* Instruction costs on PPCE5500 processors. */
++static const
++struct processor_costs ppce5500_cost = {
++ COSTS_N_INSNS (5), /* mulsi */
++ COSTS_N_INSNS (5), /* mulsi_const */
++ COSTS_N_INSNS (4), /* mulsi_const9 */
++ COSTS_N_INSNS (5), /* muldi */
++ COSTS_N_INSNS (14), /* divsi */
++ COSTS_N_INSNS (14), /* divdi */
++ COSTS_N_INSNS (7), /* fp */
++ COSTS_N_INSNS (10), /* dmul */
++ COSTS_N_INSNS (36), /* sdiv */
++ COSTS_N_INSNS (66), /* ddiv */
++ 64, /* cache line size */
++ 32, /* l1 cache */
++ 128, /* l2 cache */
++ 1, /* prefetch streams /*/
++};
++
++/* Instruction costs on PPCE6500 processors. */
++static const
++struct processor_costs ppce6500_cost = {
++ COSTS_N_INSNS (5), /* mulsi */
++ COSTS_N_INSNS (5), /* mulsi_const */
++ COSTS_N_INSNS (4), /* mulsi_const9 */
++ COSTS_N_INSNS (5), /* muldi */
++ COSTS_N_INSNS (14), /* divsi */
++ COSTS_N_INSNS (14), /* divdi */
++ COSTS_N_INSNS (7), /* fp */
++ COSTS_N_INSNS (10), /* dmul */
++ COSTS_N_INSNS (36), /* sdiv */
++ COSTS_N_INSNS (66), /* ddiv */
++ 64, /* cache line size */
++ 32, /* l1 cache */
++ 128, /* l2 cache */
++ 1, /* prefetch streams /*/
++};
++
+ /* Instruction costs on AppliedMicro Titan processors. */
+ static const
+ struct processor_costs titan_cost = {
+@@ -2741,13 +2779,19 @@
+ error ("target attribute or pragma changes SPE ABI");
+
+ if (rs6000_cpu == PROCESSOR_PPCE300C2 || rs6000_cpu == PROCESSOR_PPCE300C3
+- || rs6000_cpu == PROCESSOR_PPCE500MC || rs6000_cpu == PROCESSOR_PPCE500MC64)
++ || rs6000_cpu == PROCESSOR_PPCE500MC || rs6000_cpu == PROCESSOR_PPCE500MC64
++ || rs6000_cpu == PROCESSOR_PPCE5500)
+ {
+ if (TARGET_ALTIVEC)
+ error ("AltiVec not supported in this target");
+ if (TARGET_SPE)
+ error ("SPE not supported in this target");
+ }
++ if (rs6000_cpu == PROCESSOR_PPCE6500)
++ {
++ if (TARGET_SPE)
++ error ("SPE not supported in this target");
++ }
+
+ /* Disable Cell microcode if we are optimizing for the Cell
+ and not optimizing for size. */
+@@ -2842,7 +2886,9 @@
+ user's opinion, though. */
+ if (rs6000_block_move_inline_limit == 0
+ && (rs6000_cpu == PROCESSOR_PPCE500MC
+- || rs6000_cpu == PROCESSOR_PPCE500MC64))
++ || rs6000_cpu == PROCESSOR_PPCE500MC64
++ || rs6000_cpu == PROCESSOR_PPCE5500
++ || rs6000_cpu == PROCESSOR_PPCE6500))
+ rs6000_block_move_inline_limit = 128;
+
+ /* store_one_arg depends on expand_block_move to handle at least the
+@@ -2989,6 +3035,8 @@
+ case PROCESSOR_PPC8548:
+ case PROCESSOR_PPCE500MC:
+ case PROCESSOR_PPCE500MC64:
++ case PROCESSOR_PPCE5500:
++ case PROCESSOR_PPCE6500:
+
+ rs6000_single_float = TARGET_E500_SINGLE || TARGET_E500_DOUBLE;
+ rs6000_double_float = TARGET_E500_DOUBLE;
+@@ -3033,7 +3081,9 @@
+ || rs6000_cpu == PROCESSOR_POWER6
+ || rs6000_cpu == PROCESSOR_POWER7
+ || rs6000_cpu == PROCESSOR_PPCE500MC
+- || rs6000_cpu == PROCESSOR_PPCE500MC64);
++ || rs6000_cpu == PROCESSOR_PPCE500MC64
++ || rs6000_cpu == PROCESSOR_PPCE5500
++ || rs6000_cpu == PROCESSOR_PPCE6500);
+
+ /* Allow debug switches to override the above settings. These are set to -1
+ in rs6000.opt to indicate the user hasn't directly set the switch. */
+@@ -3256,6 +3306,14 @@
+ rs6000_cost = &ppce500mc64_cost;
+ break;
+
++ case PROCESSOR_PPCE5500:
++ rs6000_cost = &ppce5500_cost;
++ break;
++
++ case PROCESSOR_PPCE6500:
++ rs6000_cost = &ppce6500_cost;
++ break;
++
+ case PROCESSOR_TITAN:
+ rs6000_cost = &titan_cost;
+ break;
+@@ -22304,6 +22362,8 @@
+ || rs6000_cpu_attr == CPU_PPC750
+ || rs6000_cpu_attr == CPU_PPC7400
+ || rs6000_cpu_attr == CPU_PPC7450
++ || rs6000_cpu_attr == CPU_PPCE5500
++ || rs6000_cpu_attr == CPU_PPCE6500
+ || rs6000_cpu_attr == CPU_POWER4
+ || rs6000_cpu_attr == CPU_POWER5
+ || rs6000_cpu_attr == CPU_POWER7
+@@ -22849,6 +22909,8 @@
+ case CPU_PPCE300C3:
+ case CPU_PPCE500MC:
+ case CPU_PPCE500MC64:
++ case CPU_PPCE5500:
++ case CPU_PPCE6500:
+ case CPU_TITAN:
+ return 2;
+ case CPU_RIOS2:
+Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.h
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.h 2012-07-06 19:52:30.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/rs6000.h 2012-07-06 19:53:26.358779999 -0700
+@@ -168,6 +168,8 @@
+ %{mcpu=e300c3: -me300} \
+ %{mcpu=e500mc: -me500mc} \
+ %{mcpu=e500mc64: -me500mc64} \
++%{mcpu=e5500: -me5500} \
++%{mcpu=e6500: -me6500} \
+ %{maltivec: -maltivec} \
+ %{mvsx: -mvsx %{!maltivec: -maltivec} %{!mcpu*: %(asm_cpu_power7)}} \
+ -many"
+Index: gcc-4_7-branch/gcc/config/rs6000/rs6000.md
+===================================================================
+--- gcc-4_7-branch.orig/gcc/config/rs6000/rs6000.md 2012-07-06 19:52:32.000000000 -0700
++++ gcc-4_7-branch/gcc/config/rs6000/rs6000.md 2012-07-06 19:53:26.358779999 -0700
+@@ -166,7 +166,7 @@
+ ;; Processor type -- this attribute must exactly match the processor_type
+ ;; enumeration in rs6000.h.
+
+-(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2,titan"
++(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,power4,power5,power6,power7,cell,ppca2,titan"
+ (const (symbol_ref "rs6000_cpu_attr")))
+
+
+@@ -194,6 +194,8 @@
+ (include "e300c2c3.md")
+ (include "e500mc.md")
+ (include "e500mc64.md")
++(include "e5500.md")
++(include "e6500.md")
+ (include "power4.md")
+ (include "power5.md")
+ (include "power6.md")
+Index: gcc-4_7-branch/gcc/doc/invoke.texi
+===================================================================
+--- gcc-4_7-branch.orig/gcc/doc/invoke.texi 2012-07-06 19:43:53.000000000 -0700
++++ gcc-4_7-branch/gcc/doc/invoke.texi 2012-07-06 19:53:26.362779999 -0700
+@@ -16565,11 +16565,13 @@
+ @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
+ @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
+ @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
+-@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{ec603e}, @samp{G3},
+-@samp{G4}, @samp{G5}, @samp{titan}, @samp{power}, @samp{power2}, @samp{power3},
+-@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x},
+-@samp{power7}, @samp{common}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
+-@samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
++@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
++@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
++@samp{titan}, @samp{power}, @samp{power2}, @samp{power3},
++@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6},
++@samp{power6x}, @samp{power7}, @samp{common}, @samp{powerpc},
++@samp{powerpc64}, @samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc},
++and @samp{rs64}.
+
+ @option{-mcpu=common} selects a completely generic processor. Code
+ generated under this option will run on any POWER or PowerPC processor.
+Index: gcc-4_7-branch/gcc/testsuite/gcc.dg/tree-ssa/vector-3.c
+===================================================================
+--- gcc-4_7-branch.orig/gcc/testsuite/gcc.dg/tree-ssa/vector-3.c 2012-07-06 19:43:53.000000000 -0700
++++ gcc-4_7-branch/gcc/testsuite/gcc.dg/tree-ssa/vector-3.c 2012-07-06 19:53:26.362779999 -0700
+@@ -14,7 +14,7 @@
+
+ /* We should be able to optimize this to just "return 0.0;" */
+ /* { dg-final { scan-tree-dump-times "BIT_FIELD_REF" 0 "optimized"} } */
+-/* { dg-final { scan-tree-dump-times "0.0" 1 "optimized"} } */
++/* { dg-final { scan-tree-dump-times "0\\\.0" 1 "optimized"} } */
+
+ /* { dg-final { cleanup-tree-dump "optimized" } } */
+
diff --git a/meta-aarch64/recipes-devtools/gcc/files/pr32219.patch b/meta-aarch64/recipes-devtools/gcc/files/pr32219.patch
new file mode 100644
index 00000000..bea20630
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/pr32219.patch
@@ -0,0 +1,72 @@
+Upstream-Status:Backport
+Hi,
+
+As suggested by richi.
+regtested on i686-linux-gnu with all default languages and no regressions.
+Ok for trunk?
+
+gcc/ChangeLog
+2010-03-15 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
+
+ PR target/32219
+ * varasm.c (default_binds_local_p_1): Weak data is not local.
+
+gcc/testsuite/ChangeLog
+2010-03-15 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
+
+ PR target/32219
+ * gcc.dg/visibility-21.c: New test.
+
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+ gcc/testsuite/gcc.dg/visibility-21.c | 14 ++++++++++++++
+ gcc/varasm.c | 8 ++++----
+ 2 files changed, 18 insertions(+), 4 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/visibility-21.c
+
+Index: gcc-4_7-branch/gcc/testsuite/gcc.dg/visibility-21.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4_7-branch/gcc/testsuite/gcc.dg/visibility-21.c 2012-04-10 10:39:38.083396738 -0700
+@@ -0,0 +1,14 @@
++/* PR target/32219 */
++/* { dg-do run } */
++/* { dg-require-visibility "" } */
++/* { dg-options "-fPIC" { target fpic } } */
++
++extern void f() __attribute__((weak,visibility("hidden")));
++extern int puts( char const* );
++int main()
++{
++ if (f)
++ f();
++ return 0;
++}
++
+Index: gcc-4_7-branch/gcc/varasm.c
+===================================================================
+--- gcc-4_7-branch.orig/gcc/varasm.c 2012-04-10 10:17:24.127330049 -0700
++++ gcc-4_7-branch/gcc/varasm.c 2012-04-10 10:39:38.087396414 -0700
+@@ -6937,6 +6937,10 @@
+ /* Static variables are always local. */
+ else if (! TREE_PUBLIC (exp))
+ local_p = true;
++ /* hidden weak can't be overridden by something non-local, all
++ that is possible is that it is not defined at all. */
++ else if (DECL_WEAK (exp))
++ local_p = false;
+ /* A variable is local if the user has said explicitly that it will
+ be. */
+ else if ((DECL_VISIBILITY_SPECIFIED (exp)
+@@ -6950,11 +6954,6 @@
+ local. */
+ else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
+ local_p = true;
+- /* Default visibility weak data can be overridden by a strong symbol
+- in another module and so are not local. */
+- else if (DECL_WEAK (exp)
+- && !resolved_locally)
+- local_p = false;
+ /* If PIC, then assume that any global name can be overridden by
+ symbols resolved from other modules. */
+ else if (shlib)
diff --git a/meta-aarch64/recipes-devtools/gcc/files/rs6000-tables.patch b/meta-aarch64/recipes-devtools/gcc/files/rs6000-tables.patch
new file mode 100644
index 00000000..5b8064b0
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/rs6000-tables.patch
@@ -0,0 +1,135 @@
+Upstream-Status: Backport
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+From 98da658b6944d0bf54beb10001e567d8b8922666 Mon Sep 17 00:00:00 2001
+From: edmarwjr <edmarwjr@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Wed, 6 Jun 2012 18:09:18 +0000
+Subject: [PATCH] 2012-06-06 Edmar Wienskoski <edmar@freescale.com>
+
+ * config/rs6000/rs6000-tables.opt: Regenerated.
+
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188274 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ gcc/ChangeLog | 4 +++
+ gcc/config/rs6000/rs6000-tables.opt | 58 +++++++++++++++++++----------------
+ 2 files changed, 36 insertions(+), 26 deletions(-)
+
+Index: git/gcc/config/rs6000/rs6000-tables.opt
+===================================================================
+--- git.orig/gcc/config/rs6000/rs6000-tables.opt 2012-07-06 20:54:29.000000000 -0700
++++ git/gcc/config/rs6000/rs6000-tables.opt 2012-07-06 20:58:12.436646819 -0700
+@@ -126,80 +126,86 @@
+ Enum(rs6000_cpu_opt_value) String(e500mc64) Value(32)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(860) Value(33)
++Enum(rs6000_cpu_opt_value) String(e5500) Value(33)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(970) Value(34)
++Enum(rs6000_cpu_opt_value) String(e6500) Value(34)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(cell) Value(35)
++Enum(rs6000_cpu_opt_value) String(860) Value(35)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(common) Value(36)
++Enum(rs6000_cpu_opt_value) String(970) Value(36)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(ec603e) Value(37)
++Enum(rs6000_cpu_opt_value) String(cell) Value(37)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(G3) Value(38)
++Enum(rs6000_cpu_opt_value) String(common) Value(38)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(G4) Value(39)
++Enum(rs6000_cpu_opt_value) String(ec603e) Value(39)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(G5) Value(40)
++Enum(rs6000_cpu_opt_value) String(G3) Value(40)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(titan) Value(41)
++Enum(rs6000_cpu_opt_value) String(G4) Value(41)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(power) Value(42)
++Enum(rs6000_cpu_opt_value) String(G5) Value(42)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(power2) Value(43)
++Enum(rs6000_cpu_opt_value) String(titan) Value(43)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(power3) Value(44)
++Enum(rs6000_cpu_opt_value) String(power) Value(44)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(power4) Value(45)
++Enum(rs6000_cpu_opt_value) String(power2) Value(45)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(power5) Value(46)
++Enum(rs6000_cpu_opt_value) String(power3) Value(46)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(power5+) Value(47)
++Enum(rs6000_cpu_opt_value) String(power4) Value(47)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(power6) Value(48)
++Enum(rs6000_cpu_opt_value) String(power5) Value(48)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(power6x) Value(49)
++Enum(rs6000_cpu_opt_value) String(power5+) Value(49)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(power7) Value(50)
++Enum(rs6000_cpu_opt_value) String(power6) Value(50)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(powerpc) Value(51)
++Enum(rs6000_cpu_opt_value) String(power6x) Value(51)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(powerpc64) Value(52)
++Enum(rs6000_cpu_opt_value) String(power7) Value(52)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(rios) Value(53)
++Enum(rs6000_cpu_opt_value) String(powerpc) Value(53)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(rios1) Value(54)
++Enum(rs6000_cpu_opt_value) String(powerpc64) Value(54)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(rios2) Value(55)
++Enum(rs6000_cpu_opt_value) String(rios) Value(55)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(rsc) Value(56)
++Enum(rs6000_cpu_opt_value) String(rios1) Value(56)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(rsc1) Value(57)
++Enum(rs6000_cpu_opt_value) String(rios2) Value(57)
+
+ EnumValue
+-Enum(rs6000_cpu_opt_value) String(rs64) Value(58)
++Enum(rs6000_cpu_opt_value) String(rsc) Value(58)
++
++EnumValue
++Enum(rs6000_cpu_opt_value) String(rsc1) Value(59)
++
++EnumValue
++Enum(rs6000_cpu_opt_value) String(rs64) Value(60)
+
diff --git a/meta-aarch64/recipes-devtools/gcc/files/use-defaults.h-and-t-oe-in-B.patch b/meta-aarch64/recipes-devtools/gcc/files/use-defaults.h-and-t-oe-in-B.patch
new file mode 100644
index 00000000..212c2632
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/files/use-defaults.h-and-t-oe-in-B.patch
@@ -0,0 +1,77 @@
+Upstream-Status: Pending
+
+Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
+the source can be shared between gcc-cross-initial,
+gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
+---
+ gcc/Makefile.in | 2 +-
+ gcc/configure | 4 ++--
+ gcc/configure.ac | 4 ++--
+ gcc/mkconfig.sh | 4 ++--
+ 4 files changed, 7 insertions(+), 7 deletions(-)
+
+Index: gcc-4_7-branch/gcc/Makefile.in
+===================================================================
+--- gcc-4_7-branch.orig/gcc/Makefile.in 2012-04-10 10:37:09.347387424 -0700
++++ gcc-4_7-branch/gcc/Makefile.in 2012-04-10 10:39:24.019393881 -0700
+@@ -481,7 +481,7 @@
+ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
+
+ xmake_file=@xmake_file@
+-tmake_file=@tmake_file@
++tmake_file=@tmake_file@ ./t-oe
+ TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
+ TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
+ TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
+Index: gcc-4_7-branch/gcc/configure
+===================================================================
+--- gcc-4_7-branch.orig/gcc/configure 2012-04-10 10:37:57.211389779 -0700
++++ gcc-4_7-branch/gcc/configure 2012-04-10 10:39:24.027393938 -0700
+@@ -11692,8 +11692,8 @@
+ tm_include_list="${tm_include_list} $f"
+ ;;
+ defaults.h )
+- tm_file_list="${tm_file_list} \$(srcdir)/$f"
+- tm_include_list="${tm_include_list} $f"
++ tm_file_list="${tm_file_list} ./$f"
++ tm_include_list="${tm_include_list} ./$f"
+ ;;
+ * )
+ tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
+Index: gcc-4_7-branch/gcc/configure.ac
+===================================================================
+--- gcc-4_7-branch.orig/gcc/configure.ac 2012-04-10 10:37:57.215389769 -0700
++++ gcc-4_7-branch/gcc/configure.ac 2012-04-10 10:39:24.027393938 -0700
+@@ -1699,8 +1699,8 @@
+ tm_include_list="${tm_include_list} $f"
+ ;;
+ defaults.h )
+- tm_file_list="${tm_file_list} \$(srcdir)/$f"
+- tm_include_list="${tm_include_list} $f"
++ tm_file_list="${tm_file_list} ./$f"
++ tm_include_list="${tm_include_list} ./$f"
+ ;;
+ * )
+ tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
+Index: gcc-4_7-branch/gcc/mkconfig.sh
+===================================================================
+--- gcc-4_7-branch.orig/gcc/mkconfig.sh 2012-04-10 10:17:24.383330061 -0700
++++ gcc-4_7-branch/gcc/mkconfig.sh 2012-04-10 10:39:24.027393938 -0700
+@@ -78,7 +78,7 @@
+ if [ $# -ge 1 ]; then
+ echo '#ifdef IN_GCC' >> ${output}T
+ for file in "$@"; do
+- if test x"$file" = x"defaults.h"; then
++ if test x"$file" = x"./defaults.h"; then
+ postpone_defaults_h="yes"
+ else
+ echo "# include \"$file\"" >> ${output}T
+@@ -104,7 +104,7 @@
+
+ # If we postponed including defaults.h, add the #include now.
+ if test x"$postpone_defaults_h" = x"yes"; then
+- echo "# include \"defaults.h\"" >> ${output}T
++ echo "# include \"./defaults.h\"" >> ${output}T
+ fi
+
+ # Add multiple inclusion protection guard, part two.
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-4.7.inc b/meta-aarch64/recipes-devtools/gcc/gcc-4.7.inc
new file mode 100644
index 00000000..1a3e09b0
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-4.7.inc
@@ -0,0 +1,141 @@
+require gcc-common.inc
+
+PR = "r13"
+
+# Third digit in PV should be incremented after a minor release
+# happens from this branch on gcc e.g. currently its 4.7.1
+# when 4.7.2 is releases and we bump SRCREV beyond the release
+# on branch then PV should be incremented to 4.7.2+svnr${SRCPV}
+# to reflect that change
+
+PV = "4.7.2"
+
+# BINV should be incremented after updating to a revision
+# after a minor gcc release (e.g. 4.7.1 or 4.7.2) has been made
+# the value will be minor-release+1 e.g. if current minor release was
+# 4.7.1 then the value below will have 2 which will mean 4.7.2
+# which will be next minor release and so on.
+
+BINV = "4.7.2"
+
+FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/gcc-4.7' ], d)}"
+
+DEPENDS =+ "mpfr gmp libmpc"
+NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
+
+LICENSE="GPL-3.0-with-GCC-exception & GPLv3"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
+ file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
+ file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
+ file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
+ file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8"
+
+SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
+ file://gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
+ file://100-uclibc-conf.patch \
+ file://gcc-uclibc-locale-ctype_touplow_t.patch \
+ file://200-uclibc-locale.patch \
+ file://203-uclibc-locale-no__x.patch; \
+ file://204-uclibc-locale-wchar_fix.patch; \
+ file://205-uclibc-locale-update.patch; \
+ file://301-missing-execinfo_h.patch \
+ file://302-c99-snprintf.patch \
+ file://303-c99-complex-ugly-hack.patch \
+ file://304-index_macro.patch \
+ file://305-libmudflap-susv3-legacy.patch \
+ file://306-libstdc++-namespace.patch \
+ file://740-sh-pr24836.patch \
+ file://800-arm-bigendian.patch \
+ file://gcc-poison-system-directories.patch \
+ file://gcc-poison-dir-extend.patch \
+ file://gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
+ file://64bithack.patch \
+ file://optional_libstdc.patch \
+ file://disable_relax_pic_calls_flag.patch \
+ file://COLLECT_GCC_OPTIONS.patch \
+ file://use-defaults.h-and-t-oe-in-B.patch \
+ file://ppc_with_cpu.patch \
+ file://ppce5500-e6500-support.patch \
+ file://rs6000-tables.patch \
+ file://define_insn_reservation.patch \
+ file://pr32219.patch \
+ file://fortran-cross-compile-hack.patch \
+ file://libgcc-sjlj-check.patch \
+ file://cpp-honor-sysroot.patch \
+ file://mips64-default-n64.patch \
+ file://GLIBC_DYNAMIC_LINKER.patch \
+ file://arm-hard-float-loader.patch \
+ file://gcc-argument-list-too-long.patch \
+ file://fix-g++-sysroot.patch \
+ file://disablesdt.patch \
+ file://libtool.patch \
+ file://gcc-armv4-pass-fix-v4bx-to-ld.patch \
+ file://ppc_no_crtsavres.patch \
+ file://0001-crtstuff.c-USE_PT_GNU_EH_FRAME-Define-for-systems-us.patch \
+ file://0001-Makefile.in-vis_hide-gen-hide-list-Do-not-make-defin.patch \
+ "
+SRC_URI[md5sum] = "cc308a0891e778cfda7a151ab8a6e762"
+SRC_URI[sha256sum] = "8a9283d7010fb9fe5ece3ca507e0af5c19412626384f8a5e9434251ae100b084"
+
+S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
+B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
+
+# Language Overrides
+FORTRAN = ""
+JAVA = ""
+
+EXTRA_OECONF_BASE = " --enable-lto \
+ --enable-libssp \
+ --disable-bootstrap \
+ --disable-libgomp \
+ --disable-libmudflap \
+ --with-system-zlib \
+ --with-linker-hash-style=${LINKER_HASH_STYLE} \
+ --with-ppl=no \
+ --with-cloog=no \
+ --enable-checking=release \
+ --enable-cheaders=c_global "
+
+EXTRA_OECONF_INITIAL = "--disable-libmudflap \
+ --disable-libgomp \
+ --disable-libssp \
+ --disable-libquadmath \
+ --with-system-zlib \
+ --disable-lto \
+ --disable-plugin \
+ --enable-decimal-float=no"
+
+EXTRA_OECONF_INTERMEDIATE = "--disable-libmudflap \
+ --disable-libgomp \
+ --disable-libquadmath \
+ --with-system-zlib \
+ --disable-lto \
+ --disable-plugin \
+ --disable-libssp"
+
+EXTRA_OECONF_append_libc-uclibc = " --disable-decimal-float "
+
+EXTRA_OECONF_PATHS = " \
+ --with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++ \
+ --with-sysroot=${STAGING_DIR_TARGET} \
+ --with-build-sysroot=${STAGING_DIR_TARGET}"
+
+do_configure_prepend () {
+ # teach gcc to find correct target includedir when checking libc ssp support
+ mkdir -p ${B}/gcc
+ echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
+ cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
+ cat >>${B}/gcc/defaults.h.new <<_EOF
+#ifndef STANDARD_STARTFILE_PREFIX_1
+#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
+#endif
+#ifndef STANDARD_STARTFILE_PREFIX_2
+#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
+#endif
+#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
+#endif /* ! GCC_DEFAULTS_H */
+_EOF
+ mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
+}
+
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-aarch64-4.7.inc b/meta-aarch64/recipes-devtools/gcc/gcc-aarch64-4.7.inc
new file mode 100644
index 00000000..92deb41f
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-aarch64-4.7.inc
@@ -0,0 +1,146 @@
+require gcc-common.inc
+
+PR = "r5+svn${SRCPV}"
+
+# Third digit in PV should be incremented after a minor release
+# happens from this branch on gcc e.g. currently its 4.7.1
+# when 4.7.2 is releases and we bump SRCREV beyond the release
+# on branch then PV should be incremented to 4.7.2+svnr${SRCPV}
+# to reflect that change
+
+# using 4.7.1.0 for upgrade path when we move past 4.7.2 release
+# then we should drop the last 0 as well.
+
+#PV = "4.7.2"
+
+# BINV should be incremented after updating to a revision
+# after a minor gcc release (e.g. 4.7.1 or 4.7.2) has been made
+# the value will be minor-release+1 e.g. if current minor release was
+# 4.7.1 then the value below will have 2 which will mean 4.7.2
+# which will be next minor release and so on.
+
+DEFAULT_PREFERENCE_aarch64 = "1"
+
+BINV = "4.7.3"
+
+SRCREV = "${AUTOREV}"
+BRANCH = "aarch64-4.7-branch"
+SRC_BRANCH = "ARM/${BRANCH}"
+
+DEPENDS =+ "mpfr gmp libmpc"
+NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
+
+LICENSE="GPL-3.0-with-GCC-exception & GPLv3"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
+ file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
+ file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
+ file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
+ file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8"
+
+SRC_URI = "svn://gcc.gnu.org/svn/gcc/branches;module=${SRC_BRANCH} \
+ file://gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
+ file://100-uclibc-conf.patch \
+ file://gcc-uclibc-locale-ctype_touplow_t.patch \
+ file://200-uclibc-locale.patch \
+ file://203-uclibc-locale-no__x.patch; \
+ file://204-uclibc-locale-wchar_fix.patch; \
+ file://205-uclibc-locale-update.patch; \
+ file://301-missing-execinfo_h.patch \
+ file://302-c99-snprintf.patch \
+ file://303-c99-complex-ugly-hack.patch \
+ file://304-index_macro.patch \
+ file://305-libmudflap-susv3-legacy.patch \
+ file://306-libstdc++-namespace.patch \
+ file://740-sh-pr24836.patch \
+ file://800-arm-bigendian.patch \
+ file://gcc-poison-system-directories.patch \
+ file://gcc-poison-dir-extend.patch \
+ file://gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
+ file://64bithack.patch \
+ file://optional_libstdc.patch \
+ file://disable_relax_pic_calls_flag.patch \
+ file://COLLECT_GCC_OPTIONS.patch \
+ file://use-defaults.h-and-t-oe-in-B.patch \
+ file://ppc_with_cpu.patch \
+ file://ppce5500-e6500-support.patch \
+ file://rs6000-tables.patch \
+ file://define_insn_reservation.patch \
+ file://pr32219.patch \
+ file://fortran-cross-compile-hack.patch \
+ file://libgcc-sjlj-check.patch \
+ file://cpp-honor-sysroot.patch \
+ file://mips64-default-n64.patch \
+ file://GLIBC_DYNAMIC_LINKER.patch \
+ file://arm-hard-float-loader.patch \
+ file://gcc-argument-list-too-long.patch \
+ file://fix-g++-sysroot.patch \
+ file://disablesdt.patch \
+ file://libtool.patch \
+ file://gcc-armv4-pass-fix-v4bx-to-ld.patch \
+ file://ppc_no_crtsavres.patch \
+ file://0001-crtstuff.c-USE_PT_GNU_EH_FRAME-Define-for-systems-us.patch \
+ file://0001-Makefile.in-vis_hide-gen-hide-list-Do-not-make-defin.patch \
+"
+
+S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${SRC_BRANCH}"
+B = "${WORKDIR}/${BRANCH}/build.${HOST_SYS}.${TARGET_SYS}"
+
+# Language Overrides
+FORTRAN = ""
+JAVA = ""
+
+EXTRA_OECONF_BASE = " --enable-lto \
+ --enable-libssp \
+ --disable-bootstrap \
+ --disable-libgomp \
+ --disable-libmudflap \
+ --with-system-zlib \
+ --with-linker-hash-style=${LINKER_HASH_STYLE} \
+ --with-ppl=no \
+ --with-cloog=no \
+ --enable-checking=release \
+ --enable-cheaders=c_global "
+
+EXTRA_OECONF_INITIAL = "--disable-libmudflap \
+ --disable-libgomp \
+ --disable-libssp \
+ --disable-libquadmath \
+ --with-system-zlib \
+ --disable-lto \
+ --disable-plugin \
+ --enable-decimal-float=no"
+
+EXTRA_OECONF_INTERMEDIATE = "--disable-libmudflap \
+ --disable-libgomp \
+ --disable-libquadmath \
+ --with-system-zlib \
+ --disable-lto \
+ --disable-plugin \
+ --disable-libssp"
+
+EXTRA_OECONF_append_libc-uclibc = " --disable-decimal-float "
+
+EXTRA_OECONF_PATHS = " \
+ --with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++ \
+ --with-sysroot=${STAGING_DIR_TARGET} \
+ --with-build-sysroot=${STAGING_DIR_TARGET}"
+
+do_configure_prepend () {
+ # teach gcc to find correct target includedir when checking libc ssp support
+ mkdir -p ${B}/gcc
+ echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
+ cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
+ cat >>${B}/gcc/defaults.h.new <<_EOF
+#ifndef STANDARD_STARTFILE_PREFIX_1
+#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
+#endif
+#ifndef STANDARD_STARTFILE_PREFIX_2
+#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
+#endif
+#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
+#endif /* ! GCC_DEFAULTS_H */
+_EOF
+ mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
+}
+
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-common.inc b/meta-aarch64/recipes-devtools/gcc/gcc-common.inc
new file mode 100644
index 00000000..72180db2
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-common.inc
@@ -0,0 +1,96 @@
+DESCRIPTION = "The GNU cc and gcc C compilers."
+HOMEPAGE = "http://www.gnu.org/software/gcc/"
+SECTION = "devel"
+LICENSE = "GPL"
+
+NATIVEDEPS = ""
+
+inherit autotools gettext
+
+FILESDIR = "${@os.path.dirname(d.getVar('FILE',1))}/gcc-${PV}"
+
+def get_gcc_fpu_setting(bb, d):
+ if d.getVar('ARMPKGSFX_EABI', True) == "hf" and d.getVar('TRANSLATED_TARGET_ARCH', True) == "arm":
+ return "--with-float=hard"
+ if d.getVar('TARGET_FPU', True) in [ 'soft' ]:
+ return "--with-float=soft"
+ if d.getVar('TARGET_FPU', True) in [ 'ppc-efd' ]:
+ return "--enable-e500_double"
+ return ""
+
+def get_gcc_mips_plt_setting(bb, d):
+ if d.getVar('TRANSLATED_TARGET_ARCH', True) in [ 'mips', 'mipsel' ] and 'mplt' in d.getVar('DISTRO_FEATURES',1).split() :
+ return "--with-mips-plt"
+ return ""
+
+def get_gcc_multiarch_setting(bb, d):
+ target_arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
+ multiarch_options = {
+ "i586": "--enable-targets=all",
+ "powerpc": "--enable-targets=powerpc64",
+ "sparc": "--enable-targets=all",
+ }
+
+ if 'multiarch' in d.getVar('DISTRO_FEATURES', True).split() :
+ if target_arch in multiarch_options :
+ return multiarch_options[target_arch]
+ return ""
+
+# We really need HOST_SYS here for some packages and TARGET_SYS for others.
+# For now, libgcc is most important so we fix for that - RP.
+SHLIBSDIR = "${STAGING_DIR_TARGET}/shlibs"
+
+DEBIANNAME_libgcc = "libgcc1"
+
+MIRRORS =+ "\
+${GNU_MIRROR}/gcc/releases/ ftp://gcc.gnu.org/pub/gcc/releases/ \n \
+${GNU_MIRROR}/gcc/ http://mirrors.rcn.net/pub/sourceware/gcc/releases/ \n \
+${GNU_MIRROR}/gcc/releases/ http://gcc.get-software.com/releases/ \n \
+${GNU_MIRROR}/gcc/ http://gcc.get-software.com/releases/ \n \
+"
+
+#
+# Set some default values
+#
+gcclibdir = "${libdir}/gcc"
+BINV = "${PV}"
+#S = "${WORKDIR}/gcc-${PV}"
+S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
+B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
+
+# SS means Shared Stamps directory
+SS = "${TMPDIR}/stamps/work-shared/gcc-${PV}-${PR}"
+do_fetch[stamp-base] = "${SS}"
+do_unpack[stamp-base] = "${SS}"
+do_patch[stamp-base] = "${SS}"
+
+# SW means Shared Work directory
+SW = "${TMPDIR}/work-shared/gcc-${PV}-${PR}"
+WORKDIR_task-unpack = "${SW}"
+WORKDIR_task-patch = "${SW}"
+
+target_includedir ?= "${includedir}"
+target_libdir ?= "${libdir}"
+target_base_libdir ?= "${base_libdir}"
+target_prefix ?= "${prefix}"
+
+CLEANFUNCS += "workshared_clean"
+# The do_clean should be exclusive since share ${S}
+do_clean[lockfiles] = "${SW}.clean.lock"
+
+python workshared_clean () {
+ """clear the source directory"""
+ dir = d.expand("${SW}")
+ bb.note("Removing " + dir)
+ oe.path.remove(dir)
+
+ """clear the the stamps in work-shared"""
+ dir = "%s.*" % bb.data.expand(d.getVarFlag('do_fetch', 'stamp-base', True), d)
+ bb.note("Removing " + dir)
+ oe.path.remove(dir)
+}
+
+# We need to ensure that for the shared work directory, the do_patch singatures match
+# The real WORKDIR location isn't a dependency for the shared workdir.
+src_patches[vardepsexclude] = "WORKDIR"
+should_apply[vardepsexclude] += "PN"
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-configure-common.inc b/meta-aarch64/recipes-devtools/gcc/gcc-configure-common.inc
new file mode 100644
index 00000000..908ad3eb
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-configure-common.inc
@@ -0,0 +1,130 @@
+#
+# Build the list of lanaguages to build.
+#
+# These can be overridden by the version specific .inc file.
+
+# Java (gcj doesn't work on all architectures)
+JAVA ?= ",java"
+JAVA_arm ?= ""
+JAVA_armeb ?= ""
+JAVA_mipsel ?= ""
+JAVA_sh3 ?= ""
+# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
+FORTRAN ?= ",f77"
+LANGUAGES ?= "c,c++${FORTRAN}${JAVA}"
+# disable --enable-target-optspace for powerpc SPE
+# at -Os libgcc.so.1 creates references into
+# hidden symbols in libgcc.a which linker complains
+# when linking shared libraries further in the build like (gnutls)
+
+SPECIAL_ARCH_LIST = "powerpc"
+OPTSPACE = '${@base_contains("SPECIAL_ARCH_LIST", "${TARGET_ARCH}", "", "--enable-target-optspace",d)}'
+
+EXTRA_OECONF_BASE ?= ""
+EXTRA_OECONF_PATHS ?= ""
+EXTRA_OECONF_INITIAL ?= ""
+EXTRA_OECONF_INTERMEDIATE ?= ""
+
+GCCMULTILIB = "--disable-multilib"
+
+EXTRA_OECONF = "${@['--enable-clocale=generic', ''][d.getVar('USE_NLS', True) != 'no']} \
+ --with-gnu-ld \
+ --enable-shared \
+ --enable-languages=${LANGUAGES} \
+ --enable-threads=posix \
+ ${GCCMULTILIB} \
+ --enable-c99 \
+ --enable-long-long \
+ --enable-symvers=gnu \
+ --enable-libstdcxx-pch \
+ --program-prefix=${TARGET_PREFIX} \
+ --without-local-prefix \
+ ${OPTSPACE} \
+ ${EXTRA_OECONF_BASE} \
+ ${EXTRA_OECONF_FPU} \
+ ${EXTRA_OECONF_PATHS} \
+ ${@get_gcc_mips_plt_setting(bb, d)} \
+ ${@get_gcc_multiarch_setting(bb, d)}"
+
+export gcc_cv_collect2_libs = 'none required'
+# We need to set gcc_cv_collect2_libs else there is cross-compilation badness
+# in the config.log files (which might not get generated until do_compile
+# hence being missed by the insane do_configure check).
+
+# Build uclibc compilers without cxa_atexit support
+EXTRA_OECONF_append_linux = " --enable-__cxa_atexit"
+EXTRA_OECONF_append_libc-uclibc = " --enable-__cxa_atexit"
+
+EXTRA_OECONF_append_mips64 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
+EXTRA_OECONF_append_mips64el = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
+
+EXTRA_OECONF_FPU = "${@get_gcc_fpu_setting(bb, d)}"
+CPPFLAGS = ""
+
+# powerpc needs this to comply with the ABI
+EXTRA_OECONF_append_powerpc = " --with-long-double-128"
+EXTRA_OECONF_append_powerpc64 = " --with-long-double-128"
+
+# Used by configure to define additional values for FLAGS_FOR_TARGET -
+# passed to all the compilers.
+ARCH_FLAGS_FOR_TARGET = "${TARGET_CC_ARCH}"
+EXTRA_OEMAKE += "ARCH_FLAGS_FOR_TARGET='${ARCH_FLAGS_FOR_TARGET}'"
+
+SYSTEMHEADERS = "${target_includedir}"
+SYSTEMLIBS = "${target_base_libdir}/"
+SYSTEMLIBS1 = "${target_libdir}/"
+
+do_configure_prepend () {
+ # teach gcc to find correct target includedir when checking libc ssp support
+ mkdir -p ${B}/gcc
+ echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
+ cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
+ cat >>${B}/gcc/defaults.h.new <<_EOF
+#ifndef STANDARD_INCLUDE_DIR
+#define STANDARD_INCLUDE_DIR "${SYSTEMHEADERS}"
+#endif
+#ifndef STANDARD_STARTFILE_PREFIX_1
+#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
+#endif
+#ifndef STANDARD_STARTFILE_PREFIX_2
+#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
+#endif
+#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
+#endif /* ! GCC_DEFAULTS_H */
+_EOF
+ mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
+}
+
+do_configure () {
+ # Setup these vars for cross building only
+ # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
+ # gcc build stuff when the build is producing a cross compiler - i.e.
+ # when the 'current' target is the 'host' system, and the host is not
+ # the target (because the build is actually making a cross compiler!)
+ if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
+ export CC_FOR_TARGET="${CC}"
+ export GCC_FOR_TARGET="${CC}"
+ export CXX_FOR_TARGET="${CXX}"
+ export AS_FOR_TARGET="${HOST_PREFIX}as"
+ export LD_FOR_TARGET="${HOST_PREFIX}ld"
+ export NM_FOR_TARGET="${HOST_PREFIX}nm"
+ export AR_FOR_TARGET="${HOST_PREFIX}ar"
+ export GFORTRAN_FOR_TARGET="gfortran"
+ export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
+ fi
+ export CC_FOR_BUILD="${BUILD_CC}"
+ export CXX_FOR_BUILD="${BUILD_CXX}"
+ export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
+ export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
+ export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
+ export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
+ export ARCH_FLAGS_FOR_TARGET="${ARCH_FLAGS_FOR_TARGET}"
+ export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
+ export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
+ export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
+ export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
+ (cd ${S} && gnu-configize) || die "failure running gnu-configize"
+
+ oe_runconf
+}
+
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-configure-cross.inc b/meta-aarch64/recipes-devtools/gcc/gcc-configure-cross.inc
new file mode 100644
index 00000000..243ee55d
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-configure-cross.inc
@@ -0,0 +1,28 @@
+require gcc-configure-common.inc
+
+EXTRA_OECONF += " --enable-poison-system-directories \
+ "
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+EXTRA_OECONF_PATHS = " \
+ --with-headers=${STAGING_DIR_TARGET}${SYSTEMHEADERS} \
+ --with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++ \
+ --with-sysroot=${STAGING_DIR_TARGET} \
+ --with-build-sysroot=${STAGING_DIR_TARGET}"
+
+do_compile_prepend () {
+ export CC="${BUILD_CC}"
+ export AR_FOR_TARGET="${TARGET_SYS}-ar"
+ export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib"
+ export LD_FOR_TARGET="${TARGET_SYS}-ld"
+ export NM_FOR_TARGET="${TARGET_SYS}-nm"
+ export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}"
+ export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
+ export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
+ export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
+ export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
+}
+
+LIBGCCS_VAR = "-lgcc_s"
+LIBGCCS_VAR_avr32 = ""
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-configure-runtime.inc b/meta-aarch64/recipes-devtools/gcc/gcc-configure-runtime.inc
new file mode 100644
index 00000000..d40383ce
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-configure-runtime.inc
@@ -0,0 +1,59 @@
+require gcc-configure-common.inc
+
+CXXFLAGS := "${@oe_filter_out('-fvisibility-inlines-hidden', '${CXXFLAGS}', d)}"
+
+EXTRA_OECONF_PATHS = " \
+ --with-gxx-include-dir=${includedir}/c++/ \
+ --with-sysroot=${STAGING_DIR_TARGET} \
+ --with-build-sysroot=${STAGING_DIR_TARGET}"
+
+RUNTIMETARGET = "libssp libstdc++-v3"
+RUNTIMETARGET_append_powerpc = " libgomp"
+RUNTIMETARGET_append_powerpc64 = " libgomp"
+# ?
+# libiberty
+# libmudflap
+# libgfortran
+
+do_configure () {
+ export CXX="${CXX} -nostdinc++ -nostdlib++"
+ mtarget=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-nativesdk##`
+ target=`echo ${TARGET_SYS} | sed -e s#-nativesdk##`
+ cp -fpPR ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget/* ${B}
+ for d in libgcc ${RUNTIMETARGET}; do
+ echo "Configuring $d"
+ rm -rf ${B}/$target/$d/
+ mkdir -p ${B}/$target/$d/
+ cd ${B}/$target/$d/
+ chmod a+x ${S}/$d/configure
+ ${S}/$d/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
+ done
+}
+
+do_compile () {
+ target=`echo ${TARGET_SYS} | sed -e s#-nativesdk##`
+ for d in libgcc ${RUNTIMETARGET}; do
+ cd ${B}/$target/$d/
+ oe_runmake MULTIBUILDTOP=${B}/$target/$d/
+ done
+}
+
+do_install () {
+ target=`echo ${TARGET_SYS} | sed -e s#-nativesdk##`
+ for d in ${RUNTIMETARGET}; do
+ cd ${B}/$target/$d/
+ oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/$d/ install
+ if [ "$d" = "libgomp" ]; then
+ rm -rf ${D}${datadir}/info/libgomp.info ${D}${datadir}/info/dir
+ rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
+ rmdir --ignore-fail-on-non-empty -p ${D}${datadir}/info
+ fi
+ done
+ chown -R root:root ${D}
+}
+
+INHIBIT_DEFAULT_DEPS = "1"
+DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ libgcc"
+PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs"
+
+BBCLASSEXTEND = "nativesdk"
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-configure-sdk.inc b/meta-aarch64/recipes-devtools/gcc/gcc-configure-sdk.inc
new file mode 100644
index 00000000..51c02170
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-configure-sdk.inc
@@ -0,0 +1,47 @@
+require gcc-configure-common.inc
+
+EXTRA_OECONF_PATHS = "--with-gxx-include-dir=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}${target_includedir}/c++ \
+ --with-build-time-tools=${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}/bin \
+ --with-sysroot=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS} \
+ --with-build-sysroot=${STAGING_DIR_TARGET}"
+
+#
+# gcc-cross looks and finds these in ${exec_prefix} but we're not so lucky
+# for the sdk. Hardcoding the paths ensures the build doesn't go canadian or worse.
+#
+export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
+export AS_FOR_TARGET = "${TARGET_PREFIX}as"
+export DLLTOOL_FOR_TARGET = "${TARGET_PREFIX}dlltool"
+export CC_FOR_TARGET = "${TARGET_PREFIX}gcc"
+export CXX_FOR_TARGET = "${TARGET_PREFIX}g++"
+export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
+export LIPO_FOR_TARGET = "${TARGET_PREFIX}lipo"
+export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
+export OBJDUMP_FOR_TARGET = "${TARGET_PREFIX}objdump"
+export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
+export STRIP_FOR_TARGET = "${TARGET_PREFIX}strip"
+export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
+
+#
+# We need to override this and make sure the compiler can find staging
+#
+export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
+
+do_configure () {
+ export CC_FOR_BUILD="${BUILD_CC}"
+ export CXX_FOR_BUILD="${BUILD_CXX}"
+ export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
+ export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
+ export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
+ export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
+ export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
+ export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
+ export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
+ export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
+ (cd ${S} && gnu-configize) || die "failure running gnu-configize"
+ oe_runconf
+}
+
+do_compile () {
+ oe_runmake all-host all-target-libgcc
+}
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-configure-target.inc b/meta-aarch64/recipes-devtools/gcc/gcc-configure-target.inc
new file mode 100644
index 00000000..f41301f2
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-configure-target.inc
@@ -0,0 +1,7 @@
+require gcc-configure-common.inc
+
+EXTRA_OECONF_PATHS = " \
+ --with-sysroot=/ \
+ --with-build-sysroot=${STAGING_DIR_TARGET} \
+ --with-native-system-header-dir=${STAGING_DIR_TARGET}${target_includedir} \
+ --with-gxx-include-dir=${includedir}/c++/"
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta-aarch64/recipes-devtools/gcc/gcc-cross-canadian.inc
new file mode 100644
index 00000000..ef861ae6
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-cross-canadian.inc
@@ -0,0 +1,8 @@
+inherit cross-canadian
+
+DESCRIPTION = "The cross-canadian GNU cc and gcc C compilers for ${TARGET_ARCH} target."
+PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+BPN = "gcc"
+
+DEPENDS = "virtual/${HOST_PREFIX}binutils-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc gettext"
+
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-cross-canadian_aarch64-4.7.bb b/meta-aarch64/recipes-devtools/gcc/gcc-cross-canadian_aarch64-4.7.bb
new file mode 100644
index 00000000..53c46326
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-cross-canadian_aarch64-4.7.bb
@@ -0,0 +1,26 @@
+inherit cross-canadian
+
+require recipes-devtools/gcc/gcc-${PV}.inc
+require gcc-cross-canadian.inc
+require gcc-configure-sdk.inc
+require gcc-package-sdk.inc
+
+DEPENDS += "nativesdk-gmp nativesdk-mpfr nativesdk-libmpc nativesdk-elfutils"
+RDEPENDS_${PN} += "nativesdk-mpfr nativesdk-libmpc nativesdk-elfutils"
+
+SYSTEMHEADERS = "/usr/include"
+SYSTEMLIBS = "${target_base_libdir}/"
+SYSTEMLIBS1 = "${target_libdir}/"
+
+EXTRA_OECONF += "--disable-libunwind-exceptions --disable-libssp \
+ --disable-libgomp --disable-libmudflap \
+ --with-mpfr=${STAGING_DIR_HOST}${layout_exec_prefix} \
+ --with-mpc=${STAGING_DIR_HOST}${layout_exec_prefix}"
+
+# to find libmpfr
+# export LD_LIBRARY_PATH = "{STAGING_DIR_HOST}${layout_exec_prefix}"
+
+PARALLEL_MAKE = ""
+
+# gcc 4.7 needs -isystem
+export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}"
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-cross-initial.inc b/meta-aarch64/recipes-devtools/gcc/gcc-cross-initial.inc
new file mode 100644
index 00000000..ff6556c5
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-cross-initial.inc
@@ -0,0 +1,79 @@
+DEPENDS = "virtual/${TARGET_PREFIX}binutils ${NATIVEDEPS}"
+PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
+PACKAGES = ""
+
+INHIBIT_AUTOTOOLS_DEPS = "1"
+INHIBIT_DEFAULT_DEPS = "1"
+
+CROSS_TARGET_SYS_DIR_append = ".${PN}"
+
+# This is intended to be a -very- basic config
+# sysroot is needed in case we use libc-initial
+EXTRA_OECONF = "--with-newlib \
+ --without-headers \
+ --disable-shared \
+ --disable-threads \
+ --disable-multilib \
+ --disable-__cxa_atexit \
+ --enable-languages=c \
+ ${OPTSPACE} \
+ --program-prefix=${TARGET_PREFIX} \
+ --with-sysroot=${STAGING_DIR_TARGET} \
+ --with-build-sysroot=${GCCCROSS_BUILDSYSROOT} \
+ ${EXTRA_OECONF_INITIAL} \
+ ${@base_contains('DISTRO_FEATURES', 'ld-is-gold', '--with-ld=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}ld.bfd', '', d)} \
+ ${EXTRA_OECONF_FPU}"
+
+GCCCROSS_BUILDSYSROOT = "${B}/tmpsysroot"
+
+do_configure_prepend () {
+ sysr=${GCCCROSS_BUILDSYSROOT}${target_includedir}
+ mkdir -p $sysr
+ for t in linux asm asm-generic; do
+ rm -f $sysr/$t
+ ln -s ${STAGING_DIR_TARGET}${target_includedir}/$t $sysr/
+ done
+}
+
+do_compile () {
+ oe_runmake all-gcc all-target-libgcc
+}
+do_install () {
+ oe_runmake 'DESTDIR=${D}' install-gcc install-target-libgcc
+
+ # We don't really need this (here shares/ contains man/, info/, locale/).
+ rm -rf ${D}${datadir}/
+
+ # We use libiberty from binutils
+ find ${D}${exec_prefix}/lib -name libiberty.a | xargs rm -f
+ find ${D}${exec_prefix}/lib -name libiberty.h | xargs rm -f
+
+ # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
+ # found. These need to be relative paths so they work in different locations.
+ dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
+ install -d $dest
+ for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
+ ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
+ done
+ # fixed limits.h infact includes the so called real limits.h
+ # which should come from libc but when we build libc-initial
+ # then bunch of configure tests include fixed limits.h which in turn
+ # includes real limits.h but this real limits.h is not staged yet
+ # so we overwirte the generated include-fixed/limits.h for gcc-cross-initial
+ # to get rid references to real limits.h
+ cp gcc/include-fixed/limits.h ${D}${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed/limits.h
+}
+#
+# Override the default sysroot staging copy since this won't look like a target system
+#
+sysroot_stage_all() {
+ sysroot_stage_dir ${D} ${SYSROOT_DESTDIR}
+ install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_base_libdir}/
+ install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/
+ mv ${SYSROOT_DESTDIR}${target_base_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_base_libdir}/ || true
+ mv ${SYSROOT_DESTDIR}${target_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/ || true
+}
+
+do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_HOST} ${SYSROOT_DESTDIR}/${STAGING_DIR_TARGET}/${target_base_libdir}"
+do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_HOST} ${STAGING_DIR_TCBOOTSTRAP}/${target_base_libdir}"
+
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-cross-initial_aarch64-4.7.bb b/meta-aarch64/recipes-devtools/gcc/gcc-cross-initial_aarch64-4.7.bb
new file mode 100644
index 00000000..4c73e5ce
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-cross-initial_aarch64-4.7.bb
@@ -0,0 +1,2 @@
+require recipes-devtools/gcc/gcc-cross_${PV}.bb
+require gcc-cross-initial.inc
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-cross.inc b/meta-aarch64/recipes-devtools/gcc/gcc-cross.inc
new file mode 100644
index 00000000..6d160d65
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-cross.inc
@@ -0,0 +1,102 @@
+inherit cross
+
+DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc ${NATIVEDEPS}"
+PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
+
+require gcc-configure-cross.inc
+require gcc-package-cross.inc
+
+do_compile () {
+ oe_runmake all-host all-target-libgcc
+ # now generate script to drive testing
+ echo "#!/usr/bin/env sh" >${B}/${TARGET_PREFIX}testgcc
+ set >> ${B}/${TARGET_PREFIX}testgcc
+ # prune out the unneeded vars
+ sed -i -e "/^BASH/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^USER/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^OPT/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^DIRSTACK/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^EUID/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^FUNCNAME/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^GROUPS/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^HOST/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^HOME/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^IFS/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^LC_ALL/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^LOGNAME/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^MACHTYPE/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^OSTYPE/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^PIPE/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^SHELL/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^'/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^UID/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^TERM/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^PATCH_GET/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^PKG_/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^POSIXLY_/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^PPID/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^PS4/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^Q/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^SHLVL/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^STAGING/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^LD_LIBRARY_PATH/d" ${B}/${TARGET_PREFIX}testgcc
+ sed -i -e "/^PSEUDO/d" ${B}/${TARGET_PREFIX}testgcc
+
+ # append execution part of the script
+cat >> ${B}/${TARGET_PREFIX}testgcc << STOP
+target="\$1"
+usage () {
+ echo "Usage:"
+ echo "\$0 user@target 'extra options to dejagnu'"
+ echo "\$0 target 'extra options to dejagnu'"
+ echo "\$0 target"
+ echo "e.g. \$0 192.168.7.2 ' dg.exp=visibility-d.c'"
+ echo "will only run visibility-d.c test case"
+ echo "e.g. \$0 192.168.7.2 '/-mthumb dg.exp=visibility-d.c'"
+ echo "will only run visibility-d.c test case in thumb mode"
+ echo "You need to have dejagnu autogen expect installed"
+ echo "on the build host"
+ }
+if [ "x\$target" = "x" ]
+then
+ echo "Please specify the target machine and remote user in form of user@target\n"
+ usage
+ exit 1;
+fi
+
+shift
+
+echo "\$target" | grep "@" 2>&1 > /dev/null
+if [ "x\$?" = "x0" ]
+then
+ user=\$(echo \$target | cut -d '@' -f 1)
+ target=\$(echo \$target | cut -d '@' -f 2)
+else
+ user=\$USER
+fi
+ssh \$user@\$target date 2>&1 > /dev/null
+if [ "x\$?" != "x0" ]
+then
+ echo "Failed connecting to \$user@\$target it could be because"
+ echo "you don't have passwordless ssh setup to access \$target"
+ echo "or sometimes host key has been changed"
+ echo "in such case do something like below on build host"
+ echo "ssh-keygen -f "~/.ssh/known_hosts" -R \$target"
+ echo "and then try ssh \$user@\$target"
+
+ usage
+ exit 1
+fi
+ echo "lappend boards_dir [pwd]/../../.." > ${B}/site.exp
+ echo "load_generic_config \"unix\"" > ${B}/${PACKAGE_ARCH}.exp
+ echo "set_board_info username \$user" >> ${B}/${PACKAGE_ARCH}.exp
+ echo "set_board_info rsh_prog ssh" >> ${B}/${PACKAGE_ARCH}.exp
+ echo "set_board_info rcp_prog scp" >> ${B}/${PACKAGE_ARCH}.exp
+ echo "set_board_info hostname \$target" >> ${B}/${PACKAGE_ARCH}.exp
+ DEJAGNU=${B}/site.exp make -k check RUNTESTFLAGS="--target_board=${PACKAGE_ARCH}\$@"
+
+STOP
+
+ chmod +x ${B}/${TARGET_PREFIX}testgcc
+
+}
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-cross4.inc b/meta-aarch64/recipes-devtools/gcc/gcc-cross4.inc
new file mode 100644
index 00000000..4a20818d
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-cross4.inc
@@ -0,0 +1,3 @@
+require gcc-cross.inc
+
+EXTRA_OECONF_append_sh4 = " --with-multilib-list= --enable-incomplete-targets "
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-cross_aarch64-4.7.bb b/meta-aarch64/recipes-devtools/gcc/gcc-cross_aarch64-4.7.bb
new file mode 100644
index 00000000..d6052351
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-cross_aarch64-4.7.bb
@@ -0,0 +1,14 @@
+require recipes-devtools/gcc/gcc-${PV}.inc
+require gcc-cross4.inc
+
+EXTRA_OECONF += "--disable-libunwind-exceptions \
+ --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native} \
+ --with-system-zlib "
+
+EXTRA_OECONF_PATHS = " \
+ --with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++ \
+ --with-sysroot=${STAGING_DIR_TARGET} \
+ --with-build-sysroot=${STAGING_DIR_TARGET}"
+
+
+ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-crosssdk-initial.inc b/meta-aarch64/recipes-devtools/gcc/gcc-crosssdk-initial.inc
new file mode 100644
index 00000000..c6f74a64
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-crosssdk-initial.inc
@@ -0,0 +1,8 @@
+inherit crosssdk
+
+SYSTEMHEADERS = "${SDKPATHNATIVE}${prefix_nativesdk}/include"
+SYSTEMLIBS = "${SDKPATHNATIVE}${base_libdir_nativesdk}/"
+SYSTEMLIBS1 = "${SDKPATHNATIVE}${libdir_nativesdk}/"
+
+DEPENDS = "virtual/${TARGET_PREFIX}binutils-crosssdk gettext-native ${NATIVEDEPS}"
+PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial-crosssdk"
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-crosssdk-initial_aarch64-4.7.bb b/meta-aarch64/recipes-devtools/gcc/gcc-crosssdk-initial_aarch64-4.7.bb
new file mode 100644
index 00000000..39c90ca0
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-crosssdk-initial_aarch64-4.7.bb
@@ -0,0 +1,4 @@
+require recipes-devtools/gcc/gcc-cross-initial_${PV}.bb
+require gcc-crosssdk-initial.inc
+EXTRA_OECONF += " --with-native-system-header-dir=${SYSTEMHEADERS} "
+
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-crosssdk.inc b/meta-aarch64/recipes-devtools/gcc/gcc-crosssdk.inc
new file mode 100644
index 00000000..467a3f5d
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-crosssdk.inc
@@ -0,0 +1,10 @@
+inherit crosssdk
+
+SYSTEMHEADERS = "${SDKPATHNATIVE}${prefix_nativesdk}/include"
+SYSTEMLIBS = "${SDKPATHNATIVE}${base_libdir_nativesdk}/"
+SYSTEMLIBS1 = "${SDKPATHNATIVE}${libdir_nativesdk}/"
+
+GCCMULTILIB = "--disable-multilib"
+
+DEPENDS = "virtual/${TARGET_PREFIX}binutils-crosssdk virtual/nativesdk-${TARGET_PREFIX}libc-for-gcc gettext-native"
+PROVIDES = "virtual/${TARGET_PREFIX}gcc-crosssdk virtual/${TARGET_PREFIX}g++-crosssdk"
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-crosssdk_aarch64-4.7.bb b/meta-aarch64/recipes-devtools/gcc/gcc-crosssdk_aarch64-4.7.bb
new file mode 100644
index 00000000..40a6c4fe
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-crosssdk_aarch64-4.7.bb
@@ -0,0 +1,2 @@
+require recipes-devtools/gcc/gcc-cross_${PV}.bb
+require gcc-crosssdk.inc
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-package-cross.inc b/meta-aarch64/recipes-devtools/gcc/gcc-package-cross.inc
new file mode 100644
index 00000000..9718101a
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-package-cross.inc
@@ -0,0 +1,47 @@
+INHIBIT_PACKAGE_STRIP = "1"
+
+# Compute how to get from libexecdir to bindir in python (easier than shell)
+BINRELPATH = "${@oe.path.relative(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${STAGING_DIR_NATIVE}${prefix_native}/bin/${MULTIMACH_TARGET_SYS}"))}"
+
+do_install () {
+ oe_runmake 'DESTDIR=${D}' install-host
+
+ install -d ${D}${target_base_libdir}
+ install -d ${D}${target_libdir}
+
+ # Link gfortran to g77 to satisfy not-so-smart configure or hard coded g77
+ # gfortran is fully backwards compatible. This is a safe and practical solution.
+ ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true
+
+
+ # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
+ # found. These need to be relative paths so they work in different locations.
+ dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
+ install -d $dest
+ for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
+ ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
+ ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t
+ done
+
+ # Remove things we don't need but keep share/java
+ for d in info man share/doc share/locale share/man share/info; do
+ rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/$d
+ done
+
+ # We use libiberty from binutils
+ find ${D}${exec_prefix}/lib -name libiberty.a | xargs rm -f
+ find ${D}${exec_prefix}/lib -name libiberty.h | xargs rm -f
+
+ # gcc-runtime installs libgcc into a special location in staging since it breaks doing a standalone build
+ case ${PN} in
+ *gcc-cross|*gcc-crosssdk)
+ dest=${D}/${includedir}/gcc-build-internal-${MULTIMACH_TARGET_SYS}
+ cp -fpPR . $dest
+ ;;
+ esac
+}
+
+do_package[noexec] = "1"
+do_package_write_ipk[noexec] = "1"
+do_package_write_rpm[noexec] = "1"
+do_package_write_deb[noexec] = "1"
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-package-runtime.inc b/meta-aarch64/recipes-devtools/gcc/gcc-package-runtime.inc
new file mode 100644
index 00000000..75847b6b
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-package-runtime.inc
@@ -0,0 +1,80 @@
+PACKAGES = "\
+ ${PN}-dbg \
+ libstdc++ \
+ libstdc++-precompile-dev \
+ libstdc++-dev \
+ libstdc++-staticdev \
+ libg2c \
+ libg2c-dev \
+ libssp \
+ libssp-dev \
+ libssp-staticdev \
+ libgfortran \
+ libgfortran-dev \
+ libmudflap \
+ libmudflap-dev \
+ libgomp \
+ libgomp-dev \
+ libgomp-staticdev \
+"
+# The base package doesn't exist, so we clear the recommends.
+RRECOMMENDS_${PN}-dbg = ""
+
+# include python debugging scripts
+FILES_${PN}-dbg += "\
+ ${libdir}/libstdc++.so.*-gdb.py \
+ ${datadir}/gcc-${BINV}/python/libstdcxx"
+
+FILES_libg2c = "${target_libdir}/libg2c.so.*"
+FILES_libg2c-dev = "\
+ ${libdir}/libg2c.so \
+ ${libdir}/libg2c.a \
+ ${libdir}/libfrtbegin.a"
+
+FILES_libstdc++ = "${libdir}/libstdc++.so.*"
+FILES_libstdc++-dev = "\
+ ${includedir}/c++/ \
+ ${libdir}/libstdc++.so \
+ ${libdir}/libstdc++.la \
+ ${libdir}/libsupc++.la"
+FILES_libstdc++-staticdev = "\
+ ${libdir}/libstdc++.a \
+ ${libdir}/libsupc++.a"
+
+FILES_libstdc++-precompile-dev = "${includedir}/c++/${TARGET_SYS}/bits/*.gch"
+
+FILES_libssp = "${libdir}/libssp.so.*"
+FILES_libssp-dev = " \
+ ${libdir}/libssp*.so \
+ ${libdir}/libssp*_nonshared.a \
+ ${libdir}/libssp*.la \
+ ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ssp"
+FILES_libssp-staticdev = " \
+ ${libdir}/libssp*.a"
+
+FILES_libgfortran = "${libdir}/libgfortran.so.*"
+FILES_libgfortran-dev = " \
+ ${libdir}/libgfortran.a \
+ ${libdir}/libgfortran.so \
+ ${libdir}/libgfortranbegin.a"
+
+FILES_libmudflap = "${libdir}/libmudflap*.so.*"
+FILES_libmudflap-dev = "\
+ ${libdir}/libmudflap*.so \
+ ${libdir}/libmudflap*.a \
+ ${libdir}/libmudflap*.la"
+
+FILES_libgomp = "${libdir}/libgomp*${SOLIBS}"
+FILES_libgomp-dev = "\
+ ${libdir}/libgomp*${SOLIBSDEV} \
+ ${libdir}/libgomp*.la \
+ ${libdir}/libgomp.spec \
+ ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/omp.h \
+ "
+FILES_libgomp-staticdev = "\
+ ${libdir}/libgomp*.a \
+ "
+
+do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_package"
+do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_package"
+do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_package"
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-package-sdk.inc b/meta-aarch64/recipes-devtools/gcc/gcc-package-sdk.inc
new file mode 100644
index 00000000..f32e95fb
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-package-sdk.inc
@@ -0,0 +1,68 @@
+INHIBIT_PACKAGE_STRIP = "1"
+
+# Having anything auto depending on gcc-cross-sdk is a really bad idea...
+EXCLUDE_FROM_SHLIBS = "1"
+
+PACKAGES = "${PN} ${PN}-doc"
+
+FILES_${PN} = "\
+ ${bindir}/* \
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/* \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/lib* \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.* \
+ ${includedir}/c++/${BINV} \
+ ${prefix}/${TARGET_SYS}/bin/* \
+ ${prefix}/${TARGET_SYS}/lib/* \
+ ${prefix}/${TARGET_SYS}/usr/include/* \
+ "
+INSANE_SKIP_${PN} += "dev-so"
+
+FILES_${PN}-doc = "\
+ ${infodir} \
+ ${mandir} \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
+ "
+
+do_install () {
+ oe_runmake 'DESTDIR=${D}' install-host
+
+ # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
+ rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
+ rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
+
+ # We care about g++ not c++
+ rm -f ${D}${bindir}/*c++
+
+ # We don't care about the gcc-<version> copies
+ rm -f ${D}${bindir}/*gcc-?.?*
+
+ # We use libiberty from binutils
+ rm -f ${D}${prefix}/${TARGET_SYS}/lib/libiberty.a
+ # Not sure where the strange paths come from
+ rm -f ${D}${libdir}/../lib/libiberty.a
+ rm -f ${D}${libdir}/libiberty.a
+
+ # Cleanup empty directories which are not shipped
+ # we use rmdir instead of 'rm -f' to ensure the non empty directories are not deleted
+ # ${D}${libdir}/../lib only seems to appear with SDKMACHINE=i686
+ local empty_dirs="${D}${libdir}/../lib ${D}${prefix}/${TARGET_SYS}/lib ${D}${prefix}/${TARGET_SYS} ${D}${includedir}"
+ for i in $empty_dirs; do
+ [ -d $i ] && rmdir --ignore-fail-on-non-empty $i
+ done
+
+ # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
+ # found.
+ dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
+ install -d $dest
+ for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
+ ln -sf ${bindir}/${TARGET_PREFIX}$t $dest$t
+ done
+
+ chown -R root:root ${D}
+}
+
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-package-target.inc b/meta-aarch64/recipes-devtools/gcc/gcc-package-target.inc
new file mode 100644
index 00000000..c39aaa8b
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-package-target.inc
@@ -0,0 +1,142 @@
+PACKAGES = "\
+ ${PN} ${PN}-plugins ${PN}-symlinks \
+ g++ g++-symlinks \
+ cpp cpp-symlinks \
+ g77 g77-symlinks \
+ gfortran gfortran-symlinks \
+ gcov gcov-symlinks \
+ ${PN}-plugin-dev \
+ ${PN}-doc \
+ ${PN}-dev \
+ ${PN}-dbg \
+"
+
+FILES_${PN} = "\
+ ${bindir}/${TARGET_PREFIX}gcc* \
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2 \
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc* \
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lto* \
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto*${SOLIBSDEV} \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
+"
+INSANE_SKIP_${PN} += "dev-so"
+
+FILES_${PN}-dbg += "\
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/.debug/ \
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/.debug/ \
+"
+FILES_${PN}-dev = "\
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
+"
+FILES_${PN}-plugin-dev = "\
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/gengtype \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.state \
+"
+FILES_${PN}-symlinks = "\
+ ${bindir}/cc \
+ ${bindir}/gcc \
+ ${bindir}/gccbug \
+"
+
+FILES_${PN}-plugins = "\
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin \
+"
+ALLOW_EMPTY_${PN}-plugins = "1"
+
+FILES_g77 = "\
+ ${bindir}/${TARGET_PREFIX}g77 \
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771 \
+"
+FILES_g77-symlinks = "\
+ ${bindir}/g77 \
+ ${bindir}/f77 \
+"
+FILES_gfortran = "\
+ ${bindir}/${TARGET_PREFIX}gfortran \
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \
+"
+FILES_gfortran-symlinks = "\
+ ${bindir}/gfortran \
+ ${bindir}/f95"
+
+FILES_cpp = "\
+ ${bindir}/${TARGET_PREFIX}cpp \
+ ${base_libdir}/cpp \
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1"
+FILES_cpp-symlinks = "${bindir}/cpp"
+
+FILES_gcov = "${bindir}/${TARGET_PREFIX}gcov"
+FILES_gcov-symlinks = "${bindir}/gcov"
+
+FILES_g++ = "\
+ ${bindir}/${TARGET_PREFIX}g++ \
+ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
+"
+FILES_g++-symlinks = "\
+ ${bindir}/c++ \
+ ${bindir}/g++ \
+"
+
+
+FILES_${PN}-doc = "\
+ ${infodir} \
+ ${mandir} \
+ ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
+"
+
+do_install () {
+ oe_runmake 'DESTDIR=${D}' install-host
+
+ # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
+ rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
+ rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
+ rm -rf ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/*.la
+ rmdir ${D}${includedir}
+
+ # Hack around specs file assumptions
+ test -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs && sed -i -e '/^*cross_compile:$/ { n; s/1/0/; }' ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs
+
+ # Cleanup manpages..
+ rm -rf ${D}${mandir}/man7
+
+ cd ${D}${bindir}
+
+ # We care about g++ not c++
+ rm -f *c++
+
+ # We don't care about the gcc-<version> ones for this
+ rm -f *gcc-?.?*
+
+ # We use libiberty from binutils
+ find ${D}${exec_prefix}/lib -name libiberty.a | xargs rm -f
+ find ${D}${exec_prefix}/lib -name libiberty.h | xargs rm -f
+
+ # Not sure why we end up with these but we don't want them...
+ rm -f ${TARGET_PREFIX}${TARGET_PREFIX}*
+
+ # Symlinks so we can use these trivially on the target
+ if [ -e ${TARGET_PREFIX}g77 ]; then
+ ln -sf ${TARGET_PREFIX}g77 g77 || true
+ ln -sf g77 f77 || true
+ fi
+ if [ -e ${TARGET_PREFIX}gfortran ]; then
+ ln -sf ${TARGET_PREFIX}gfortran gfortran || true
+ ln -sf gfortran f95 || true
+ fi
+ ln -sf ${TARGET_PREFIX}g++ g++
+ ln -sf ${TARGET_PREFIX}gcc gcc
+ ln -sf ${TARGET_PREFIX}cpp cpp
+ install -d ${D}${base_libdir}
+ ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp
+ ln -sf g++ c++
+ ln -sf gcc cc
+
+ chown -R root:root ${D}
+}
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc-runtime_aarch64-4.7.bb b/meta-aarch64/recipes-devtools/gcc/gcc-runtime_aarch64-4.7.bb
new file mode 100644
index 00000000..fbaf057f
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc-runtime_aarch64-4.7.bb
@@ -0,0 +1,8 @@
+require recipes-devtools/gcc/gcc-${PV}.inc
+require gcc-configure-runtime.inc
+require gcc-package-runtime.inc
+
+ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
+
+EXTRA_OECONF += "--disable-libunwind-exceptions"
+EXTRA_OECONF_append_linuxstdbase = " --enable-clocale=gnu"
diff --git a/meta-aarch64/recipes-devtools/gcc/gcc_aarch64-4.7.bb b/meta-aarch64/recipes-devtools/gcc/gcc_aarch64-4.7.bb
new file mode 100644
index 00000000..9954375e
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/gcc_aarch64-4.7.bb
@@ -0,0 +1,5 @@
+require recipes-devtools/gcc/gcc-${PV}.inc
+require gcc-configure-target.inc
+require gcc-package-target.inc
+
+ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
diff --git a/meta-aarch64/recipes-devtools/gcc/libgcc_aarch64-4.7.bb b/meta-aarch64/recipes-devtools/gcc/libgcc_aarch64-4.7.bb
new file mode 100644
index 00000000..5eaa5155
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gcc/libgcc_aarch64-4.7.bb
@@ -0,0 +1,72 @@
+require recipes-devtools/gcc/gcc-${PV}.inc
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+ ${PN}-dbg \
+ libgcov-dev \
+ "
+
+FILES_${PN} = "${base_libdir}/libgcc*.so.*"
+FILES_${PN}-dev = " \
+ ${base_libdir}/libgcc*.so \
+ ${libdir}/${TARGET_SYS}/${BINV}/*crt* \
+ ${libdir}/${TARGET_SYS}/${BINV}/libgcc*"
+FILES_libgcov-dev = " \
+ ${libdir}/${TARGET_SYS}/${BINV}/libgcov.a \
+ "
+FILES_${PN}-dbg += "${base_libdir}/.debug/"
+
+do_configure () {
+ target=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-nativesdk##`
+ install -d ${D}${base_libdir} ${D}${libdir}
+ cp -fpPR ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$target/* ${B}
+ mkdir -p ${B}/${BPN}
+ cd ${B}/${BPN}
+ chmod a+x ${S}/${BPN}/configure
+ ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
+}
+
+do_compile () {
+ target=`echo ${TARGET_SYS} | sed -e s#-nativesdk##`
+ cd ${B}/${BPN}
+ oe_runmake MULTIBUILDTOP=${B}/$target/${BPN}/
+}
+
+do_install () {
+ target=`echo ${TARGET_SYS} | sed -e s#-nativesdk##`
+ cd ${B}/${BPN}
+ oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/${BPN}/ install
+
+ # Move libgcc_s into /lib
+ mkdir -p ${D}${base_libdir}
+ if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
+ mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir}
+ else
+ mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
+ fi
+
+ # install the runtime in /usr/lib/ not in /usr/lib/gcc on target
+ # so that cross-gcc can find it in the sysroot
+
+ mv ${D}${libdir}/gcc/* ${D}${libdir}
+ rm -rf ${D}${libdir}/gcc/
+ # unwind.h is installed here which is shipped in gcc-cross
+ # as well as target gcc and they are identical so we dont
+ # ship one with libgcc here
+ rm -rf ${D}${libdir}/${TARGET_SYS}/${BINV}/include
+}
+
+do_package[depends] += "virtual/${MLPREFIX}libc:do_package"
+do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_package"
+do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_package"
+do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_package"
+
+BBCLASSEXTEND = "nativesdk"
+
+INSANE_SKIP_${PN}-dev = "staticdev"
+INSANE_SKIP_${MLPREFIX}libgcov-dev = "staticdev"
diff --git a/meta-aarch64/recipes-devtools/gdb/gdb-common.inc b/meta-aarch64/recipes-devtools/gdb/gdb-common.inc
new file mode 100644
index 00000000..74519f06
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gdb/gdb-common.inc
@@ -0,0 +1,72 @@
+DESCRIPTION = "gdb - GNU debugger"
+HOMEPAGE = "http://www.gnu.org/software/gdb/"
+LICENSE="GPLv3+"
+SECTION = "devel"
+DEPENDS = "expat ncurses readline ${LTTNGUST}"
+
+LTTNGUST = "lttng-ust"
+LTTNGUST_libc-uclibc = ""
+LTTNGUST_mips = ""
+LTTNGUST_mipsel = ""
+LTTNGUST_mips64 = ""
+LTTNGUST_mips64el = ""
+LTTNGUST_sh4 = ""
+LTTNGUST_aarch64 = ""
+
+INC_PR = "r0"
+PV = "7.5.50.20130208+git${SRCPV}"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
+ file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674 \
+ file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
+ file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6"
+
+inherit autotools
+
+SRCREV = "f17e8198bdfc430f13816aba90c1e5f6130b9424"
+
+SRC_URI = "git://sourceware.org/git/gdb.git;branch=master"
+
+S = "${WORKDIR}/git"
+
+export CC_FOR_BUILD = "${BUILD_CC}"
+export CXX_FOR_BUILD = "${BUILD_CXX}"
+export CPP_FOR_BUILD = "${BUILD_CPP}"
+export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS}"
+export CXXFLAGS_FOR_BUILD = "${BUILD_CXXFLAGS}"
+export CPPFLAGS_FOR_BUILD = "${BUILD_CPPFLAGS}"
+
+B = "${WORKDIR}/build-${TARGET_SYS}"
+
+EXTRA_OEMAKE = "'SUBDIRS=intl mmalloc libiberty opcodes bfd sim gdb etc utils'"
+
+EXPAT = "--with-expat --with-libexpat-prefix=${STAGING_DIR_HOST}"
+
+EXTRA_OECONF = "--disable-gdbtk --disable-tui --disable-x --disable-werror \
+ --with-curses --disable-multilib --with-system-readline --disable-sim \
+ ${GDBPROPREFIX} ${EXPAT} \
+ ${@base_contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)} \
+ "
+
+GDBPROPREFIX = "--program-prefix=''"
+
+do_configure () {
+ # override this function to avoid the autoconf/automake/aclocal/autoheader
+ # calls for now
+ (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
+ oe_runconf
+}
+
+# we don't want gdb to provide bfd/iberty/opcodes, which instead will override the
+# right bits installed by binutils.
+do_install_append() {
+ rm -rf ${D}${libdir}
+ rm -rf ${D}${includedir}
+ rm -rf ${D}${datadir}/locale
+}
+
+RRECOMMENDS_gdb_append_linux = " glibc-thread-db "
+RRECOMMENDS_gdb_append_linux-gnueabi = " glibc-thread-db "
+RRECOMMENDS_gdbserver_append_linux = " glibc-thread-db "
+RRECOMMENDS_gdbserver_append_linux-gnueabi = " glibc-thread-db "
+
diff --git a/meta-aarch64/recipes-devtools/gdb/gdb-cross-canadian_git.bb b/meta-aarch64/recipes-devtools/gdb/gdb-cross-canadian_git.bb
new file mode 100644
index 00000000..5b85d36b
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gdb/gdb-cross-canadian_git.bb
@@ -0,0 +1,6 @@
+require gdb-common.inc
+require recipes-devtools/gdb/gdb-cross-canadian.inc
+
+PR = "${INC_PR}.0"
+
+GDBPROPREFIX = "--program-prefix='${TARGET_PREFIX}'"
diff --git a/meta-aarch64/recipes-devtools/gdb/gdb-cross.inc b/meta-aarch64/recipes-devtools/gdb/gdb-cross.inc
new file mode 100644
index 00000000..33feb581
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gdb/gdb-cross.inc
@@ -0,0 +1,12 @@
+require gdb-common.inc
+
+DEPENDS = "expat-native ncurses-native"
+
+EXTRA_OECONF += "--without-python"
+
+#EXTRA_OEMAKE += "LDFLAGS='${BUILD_LDFLAGS}'"
+
+GDBPROPREFIX = ""
+
+inherit cross
+inherit gettext
diff --git a/meta-aarch64/recipes-devtools/gdb/gdb-cross_git.bb b/meta-aarch64/recipes-devtools/gdb/gdb-cross_git.bb
new file mode 100644
index 00000000..ceb1437a
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gdb/gdb-cross_git.bb
@@ -0,0 +1,5 @@
+require gdb-cross.inc
+
+SRC_URI += "file://sim-install-6.6.patch"
+
+PR = "${INC_PR}.0"
diff --git a/meta-aarch64/recipes-devtools/gdb/gdb.inc b/meta-aarch64/recipes-devtools/gdb/gdb.inc
new file mode 100644
index 00000000..a98ef207
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gdb/gdb.inc
@@ -0,0 +1,12 @@
+require gdb-common.inc
+
+inherit gettext
+
+SRC_URI += "file://kill_arm_map_symbols.patch \
+ "
+#LDFLAGS_append = " -s"
+#export CFLAGS_append=" -L${STAGING_LIBDIR}"
+
+# cross-canadian must not see this
+PACKAGES =+ "gdbserver"
+FILES_gdbserver = "${bindir}/gdbserver"
diff --git a/meta-aarch64/recipes-devtools/gdb/gdb/gdbserver-cflags-last.diff b/meta-aarch64/recipes-devtools/gdb/gdb/gdbserver-cflags-last.diff
new file mode 100644
index 00000000..0a79b188
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gdb/gdb/gdbserver-cflags-last.diff
@@ -0,0 +1,25 @@
+Upstream-Status: Pending
+
+Index: gdb/gdbserver/Makefile.in
+===================================================================
+--- gdb/gdbserver/Makefile.in.orig 2011-03-09 23:32:02.000000000 -0800
++++ gdb/gdbserver/Makefile.in 2011-08-05 21:16:43.592202579 -0700
+@@ -94,10 +94,10 @@
+ CFLAGS = @CFLAGS@
+
+ # INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
+-INTERNAL_CFLAGS_BASE = ${CFLAGS} ${GLOBAL_CFLAGS} \
++INTERNAL_CFLAGS_BASE = ${GLOBAL_CFLAGS} \
+ ${PROFILE_CFLAGS} ${INCLUDE_CFLAGS}
+ INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS)
+-INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS)
++INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) ${CFLAGS}
+
+ # LDFLAGS is specifically reserved for setting from the command line
+ # when running make.
+INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) ${CFLAGS}
+
+ # LDFLAGS is specifically reserved for setting from the command line
+ # when running make.
+ LDFLAGS = @LDFLAGS@
+ INTERNAL_LDFLAGS = $(LDFLAGS) @RDYNAMIC@
diff --git a/meta-aarch64/recipes-devtools/gdb/gdb/kill_arm_map_symbols.patch b/meta-aarch64/recipes-devtools/gdb/gdb/kill_arm_map_symbols.patch
new file mode 100644
index 00000000..9fc45b9f
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gdb/gdb/kill_arm_map_symbols.patch
@@ -0,0 +1,26 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+Index: gdb-7.3/gdb/arm-tdep.c
+===================================================================
+--- gdb-7.3.orig/gdb/arm-tdep.c 2011-05-17 14:27:01.000000000 -0700
++++ gdb-7.3/gdb/arm-tdep.c 2011-08-05 22:29:58.784201850 -0700
+@@ -7806,6 +7806,19 @@
+ static void
+ arm_elf_make_msymbol_special(asymbol *sym, struct minimal_symbol *msym)
+ {
++
++ /* FIXME: We want gdb to ignore the ARM ELF mapping symbols when
++ displaying disassembly so we use this horrible hack here to
++ artifically set their address to the highest possible value.
++ This is wrong of course, and it prevents the symbols from being
++ used for their intended purpose - to distinguish between ARM
++ and THUMB code. So we ought to find a better way to do this. */
++ if (bfd_asymbol_name (sym)
++ && bfd_asymbol_name (sym)[0] == '$'
++ && bfd_asymbol_name (sym)[1] != 0
++ && bfd_asymbol_name (sym)[2] == 0)
++ SYMBOL_VALUE_ADDRESS(msym) = (CORE_ADDR) 0x7ffffffc;
++
+ if (ARM_SYM_BRANCH_TYPE (&((elf_symbol_type *)sym)->internal_elf_sym)
+ == ST_BRANCH_TO_THUMB)
+ MSYMBOL_SET_SPECIAL (msym);
diff --git a/meta-aarch64/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch b/meta-aarch64/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch
new file mode 100644
index 00000000..b046f160
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch
@@ -0,0 +1,1426 @@
+Description: Add Renesas SH (sh4) support
+ Add support for Renesas SH (sh4) architecture.
+ .
+ gdb (7.4-1~cvs20111117.2) experimental; urgency=low
+ .
+ * Add Renesas SH (sh4) support (Closes: #576242)
+ - Thanks Nobuhiro Iwamatsu, Takashi Yoshii.
+Author: Hector Oron <zumbi@debian.org>
+Bug-Debian: http://bugs.debian.org/576242
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Last-Update: <2011-11-17>
+
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: gdb-7.5/gdb/configure.host
+===================================================================
+--- gdb-7.5.orig/gdb/configure.host 2012-05-30 12:41:34.000000000 -0700
++++ gdb-7.5/gdb/configure.host 2012-09-19 14:40:42.974609772 -0700
+@@ -140,6 +140,7 @@
+
+ s390*-*-*) gdb_host=s390 ;;
+
++sh*-*-linux*) gdb_host=linux ;;
+ sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
+ gdb_host=nbsd ;;
+ sh*-*-openbsd*) gdb_host=nbsd ;;
+Index: gdb-7.5/gdb/Makefile.in
+===================================================================
+--- gdb-7.5.orig/gdb/Makefile.in 2012-07-02 08:29:33.000000000 -0700
++++ gdb-7.5/gdb/Makefile.in 2012-09-19 14:40:42.974609772 -0700
+@@ -1493,6 +1493,7 @@
+ score-tdep.c \
+ ser-go32.c ser-pipe.c ser-tcp.c ser-mingw.c \
+ sh-tdep.c sh64-tdep.c shnbsd-tdep.c shnbsd-nat.c \
++ sh-linux-tdep.c sh-linux-nat.c \
+ sol2-tdep.c \
+ solib-irix.c solib-svr4.c solib-sunos.c \
+ sparc-linux-nat.c sparc-linux-tdep.c \
+Index: gdb-7.5/gdb/sh-linux-tdep.c
+===================================================================
+--- gdb-7.5.orig/gdb/sh-linux-tdep.c 2012-05-07 06:17:29.000000000 -0700
++++ gdb-7.5/gdb/sh-linux-tdep.c 2012-09-19 14:46:50.610623784 -0700
+@@ -18,14 +18,37 @@
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+ #include "defs.h"
++#include "gdbcore.h"
++#include "frame.h"
++#include "frame-base.h"
++#include "frame-unwind.h"
++#include "dwarf2-frame.h"
++#include "value.h"
++#include "regcache.h"
++#include "inferior.h"
+ #include "osabi.h"
+
++#include "reggroups.h"
++#include "arch-utils.h"
++#include "floatformat.h"
+ #include "solib-svr4.h"
+ #include "symtab.h"
++#include "gdb_string.h"
++#include "command.h"
++#include "gdb_assert.h"
+
+ #include "trad-frame.h"
+ #include "tramp-frame.h"
+
++#include <sys/ptrace.h>
++#include <sys/types.h>
++#include <sys/param.h>
++#include <sys/user.h>
++#include <sys/syscall.h>
++
++#include <asm/ptrace.h>
++
++#include "regset.h"
+ #include "glibc-tdep.h"
+ #include "sh-tdep.h"
+ #include "linux-tdep.h"
+@@ -180,9 +203,505 @@
+ sh_linux_rt_sigreturn_init
+ };
+
++/* Recognizing signal handler frames. */
++
++/* GNU/Linux has two flavors of signals. Normal signal handlers, and
++ "realtime" (RT) signals. The RT signals can provide additional
++ information to the signal handler if the SA_SIGINFO flag is set
++ when establishing a signal handler using `sigaction'. It is not
++ unlikely that future versions of GNU/Linux will support SA_SIGINFO
++ for normal signals too. */
++
++/* When the SH Linux kernel calls a signal handler and the
++ SA_RESTORER flag isn't set, the return address points to a bit of
++ code on the stack. This function returns whether the PC appears to
++ be within this bit of code.
++
++ The instruction sequence for normal signals is
++ mov.w 1f,r3
++ trapa #16
++ or r0, r0
++ or r0, r0
++ or r0, r0
++ or r0, r0
++ or r0, r0
++ 1: .word __NR_sigreturn
++ or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x0077.
++
++ Checking for the code sequence should be somewhat reliable, because
++ the effect is to call the system call sigreturn. This is unlikely
++ to occur anywhere other than a signal trampoline.
++
++ It kind of sucks that we have to read memory from the process in
++ order to identify a signal trampoline, but there doesn't seem to be
++ any other way. The PC_IN_SIGTRAMP macro in tm-linux.h arranges to
++ only call us if no function name could be identified, which should
++ be the case since the code is on the stack.
++
++ Detection of signal trampolines for handlers that set the
++ SA_RESTORER flag is in general not possible. Unfortunately this is
++ what the GNU C Library has been doing for quite some time now.
++ However, as of version 2.1.2, the GNU C Library uses signal
++ trampolines (named __restore and __restore_rt) that are identical
++ to the ones used by the kernel. Therefore, these trampolines are
++ supported too. */
++
++#define MOVW(n) (0x9300|((n)-2)) /* Move mem word at PC+n to R3 */
++#define TRAP16 0xc310 /* Syscall w/no args (NR in R3) */
++#define OR_R0_R0 0x200b /* or r0,r0 (insert to avoid hardware bug) */
++
++#define LINUX_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */
++#define LINUX_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */
++#define LINUX_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */
++
++static const unsigned short linux_sigtramp_code[] =
++{
++ LINUX_SIGTRAMP_INSN0,
++ LINUX_SIGTRAMP_INSN1,
++ LINUX_SIGTRAMP_INSN2,
++ LINUX_SIGTRAMP_INSN2,
++ LINUX_SIGTRAMP_INSN2,
++ LINUX_SIGTRAMP_INSN2,
++ LINUX_SIGTRAMP_INSN2,
++ __NR_sigreturn
++};
++
++#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
++
++/* If PC is in a sigtramp routine, return the address of the start of
++ the routine. Otherwise, return 0. */
++
++static CORE_ADDR
++sh_linux_sigtramp_start (struct frame_info *next_frame)
++{
++ CORE_ADDR pc = get_frame_pc (next_frame);
++ gdb_byte buf[LINUX_SIGTRAMP_LEN];
++
++ /* We only recognize a signal trampoline if PC is at the start of
++ one of the three instructions. We optimize for finding the PC at
++ the start, as will be the case when the trampoline is not the
++ first frame on the stack. We assume that in the case where the
++ PC is not at the start of the instruction sequence, there will be
++ a few trailing readable bytes on the stack. */
++
++ if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN))
++ return 0;
++
++ if (buf[0] != LINUX_SIGTRAMP_INSN0)
++ {
++ if (buf[0] != LINUX_SIGTRAMP_INSN1)
++ return 0;
++
++ pc -= 2;
++
++ if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN))
++ return 0;
++ }
++
++ if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0)
++ return 0;
++
++ return pc;
++}
++
++/* This function does the same for RT signals. Here the instruction
++ sequence is
++ mov.w 1f,r3
++ trapa #16
++ or r0, r0
++ or r0, r0
++ or r0, r0
++ or r0, r0
++ or r0, r0
++ 1: .word __NR_rt_sigreturn
++ or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x00ad.
++
++ The effect is to call the system call rt_sigreturn. */
++
++#define LINUX_RT_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */
++#define LINUX_RT_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */
++#define LINUX_RT_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */
++
++static const unsigned short linux_rt_sigtramp_code[] =
++{
++ LINUX_RT_SIGTRAMP_INSN0,
++ LINUX_RT_SIGTRAMP_INSN1,
++ LINUX_RT_SIGTRAMP_INSN2,
++ LINUX_RT_SIGTRAMP_INSN2,
++ LINUX_RT_SIGTRAMP_INSN2,
++ LINUX_RT_SIGTRAMP_INSN2,
++ LINUX_RT_SIGTRAMP_INSN2,
++ __NR_rt_sigreturn
++};
++
++#define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code)
++
++/* If PC is in a RT sigtramp routine, return the address of the start
++ of the routine. Otherwise, return 0. */
++
++static CORE_ADDR
++sh_linux_rt_sigtramp_start (struct frame_info *next_frame)
++{
++ CORE_ADDR pc = get_frame_pc (next_frame);
++ gdb_byte buf[LINUX_RT_SIGTRAMP_LEN];
++
++ /* We only recognize a signal trampoline if PC is at the start of
++ one of the two instructions. We optimize for finding the PC at
++ the start, as will be the case when the trampoline is not the
++ first frame on the stack. We assume that in the case where the
++ PC is not at the start of the instruction sequence, there will be
++ a few trailing readable bytes on the stack. */
++
++ if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_RT_SIGTRAMP_LEN))
++ return 0;
++
++ if (buf[0] != LINUX_RT_SIGTRAMP_INSN0)
++ {
++ if (buf[0] != LINUX_RT_SIGTRAMP_INSN1)
++ return 0;
++
++ pc -= 2;
++
++ if (!safe_frame_unwind_memory (next_frame, pc, buf,
++ LINUX_RT_SIGTRAMP_LEN))
++ return 0;
++ }
++
++ if (memcmp (buf, linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN) != 0)
++ return 0;
++
++ return pc;
++}
++
++/* Return whether PC is in a GNU/Linux sigtramp routine. */
++
++static int
++sh_linux_sigtramp_p (struct frame_info *this_frame)
++{
++ CORE_ADDR pc = get_frame_pc (this_frame);
++ char *name;
++
++ find_pc_partial_function (pc, &name, NULL, NULL);
++
++ /* If we have NAME, we can optimize the search. The trampolines are
++ named __restore and __restore_rt. However, they aren't dynamically
++ exported from the shared C library, so the trampoline may appear to
++ be part of the preceding function. This should always be sigaction,
++ __sigaction, or __libc_sigaction (all aliases to the same function). */
++ if (name == NULL || strstr (name, "sigaction") != NULL)
++ return (sh_linux_sigtramp_start (this_frame) != 0
++ || sh_linux_rt_sigtramp_start (this_frame) != 0);
++
++ return (strcmp ("__restore", name) == 0
++ || strcmp ("__restore_rt", name) == 0);
++}
++
++/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
++#define SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 12
++
++
++/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
++ routine, return the address of the associated sigcontext structure. */
++
++static CORE_ADDR
++sh_linux_sigcontext_addr (struct frame_info *this_frame)
++{
++ CORE_ADDR pc;
++ CORE_ADDR sp;
++
++ sp = get_frame_register_unsigned (this_frame, SP_REGNUM);
++
++ pc = sh_linux_sigtramp_start (this_frame);
++ if (pc)
++ {
++ return sp;
++ }
++
++ pc = sh_linux_rt_sigtramp_start (this_frame);
++ if (pc)
++ {
++ CORE_ADDR ucontext_addr;
++
++ /* The sigcontext structure is part of the user context. A
++ pointer to the user context is passed as the third argument
++ to the signal handler. */
++ ucontext_addr = get_frame_register_unsigned (this_frame, ARG0_REGNUM+2);
++ return ucontext_addr + SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
++ }
++
++ error ("Couldn't recognize signal trampoline.");
++ return 0;
++}
++
++/* Signal trampolines. */
++extern struct sh_frame_cache *sh_alloc_frame_cache (void);
++
++static struct sh_frame_cache *
++sh_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
++{
++ struct sh_frame_cache *cache;
++ struct gdbarch_tdep *tdep = gdbarch_tdep (get_current_arch ());
++ CORE_ADDR sigcontext_addr;
++
++ if (*this_cache)
++ return *this_cache;
++
++ cache = sh_alloc_frame_cache ();
++
++ cache->base = get_frame_register_unsigned (this_frame, SP_REGNUM);
++ sigcontext_addr = tdep->sigcontext_addr (this_frame);
++ if (tdep->sc_reg_offset)
++ {
++ int i;
++
++ gdb_assert (tdep->sc_num_regs <= SH_NUM_REGS);
++
++ for (i = 0; i < tdep->sc_num_regs; i++)
++ if (tdep->sc_reg_offset[i] != -1)
++ cache->saved_regs[i] = sigcontext_addr + tdep->sc_reg_offset[i];
++ }
++
++ *this_cache = cache;
++ return cache;
++}
++
++static void
++sh_linux_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache,
++ struct frame_id *this_id)
++{
++ struct sh_frame_cache *cache =
++ sh_linux_sigtramp_frame_cache (this_frame, this_cache);
++
++ (*this_id) = frame_id_build (cache->base + 64, cache->pc);
++}
++
++extern struct value * sh_frame_prev_register ();
++static struct value *
++sh_linux_sigtramp_frame_prev_register (struct frame_info *this_frame,
++ void **this_cache, int regnum)
++{
++ sh_linux_sigtramp_frame_cache (this_frame, this_cache);
++
++ return sh_frame_prev_register (this_frame, this_cache, regnum);
++}
++
++static int
++sh_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
++ struct frame_info *this_frame,
++ void **this_prologue_cache)
++{
++ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
++
++ /* We shouldn't even bother if we don't have a sigcontext_addr
++ handler. */
++ if (tdep->sigcontext_addr == NULL)
++ return 0;
++
++ if (tdep->sigtramp_p != NULL)
++ {
++ if (tdep->sigtramp_p (this_frame))
++ return 1;
++ }
++
++ return 0;
++}
++
++static const struct frame_unwind sh_linux_sigtramp_frame_unwind =
++{
++ SIGTRAMP_FRAME,
++ sh_linux_sigtramp_frame_this_id,
++ sh_linux_sigtramp_frame_prev_register,
++ NULL,
++ sh_linux_sigtramp_frame_sniffer
++};
++
++/* Supply register REGNUM from the buffer specified by GREGS and LEN
++ in the general-purpose register set REGSET to register cache
++ REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
++
++void
++sh_supply_gregset (const struct regset *regset, struct regcache *regcache,
++ int regnum, const void *gregs, size_t len)
++{
++ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
++ const char *regs = gregs;
++ int i;
++
++ gdb_assert (len == tdep->sizeof_gregset);
++
++ for (i = 0; i < tdep->gregset_num_regs; i++)
++ {
++ if ((regnum == i || regnum == -1)
++ && tdep->gregset_reg_offset[i] != -1)
++ regcache_raw_supply (regcache, i, regs + tdep->gregset_reg_offset[i]);
++ }
++}
++
++/* Collect register REGNUM from the register cache REGCACHE and store
++ it in the buffer specified by GREGS and LEN as described by the
++ general-purpose register set REGSET. If REGNUM is -1, do this for
++ all registers in REGSET. */
++
++void
++sh_collect_gregset (const struct regset *regset,
++ const struct regcache *regcache,
++ int regnum, void *gregs, size_t len)
++{
++ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
++ char *regs = gregs;
++ int i;
++
++ gdb_assert (len == tdep->sizeof_gregset);
++
++ for (i = 0; i < tdep->gregset_num_regs; i++)
++ {
++ if ((regnum == i || regnum == -1)
++ && tdep->gregset_reg_offset[i] != -1)
++ regcache_raw_collect (regcache, i, regs + tdep->gregset_reg_offset[i]);
++ }
++}
++
++/* Supply register REGNUM from the buffer specified by FPREGS and LEN
++ in the floating-point register set REGSET to register cache
++ REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
++
++static void
++sh_supply_fpregset (const struct regset *regset, struct regcache *regcache,
++ int regnum, const void *fpregs, size_t len)
++{
++ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
++ const char *regs = fpregs;
++ int i;
++
++ gdb_assert (len == tdep->sizeof_fpregset);
++ for (i = 0; i < 16; i++)
++ {
++ if (regnum == i+25 || regnum == -1)
++ regcache_raw_supply (regcache, i+25, regs + i*4);
++ }
++ if (regnum == FPSCR_REGNUM || regnum == -1)
++ regcache_raw_supply (regcache, FPSCR_REGNUM, regs + 32*4);
++ if (regnum == FPUL_REGNUM || regnum == -1)
++ regcache_raw_supply (regcache, FPUL_REGNUM, regs + 33*4);
++}
++
++/* Collect register REGNUM from the register cache REGCACHE and store
++ it in the buffer specified by FPREGS and LEN as described by the
++ floating-point register set REGSET. If REGNUM is -1, do this for
++ all registers in REGSET. */
++
++static void
++sh_collect_fpregset (const struct regset *regset,
++ const struct regcache *regcache,
++ int regnum, void *fpregs, size_t len)
++{
++ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
++ char *regs = fpregs;
++ int i;
++
++ gdb_assert (len == tdep->sizeof_fpregset);
++ for (i = 0; i < 16; i++)
++ {
++ if (regnum == i+25 || regnum == -1)
++ regcache_raw_collect (regcache, i+25, regs + i*4);
++ }
++ if (regnum == FPSCR_REGNUM || regnum == -1)
++ regcache_raw_collect (regcache, FPSCR_REGNUM, regs + 32*4);
++ if (regnum == FPUL_REGNUM || regnum == -1)
++ regcache_raw_collect (regcache, FPUL_REGNUM, regs + 33*4);
++}
++
++/* Return the appropriate register set for the core section identified
++ by SECT_NAME and SECT_SIZE. */
++
++const struct regset *
++sh_linux_regset_from_core_section (struct gdbarch *gdbarch,
++ const char *sect_name, size_t sect_size)
++{
++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++
++ if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset)
++ {
++ if (tdep->gregset == NULL)
++ tdep->gregset = regset_alloc (gdbarch, sh_supply_gregset,
++ sh_collect_gregset);
++ return tdep->gregset;
++ }
++
++ if ((strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset))
++ {
++ if (tdep->fpregset == NULL)
++ tdep->fpregset = regset_alloc (gdbarch, sh_supply_fpregset,
++ sh_collect_fpregset);
++ return tdep->fpregset;
++ }
++
++ return NULL;
++}
++
++/* The register sets used in GNU/Linux ELF core-dumps are identical to
++ the register sets in `struct user' that are used for a.out
++ core-dumps. These are also used by ptrace(2). The corresponding
++ types are `elf_gregset_t' for the general-purpose registers (with
++ `elf_greg_t' the type of a single GP register) and `elf_fpregset_t'
++ for the floating-point registers.
++
++ Those types used to be available under the names `gregset_t' and
++ `fpregset_t' too, and GDB used those names in the past. But those
++ names are now used for the register sets used in the `mcontext_t'
++ type, which have a different size and layout. */
++
++/* Mapping between the general-purpose registers in `struct user'
++ format and GDB's register cache layout. */
++
++/* From <sys/reg.h>. */
++static int sh_linux_gregset_reg_offset[] =
++{
++ 0, 4, 8, 12, 16, 20, 24, 28,
++ 32, 36, 40, 44, 48, 52, 56, 60,
++
++ REG_PC*4, REG_PR*4, REG_GBR*4, -1,
++ REG_MACH*4, REG_MACL*4, REG_SR*4,
++};
++
++/* Mapping between the general-purpose registers in `struct
++ sigcontext' format and GDB's register cache layout. */
++
++/* From <asm/sigcontext.h>. */
++static int sh_linux_sc_reg_offset[] =
++{
++ 4, 8, 12, 16, 20, 24, 28, 32,
++ 36, 40, 44, 48, 52, 56, 60, 64,
++ 68, 72, 80, -1,
++ 84, 88, 76
++};
++
+ static void
+ sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+ {
++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++ bfd abfd;
++
++ tdep->gregset_reg_offset = sh_linux_gregset_reg_offset;
++ tdep->gregset_num_regs = ARRAY_SIZE (sh_linux_gregset_reg_offset);
++ tdep->sizeof_gregset = 23 * 4;
++
++ tdep->jb_pc_offset = 32; /* From <bits/setjmp.h>. */
++
++ tdep->sigtramp_p = sh_linux_sigtramp_p;
++ tdep->sigcontext_addr = sh_linux_sigcontext_addr;
++ tdep->sc_reg_offset = sh_linux_sc_reg_offset;
++ tdep->sc_num_regs = ARRAY_SIZE (sh_linux_sc_reg_offset);
++
++ frame_unwind_append_unwinder(gdbarch, &sh_linux_sigtramp_frame_unwind);
++
++ /* If we have a register mapping, enable the generic core file
++ support, unless it has already been enabled. */
++ if (tdep->gregset_reg_offset
++ && !gdbarch_regset_from_core_section_p (gdbarch))
++ set_gdbarch_regset_from_core_section (gdbarch,
++ sh_linux_regset_from_core_section);
++
+ linux_init_abi (info, gdbarch);
+
+ /* GNU/Linux uses SVR4-style shared libraries. */
+Index: gdb-7.5/gdb/sh-tdep.h
+===================================================================
+--- gdb-7.5.orig/gdb/sh-tdep.h 2012-03-01 15:55:40.000000000 -0800
++++ gdb-7.5/gdb/sh-tdep.h 2012-09-19 14:48:32.406627602 -0700
+@@ -21,6 +21,12 @@
+
+ /* Contributed by Steve Chamberlain sac@cygnus.com. */
+
++struct frame_info;
++struct gdbarch;
++struct reggroup;
++struct regset;
++struct regcache;
++
+ /* Registers for all SH variants. Used also by sh3-rom.c. */
+ enum
+ {
+@@ -29,6 +35,7 @@
+ ARG0_REGNUM = 4,
+ ARGLAST_REGNUM = 7,
+ FP_REGNUM = 14,
++ SP_REGNUM = 15,
+ PC_REGNUM = 16,
+ PR_REGNUM = 17,
+ GBR_REGNUM = 18,
+@@ -81,6 +88,24 @@
+ FV0_REGNUM = 76,
+ FV_LAST_REGNUM = 79
+ };
++#define SH_NUM_REGS 67
++
++struct sh_frame_cache
++{
++ /* Base address. */
++ CORE_ADDR base;
++ LONGEST sp_offset;
++ CORE_ADDR pc;
++
++ /* Flag showing that a frame has been created in the prologue code. */
++ int uses_fp;
++
++ /* Saved registers. */
++ CORE_ADDR saved_regs[SH_NUM_REGS];
++ CORE_ADDR saved_sp;
++};
++
++extern struct sh_frame_cache *sh_frame_cache (struct frame_info *next_frame, void **this_cache);
+
+ /* This structure describes a register in a core-file. */
+ struct sh_corefile_regmap
+@@ -89,8 +114,32 @@
+ unsigned int offset;
+ };
+
++/* sh architecture specific information. */
+ struct gdbarch_tdep
+ {
++ /* General-purpose registers. */
++ struct regset *gregset;
++ int *gregset_reg_offset;
++ int gregset_num_regs;
++ size_t sizeof_gregset;
++
++ /* Floating-point registers. */
++ struct regset *fpregset;
++ size_t sizeof_fpregset;
++
++ /* Offset of saved PC in jmp_buf. */
++ int jb_pc_offset;
++
++ /* Detect sigtramp. */
++ int (*sigtramp_p) (struct frame_info *);
++
++ /* Get address of sigcontext for sigtramp. */
++ CORE_ADDR (*sigcontext_addr) (struct frame_info *);
++
++ /* Offset of registers in `struct sigcontext'. */
++ int *sc_reg_offset;
++ int sc_num_regs;
++
+ /* Non-NULL when debugging from a core file. Provides the offset
+ where each general-purpose register is stored inside the associated
+ core file section. */
+Index: gdb-7.5/gdb/sh-linux-nat.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.5/gdb/sh-linux-nat.c 2012-09-19 14:40:42.978609771 -0700
+@@ -0,0 +1,269 @@
++/* Low level SH interface to ptrace, for GDB when running native.
++ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
++
++This file is part of GDB.
++
++This program is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++
++#include "defs.h"
++#include "inferior.h"
++#include "gdbcore.h"
++#include "regcache.h"
++#include "linux-nat.h"
++#include "target.h"
++#include "arch-utils.h"
++
++#include "gdb_assert.h"
++#include "gdb_string.h"
++#include <sys/ptrace.h>
++#include <sys/user.h>
++#include <sys/procfs.h>
++#include <asm/ptrace.h>
++
++/* Prototypes for supply_gregset etc. */
++#include "gregset.h"
++#include "sh-tdep.h"
++
++/* Defines ps_err_e, struct ps_prochandle. */
++#include "gdb_proc_service.h"
++
++//#include <asm/elf.h>
++
++#define SH_LINUX_NUM_REGS 40
++/* This table must line up with REGISTER_NAME in "sh-tdep.c". */
++static const int regmap[] =
++{
++ /* general registers 0-15 */
++ REG_REG0 , REG_REG0+1 , REG_REG0+2 , REG_REG0+3,
++ REG_REG0+4 , REG_REG0+5 , REG_REG0+6 , REG_REG0+7,
++ REG_REG0+8 , REG_REG0+9 , REG_REG0+10, REG_REG0+11,
++ REG_REG0+12, REG_REG0+13, REG_REG0+14, REG_REG0+15,
++ /* 16 - 22 */
++ REG_PC, REG_PR, REG_GBR, -1, REG_MACH, REG_MACL, REG_SR,
++ /* 23, 24 */
++ REG_FPUL, REG_FPSCR,
++ /* floating point registers 25 - 40 */
++ REG_FPREG0 , REG_FPREG0+1 , REG_FPREG0+2 , REG_FPREG0+3 ,
++ REG_FPREG0+4 , REG_FPREG0+5 , REG_FPREG0+6 , REG_FPREG0+7 ,
++ REG_FPREG0+8 , REG_FPREG0+9 , REG_FPREG0+10, REG_FPREG0+11,
++ REG_FPREG0+12, REG_FPREG0+13, REG_FPREG0+14, REG_FPREG0+15,
++};
++
++CORE_ADDR
++register_u_addr (CORE_ADDR blockend, int regnum)
++{
++ if (regnum < 0 || regnum >= sizeof regmap/sizeof regmap[0])
++ return (CORE_ADDR)-1;
++ return (blockend + 4 * regmap[regnum]);
++}
++
++
++/* Return the address in the core dump or inferior of register REGNO.
++ BLOCKEND is the address of the end of the user structure. */
++
++CORE_ADDR
++register_addr (int regno, CORE_ADDR blockend)
++{
++ CORE_ADDR addr;
++
++ if (regno < 0 || regno >= SH_LINUX_NUM_REGS) {
++ internal_error (__FILE__, __LINE__,
++ _("Got request for bad register number %d."), regno);
++ }
++
++ REGISTER_U_ADDR (addr, blockend, regno);
++
++ return addr;
++}
++
++/* Fetch one register. */
++
++static void
++fetch_register (struct regcache *regcache, int tid, int regno)
++{
++ int val;
++
++ if (cannot_fetch_register (regno))
++ {
++ regcache_raw_supply (regcache, regno, NULL);
++ return;
++ }
++
++ errno = 0;
++ val = ptrace (PTRACE_PEEKUSER, tid, register_addr (regno, 0), 0);
++ if (errno != 0)
++ perror_with_name (_("Couldn't get registers"));
++
++ regcache_raw_supply (regcache, regno, &val);
++}
++
++/* Store one register. */
++
++static void
++store_register (struct regcache *regcache, int tid, int regno)
++{
++ int val;
++
++ if (cannot_store_register (regno))
++ return;
++
++ errno = 0;
++ regcache_raw_collect (regcache, regno, &val);
++ ptrace (PTRACE_POKEUSER, tid, register_addr (regno, 0), val);
++ if (errno != 0)
++ perror_with_name (_("Couldn't write registers"));
++}
++
++/* Transfering the general-purpose registers between GDB, inferiors
++ and core files. */
++
++/* Fill GDB's register array with the general-purpose register values
++ in *GREGSETP. */
++
++void
++supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
++{
++ elf_greg_t *regp = (elf_greg_t *) gregsetp;
++ int i;
++
++ for (i = 0; i < 23; i++)
++ if (regmap[i] == -1)
++ regcache_raw_supply (regcache, i, NULL);
++ else
++ regcache_raw_supply (regcache, i, (char *) (regp + regmap[i]));
++}
++
++/* Fill register REGNO (if it is a general-purpose register) in
++ *GREGSETPS with the value in GDB's register array. If REGNO is -1,
++ do this for all registers. */
++
++void
++fill_gregset (const struct regcache *regcache, elf_gregset_t *gregsetp, int regno)
++{
++ elf_greg_t *regp = (elf_greg_t *) gregsetp;
++ int i;
++
++ for (i = 0; i < 23; i++)
++ if (regmap[i] != -1 && (regno == -1 || regno == i))
++ regcache_raw_collect (regcache, i, (char *) (regp + regmap[i]));
++}
++
++/* Transfering floating-point registers between GDB, inferiors and cores. */
++
++/* Fill GDB's register array with the floating-point register values in
++ *FPREGSETP. */
++
++void
++supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
++{
++ int i;
++ long *regp = (long *)fpregsetp;
++
++ for (i = 0; i < 16; i++)
++ regcache_raw_supply (regcache, 25 + i, (char *) (regp + i));
++ regcache_raw_supply (regcache, FPUL_REGNUM, (char *) (regp + REG_FPUL - REG_FPREG0));
++ regcache_raw_supply (regcache, FPSCR_REGNUM, (char *) (regp + REG_FPSCR - REG_FPREG0));
++}
++
++/* Fill register REGNO (if it is a floating-point register) in
++ *FPREGSETP with the value in GDB's register array. If REGNO is -1,
++ do this for all registers. */
++
++void
++fill_fpregset (const struct regcache *regcache, elf_fpregset_t *fpregsetp, int regno)
++{
++ int i;
++ long *regp = (long *)fpregsetp;
++
++ for (i = 0; i < 16; i++)
++ if ((regno == -1) || (regno == i))
++ regcache_raw_collect (regcache, 25 + i, (char *) (regp + i));
++ if ((regno == -1) || regno == FPSCR_REGNUM)
++ regcache_raw_collect (regcache, FPSCR_REGNUM, (char *) (regp + REG_FPSCR - REG_FPREG0));
++ if ((regno == -1) || regno == FPUL_REGNUM)
++ regcache_raw_collect (regcache, FPUL_REGNUM, (char *) (regp + REG_FPUL - REG_FPREG0));
++}
++
++/* Transferring arbitrary registers between GDB and inferior. */
++
++/* Check if register REGNO in the child process is accessible.
++ If we are accessing registers directly via the U area, only the
++ general-purpose registers are available.
++ All registers should be accessible if we have GETREGS support. */
++
++int
++cannot_fetch_register (int regno)
++{
++ return (regno < 0 || regno >= sizeof regmap / sizeof regmap[0] || regmap[regno] == -1);
++}
++
++int
++cannot_store_register (int regno)
++{
++ return (regno < 0 || regno >= sizeof regmap / sizeof regmap[0] || regmap[regno] == -1);
++}
++
++/* Fetch register values from the inferior.
++ If REGNO is negative, do this for all registers.
++ Otherwise, REGNO specifies which register (so we can save time). */
++
++static void
++sh_linux_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno)
++{
++ int i;
++ int tid;
++
++ /* GNU/Linux LWP ID's are process ID's. */
++ if ((tid = TIDGET (inferior_ptid)) == 0)
++ tid = PIDGET (inferior_ptid); /* Not a threaded program. */
++
++ for (i = 0; i < SH_LINUX_NUM_REGS; i++)
++ if (regno == -1 || regno == i)
++ fetch_register (regcache, tid, i);
++}
++/* Store our register values back into the inferior.
++ If REGNO is negative, do this for all registers.
++ Otherwise, REGNO specifies which register (so we can save time). */
++
++static void
++sh_linux_store_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno)
++{
++ int i;
++ int tid;
++
++ /* GNU/Linux LWP ID's are process ID's. */
++ if ((tid = TIDGET (inferior_ptid)) == 0)
++ tid = PIDGET (inferior_ptid); /* Not a threaded program. */
++
++ for (i = 0; i < SH_LINUX_NUM_REGS; i++)
++ if (regno == -1 || regno == i)
++ store_register (regcache, tid, i);
++}
++
++void
++_initialize_sh_linux_nat (void)
++{
++ struct target_ops *t;
++
++ /* Fill in the generic GNU/Linux methods. */
++ t = linux_target ();
++
++ /* Add our register access methods. */
++ t->to_fetch_registers = sh_linux_fetch_inferior_registers;
++ t->to_store_registers = sh_linux_store_inferior_registers;
++
++ /* Register the target. */
++ linux_nat_add_target (t);
++}
+Index: gdb-7.5/gdb/sh-tdep.c
+===================================================================
+--- gdb-7.5.orig/gdb/sh-tdep.c 2012-06-08 07:24:57.000000000 -0700
++++ gdb-7.5/gdb/sh-tdep.c 2012-09-19 14:45:09.770619943 -0700
+@@ -21,6 +21,9 @@
+ sac@cygnus.com. */
+
+ #include "defs.h"
++#include "arch-utils.h"
++#include "command.h"
++#include "dummy-frame.h"
+ #include "frame.h"
+ #include "frame-base.h"
+ #include "frame-unwind.h"
+@@ -37,6 +40,7 @@
+ #include "arch-utils.h"
+ #include "floatformat.h"
+ #include "regcache.h"
++#include "regset.h"
+ #include "doublest.h"
+ #include "osabi.h"
+ #include "reggroups.h"
+@@ -69,23 +73,6 @@
+
+ static const char *sh_active_calling_convention = sh_cc_gcc;
+
+-#define SH_NUM_REGS 67
+-
+-struct sh_frame_cache
+-{
+- /* Base address. */
+- CORE_ADDR base;
+- LONGEST sp_offset;
+- CORE_ADDR pc;
+-
+- /* Flag showing that a frame has been created in the prologue code. */
+- int uses_fp;
+-
+- /* Saved registers. */
+- CORE_ADDR saved_regs[SH_NUM_REGS];
+- CORE_ADDR saved_sp;
+-};
+-
+ static int
+ sh_is_renesas_calling_convention (struct type *func_type)
+ {
+@@ -1045,7 +1032,7 @@
+ return 0;
+ /* Otherwise if the type of that member is float, the whole type is
+ treated as float. */
+- if (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_FLT)
++ if (TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, 0))) == TYPE_CODE_FLT)
+ return 1;
+ /* Otherwise it's not treated as float. */
+ return 0;
+@@ -1095,7 +1082,7 @@
+ in four registers available. Loop thru args from first to last. */
+ for (argnum = 0; argnum < nargs; argnum++)
+ {
+- type = value_type (args[argnum]);
++ type = check_typedef (value_type (args[argnum]));
+ len = TYPE_LENGTH (type);
+ val = sh_justify_value_in_reg (gdbarch, args[argnum], len);
+
+@@ -1809,7 +1796,7 @@
+ reg->how = DWARF2_FRAME_REG_UNDEFINED;
+ }
+
+-static struct sh_frame_cache *
++struct sh_frame_cache *
+ sh_alloc_frame_cache (void)
+ {
+ struct sh_frame_cache *cache;
+@@ -1836,7 +1823,7 @@
+ return cache;
+ }
+
+-static struct sh_frame_cache *
++struct sh_frame_cache *
+ sh_frame_cache (struct frame_info *this_frame, void **this_cache)
+ {
+ struct gdbarch *gdbarch = get_frame_arch (this_frame);
+@@ -1903,9 +1890,9 @@
+ return cache;
+ }
+
+-static struct value *
+-sh_frame_prev_register (struct frame_info *this_frame,
+- void **this_cache, int regnum)
++struct value *
++sh_frame_prev_register (struct frame_info *this_frame, void **this_cache,
++ int regnum)
+ {
+ struct gdbarch *gdbarch = get_frame_arch (this_frame);
+ struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache);
+@@ -1919,7 +1906,7 @@
+ the current frame. Frob regnum so that we pull the value from
+ the correct place. */
+ if (regnum == gdbarch_pc_regnum (gdbarch))
+- regnum = PR_REGNUM;
++ regnum = PR_REGNUM; /* XXX: really? */
+
+ if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1)
+ return frame_unwind_got_memory (this_frame, regnum,
+@@ -2225,8 +2212,8 @@
+ static struct gdbarch *
+ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
+ {
+- struct gdbarch *gdbarch;
+ struct gdbarch_tdep *tdep;
++ struct gdbarch *gdbarch;
+
+ /* SH5 is handled entirely in sh64-tdep.c. */
+ if (info.bfd_arch_info->mach == bfd_mach_sh5)
+@@ -2242,6 +2229,18 @@
+ tdep = XZALLOC (struct gdbarch_tdep);
+ gdbarch = gdbarch_alloc (&info, tdep);
+
++ /* General-purpose registers. */
++ tdep->gregset = NULL;
++ tdep->gregset_reg_offset = NULL;
++ tdep->gregset_num_regs = 23;
++ tdep->sizeof_gregset = 0;
++
++ /* Floating-point registers. */
++ tdep->fpregset = NULL;
++ tdep->sizeof_fpregset = 34*4;
++
++ tdep->jb_pc_offset = -1;
++
+ set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
+ set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
+ set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
+@@ -2389,10 +2388,11 @@
+ break;
+ }
+
++ dwarf2_append_unwinders (gdbarch);
++
+ /* Hook in ABI-specific overrides, if they have been registered. */
+ gdbarch_init_osabi (info, gdbarch);
+
+- dwarf2_append_unwinders (gdbarch);
+ frame_unwind_append_unwinder (gdbarch, &sh_stub_unwind);
+ frame_unwind_append_unwinder (gdbarch, &sh_frame_unwind);
+
+Index: gdb-7.5/gdb/testsuite/gdb.asm/sh-linux.inc
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.5/gdb/testsuite/gdb.asm/sh-linux.inc 2012-09-19 14:40:42.978609771 -0700
+@@ -0,0 +1,78 @@
++# You'll find a bunch of nop opcodes in the below macros. They are
++# there to keep the code correctly aligned. Be careful to maintain
++# them when changing the code.
++
++ comment "subroutine declare"
++ .purgem gdbasm_declare
++ .macro gdbasm_declare name
++ .align 1
++ .global \name
++\name:
++ .endm
++
++ comment "subroutine prologue"
++ .macro gdbasm_enter
++ mov.l r14,@-r15
++ sts.l pr,@-r15
++ mov r15,r14
++ nop
++ .endm
++
++ comment "subroutine epilogue"
++ .macro gdbasm_leave
++ mov r14,r15
++ lds.l @r15+,pr
++ mov.l @r15+,r14
++ rts
++ nop
++ nop
++ .endm
++
++ comment "subroutine end"
++ .purgem gdbasm_end
++ .macro gdbasm_end name
++ .size \name, .-_foo1
++ .align 1
++ .endm
++
++ comment "subroutine call"
++ .macro gdbasm_call subr
++ mov.l .Lconst\@,r1
++ bra .Lafterconst\@
++ nop
++ .align 2
++.Lconst\@:
++ .long \subr
++.Lafterconst\@:
++ jsr @r1
++ nop
++ .endm
++
++ .macro gdbasm_several_nops
++ nop
++ nop
++ nop
++ nop
++ .endm
++
++ comment "exit (0)"
++ .macro gdbasm_exit0
++ sleep
++ nop
++ .endm
++
++ comment "crt0 startup"
++ .macro gdbasm_startup
++ mov #0,r14
++ .endm
++
++ comment "Declare a data variable"
++ .purgem gdbasm_datavar
++ .macro gdbasm_datavar name value
++ .data
++ .align 2
++ .type \name, @object
++ .size \name, 4
++\name:
++ .long \value
++ .endm
+Index: gdb-7.5/gdb/testsuite/gdb.asm/sh.inc
+===================================================================
+--- gdb-7.5.orig/gdb/testsuite/gdb.asm/sh.inc 2012-04-16 01:02:09.000000000 -0700
++++ gdb-7.5/gdb/testsuite/gdb.asm/sh.inc 2012-09-19 14:40:42.978609771 -0700
+@@ -40,9 +40,8 @@
+ mov.l .Lconst\@,r1
+ bra .Lafterconst\@
+ nop
+- nop
+-.Lconst\@:
+ .align 2
++.Lconst\@:
+ .long \subr
+ .align 1
+ .Lafterconst\@:
+Index: gdb-7.5/gdb/testsuite/gdb.asm/asm-source.exp
+===================================================================
+--- gdb-7.5.orig/gdb/testsuite/gdb.asm/asm-source.exp 2012-06-25 13:11:43.000000000 -0700
++++ gdb-7.5/gdb/testsuite/gdb.asm/asm-source.exp 2012-09-19 14:40:42.978609771 -0700
+@@ -108,6 +108,11 @@
+ append link-flags " -m elf32ppc"
+ }
+ }
++ "sh*-linux*" {
++ set asm-arch sh-linux
++ set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}"
++ set debug-flags "-gdwarf-2"
++ }
+ "sh*-*-*" {
+ set asm-arch sh
+ set debug-flags "-gdwarf-2"
+Index: gdb-7.5/gdb/testsuite/gdb.base/sigall.c
+===================================================================
+--- gdb-7.5.orig/gdb/testsuite/gdb.base/sigall.c 2012-02-28 02:24:15.000000000 -0800
++++ gdb-7.5/gdb/testsuite/gdb.base/sigall.c 2012-09-19 14:42:02.202612808 -0700
+@@ -5,6 +5,10 @@
+ /* Signal handlers, we set breakpoints in them to make sure that the
+ signals really get delivered. */
+
++#ifdef __sh__
++#define signal(a,b) /* Signals not supported on this target - make them go away */
++#endif
++
+ #ifdef PROTOTYPES
+ void
+ handle_ABRT (int sig)
+Index: gdb-7.5/gdb/testsuite/gdb.base/signals.c
+===================================================================
+--- gdb-7.5.orig/gdb/testsuite/gdb.base/signals.c 2012-02-28 02:24:15.000000000 -0800
++++ gdb-7.5/gdb/testsuite/gdb.base/signals.c 2012-09-19 14:43:22.034615831 -0700
+@@ -3,6 +3,10 @@
+ #include <signal.h>
+ #include <unistd.h>
+
++#ifdef __sh__
++#define signal(a,b) /* Signals not supported on this target - make them go away */
++#define alarm(a) /* Ditto for alarm() */
++#endif
+
+ static int count = 0;
+
+Index: gdb-7.5/gdb/testsuite/gdb.base/annota1.c
+===================================================================
+--- gdb-7.5.orig/gdb/testsuite/gdb.base/annota1.c 2012-02-28 14:40:48.000000000 -0800
++++ gdb-7.5/gdb/testsuite/gdb.base/annota1.c 2012-09-19 14:42:42.074614308 -0700
+@@ -1,6 +1,9 @@
+ #include <stdio.h>
+ #include <signal.h>
+
++#ifdef __sh__
++#define signal(a,b) /* Signals not supported on this target - make them go away */
++#endif
+
+ #ifdef PROTOTYPES
+ void
+Index: gdb-7.5/gdb/testsuite/gdb.base/annota3.c
+===================================================================
+--- gdb-7.5.orig/gdb/testsuite/gdb.base/annota3.c 2012-02-28 14:40:48.000000000 -0800
++++ gdb-7.5/gdb/testsuite/gdb.base/annota3.c 2012-09-19 14:43:54.410617081 -0700
+@@ -1,6 +1,10 @@
+ #include <stdio.h>
+ #include <signal.h>
+
++#ifdef __sh__
++#define signal(a,b) /* Signals not supported on this target - make them go away */
++#endif
++
+
+ #ifdef PROTOTYPES
+ void
+Index: gdb-7.5/gdb/config/sh/xm-linux.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.5/gdb/config/sh/xm-linux.h 2012-09-19 14:40:42.994609807 -0700
+@@ -0,0 +1,32 @@
++/* Native support for GNU/Linux, for GDB, the GNU debugger.
++ Copyright (C) 2000 Free Software Foundation, Inc.
++
++This file is part of GDB.
++
++This program is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++
++#ifndef XM_LINUX_H
++#define XM_LINUX_H
++
++#define HOST_BYTE_ORDER LITTLE_ENDIAN
++
++#define HAVE_TERMIOS
++
++#define NEED_POSIX_SETPGID
++
++/* Need R_OK etc, but USG isn't defined. */
++#include <unistd.h>
++
++#endif /* #ifndef XM_LINUX_H */
+Index: gdb-7.5/gdb/config/sh/nm-linux.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.5/gdb/config/sh/nm-linux.h 2012-09-19 14:40:42.994609807 -0700
+@@ -0,0 +1,54 @@
++/* Native-dependent definitions for SuperH running Linux, for GDB.
++ Copyright 2004 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330,
++ Boston, MA 02111-1307, USA. */
++
++#ifndef NM_LINUX_H
++#define NM_LINUX_H
++
++/* Get generic Linux native definitions. */
++#include "config/nm-linux.h"
++/* Support for the user area. */
++
++/* Return the size of the user struct. */
++extern int kernel_u_size (void);
++#define KERNEL_U_SIZE kernel_u_size()
++
++/* This is the amount to substract from u.u_ar0 to get the offset in
++ the core file of the register values. */
++#define KERNEL_U_ADDR 0
++
++#define U_REGS_OFFSET 0
++
++extern CORE_ADDR register_u_addr (CORE_ADDR blockend, int regnum);
++#define REGISTER_U_ADDR(addr, blockend, regnum) \
++ (addr) = register_u_addr (blockend, regnum)
++
++/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
++#define FETCH_INFERIOR_REGISTERS
++
++/* Nevertheless, define CANNOT_{FETCH,STORE}_REGISTER, because we
++ might fall back on the code `infptrace.c' (well a copy of that code
++ in `sh-linux-nat.c' for now) and we can access only the
++ general-purpose registers in that way. */
++extern int cannot_fetch_register (int regno);
++extern int cannot_store_register (int regno);
++#define CANNOT_FETCH_REGISTER(regno) cannot_fetch_register (regno)
++#define CANNOT_STORE_REGISTER(regno) cannot_store_register (regno)
++
++#endif /* NM_LINUX_H */
+Index: gdb-7.5/gdb/config/sh/linux.mh
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.5/gdb/config/sh/linux.mh 2012-09-19 14:40:42.994609807 -0700
+@@ -0,0 +1,8 @@
++# Host: Renesas Super-H running GNU/Linux
++NAT_FILE= config/sh/nm-linux.h
++NATDEPFILES= inf-ptrace.o fork-child.o corelow.o sh-linux-nat.o \
++ proc-service.o linux-thread-db.o gcore.o \
++ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
++
++NAT_CDEPS = $(srcdir)/proc-service.list
++LOADLIBES= -ldl $(RDYNAMIC)
+@ -1,8 +1,12 @@
+ #include <stdio.h>
+ #include <signal.h>
+
++#ifdef __sh__
++#define signal(a,b) /* Signals not supported on this target - make them go away */
++#endif
++
+
+ #ifdef PROTOTYPES
+ void
+ handle_USR1 (int sig)
+ {
+--- gdb-7.5.1.orig/gdb/testsuite/gdb.base/sigall.c
++++ gdb-7.5.1/gdb/testsuite/gdb.base/sigall.c
+@@ -3,10 +3,14 @@
+
+
+ /* Signal handlers, we set breakpoints in them to make sure that the
+ signals really get delivered. */
+
++#ifdef __sh__
++#define signal(a,b) /* Signals not supported on this target - make them go away */
++#endif
++
+ #ifdef PROTOTYPES
+ void
+ handle_ABRT (int sig)
+ #else
+ void
+--- gdb-7.5.1.orig/gdb/testsuite/gdb.base/signals.c
++++ gdb-7.5.1/gdb/testsuite/gdb.base/signals.c
+@@ -1,10 +1,14 @@
+ /* Test GDB dealing with stuff like stepping into sigtramp. */
+
+ #include <signal.h>
+ #include <unistd.h>
+
++#ifdef __sh__
++#define signal(a,b) /* Signals not supported on this target - make them go away */
++#define alarm(a) /* Ditto for alarm() */
++#endif
+
+ static int count = 0;
+
+ #ifdef PROTOTYPES
+ static void
diff --git a/meta-aarch64/recipes-devtools/gdb/gdb/sim-install-6.6.patch b/meta-aarch64/recipes-devtools/gdb/gdb/sim-install-6.6.patch
new file mode 100644
index 00000000..2ccf5264
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gdb/gdb/sim-install-6.6.patch
@@ -0,0 +1,21 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+--- gdb-6.1/sim/common/Makefile.in~ 2004-01-15 21:25:06.000000000 +0000
++++ gdb-6.1/sim/common/Makefile.in 2004-07-22 17:07:46.237809032 +0100
+@@ -34,7 +34,7 @@
+
+ datadir = @datadir@
+ mandir = @mandir@
+-man1dir = $(mandir)/man1
++man1dir = $(DESTDIR)$(mandir)/man1
+ infodir = @infodir@
+ includedir = @includedir@
+
+
+dir = $(mandir)/man1
++man1dir = $(DESTDIR)$(mandir)/man1
+ infodir = @infodir@
+ includedir = @includedir@
+
+ SHELL = /bin/sh
+
diff --git a/meta-aarch64/recipes-devtools/gdb/gdb_git.bb b/meta-aarch64/recipes-devtools/gdb/gdb_git.bb
new file mode 100644
index 00000000..bb5a2489
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/gdb/gdb_git.bb
@@ -0,0 +1,7 @@
+require gdb.inc
+LICENSE="GPLv2 & GPLv3 & LGPLv2 & LGPLv3"
+LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
+ file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
+ file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
+ file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674"
+PR = "${INC_PR}.0"
diff --git a/meta-aarch64/recipes-devtools/php/.php.inc.swp b/meta-aarch64/recipes-devtools/php/.php.inc.swp
new file mode 100644
index 00000000..b21a92cc
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/.php.inc.swp
Binary files differ
diff --git a/meta-aarch64/recipes-devtools/php/php.inc b/meta-aarch64/recipes-devtools/php/php.inc
new file mode 100644
index 00000000..b01aee24
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/php.inc
@@ -0,0 +1,127 @@
+DESCRIPTION = "A server-side, HTML-embedded scripting language. This package provides the CGI."
+HOMEPAGE = "http://www.php.net"
+SECTION = "console/network"
+LICENSE = "PHP-3.0"
+BBCLASSEXTEND = "native"
+DEPENDS = "zlib libxml2 virtual/libiconv php-native lemon-native mysql5 \
+ libc-client openssl sqlite3"
+DEPENDS_virtclass-native = "zlib-native libxml2-native"
+
+INC_PR = "r5"
+
+SRC_URI = "http://www.php.net/distributions/php-${PV}.tar.bz2"
+
+S = "${WORKDIR}/php-${PV}"
+
+inherit autotools pkgconfig pythonnative gettext
+
+SSTATE_SCAN_FILES += "build-defs.h"
+
+# Common EXTRA_OECONF
+COMMON_EXTRA_OECONF = "--enable-sockets --enable-pcntl --enable-shared"
+EXTRA_OECONF = "--enable-mbstring --enable-discard-path --enable-wddx \
+ --enable-magic-quotes --enable-fastcgi --enable-fpm \
+ --with-imap=${STAGING_DIR_HOST} \
+ --with-gettext=${STAGING_LIBDIR}/.. \
+ --with-imap-ssl=${STAGING_DIR_HOST} \
+ --with-zlib --with-zlib-dir=${STAGING_LIBDIR}/.. \
+ --with-iconv=${STAGING_LIBDIR}/.. \
+ --with-libxml-dir=${STAGING_BINDIR_CROSS} \
+ --disable-embedded-mysqli \
+ --with-mysql="${STAGING_DIR_TARGET}${prefix}" \
+ --with-mysqli="${STAGING_BINDIR_CROSS}/mysql_config" \
+ --with-sqlite3=${STAGING_LIBDIR}/.. --enable-sqlite-utf8 \
+ --with-pdo-mysql="${STAGING_BINDIR_CROSS}/mysql_config" \
+ --with-pdo-sqlite=${STAGING_LIBDIR}/.. ${COMMON_EXTRA_OECONF} \
+ "
+EXTRA_OECONF_virtclass-native = "--with-cgi --without-libpng --without-libjpeg \
+ --with-zlib --with-zlib-dir=${STAGING_LIBDIR_NATIVE}/.. \
+ --with-libxml-dir=${STAGING_BINDIR_NATIVE} \
+ ${COMMON_EXTRA_OECONF} \
+ "
+
+LIBS_virtclass-native = " -lxml2 "
+LIBS_pn-php =" -lpthread "
+export LIBS
+THREADS_pn-php = "pthread"
+export THREADS
+export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}"
+export PHP_PEAR_PHP_BIN = "${STAGING_BINDIR_NATIVE}/php"
+CFLAGS += " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -D_GNU_SOURCE"
+
+acpaths = ""
+
+do_install () {
+ oe_runmake 'INSTALL_ROOT=${D}' install
+}
+
+do_install_append_pn-php-native() {
+ rm -rf ${D}/${libdir}/php/.registry
+ rm -rf ${D}/${libdir}/php/.channels
+ rm -rf ${D}/${libdir}/php/.[a-z]*
+}
+
+# fixme
+do_install_append_pn-php() {
+ install -d ${D}/${sysconfdir}/
+
+ if [ -d ${D}/${STAGING_DIR_NATIVE}/${sysconfdir} ];then
+ mv ${D}/${STAGING_DIR_NATIVE}/${sysconfdir}/* ${D}/${sysconfdir}/
+ fi
+ rm -rf ${D}/${TMPDIR}
+ rm -rf ${D}/.registry
+ rm -rf ${D}/.channels
+ rm -rf ${D}/.[a-z]*
+ rm -rf ${D}/var
+ rm -f ${D}/${sysconfdir}/php-fpm.conf.default
+ sed -i 's:${STAGING_DIR_NATIVE}::g' ${D}/${sysconfdir}/pear.conf
+ install -m 0644 ${WORKDIR}/php-fpm.conf ${D}/${sysconfdir}/php-fpm.conf
+ install -d ${D}/${sysconfdir}/apache2/conf.d
+ install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf
+ install -d ${D}${sysconfdir}/init.d
+ sed -i 's:=/usr/sbin:=${sbindir}:g' ${S}/sapi/fpm/init.d.php-fpm
+ sed -i 's:=/etc:=${sysconfdir}:g' ${S}/sapi/fpm/init.d.php-fpm
+ sed -i 's:=/var:=${localstatedir}:g' ${S}/sapi/fpm/init.d.php-fpm
+ install -m 0755 ${S}/sapi/fpm/init.d.php-fpm ${D}${sysconfdir}/init.d/php-fpm
+ TMP=`dirname ${D}/${TMPDIR}`
+ while test ${TMP} != ${D}; do
+ rmdir ${TMP}
+ TMP=`dirname ${TMP}`;
+ done
+}
+
+PACKAGES = "${PN}-dbg ${PN}-cli ${PN}-cgi ${PN}-fpm ${PN}-fpm-apache2 ${PN}-pear ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}"
+
+RDEPENDS_${PN}-pear = "${PN}"
+RDEPENDS_${PN}-cli = "${PN}"
+RDEPENDS_${PN}-dev = "${PN}"
+
+INITSCRIPT_PACKAGES = "${PN}-fpm"
+inherit update-rc.d
+
+FILES_${PN}-dbg =+ "${bindir}/.debug"
+FILES_${PN}-doc += "${libdir}/php/doc"
+FILES_${PN}-cli = "${bindir}/php"
+FILES_${PN}-cgi = "${bindir}/php-cgi"
+FILES_${PN}-fpm = "${sbindir}/php-fpm ${sysconfdir}/php-fpm.conf ${datadir}/fpm ${sysconfdir}/init.d/php-fpm"
+FILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf"
+CONFFILES_${PN}-fpm = "${sysconfdir}/php-fpm.conf"
+CONFFILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf"
+INITSCRIPT_NAME_${PN}-fpm = "php-fpm"
+INITSCRIPT_PARAMS_${PN}-fpm = "defaults 60"
+FILES_${PN}-pear = "${bindir}/pear* ${bindir}/pecl ${libdir}/php/PEAR \
+ ${libdir}/php/PEAR.php ${libdir}/php/System.php \
+ ${libdir}php/peclcmd.php ${libdir}/php/pearcmd.php \
+ ${libdir}/php/.channels ${libdir}/php/.channels/.alias \
+ ${libdir}/php/.channels\__uri.reg \
+ ${libdir}/php/.channels\pear.php.net.reg \
+ ${libdir}/php/.channels/pecl.php.net.reg \
+ ${libdir}/php/.registry ${libdir}/php/Archive/Tar.php \
+ ${libdir}/php/Console/Getopt.php ${libdir}/php/OS/Guess.php \
+ ${sysconfdir}/pear.conf"
+FILES_${PN}-dev = "${includedir}/php ${libdir}/build ${bindir}/phpize \
+ ${bindir}/php-config ${libdir}/php/.depdb \
+ ${libdir}/php/.depdblock ${libdir}/php/.filemap \
+ ${libdir}/php/.lock ${libdir}/php/test"
+FILES_${PN} = "${libdir}/php"
+FILES_${PN} += "${bindir}"
diff --git a/meta-aarch64/recipes-devtools/php/php/0001-php-don-t-use-broken-wrapper-for-mkdir.patch b/meta-aarch64/recipes-devtools/php/php/0001-php-don-t-use-broken-wrapper-for-mkdir.patch
new file mode 100644
index 00000000..9b71e9d2
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/php/0001-php-don-t-use-broken-wrapper-for-mkdir.patch
@@ -0,0 +1,26 @@
+From 411ec4b31fdcc524f13fe5be80fd6769b7d16a5d Mon Sep 17 00:00:00 2001
+From: Koen Kooi <koen@dominion.thruhere.net>
+Date: Thu, 3 Nov 2011 14:27:15 +0100
+Subject: [PATCH] php: don't use broken wrapper for mkdir
+
+Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
+---
+
+Upstream-Status: Inappropriate
+
+ Makefile.global | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/Makefile.global b/Makefile.global
+index 8dad0e4..abdb5d2 100644
+--- a/Makefile.global
++++ b/Makefile.global
+@@ -1,4 +1,4 @@
+-mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
++mkinstalldirs = mkdir -p
+ INSTALL = $(top_srcdir)/build/shtool install -c
+ INSTALL_DATA = $(INSTALL) -m 644
+
+--
+1.7.2.5
+
diff --git a/meta-aarch64/recipes-devtools/php/php/acinclude-xml2-config.patch b/meta-aarch64/recipes-devtools/php/php/acinclude-xml2-config.patch
new file mode 100644
index 00000000..bf519d29
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/php/acinclude-xml2-config.patch
@@ -0,0 +1,18 @@
+--- /orig-acinclude.m4 2007-02-20 15:03:25.000000000 +0200
++++ /acinclude.m4 2007-02-20 15:03:24.000000000 +0200
+@@ -2359,12 +2359,9 @@
+ AC_DEFUN([PHP_SETUP_LIBXML], [
+ AC_CACHE_CHECK([for xml2-config path], ac_cv_php_xml2_config_path,
+ [
+- for i in $PHP_LIBXML_DIR /usr/local /usr; do
+- if test -x "$i/bin/xml2-config"; then
+- ac_cv_php_xml2_config_path="$i/bin/xml2-config"
+- break
+- fi
+- done
++
++ ac_cv_php_xml2_config_path="$PHP_LIBXML_DIR/xml2-config"
++
+ ])
+
+ if test -x "$ac_cv_php_xml2_config_path"; then
diff --git a/meta-aarch64/recipes-devtools/php/php/fix-fpm-cross-compile.patch b/meta-aarch64/recipes-devtools/php/php/fix-fpm-cross-compile.patch
new file mode 100644
index 00000000..b009347a
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/php/fix-fpm-cross-compile.patch
@@ -0,0 +1,38 @@
+From 0b44f16ea2f18a08eb1249db6621840527eab5e0 Mon Sep 17 00:00:00 2001
+From: Jerome Loyet <fat@php.net>
+Date: Wed, 23 May 2012 11:40:22 +0200
+Subject: [PATCH] - Fixed bug #61839 (Unable to cross-compile PHP with
+ --enable-fpm)
+
+---
+Upstream-Status: Applied
+http://git.php.net/?p=php-src.git;a=commit;h=0b44f16ea2f18a08eb1249db6621840527eab5e0
+
+ NEWS | 1 +
+ sapi/fpm/config.m4 | 4 ++++
+ 2 files changed, 5 insertions(+)
+
+diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4
+index 8962810..6c860c9 100644
+--- a/sapi/fpm/config.m4
++++ b/sapi/fpm/config.m4
+@@ -192,6 +192,8 @@ AC_DEFUN([AC_FPM_TRACE],
+ have_ptrace=no
+ have_broken_ptrace=yes
+ AC_MSG_RESULT([no])
++ ], [
++ AC_MSG_RESULT([skipped (cross compiling)])
+ ])
+ fi
+
+@@ -264,6 +266,8 @@ AC_DEFUN([AC_FPM_TRACE],
+ ], [
+ proc_mem_file=""
+ AC_MSG_RESULT([no])
++ ], [
++ AC_MSG_RESULT([skipped (cross compiling)])
+ ])
+ fi
+
+--
+1.7.11.5
diff --git a/meta-aarch64/recipes-devtools/php/php/iconv.patch b/meta-aarch64/recipes-devtools/php/php/iconv.patch
new file mode 100644
index 00000000..f3d2a16b
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/php/iconv.patch
@@ -0,0 +1,27 @@
+diff --git a/acinclude.m4 b/acinclude.m4
+index 4c28b80..d6491a1 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -2439,7 +2439,8 @@ AC_DEFUN([PHP_SETUP_ICONV], [
+ dnl Check libc first if no path is provided in --with-iconv
+ dnl
+
+- if test "$PHP_ICONV" = "yes"; then
++ dnl must check against no, not against yes as PHP_ICONV can also include a path, which implies yes
++ if test "$PHP_ICONV" != "no"; then
+ dnl Reset LIBS temporarily as it may have already been included
+ dnl -liconv in.
+ LIBS_save="$LIBS"
+diff --git a/ext/iconv/config.m4 b/ext/iconv/config.m4
+index d673b0a..1fbef13 100644
+--- a/ext/iconv/config.m4
++++ b/ext/iconv/config.m4
+@@ -15,7 +15,7 @@ if test "$PHP_ICONV" != "no"; then
+
+ if test "$iconv_avail" != "no"; then
+ if test -z "$ICONV_DIR"; then
+- for i in /usr/local /usr; do
++ for i in $PHP_ICONV /usr/local /usr; do
+ if test -f "$i/include/iconv.h" || test -f "$i/include/giconv.h"; then
+ PHP_ICONV_PREFIX="$i"
+ break
diff --git a/meta-aarch64/recipes-devtools/php/php/imap-fix-autofoo.patch b/meta-aarch64/recipes-devtools/php/php/imap-fix-autofoo.patch
new file mode 100644
index 00000000..3695b7bc
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/php/imap-fix-autofoo.patch
@@ -0,0 +1,41 @@
+Index: php-5.2.11/ext/imap/config.m4
+===================================================================
+--- php-5.2.11.orig/ext/imap/config.m4 2009-12-10 12:27:52.800974533 -0700
++++ php-5.2.11/ext/imap/config.m4 2009-12-10 12:28:33.720976583 -0700
+@@ -103,7 +103,7 @@
+ PHP_NEW_EXTENSION(imap, php_imap.c, $ext_shared)
+ AC_DEFINE(HAVE_IMAP,1,[ ])
+
+- for i in $PHP_IMAP /usr/local /usr; do
++ for i in $PHP_IMAP $PHP_IMAP/usr /usr/local /usr; do
+ IMAP_INC_CHK()
+ el[]IMAP_INC_CHK(/include/c-client)
+ el[]IMAP_INC_CHK(/include/imap)
+@@ -192,13 +192,7 @@
+ AC_MSG_ERROR(Cannot find rfc822.h. Please check your c-client installation.)
+ fi
+
+- if test -r "$IMAP_DIR/c-client/c-client.a"; then
+- ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1
+- elif test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
+- ln -s "$IMAP_DIR/$PHP_LIBDIR/c-client.a" "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" >/dev/null 2>&1
+- fi
+-
+- for lib in c-client4 c-client imap; do
++ for lib in /usr/lib c-client4 c-client imap; do
+ IMAP_LIB=$lib
+ IMAP_LIB_CHK($PHP_LIBDIR)
+ IMAP_LIB_CHK(c-client)
+Index: php-5.2.11/acinclude.m4
+===================================================================
+--- php-5.2.11.orig/acinclude.m4 2009-12-10 12:37:13.134722881 -0700
++++ php-5.2.11/acinclude.m4 2009-12-10 12:37:39.342007053 -0700
+@@ -2338,7 +2338,7 @@
+ PHP_OPENSSL_DIR="/usr/local/ssl /usr/local /usr /usr/local/openssl"
+ fi
+
+- for i in $PHP_OPENSSL_DIR; do
++ for i in $PHP_OPENSSL_DIR $PHP_OPENSSL_DIR/usr; do
+ if test -r $i/include/openssl/evp.h; then
+ OPENSSL_INCDIR=$i/include
+ fi
diff --git a/meta-aarch64/recipes-devtools/php/php/pear-makefile.patch b/meta-aarch64/recipes-devtools/php/php/pear-makefile.patch
new file mode 100644
index 00000000..1928b989
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/php/pear-makefile.patch
@@ -0,0 +1,13 @@
+diff --git a/pear/Makefile.frag b/pear/Makefile.frag
+index 1f6f70e..b19a77c 100644
+--- a/pear/Makefile.frag
++++ b/pear/Makefile.frag
+@@ -11,7 +11,7 @@ PEAR_PREFIX = -dp a${program_prefix}
+ PEAR_SUFFIX = -ds a$(program_suffix)
+
+ install-pear-installer: $(SAPI_CLI_PATH)
+- @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) pear/install-pear-nozlib.phar -d "$(peardir)" -b "$(bindir)" ${PEAR_PREFIX} ${PEAR_SUFFIX}
++ @$(PHP_NATIVE_DIR)/php $(PEAR_INSTALL_FLAGS) $(builddir)/install-pear-nozlib.phar -d "$(peardir)" -b "$(bindir)" ${PEAR_PREFIX} ${PEAR_SUFFIX}
+
+ install-pear:
+ @echo "Installing PEAR environment: $(INSTALL_ROOT)$(peardir)/"
diff --git a/meta-aarch64/recipes-devtools/php/php/phar-makefile.patch b/meta-aarch64/recipes-devtools/php/php/phar-makefile.patch
new file mode 100644
index 00000000..6fde2512
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/php/phar-makefile.patch
@@ -0,0 +1,26 @@
+diff --git a/ext/phar/Makefile.frag b/ext/phar/Makefile.frag
+index fc93d1d..9a8cd65 100755
+--- a/ext/phar/Makefile.frag
++++ b/ext/phar/Makefile.frag
+@@ -6,19 +6,8 @@ pharcmd: $(builddir)/phar.php $(builddir)/phar.phar
+
+ PHP_PHARCMD_SETTINGS = -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' -d phar.readonly=0 -d 'safe_mode=0'
+ PHP_PHARCMD_EXECUTABLE = ` \
+- if test -x "$(top_builddir)/$(SAPI_CLI_PATH)"; then \
+- $(top_srcdir)/build/shtool echo -n -- "$(top_builddir)/$(SAPI_CLI_PATH) -n"; \
+- if test "x$(PHP_MODULES)" != "x"; then \
+- $(top_srcdir)/build/shtool echo -n -- " -d extension_dir=$(top_builddir)/modules"; \
+- for i in bz2 zlib phar; do \
+- if test -f "$(top_builddir)/modules/$$i.la"; then \
+- . $(top_builddir)/modules/$$i.la; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \
+- fi; \
+- done; \
+- fi; \
+- else \
+- $(top_srcdir)/build/shtool echo -n -- "$(PHP_EXECUTABLE)"; \
+- fi;`
++ $(top_srcdir)/build/shtool echo -n -- "$(PHP_EXECUTABLE)"; `
++
+ PHP_PHARCMD_BANG = `$(top_srcdir)/build/shtool echo -n -- "$(INSTALL_ROOT)$(bindir)/$(program_prefix)php$(program_suffix)$(EXEEXT)";`
+
+ $(builddir)/phar/phar.inc: $(srcdir)/phar/phar.inc
diff --git a/meta-aarch64/recipes-devtools/php/php/php-fpm-apache.conf b/meta-aarch64/recipes-devtools/php/php/php-fpm-apache.conf
new file mode 100644
index 00000000..77cdd82a
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/php/php-fpm-apache.conf
@@ -0,0 +1,6 @@
+# Taken from http://wiki.apache.org/httpd/PHP-FPM
+
+LoadModule proxy_module lib/apache2/modules/mod_proxy.so
+LoadModule proxy_fcgi_module lib/apache2/modules/mod_proxy_fcgi.so
+
+ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/usr/share/apache2/htdocs/
diff --git a/meta-aarch64/recipes-devtools/php/php/php-fpm.conf b/meta-aarch64/recipes-devtools/php/php/php-fpm.conf
new file mode 100644
index 00000000..21e3dfb5
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/php/php-fpm.conf
@@ -0,0 +1,510 @@
+;;;;;;;;;;;;;;;;;;;;;
+; FPM Configuration ;
+;;;;;;;;;;;;;;;;;;;;;
+
+; All relative paths in this configuration file are relative to PHP's install
+; prefix (/usr). This prefix can be dynamicaly changed by using the
+; '-p' argument from the command line.
+
+; Include one or more files. If glob(3) exists, it is used to include a bunch of
+; files from a glob(3) pattern. This directive can be used everywhere in the
+; file.
+; Relative path can also be used. They will be prefixed by:
+; - the global prefix if it's been set (-p arguement)
+; - /usr otherwise
+;include=etc/fpm.d/*.conf
+
+;;;;;;;;;;;;;;;;;;
+; Global Options ;
+;;;;;;;;;;;;;;;;;;
+
+[global]
+; Pid file
+; Note: the default prefix is /var
+; Default Value: none
+;pid = run/php-fpm.pid
+
+; Error log file
+; If it's set to "syslog", log is sent to syslogd instead of being written
+; in a local file.
+; Note: the default prefix is /var
+; Default Value: log/php-fpm.log
+;error_log = log/php-fpm.log
+
+; syslog_facility is used to specify what type of program is logging the
+; message. This lets syslogd specify that messages from different facilities
+; will be handled differently.
+; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
+; Default Value: daemon
+;syslog.facility = daemon
+
+; syslog_ident is prepended to every message. If you have multiple FPM
+; instances running on the same server, you can change the default value
+; which must suit common needs.
+; Default Value: php-fpm
+;syslog.ident = php-fpm
+
+; Log level
+; Possible Values: alert, error, warning, notice, debug
+; Default Value: notice
+;log_level = notice
+
+; If this number of child processes exit with SIGSEGV or SIGBUS within the time
+; interval set by emergency_restart_interval then FPM will restart. A value
+; of '0' means 'Off'.
+; Default Value: 0
+;emergency_restart_threshold = 0
+
+; Interval of time used by emergency_restart_interval to determine when
+; a graceful restart will be initiated. This can be useful to work around
+; accidental corruptions in an accelerator's shared memory.
+; Available Units: s(econds), m(inutes), h(ours), or d(ays)
+; Default Unit: seconds
+; Default Value: 0
+;emergency_restart_interval = 0
+
+; Time limit for child processes to wait for a reaction on signals from master.
+; Available units: s(econds), m(inutes), h(ours), or d(ays)
+; Default Unit: seconds
+; Default Value: 0
+;process_control_timeout = 0
+
+; The maximum number of processes FPM will fork. This has been design to control
+; the global number of processes when using dynamic PM within a lot of pools.
+; Use it with caution.
+; Note: A value of 0 indicates no limit
+; Default Value: 0
+; process.max = 128
+
+; Specify the nice(2) priority to apply to the master process (only if set)
+; The value can vary from -19 (highest priority) to 20 (lower priority)
+; Note: - It will only work if the FPM master process is launched as root
+; - The pool process will inherit the master process priority
+; unless it specified otherwise
+; Default Value: no set
+; process.priority = -19
+
+; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
+; Default Value: yes
+;daemonize = yes
+
+; Set open file descriptor rlimit for the master process.
+; Default Value: system defined value
+;rlimit_files = 1024
+
+; Set max core size rlimit for the master process.
+; Possible Values: 'unlimited' or an integer greater or equal to 0
+; Default Value: system defined value
+;rlimit_core = 0
+
+; Specify the event mechanism FPM will use. The following is available:
+; - select (any POSIX os)
+; - poll (any POSIX os)
+; - epoll (linux >= 2.5.44)
+; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0)
+; - /dev/poll (Solaris >= 7)
+; - port (Solaris >= 10)
+; Default Value: not set (auto detection)
+; events.mechanism = epoll
+
+;;;;;;;;;;;;;;;;;;;;
+; Pool Definitions ;
+;;;;;;;;;;;;;;;;;;;;
+
+; Multiple pools of child processes may be started with different listening
+; ports and different management options. The name of the pool will be
+; used in logs and stats. There is no limitation on the number of pools which
+; FPM can handle. Your system will tell you anyway :)
+
+; Start a new pool named 'www'.
+; the variable $pool can we used in any directive and will be replaced by the
+; pool name ('www' here)
+[www]
+
+; Per pool prefix
+; It only applies on the following directives:
+; - 'slowlog'
+; - 'listen' (unixsocket)
+; - 'chroot'
+; - 'chdir'
+; - 'php_values'
+; - 'php_admin_values'
+; When not set, the global prefix (or /usr) applies instead.
+; Note: This directive can also be relative to the global prefix.
+; Default Value: none
+;prefix = /path/to/pools/$pool
+
+; Unix user/group of processes
+; Note: The user is mandatory. If the group is not set, the default user's group
+; will be used.
+user = nobody
+;group = nobody
+
+; The address on which to accept FastCGI requests.
+; Valid syntaxes are:
+; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
+; a specific port;
+; 'port' - to listen on a TCP socket to all addresses on a
+; specific port;
+; '/path/to/unix/socket' - to listen on a unix socket.
+; Note: This value is mandatory.
+listen = 127.0.0.1:9000
+
+; Set listen(2) backlog. A value of '-1' means unlimited.
+; Default Value: 128 (-1 on FreeBSD and OpenBSD)
+;listen.backlog = -1
+
+; Set permissions for unix socket, if one is used. In Linux, read/write
+; permissions must be set in order to allow connections from a web server. Many
+; BSD-derived systems allow connections regardless of permissions.
+; Default Values: user and group are set as the running user
+; mode is set to 0666
+;listen.owner = nobody
+;listen.group = nobody
+;listen.mode = 0666
+
+; List of ipv4 addresses of FastCGI clients which are allowed to connect.
+; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
+; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
+; must be separated by a comma. If this value is left blank, connections will be
+; accepted from any ip address.
+; Default Value: any
+;listen.allowed_clients = 127.0.0.1
+
+; Specify the nice(2) priority to apply to the pool processes (only if set)
+; The value can vary from -19 (highest priority) to 20 (lower priority)
+; Note: - It will only work if the FPM master process is launched as root
+; - The pool processes will inherit the master process priority
+; unless it specified otherwise
+; Default Value: no set
+; priority = -19
+
+; Choose how the process manager will control the number of child processes.
+; Possible Values:
+; static - a fixed number (pm.max_children) of child processes;
+; dynamic - the number of child processes are set dynamically based on the
+; following directives. With this process management, there will be
+; always at least 1 children.
+; pm.max_children - the maximum number of children that can
+; be alive at the same time.
+; pm.start_servers - the number of children created on startup.
+; pm.min_spare_servers - the minimum number of children in 'idle'
+; state (waiting to process). If the number
+; of 'idle' processes is less than this
+; number then some children will be created.
+; pm.max_spare_servers - the maximum number of children in 'idle'
+; state (waiting to process). If the number
+; of 'idle' processes is greater than this
+; number then some children will be killed.
+; ondemand - no children are created at startup. Children will be forked when
+; new requests will connect. The following parameter are used:
+; pm.max_children - the maximum number of children that
+; can be alive at the same time.
+; pm.process_idle_timeout - The number of seconds after which
+; an idle process will be killed.
+; Note: This value is mandatory.
+pm = dynamic
+
+; The number of child processes to be created when pm is set to 'static' and the
+; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
+; This value sets the limit on the number of simultaneous requests that will be
+; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
+; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
+; CGI. The below defaults are based on a server without much resources. Don't
+; forget to tweak pm.* to fit your needs.
+; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
+; Note: This value is mandatory.
+pm.max_children = 5
+
+; The number of child processes created on startup.
+; Note: Used only when pm is set to 'dynamic'
+; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
+pm.start_servers = 2
+
+; The desired minimum number of idle server processes.
+; Note: Used only when pm is set to 'dynamic'
+; Note: Mandatory when pm is set to 'dynamic'
+pm.min_spare_servers = 1
+
+; The desired maximum number of idle server processes.
+; Note: Used only when pm is set to 'dynamic'
+; Note: Mandatory when pm is set to 'dynamic'
+pm.max_spare_servers = 3
+
+; The number of seconds after which an idle process will be killed.
+; Note: Used only when pm is set to 'ondemand'
+; Default Value: 10s
+;pm.process_idle_timeout = 10s;
+
+; The number of requests each child process should execute before respawning.
+; This can be useful to work around memory leaks in 3rd party libraries. For
+; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
+; Default Value: 0
+;pm.max_requests = 500
+
+; The URI to view the FPM status page. If this value is not set, no URI will be
+; recognized as a status page. It shows the following informations:
+; pool - the name of the pool;
+; process manager - static, dynamic or ondemand;
+; start time - the date and time FPM has started;
+; start since - number of seconds since FPM has started;
+; accepted conn - the number of request accepted by the pool;
+; listen queue - the number of request in the queue of pending
+; connections (see backlog in listen(2));
+; max listen queue - the maximum number of requests in the queue
+; of pending connections since FPM has started;
+; listen queue len - the size of the socket queue of pending connections;
+; idle processes - the number of idle processes;
+; active processes - the number of active processes;
+; total processes - the number of idle + active processes;
+; max active processes - the maximum number of active processes since FPM
+; has started;
+; max children reached - number of times, the process limit has been reached,
+; when pm tries to start more children (works only for
+; pm 'dynamic' and 'ondemand');
+; Value are updated in real time.
+; Example output:
+; pool: www
+; process manager: static
+; start time: 01/Jul/2011:17:53:49 +0200
+; start since: 62636
+; accepted conn: 190460
+; listen queue: 0
+; max listen queue: 1
+; listen queue len: 42
+; idle processes: 4
+; active processes: 11
+; total processes: 15
+; max active processes: 12
+; max children reached: 0
+;
+; By default the status page output is formatted as text/plain. Passing either
+; 'html', 'xml' or 'json' in the query string will return the corresponding
+; output syntax. Example:
+; http://www.foo.bar/status
+; http://www.foo.bar/status?json
+; http://www.foo.bar/status?html
+; http://www.foo.bar/status?xml
+;
+; By default the status page only outputs short status. Passing 'full' in the
+; query string will also return status for each pool process.
+; Example:
+; http://www.foo.bar/status?full
+; http://www.foo.bar/status?json&full
+; http://www.foo.bar/status?html&full
+; http://www.foo.bar/status?xml&full
+; The Full status returns for each process:
+; pid - the PID of the process;
+; state - the state of the process (Idle, Running, ...);
+; start time - the date and time the process has started;
+; start since - the number of seconds since the process has started;
+; requests - the number of requests the process has served;
+; request duration - the duration in ┬Ás of the requests;
+; request method - the request method (GET, POST, ...);
+; request URI - the request URI with the query string;
+; content length - the content length of the request (only with POST);
+; user - the user (PHP_AUTH_USER) (or '-' if not set);
+; script - the main script called (or '-' if not set);
+; last request cpu - the %cpu the last request consumed
+; it's always 0 if the process is not in Idle state
+; because CPU calculation is done when the request
+; processing has terminated;
+; last request memory - the max amount of memory the last request consumed
+; it's always 0 if the process is not in Idle state
+; because memory calculation is done when the request
+; processing has terminated;
+; If the process is in Idle state, then informations are related to the
+; last request the process has served. Otherwise informations are related to
+; the current request being served.
+; Example output:
+; ************************
+; pid: 31330
+; state: Running
+; start time: 01/Jul/2011:17:53:49 +0200
+; start since: 63087
+; requests: 12808
+; request duration: 1250261
+; request method: GET
+; request URI: /test_mem.php?N=10000
+; content length: 0
+; user: -
+; script: /home/fat/web/docs/php/test_mem.php
+; last request cpu: 0.00
+; last request memory: 0
+;
+; Note: There is a real-time FPM status monitoring sample web page available
+; It's available in: /usr/share/fpm/status.html
+;
+; Note: The value must start with a leading slash (/). The value can be
+; anything, but it may not be a good idea to use the .php extension or it
+; may conflict with a real PHP file.
+; Default Value: not set
+;pm.status_path = /status
+
+; The ping URI to call the monitoring page of FPM. If this value is not set, no
+; URI will be recognized as a ping page. This could be used to test from outside
+; that FPM is alive and responding, or to
+; - create a graph of FPM availability (rrd or such);
+; - remove a server from a group if it is not responding (load balancing);
+; - trigger alerts for the operating team (24/7).
+; Note: The value must start with a leading slash (/). The value can be
+; anything, but it may not be a good idea to use the .php extension or it
+; may conflict with a real PHP file.
+; Default Value: not set
+;ping.path = /ping
+
+; This directive may be used to customize the response of a ping request. The
+; response is formatted as text/plain with a 200 response code.
+; Default Value: pong
+;ping.response = pong
+
+; The access log file
+; Default: not set
+;access.log = log/$pool.access.log
+
+; The access log format.
+; The following syntax is allowed
+; %%: the '%' character
+; %C: %CPU used by the request
+; it can accept the following format:
+; - %{user}C for user CPU only
+; - %{system}C for system CPU only
+; - %{total}C for user + system CPU (default)
+; %d: time taken to serve the request
+; it can accept the following format:
+; - %{seconds}d (default)
+; - %{miliseconds}d
+; - %{mili}d
+; - %{microseconds}d
+; - %{micro}d
+; %e: an environment variable (same as $_ENV or $_SERVER)
+; it must be associated with embraces to specify the name of the env
+; variable. Some exemples:
+; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
+; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
+; %f: script filename
+; %l: content-length of the request (for POST request only)
+; %m: request method
+; %M: peak of memory allocated by PHP
+; it can accept the following format:
+; - %{bytes}M (default)
+; - %{kilobytes}M
+; - %{kilo}M
+; - %{megabytes}M
+; - %{mega}M
+; %n: pool name
+; %o: ouput header
+; it must be associated with embraces to specify the name of the header:
+; - %{Content-Type}o
+; - %{X-Powered-By}o
+; - %{Transfert-Encoding}o
+; - ....
+; %p: PID of the child that serviced the request
+; %P: PID of the parent of the child that serviced the request
+; %q: the query string
+; %Q: the '?' character if query string exists
+; %r: the request URI (without the query string, see %q and %Q)
+; %R: remote IP address
+; %s: status (response code)
+; %t: server time the request was received
+; it can accept a strftime(3) format:
+; %d/%b/%Y:%H:%M:%S %z (default)
+; %T: time the log has been written (the request has finished)
+; it can accept a strftime(3) format:
+; %d/%b/%Y:%H:%M:%S %z (default)
+; %u: remote user
+;
+; Default: "%R - %u %t \"%m %r\" %s"
+;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
+
+; The log file for slow requests
+; Default Value: not set
+; Note: slowlog is mandatory if request_slowlog_timeout is set
+;slowlog = log/$pool.log.slow
+
+; The timeout for serving a single request after which a PHP backtrace will be
+; dumped to the 'slowlog' file. A value of '0s' means 'off'.
+; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
+; Default Value: 0
+;request_slowlog_timeout = 0
+
+; The timeout for serving a single request after which the worker process will
+; be killed. This option should be used when the 'max_execution_time' ini option
+; does not stop script execution for some reason. A value of '0' means 'off'.
+; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
+; Default Value: 0
+;request_terminate_timeout = 0
+
+; Set open file descriptor rlimit.
+; Default Value: system defined value
+;rlimit_files = 1024
+
+; Set max core size rlimit.
+; Possible Values: 'unlimited' or an integer greater or equal to 0
+; Default Value: system defined value
+;rlimit_core = 0
+
+; Chroot to this directory at the start. This value must be defined as an
+; absolute path. When this value is not set, chroot is not used.
+; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
+; of its subdirectories. If the pool prefix is not set, the global prefix
+; will be used instead.
+; Note: chrooting is a great security feature and should be used whenever
+; possible. However, all PHP paths will be relative to the chroot
+; (error_log, sessions.save_path, ...).
+; Default Value: not set
+;chroot =
+
+; Chdir to this directory at the start.
+; Note: relative path can be used.
+; Default Value: current directory or / when chroot
+;chdir = /var/www
+
+; Redirect worker stdout and stderr into main error log. If not set, stdout and
+; stderr will be redirected to /dev/null according to FastCGI specs.
+; Note: on highloaded environement, this can cause some delay in the page
+; process time (several ms).
+; Default Value: no
+;catch_workers_output = yes
+
+; Limits the extensions of the main script FPM will allow to parse. This can
+; prevent configuration mistakes on the web server side. You should only limit
+; FPM to .php extensions to prevent malicious users to use other extensions to
+; exectute php code.
+; Note: set an empty value to allow all extensions.
+; Default Value: .php
+;security.limit_extensions = .php .php3 .php4 .php5
+
+; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
+; the current environment.
+; Default Value: clean env
+;env[HOSTNAME] = $HOSTNAME
+;env[PATH] = /usr/local/bin:/usr/bin:/bin
+;env[TMP] = /tmp
+;env[TMPDIR] = /tmp
+;env[TEMP] = /tmp
+
+; Additional php.ini defines, specific to this pool of workers. These settings
+; overwrite the values previously defined in the php.ini. The directives are the
+; same as the PHP SAPI:
+; php_value/php_flag - you can set classic ini defines which can
+; be overwritten from PHP call 'ini_set'.
+; php_admin_value/php_admin_flag - these directives won't be overwritten by
+; PHP call 'ini_set'
+; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
+
+; Defining 'extension' will load the corresponding shared extension from
+; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
+; overwrite previously defined php.ini values, but will append the new value
+; instead.
+
+; Note: path INI options can be relative and will be expanded with the prefix
+; (pool, global or /usr)
+
+; Default Value: nothing is defined by default except the values in php.ini and
+; specified at startup with the -d argument
+;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
+;php_flag[display_errors] = off
+;php_admin_value[error_log] = /var/log/fpm-php.www.log
+;php_admin_flag[log_errors] = on
+;php_admin_value[memory_limit] = 32M
diff --git a/meta-aarch64/recipes-devtools/php/php/php-m4-divert.patch b/meta-aarch64/recipes-devtools/php/php/php-m4-divert.patch
new file mode 100644
index 00000000..dfc7b643
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/php/php-m4-divert.patch
@@ -0,0 +1,83 @@
+Patch taken from
+
+http://cvs.pld-linux.org/cgi-bin/cvsweb/packages/php/php-m4-divert.patch?rev=1.1
+
+diff -ur php-5.2.10.org/configure.in php-5.2.10/configure.in
+--- php-5.2.10.org/configure.in 2009-06-17 14:22:41.000000000 +0200
++++ php-5.2.10/configure.in 2009-08-18 12:16:25.317640253 +0200
+@@ -1,7 +1,7 @@
+ ## $Id: configure.in,v 1.579.2.52.2.139 2009/06/17 12:22:41 iliaa Exp $ -*- autoconf -*-
+ dnl ## Process this file with autoconf to produce a configure script.
+
+-divert(1)
++divert(1001)
+
+ dnl ## Diversion 1 is the autoconf + automake setup phase. We also
+ dnl ## set the PHP version, deal with platform-specific compile
+@@ -263,7 +263,7 @@
+ sinclude(TSRM/tsrm.m4)
+
+
+-divert(2)
++divert(1002)
+
+ dnl ## Diversion 2 is where we set PHP-specific options and come up
+ dnl ## with reasonable default values for them. We check for pthreads here
+@@ -302,7 +302,7 @@
+ PTHREADS_FLAGS
+ fi
+
+-divert(3)
++divert(1003)
+
+ dnl ## In diversion 3 we check for compile-time options to the PHP
+ dnl ## core and how to deal with different system dependencies.
+@@ -661,7 +661,7 @@
+ PHP_CRYPT_R_STYLE
+ fi
+
+-divert(4)
++divert(1004)
+
+ dnl ## In diversion 4 we check user-configurable general settings.
+
+@@ -902,7 +902,7 @@
+ AC_MSG_RESULT([using system default])
+ fi
+
+-divert(5)
++divert(1005)
+
+ dnl ## In diversion 5 we check which extensions should be compiled.
+ dnl ## All of these are normally in the extension directories.
+diff -ur php-5.2.10.org/ext/standard/config.m4 php-5.2.10/ext/standard/config.m4
+--- php-5.2.10.org/ext/standard/config.m4 2007-07-11 13:56:03.000000000 +0200
++++ php-5.2.10/ext/standard/config.m4 2009-08-18 12:16:25.317640253 +0200
+@@ -1,6 +1,6 @@
+ dnl $Id: config.m4,v 1.80.2.3.2.3 2007/07/11 11:56:03 jani Exp $ -*- autoconf -*-
+
+-divert(3)dnl
++divert(1003)dnl
+
+ dnl
+ dnl Check if flush should be called explicitly after buffered io
+@@ -205,7 +205,7 @@
+ AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p hypot glob strfmon nice fpclass isinf isnan)
+ AC_FUNC_FNMATCH
+
+-divert(5)dnl
++divert(1005)dnl
+
+ dnl
+ dnl Check for regex library type
+diff -ur php-5.2.10.org/scripts/phpize.m4 php-5.2.10/scripts/phpize.m4
+--- php-5.2.10.org/scripts/phpize.m4 2009-06-02 21:54:22.000000000 +0200
++++ php-5.2.10/scripts/phpize.m4 2009-08-18 12:16:25.317640253 +0200
+@@ -1,6 +1,6 @@
+ dnl This file becomes configure.in for self-contained extensions.
+
+-divert(1)
++divert(1001)
+
+ AC_PREREQ(2.13)
+ AC_INIT(config.m4)
diff --git a/meta-aarch64/recipes-devtools/php/php/php_exec_native.patch b/meta-aarch64/recipes-devtools/php/php/php_exec_native.patch
new file mode 100644
index 00000000..a563c9a5
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/php/php_exec_native.patch
@@ -0,0 +1,11 @@
+--- php/configure.in.orig 2011-03-12 02:13:19.000000000 +0100
++++ php/configure.in 2011-03-12 02:14:05.000000000 +0100
+@@ -1216,7 +1216,7 @@
+ PHP_INSTALL_CLI_TARGET="install-cli"
+ PHP_ADD_SOURCES(sapi/cli, php_cli.c php_cli_readline.c,, cli)
+ PHP_INSTALLED_SAPIS="cli $PHP_SAPI"
+- PHP_EXECUTABLE="\$(top_builddir)/\$(SAPI_CLI_PATH)"
++ PHP_EXECUTABLE="${PHP_NATIVE_DIR}/php"
+ else
+ PHP_INSTALLED_SAPIS="$PHP_SAPI"
+ fi
diff --git a/meta-aarch64/recipes-devtools/php/php_5.3.19.bb b/meta-aarch64/recipes-devtools/php/php_5.3.19.bb
new file mode 100644
index 00000000..8204104b
--- /dev/null
+++ b/meta-aarch64/recipes-devtools/php/php_5.3.19.bb
@@ -0,0 +1,22 @@
+require php.inc
+
+LIC_FILES_CHKSUM = "file://LICENSE;md5=cb564efdf78cce8ea6e4b5a4f7c05d97"
+
+PR = "${INC_PR}.0"
+
+SRC_URI += "file://acinclude-xml2-config.patch \
+ file://php-m4-divert.patch \
+ file://0001-php-don-t-use-broken-wrapper-for-mkdir.patch"
+
+SRC_URI_append_pn-php += "file://iconv.patch \
+ file://imap-fix-autofoo.patch \
+ file://pear-makefile.patch \
+ file://phar-makefile.patch \
+ file://php_exec_native.patch \
+ file://fix-fpm-cross-compile.patch \
+ file://php-fpm.conf \
+ file://php-fpm-apache.conf \
+ "
+
+SRC_URI[md5sum] = "e1d2a3ec7849d4b3032bd1abf1916aa4"
+SRC_URI[sha256sum] = "814ce55b950158c4ddadbcd0b2d7d8cb4b570de4a29b9db021020594e2469fd6"
diff --git a/meta-aarch64/recipes-extended/ltp/files/ltp-arm64.patch b/meta-aarch64/recipes-extended/ltp/files/ltp-arm64.patch
new file mode 100644
index 00000000..8911fb78
--- /dev/null
+++ b/meta-aarch64/recipes-extended/ltp/files/ltp-arm64.patch
@@ -0,0 +1,752 @@
+diff -urN ltp-full-20120903.orig/testcases/kernel/include/aarch64.in ltp-full-20120903/testcases/kernel/include/aarch64.in
+--- ltp-full-20120903.orig/testcases/kernel/include/aarch64.in 1970-01-01 02:00:00.000000000 +0200
++++ ltp-full-20120903/testcases/kernel/include/aarch64.in 2012-10-15 17:05:24.153016081 +0300
+@@ -0,0 +1,257 @@
++io_setup 0
++io_destroy 1
++io_submit 2
++io_cancel 3
++io_getevents 4
++setxattr 5
++lsetxattr 6
++fsetxattr 7
++getxattr 8
++lgetxattr 9
++fgetxattr 10
++listxattr 11
++llistxattr 12
++flistxattr 13
++removexattr 14
++lremovexattr 15
++fremovexattr 16
++getcwd 17
++lookup_dcookie 18
++eventfd2 19
++epoll_create1 20
++epoll_ctl 21
++epoll_pwait 22
++dup 23
++dup3 24
++fcntl 25
++inotify_init1 26
++inotify_add_watch 27
++inotify_rm_watch 28
++ioctl 29
++ioprio_set 30
++ioprio_get 31
++flock 32
++mknodat 33
++mkdirat 34
++unlinkat 35
++symlinkat 36
++linkat 37
++renameat 38
++umount2 39
++mount 40
++pivot_root 41
++nfsservctl 42
++statfs 43
++fstatfs 44
++truncate 45
++ftruncate 46
++fallocate 47
++faccessat 48
++chdir 49
++fchdir 50
++chroot 51
++fchmod 52
++fchmodat 53
++fchownat 54
++fchown 55
++openat 56
++close 57
++vhangup 58
++pipe2 59
++quotactl 60
++getdents64 61
++lseek 62
++read 63
++write 64
++readv 65
++writev 66
++pread64 67
++pwrite64 68
++preadv 69
++pwritev 70
++sendfile 71
++pselect6 72
++ppoll 73
++signalfd4 74
++vmsplice 75
++splice 76
++tee 77
++readlinkat 78
++fstatat 79
++fstat 80
++sync 81
++fsync 82
++fdatasync 83
++sync_file_range2 84
++sync_file_range 84
++timerfd_create 85
++timerfd_settime 86
++timerfd_gettime 87
++utimensat 88
++acct 89
++capget 90
++capset 91
++personality 92
++exit 93
++exit_group 94
++waitid 95
++set_tid_address 96
++unshare 97
++futex 98
++set_robust_list 99
++get_robust_list 100
++nanosleep 101
++getitimer 102
++setitimer 103
++kexec_load 104
++init_module 105
++delete_module 106
++timer_create 107
++timer_gettime 108
++timer_getoverrun 109
++timer_settime 110
++timer_delete 111
++clock_settime 112
++clock_gettime 113
++clock_getres 114
++clock_nanosleep 115
++syslog 116
++ptrace 117
++sched_setparam 118
++sched_setscheduler 119
++sched_getscheduler 120
++sched_getparam 121
++sched_setaffinity 122
++sched_getaffinity 123
++sched_yield 124
++sched_get_priority_max 125
++sched_get_priority_min 126
++sched_rr_get_interval 127
++restart_syscall 128
++kill 129
++tkill 130
++tgkill 131
++sigaltstack 132
++rt_sigsuspend 133
++rt_sigaction 134
++rt_sigprocmask 135
++rt_sigpending 136
++rt_sigtimedwait 137
++rt_sigqueueinfo 138
++rt_sigreturn 139
++setpriority 140
++getpriority 141
++reboot 142
++setregid 143
++setgid 144
++setreuid 145
++setuid 146
++setresuid 147
++getresuid 148
++setresgid 149
++getresgid 150
++setfsuid 151
++setfsgid 152
++times 153
++setpgid 154
++getpgid 155
++getsid 156
++setsid 157
++getgroups 158
++setgroups 159
++uname 160
++sethostname 161
++setdomainname 162
++getrlimit 163
++setrlimit 164
++getrusage 165
++umask 166
++prctl 167
++getcpu 168
++gettimeofday 169
++settimeofday 170
++adjtimex 171
++getpid 172
++getppid 173
++getuid 174
++geteuid 175
++getgid 176
++getegid 177
++gettid 178
++sysinfo 179
++mq_open 180
++mq_unlink 181
++mq_timedsend 182
++mq_timedreceive 183
++mq_notify 184
++mq_getsetattr 185
++msgget 186
++msgctl 187
++msgrcv 188
++msgsnd 189
++semget 190
++semctl 191
++semtimedop 192
++semop 193
++shmget 194
++shmctl 195
++shmat 196
++shmdt 197
++socket 198
++socketpair 199
++bind 200
++listen 201
++accept 202
++connect 203
++getsockname 204
++getpeername 205
++sendto 206
++recvfrom 207
++setsockopt 208
++getsockopt 209
++shutdown 210
++sendmsg 211
++recvmsg 212
++readahead 213
++brk 214
++munmap 215
++mremap 216
++add_key 217
++request_key 218
++keyctl 219
++clone 220
++execve 221
++mmap 222
++fadvise64 223
++swapon 224
++swapoff 225
++mprotect 226
++msync 227
++mlock 228
++munlock 229
++mlockall 230
++munlockall 231
++mincore 232
++madvise 233
++remap_file_pages 234
++mbind 235
++get_mempolicy 236
++set_mempolicy 237
++migrate_pages 238
++move_pages 239
++rt_tgsigqueueinfo 240
++perf_event_open 241
++accept4 242
++recvmmsg 243
++wait4 260
++prlimit64 261
++fanotify_init 262
++fanotify_mark 263
++name_to_handle_at 264
++open_by_handle_at 265
++clock_adjtime 266
++syncfs 267
++setns 268
++sendmmsg 269
++cacheflush 0x1002
++set_tls 0x1005
+diff -urN ltp-full-20120903.orig/testcases/kernel/include/order ltp-full-20120903/testcases/kernel/include/order
+--- ltp-full-20120903.orig/testcases/kernel/include/order 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/include/order 2012-10-15 17:05:24.169015861 +0300
+@@ -1,3 +1,4 @@
++aarch64
+ arm
+ hppa
+ i386
+diff -urN ltp-full-20120903.orig/testcases/kernel/include/regen.sh ltp-full-20120903/testcases/kernel/include/regen.sh
+--- ltp-full-20120903.orig/testcases/kernel/include/regen.sh 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/include/regen.sh 2012-10-15 17:05:24.169015861 +0300
+@@ -27,7 +27,7 @@
+
+ #define syscall(NR, ...) ({ \\
+ int __ret; \\
+- if (NR == 0) { \\
++ if (NR == __LTP__NR_INVALID_SYSCALL) { \\
+ errno = ENOSYS; \\
+ __ret = -1; \\
+ } else { \\
+@@ -71,11 +71,12 @@
+ echo -n "Generating stub list ... "
+ echo "" >> "${output_pid}"
+ echo "/* Common stubs */" >> "${output_pid}"
++echo "#define __LTP__NR_INVALID_SYSCALL -1" >> "${output_pid}"
+ for nr in $(awk '{print $1}' "${srcdir}/"*.in | sort -u) ; do
+ nr="__NR_$nr"
+ cat <<-EOF >> "${output_pid}"
+ # ifndef $nr
+- # define $nr 0
++ # define $nr __LTP__NR_INVALID_SYSCALL
+ # endif
+ EOF
+ done
+diff -urN ltp-full-20120903.orig/testcases/kernel/mem/shmt/shmt09.c ltp-full-20120903/testcases/kernel/mem/shmt/shmt09.c
+--- ltp-full-20120903.orig/testcases/kernel/mem/shmt/shmt09.c 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/mem/shmt/shmt09.c 2012-10-15 17:05:24.169015861 +0300
+@@ -61,7 +61,7 @@
+ #define INCREMENT 8388608 /* 8Mb */
+ #elif defined (__mips__) || defined (__hppa__) || defined (__sparc__)
+ #define INCREMENT 262144 /* 256Kb */
+-#elif defined __sh__ || defined (__arm__)
++#elif defined __sh__ || defined (__arm__) || defined(__aarch64__)
+ #define INCREMENT 16384 /* 16kb */
+ #else
+ #define INCREMENT SHMLBA
+@@ -162,7 +162,7 @@
+ tst_resm(TPASS, "sbrk, shmat");
+
+ /*--------------------------------------------------------*/
+-#if defined (__ia64__) || defined(__mips__) || defined(__hppa__) || defined(__arm__)
++#if defined (__ia64__) || defined(__mips__) || defined(__hppa__) || defined(__arm__) || defined(__aarch64__)
+ while ((vp = sbrk(INCREMENT)) != (void *)-1) ;
+ if (errno != ENOMEM) {
+ tst_resm(TFAIL, "Error: sbrk failed, errno = %d\n", errno);
+diff -urN ltp-full-20120903.orig/testcases/kernel/syscalls/cacheflush/cacheflush01.c ltp-full-20120903/testcases/kernel/syscalls/cacheflush/cacheflush01.c
+--- ltp-full-20120903.orig/testcases/kernel/syscalls/cacheflush/cacheflush01.c 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/syscalls/cacheflush/cacheflush01.c 2012-10-15 17:05:12.529177068 +0300
+@@ -44,16 +44,9 @@
+ #include <stdlib.h>
+ #include <errno.h>
+
+-/* Harness Specific Include Files. */
+-#include "test.h"
+-#include "usctest.h"
+-#include "linux_syscall_numbers.h"
++/* cacheflush man page states that cacheflush() is only applicable to
++ * MIPS architecture -- regardless, it's a good negative test.. */
+
+-#if defined __NR_cacheflush && __NR_cacheflush > 0
+-#include <asm/cachectl.h>
+-#else
+-/* Fake linux_syscall_numbers.h */
+-#define __NR_cacheflush 0
+ #ifndef ICACHE
+ #define ICACHE (1<<0) /* flush instruction cache */
+ #endif
+@@ -63,6 +56,22 @@
+ #ifndef BCACHE
+ #define BCACHE (ICACHE|DCACHE) /* flush both caches */
+ #endif
++
++/* Harness Specific Incnude Files. */
++#include "test.h"
++#include "usctest.h"
++#include "linux_syscall_numbers.h"
++
++/* cacheflush man page states that cacheflush() is only applicable to
++ * MIPS architecture -- regardless, it's a good negative test.. */
++#if defined __mips__
++#include <asm/cachectl.h>
++#ifndef __NR_cacheflush
++#define __NR_cacheflush 0
++#endif
++#else
++/* Fake linux_syscall_numbers.h */
++#define __NR_cacheflush 0
+ #endif
+
+ /* Extern Global Variables */
+diff -urN ltp-full-20120903.orig/testcases/kernel/syscalls/getdents/getdents01.c ltp-full-20120903/testcases/kernel/syscalls/getdents/getdents01.c
+--- ltp-full-20120903.orig/testcases/kernel/syscalls/getdents/getdents01.c 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/syscalls/getdents/getdents01.c 2012-10-15 17:05:24.169015861 +0300
+@@ -81,6 +81,21 @@
+ char *dir_name = NULL;
+ struct dirent *dirp;
+
++ /*
++ * Here's a case where invoking the system call directly
++ * doesn't seem to work. getdents.h has an assembly
++ * macro to do the job.
++ *
++ * equivalent to - getdents(fd, dirp, count);
++ * if we could call getdents that way.
++ */
++
++#ifdef __NR_getdents
++#define getdents(arg1, arg2, arg3) syscall(__NR_getdents, arg1, arg2, arg3)
++#else
++#define getdents(arg1, arg2, arg3) -ENOSYS
++#endif
++
+ if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
+ tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+@@ -109,14 +124,17 @@
+ rval = getdents(fd, dirp, count);
+ if (rval < 0) {
+
+- TEST_ERROR_LOG(errno);
++ rval *= -1;
++ TEST_ERROR_LOG(rval);
+
+- tst_resm(TFAIL|TERRNO, "getdents failed unexpectedly");
++ tst_resm(TFAIL, "%s call failed - errno = %d "
++ ": %s", TCID, rval, strerror(rval));
+ continue;
+ }
+
+ if (rval == 0) {
+- tst_resm(TFAIL, "getdents failed - returned end of directory");
++ tst_resm(TFAIL, "%s call failed - returned "
++ "end of directory", TCID);
+ continue;
+ }
+
+diff -urN ltp-full-20120903.orig/testcases/kernel/syscalls/getdents/getdents02.c ltp-full-20120903/testcases/kernel/syscalls/getdents/getdents02.c
+--- ltp-full-20120903.orig/testcases/kernel/syscalls/getdents/getdents02.c 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/syscalls/getdents/getdents02.c 2012-10-15 17:05:18.189098682 +0300
+@@ -69,12 +69,21 @@
+
+ int exp_enos[] = { EBADF, 0 }; /* 0 terminated list of expected errnos */
+
++#ifndef __i386__
++int main(void)
++{
++ tst_brkm(TCONF, NULL, "this test will only run on i386");
++ tst_exit();
++}
++#else
++
+ int main(int ac, char **av)
+ {
+ int lc;
+ char *msg;
+ int rval, fd;
+ int count;
++ const int cnum = __NR_getdents;
+ size_t size = 0;
+ char *dir_name = NULL;
+ struct dirent *dirp;
+@@ -100,15 +109,25 @@
+
+ fd = -5;
+
+- rval = getdents(fd, dirp, count);
++ /*
++ * here's a case where invoking the system call directly
++ * doesn't seem to work. getdents.h has an assembly
++ * macro to do the job.
++ *
++ * equivalent to - getdents(fd, dirp, count);
++ * if we could call getdents that way.
++ */
++
++ rval = GETDENTS_ASM();
+
+ /*
+ * Hopefully we get an error due to the bad file descriptor.
+ */
+ if (rval < 0) {
+- TEST_ERROR_LOG(errno);
++ rval *= -1;
++ TEST_ERROR_LOG(rval);
+
+- switch (errno) {
++ switch (rval) {
+ case EBADF:
+ tst_resm(TPASS,
+ "failed as expected with EBADF");
+@@ -151,3 +170,5 @@
+
+ tst_rmdir();
+ }
++
++#endif /* __i386__ */
+diff -urN ltp-full-20120903.orig/testcases/kernel/syscalls/getdents/getdents03.c ltp-full-20120903/testcases/kernel/syscalls/getdents/getdents03.c
+--- ltp-full-20120903.orig/testcases/kernel/syscalls/getdents/getdents03.c 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/syscalls/getdents/getdents03.c 2012-10-15 17:05:18.189098682 +0300
+@@ -72,12 +72,21 @@
+
+ int exp_enos[] = { EINVAL, 0 }; /* 0 terminated list of expected errnos */
+
++#ifndef __i386__
++int main(void)
++{
++ tst_brkm(TCONF, NULL, "this test will only run on i386");
++ tst_exit();
++}
++#else
++
+ int main(int ac, char **av)
+ {
+ int lc;
+ char *msg;
+ int rval, fd;
+ int count;
++ const int cnum = __NR_getdents;
+ size_t size = 0;
+ char *dir_name = NULL;
+ struct dirent *dirp;
+@@ -105,16 +114,26 @@
+ if ((fd = open(dir_name, O_RDONLY)) == -1)
+ tst_brkm(TBROK, cleanup, "open of directory failed");
+
+- rval = getdents(fd, dirp, count);
++ /*
++ * here's a case where invoking the system call directly
++ * doesn't seem to work. getdents.h has an assembly
++ * macro to do the job.
++ *
++ * equivalent to - getdents(fd, dirp, count)
++ * if we could call getdents that way.
++ */
++
++ rval = GETDENTS_ASM();
+
+ /*
+ * Hopefully we get an error due to the small buffer.
+ */
+
+ if (rval < 0) {
+- TEST_ERROR_LOG(errno);
++ rval *= -1;
++ TEST_ERROR_LOG(rval);
+
+- switch (errno) {
++ switch (rval) {
+ case EINVAL:
+ tst_resm(TPASS,
+ "getdents failed with EINVAL as expected");
+@@ -162,3 +181,5 @@
+
+ tst_rmdir();
+ }
++
++#endif /* __i386__ */
+diff -urN ltp-full-20120903.orig/testcases/kernel/syscalls/getdents/getdents04.c ltp-full-20120903/testcases/kernel/syscalls/getdents/getdents04.c
+--- ltp-full-20120903.orig/testcases/kernel/syscalls/getdents/getdents04.c 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/syscalls/getdents/getdents04.c 2012-10-15 17:05:18.193098626 +0300
+@@ -73,11 +73,20 @@
+
+ int exp_enos[] = { ENOTDIR, 0 }; /* 0 terminated list of expected errnos */
+
++#ifndef __i386__
++int main(void)
++{
++ tst_brkm(TCONF, NULL, "this test will only run on i386");
++ tst_exit();
++}
++#else
++
+ int main(int ac, char **av)
+ {
+ int lc;
+ char *msg;
+ int count, rval, fd;
++ const int cnum = 141;
+ size_t size = 0;
+ char *dir_name = NULL;
+ struct dirent *dirp;
+@@ -122,7 +131,15 @@
+ if (S_ISDIR(sbuf->st_mode))
+ tst_brkm(TBROK, cleanup, "fd is a directory");
+
+- rval = getdents(fd, dirp, count);
++ /*
++ * here's a case where invoking the system call directly
++ * doesn't seem to work. getdents.h has an assembly
++ * macro to do the job.
++ *
++ * equivalent to getdents(fd, dirp, count);
++ */
++
++ rval = GETDENTS_ASM();
+
+ /*
+ * Calling with a non directory file descriptor should give
+@@ -130,9 +147,10 @@
+ */
+
+ if (rval < 0) {
+- TEST_ERROR_LOG(errno);
++ rval *= -1;
++ TEST_ERROR_LOG(rval);
+
+- switch (errno) {
++ switch (rval) {
+ case ENOTDIR:
+ tst_resm(TPASS,
+ "getdents failed as expected with ENOTDIR");
+@@ -180,3 +198,5 @@
+
+ tst_rmdir();
+ }
++
++#endif /* __i386__ */
+diff -urN ltp-full-20120903.orig/testcases/kernel/syscalls/getdents/getdents.h ltp-full-20120903/testcases/kernel/syscalls/getdents/getdents.h
+--- ltp-full-20120903.orig/testcases/kernel/syscalls/getdents/getdents.h 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/syscalls/getdents/getdents.h 2012-10-15 17:05:18.189098682 +0300
+@@ -23,62 +23,25 @@
+
+ #ifndef __GETDENTS_H
+ #define __GETDENTS_H 1
+-
+-#include <dirent.h>
+-#include <stdio.h>
+-#include <string.h>
+-#include <unistd.h>
+ #include <sys/syscall.h>
+
+-/*
+- * The dirent struct that the C library exports is not the same
+- * as the kernel ABI, so we can't include dirent.h and use the
+- * dirent struct from there. Further, since the Linux headers
+- * don't export their vision of the struct either, we have to
+- * declare our own here. Wheeeeee.
+- */
+-
+-struct linux_dirent {
+- unsigned long d_ino;
+- unsigned long d_off;
+- unsigned short d_reclen;
+- char d_name[];
+-};
+-
+-static inline int
+-getdents(unsigned int fd, struct dirent *dirp, unsigned int count)
+-{
+- union {
+- struct linux_dirent *dirp;
+- char *buf;
+- } ptrs;
+- char buf[count];
+- long ret;
+- unsigned int i;
+-
+- ptrs.buf = buf;
+- ret = syscall(SYS_getdents, fd, buf, count);
+- if (ret < 0)
+- return ret;
+-
+-#define kdircpy(field) memcpy(&dirp[i].field, &ptrs.dirp->field, sizeof(dirp[i].field))
+-
+- i = 0;
+- while (i < count && i < ret) {
+- unsigned long reclen;
+-
+- kdircpy(d_ino);
+- kdircpy(d_reclen);
+- reclen = dirp[i].d_reclen;
+- kdircpy(d_off);
+- strcpy(dirp[i].d_name, ptrs.dirp->d_name);
+-
+- ptrs.buf += reclen;
+-
+- i += reclen;
+- }
+-
+- return ret;
+-}
++#ifdef __i386__
++ #define GETDENTS_ASM() ({ int __rval; \
++ __asm__ __volatile__(" \
++ movl %4, %%edx \n \
++ movl %3, %%ecx \n \
++ movl %2, %%ebx \n \
++ movl %1, %%eax \n \
++ int $0x80 \n \
++ movl %%eax, %0" \
++ : "=a" (__rval) \
++ : "a" (cnum), "b" (fd), "c" (dirp), "d" (count)\
++ : "memory" \
++ ); \
++ __rval; \
++ })
++#else
++ #define GETDENTS_ASM() 0
++#endif /* __i386__ */
+
+ #endif /* getdents.h */
+diff -urN ltp-full-20120903.orig/testcases/kernel/syscalls/profil/profil01.c ltp-full-20120903/testcases/kernel/syscalls/profil/profil01.c
+--- ltp-full-20120903.orig/testcases/kernel/syscalls/profil/profil01.c 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/syscalls/profil/profil01.c 2012-10-15 17:05:24.173015806 +0300
+@@ -58,6 +58,8 @@
+
+ #ifdef __arm__
+ #define ADDRESS_OFFSET 0x8000
++#elif defined(__aarch64__)
++#define ADDRESS_OFFSET 0x400000
+ #else
+ #define ADDRESS_OFFSET 0
+ #endif
+diff -urN ltp-full-20120903.orig/testcases/kernel/syscalls/sysctl/sysctl01.c ltp-full-20120903/testcases/kernel/syscalls/sysctl/sysctl01.c
+--- ltp-full-20120903.orig/testcases/kernel/syscalls/sysctl/sysctl01.c 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/syscalls/sysctl/sysctl01.c 2012-10-15 17:05:24.173015806 +0300
+@@ -58,9 +58,13 @@
+ static int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
+ void *newval, size_t newlen)
+ {
++#ifdef __NR__sysctl
+ struct __sysctl_args args =
+ { name, nlen, oldval, oldlenp, newval, newlen };
+ return syscall(__NR__sysctl, &args);
++#else
++ return -ENOSYS;
++#endif
+ }
+
+ #define SIZE(x) sizeof(x)/sizeof(x[0])
+diff -urN ltp-full-20120903.orig/testcases/kernel/syscalls/sysctl/sysctl03.c ltp-full-20120903/testcases/kernel/syscalls/sysctl/sysctl03.c
+--- ltp-full-20120903.orig/testcases/kernel/syscalls/sysctl/sysctl03.c 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/syscalls/sysctl/sysctl03.c 2012-10-15 17:05:24.173015806 +0300
+@@ -78,9 +78,13 @@
+ int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
+ void *newval, size_t newlen)
+ {
++#ifdef __NR__sysctl
+ struct __sysctl_args args =
+ { name, nlen, oldval, oldlenp, newval, newlen };
+ return syscall(__NR__sysctl, &args);
++#else
++ return -ENOSYS;
++#endif
+ }
+
+ #define SIZE(x) sizeof(x)/sizeof(x[0])
+diff -urN ltp-full-20120903.orig/testcases/kernel/syscalls/sysctl/sysctl04.c ltp-full-20120903/testcases/kernel/syscalls/sysctl/sysctl04.c
+--- ltp-full-20120903.orig/testcases/kernel/syscalls/sysctl/sysctl04.c 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/syscalls/sysctl/sysctl04.c 2012-10-15 17:05:24.173015806 +0300
+@@ -59,9 +59,13 @@
+ int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
+ void *newval, size_t newlen)
+ {
++#ifdef __NR__sysctl
+ struct __sysctl_args args =
+ { name, nlen, oldval, oldlenp, newval, newlen };
+ return syscall(__NR__sysctl, &args);
++#else
++ return -ENOSYS;
++#endif
+ }
+
+ #define SIZE(x) sizeof(x)/sizeof(x[0])
+diff -urN ltp-full-20120903.orig/testcases/kernel/syscalls/sysctl/sysctl05.c ltp-full-20120903/testcases/kernel/syscalls/sysctl/sysctl05.c
+--- ltp-full-20120903.orig/testcases/kernel/syscalls/sysctl/sysctl05.c 2012-09-03 07:39:27.000000000 +0300
++++ ltp-full-20120903/testcases/kernel/syscalls/sysctl/sysctl05.c 2012-10-15 17:05:24.173015806 +0300
+@@ -61,9 +61,13 @@
+ int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
+ void *newval, size_t newlen)
+ {
++#ifdef __NR__sysctl
+ struct __sysctl_args args =
+ { name, nlen, oldval, oldlenp, newval, newlen };
+ return syscall(__NR__sysctl, &args);
++#else
++ return -ENOSYS;
++#endif
+ }
+
+ #define SIZE(x) sizeof(x)/sizeof(x[0])
diff --git a/meta-aarch64/recipes-extended/ltp/ltp_20120903.bbappend b/meta-aarch64/recipes-extended/ltp/ltp_20120903.bbappend
new file mode 100644
index 00000000..b0cc8fec
--- /dev/null
+++ b/meta-aarch64/recipes-extended/ltp/ltp_20120903.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI_append = " file://ltp-arm64.patch"
diff --git a/meta-aarch64/recipes-extra/dwarfutils/dwarf.inc b/meta-aarch64/recipes-extra/dwarfutils/dwarf.inc
new file mode 100644
index 00000000..526f096b
--- /dev/null
+++ b/meta-aarch64/recipes-extra/dwarfutils/dwarf.inc
@@ -0,0 +1,12 @@
+DEPENDS = "elfutils"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=db2a565b9d860834e0f2c9cf569fb4e5"
+
+SRC_URI = "http://reality.sgiweb.org/davea/libdwarf-${PV}.tar.gz"
+
+SRC_URI[md5sum] = "83ab49c58439254729f543be6977692b"
+SRC_URI[sha256sum] = "c0aede3a7368c27572ae1cc403c4cbdbf6eeb91a05adbb6f41c40ed78b75cdd9"
+
+S = "${WORKDIR}/dwarf-${PV}/${BPN}"
+
+inherit autotools
diff --git a/meta-aarch64/recipes-extra/dwarfutils/dwarfdump/fix-dump.patch b/meta-aarch64/recipes-extra/dwarfutils/dwarfdump/fix-dump.patch
new file mode 100644
index 00000000..45ca7a83
--- /dev/null
+++ b/meta-aarch64/recipes-extra/dwarfutils/dwarfdump/fix-dump.patch
@@ -0,0 +1,25 @@
+---
+ Makefile.in | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- dwarfdump.orig/Makefile.in
++++ dwarfdump/Makefile.in
+@@ -104,14 +104,18 @@ naming.o: $(srcdir)/naming.c $(srcdir)/
+ # in the tree builds.
+ trivial_naming.o: $(srcdir)/naming.c
+ $(CC) $(CFLAGS) -DTRIVIAL_NAMING -c $(srcdir)/naming.c -o trivial_naming.o
+
+ tag_tree_build: $(srcdir)/tag_tree.c $(DIRINC)/dwarf.h $(HEADERS) tag_common.o makename.o common.o trivial_naming.o
++ifeq ($(NATIVE),1)
+ $(CC) $(CFLAGS) $(srcdir)/tag_tree.c tag_common.o common.o makename.o trivial_naming.o $(LDFLAGS) -o tag_tree_build
++endif
+
+ tag_attr_build: $(srcdir)/tag_attr.c $(DIRINC)/dwarf.h $(HEADERS) tag_common.o makename.o common.o trivial_naming.o
++ifeq ($(NATIVE),1)
+ $(CC) $(CFLAGS) $(srcdir)/tag_attr.c tag_common.o common.o makename.o trivial_naming.o $(LDFLAGS) -o tag_attr_build
++endif
+
+ tmp-tt-table.c tmp-tt-ext-table.c: $(srcdir)/tag_tree_ext.list $(srcdir)/tag_tree.list tag_tree_build
+ # gcc -E tag_tree.list does not work, so use a .c name
+ -rm -f tmp-t1.c
+ cp $(srcdir)/tag_tree.list tmp-t1.c
diff --git a/meta-aarch64/recipes-extra/dwarfutils/dwarfdump2/fix-dump.patch b/meta-aarch64/recipes-extra/dwarfutils/dwarfdump2/fix-dump.patch
new file mode 100644
index 00000000..18ffe812
--- /dev/null
+++ b/meta-aarch64/recipes-extra/dwarfutils/dwarfdump2/fix-dump.patch
@@ -0,0 +1,27 @@
+---
+ Makefile.in | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+--- dwarfdump2.orig/Makefile.in
++++ dwarfdump2/Makefile.in
+@@ -100,14 +100,17 @@ common.o: $(srcdir)/common.cc $(srcdir)
+ # in the tree builds.
+ trivial_naming.o: $(srcdir)/naming.cc
+ $(CXX) $(CXXFLAGS) -DTRIVIAL_NAMING -c $(srcdir)/naming.cc -o trivial_naming.o
+
+ tag_tree_build: $(srcdir)/tag_tree.cc $(DIRINC)/dwarf.h $(HEADERS) tag_common.o trivial_naming.o common.o
+- $(CXX) $(CXXFLAGS) $(srcdir)/tag_tree.cc trivial_naming.o tag_common.o common.o $(LDFLAGS) -o tag_tree_build
+-
++ifeq ($(NATIVE),1)
++ $(CXX) $(CXXFLAGS) $(srcdir)/tag_tree.cc trivial_naming.o tag_common.o common.o $(LDFLAGS) -o tag_tree_build
++endif
+ tag_attr_build: $(srcdir)/tag_attr.cc $(DIRINC)/dwarf.h $(HEADERS) trivial_naming.o tag_common.o naming.o common.o
+- $(CXX) $(CXXFLAGS) $(srcdir)/tag_attr.cc trivial_naming.o tag_common.o common.o $(LDFLAGS) -o tag_attr_build
++ifeq ($(NATIVE),1)
++ $(CXX) $(CXXFLAGS) $(srcdir)/tag_attr.cc trivial_naming.o tag_common.o common.o $(LDFLAGS) -o tag_attr_build
++endif
+
+ tmp-tt-table.cc tmp-tt-ext-table.cc: $(srcdir)/tag_tree_ext.list $(srcdir)/tag_tree.list tag_tree_build
+ # gcc -E tag_tree.list does not work, so use a .cc name
+ -rm -f tmp-t1.cc
+ cp $(srcdir)/tag_tree.list tmp-t1.cc
diff --git a/meta-aarch64/recipes-extra/dwarfutils/dwarfdump2_20121130.bb b/meta-aarch64/recipes-extra/dwarfutils/dwarfdump2_20121130.bb
new file mode 100644
index 00000000..10999d61
--- /dev/null
+++ b/meta-aarch64/recipes-extra/dwarfutils/dwarfdump2_20121130.bb
@@ -0,0 +1,22 @@
+require dwarf.inc
+
+DEPENDS = "libdwarf libdwarf-native"
+
+LIC_FILES_CHKSUM = "file://GPL.txt;md5=751419260aa954499f7abaabaa882bbe"
+
+SRC_URI += "file://fix-dump.patch"
+
+do_compile_prepend() {
+ oe_runmake CXX="${BUILD_CXX}" \
+ CXXFLAGS="${BUILD_CXXFLAGS} -I${S}/../libdwarf/ -I." \
+ LDFLAGS="${BUILD_LDFLAGS} -ldwarf -lelf" NATIVE=1
+ rm *.o dwarfdump
+}
+
+do_install() {
+ install -d ${D}${bindir} ${D}${mandir}/man1
+ install -m 0755 dwarfdump ${D}${bindir}
+ install -m 0644 dwarfdump.1 ${D}${mandir}/man1
+}
+
+PARALLEL_MAKE = ""
diff --git a/meta-aarch64/recipes-extra/dwarfutils/dwarfdump_20121130.bb b/meta-aarch64/recipes-extra/dwarfutils/dwarfdump_20121130.bb
new file mode 100644
index 00000000..1befb314
--- /dev/null
+++ b/meta-aarch64/recipes-extra/dwarfutils/dwarfdump_20121130.bb
@@ -0,0 +1,22 @@
+require dwarf.inc
+
+DEPENDS = "libdwarf libdwarf-native"
+
+LIC_FILES_CHKSUM = "file://GPL.txt;md5=751419260aa954499f7abaabaa882bbe"
+
+SRC_URI += "file://fix-dump.patch"
+
+do_compile_prepend() {
+ oe_runmake CC="${BUILD_CC}" \
+ CFLAGS="${BUILD_CFLAGS} -I${S}/../libdwarf/ -I." \
+ LDFLAGS="${BUILD_LDFLAGS} -ldwarf -lelf" NATIVE=1
+ rm *.o dwarfdump
+}
+
+do_install() {
+ install -d ${D}${bindir} ${D}${mandir}/man1
+ install -m 0755 dwarfdump ${D}${bindir}
+ install -m 0644 dwarfdump.1 ${D}${mandir}/man1
+}
+
+PARALLEL_MAKE = ""
diff --git a/meta-aarch64/recipes-extra/dwarfutils/dwarfgen_20121130.bb b/meta-aarch64/recipes-extra/dwarfutils/dwarfgen_20121130.bb
new file mode 100644
index 00000000..97d3b2fe
--- /dev/null
+++ b/meta-aarch64/recipes-extra/dwarfutils/dwarfgen_20121130.bb
@@ -0,0 +1,13 @@
+require dwarf.inc
+
+DEPENDS = "libdwarf libdwarf-native"
+
+LIC_FILES_CHKSUM = "file://GPL.txt;md5=751419260aa954499f7abaabaa882bbe"
+
+do_install() {
+ install -d ${D}${bindir} ${D}${mandir}/man1
+ install -m 0755 ${BPN} ${D}${bindir}
+ install -m 0644 ${BPN}.1 ${D}${mandir}/man1
+}
+
+PARALLEL_MAKE = ""
diff --git a/meta-aarch64/recipes-extra/dwarfutils/libdwarf/fix-gennames.patch b/meta-aarch64/recipes-extra/dwarfutils/libdwarf/fix-gennames.patch
new file mode 100644
index 00000000..901409d8
--- /dev/null
+++ b/meta-aarch64/recipes-extra/dwarfutils/libdwarf/fix-gennames.patch
@@ -0,0 +1,22 @@
+---
+ Makefile.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- libdwarf.orig/Makefile.in
++++ libdwarf/Makefile.in
+@@ -135,13 +135,13 @@ libdwarf.so: dwarf_names.h dwarf_names.c
+ $(CC) $(CFLAGS) -shared $(OBJS) dwarf_names.o -o $@
+
+ none:
+ echo "do nothing"
+ common.o: $(srcdir)/common.c $(srcdir)/common.h
+- $(CC) $(CFLAGS) -c $(srcdir)/common.c
++ $(BUILD_CC) $(BUILD_CFLAGS) -c $(srcdir)/common.c
+ gennames: $(srcdir)/gennames.c $(srcdir)/dwarf.h common.o
+- $(CC) $(CFLAGS) $(srcdir)/gennames.c common.o $(LDFLAGS) -o gennames
++ $(BUILD_CC) $(BUILD_CFLAGS) $(srcdir)/gennames.c common.o $(BUILD_LDFLAGS) -o gennames
+ dwarf_names.c dwarf_names.h: gennames $(srcdir)/dwarf.h
+ rm -f dwarf_names.h dwarf_names.c
+ ./gennames @dwarf_namestable@ -i $(srcdir) -o .
+
+
diff --git a/meta-aarch64/recipes-extra/dwarfutils/libdwarf_20121130.bb b/meta-aarch64/recipes-extra/dwarfutils/libdwarf_20121130.bb
new file mode 100644
index 00000000..4b59b381
--- /dev/null
+++ b/meta-aarch64/recipes-extra/dwarfutils/libdwarf_20121130.bb
@@ -0,0 +1,13 @@
+require dwarf.inc
+
+SRC_URI += "file://fix-gennames.patch"
+
+do_install() {
+ install -d ${D}${libdir} ${D}${includedir}/libdwarf
+ install -m 0755 libdwarf.a ${D}${libdir}
+ install -m 0644 dwarf.h libdwarf.h ${D}${includedir}/libdwarf
+}
+
+ALLOW_EMPTY_${PN} = "1"
+
+BBCLASSEXTEND = "native"
diff --git a/meta-aarch64/recipes-extra/google-glog/google-glog_svn.bb b/meta-aarch64/recipes-extra/google-glog/google-glog_svn.bb
new file mode 100644
index 00000000..b70aa82e
--- /dev/null
+++ b/meta-aarch64/recipes-extra/google-glog/google-glog_svn.bb
@@ -0,0 +1,17 @@
+DESCRIPTION = "The glog library implements application-level logging. This \
+library provides logging APIs based on C++-style streams and various helper \
+macros."
+HOMEPAGE = "https://code.google.com/p/google-glog/"
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://COPYING;md5=dc9db360e0bbd4e46672f3fd91dd6c4b"
+
+SRC_URI = "svn://google-glog.googlecode.com/svn/;module=trunk;protocol=http"
+
+SRCREV = "${AUTOREV}"
+
+PV = "0.3.2+svn${SRCPV}"
+
+S = "${WORKDIR}/trunk"
+
+inherit autotools pkgconfig
diff --git a/meta-aarch64/recipes-extra/google-perftools/gperftools_2.0.bb b/meta-aarch64/recipes-extra/google-perftools/gperftools_2.0.bb
new file mode 100644
index 00000000..17177529
--- /dev/null
+++ b/meta-aarch64/recipes-extra/google-perftools/gperftools_2.0.bb
@@ -0,0 +1,11 @@
+DESCRIPTION = "Fast, multi-threaded malloc() and nifty performance analysis tools"
+HOMEPAGE = "http://code.google.com/p/gperftools/"
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://COPYING;md5=762732742c73dc6c7fbe8632f06c059a"
+
+SRC_URI = "${DEBIAN_MIRROR}/main/g/google-perftools/google-perftools_${PV}.orig.tar.gz"
+
+SRC_URI[md5sum] = "13f6e8961bc6a26749783137995786b6"
+SRC_URI[sha256sum] = "7de3dd91f018825b1e7d332af1edace15c6211f430186febede1835069861080"
+
+inherit autotools
diff --git a/meta-aarch64/recipes-extra/hiphopvm/files/disable-not-available-for-aarch64.patch b/meta-aarch64/recipes-extra/hiphopvm/files/disable-not-available-for-aarch64.patch
new file mode 100644
index 00000000..3fde2f86
--- /dev/null
+++ b/meta-aarch64/recipes-extra/hiphopvm/files/disable-not-available-for-aarch64.patch
@@ -0,0 +1,21 @@
+---
+ CMake/HPHPFindLibs.cmake | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+--- git.orig/CMake/HPHPFindLibs.cmake
++++ git/CMake/HPHPFindLibs.cmake
+@@ -43,12 +43,12 @@ find_package(Libinotify)
+ if (LIBINOTIFY_INCLUDE_DIR)
+ include_directories(${LIBINOTIFY_INCLUDE_DIR})
+ endif()
+
+ # unwind checks
+-find_package(Libunwind REQUIRED)
+-include_directories(${LIBUNWIND_INCLUDE_DIR})
++# find_package(Libunwind REQUIRED)
++# include_directories(${LIBUNWIND_INCLUDE_DIR})
+
+ # iconv checks
+ find_package(Libiconv REQUIRED)
+ include_directories(${LIBICONV_INCLUDE_DIR})
+ if (LIBICONV_CONST)
diff --git a/meta-aarch64/recipes-extra/hiphopvm/hiphopvm_git.bb b/meta-aarch64/recipes-extra/hiphopvm/hiphopvm_git.bb
new file mode 100644
index 00000000..d837dcbd
--- /dev/null
+++ b/meta-aarch64/recipes-extra/hiphopvm/hiphopvm_git.bb
@@ -0,0 +1,61 @@
+DEPENDS = " \
+binutils \
+bison-native \
+boost \
+bzip2 \
+cmake \
+elfutils \
+expat \
+flex-native \
+gd \
+google-glog \
+icu \
+libcap \
+libc-client \
+libdwarf \
+libevent-fb \
+libmcrypt \
+libmemcached \
+libxml2 \
+mysql5 \
+ncurses \
+onig \
+openldap \
+openssl \
+libpam \
+pcre \
+readline \
+zlib \
+tbb \
+"
+
+# optional (for now) dependencies:
+#DEPENDS += "libunwind google-perftools"
+
+LICENSE = "PHP Zend"
+
+LIC_FILES_CHKSUM = " \
+ file://LICENSE.PHP;md5=cb564efdf78cce8ea6e4b5a4f7c05d97 \
+ file://LICENSE.ZEND;md5=69e7a9c51846dd6692f1b946f95f6c60"
+
+SRC_URI = "git://github.com/facebook/hiphop-php.git \
+ file://disable-not-available-for-aarch64.patch"
+
+SRCREV = "${AUTOREV}"
+
+S = "${WORKDIR}/git"
+
+PV = "0.0+git${SRCPV}"
+PR = "r1"
+
+do_configure_prepend() {
+ export HPHP_HOME="${B}"
+ export HPHP_LIB="${B}"/bin
+ export USE_HHVM=1
+ export BOOST_INCLUDEDIR=${STAGING_INCDIR}
+ export BOOST_LIBRARYDIR=${STAGING_LIBDIR}
+ export LIBGLOG_INCLUDE_DIR=${STAGING_INCDIR}
+ export LIBGLOG_LIBRARY=${STAGING_LIBDIR}
+}
+
+inherit cmake
diff --git a/meta-aarch64/recipes-extra/libevent/files/LICENSE.txt b/meta-aarch64/recipes-extra/libevent/files/LICENSE.txt
new file mode 100644
index 00000000..5a315e47
--- /dev/null
+++ b/meta-aarch64/recipes-extra/libevent/files/LICENSE.txt
@@ -0,0 +1,74 @@
+Libevent is available for use under the following license, commonly known
+as the 3-clause (or "modified") BSD license:
+
+==============================
+Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
+Copyright (c) 2007-2010 Niels Provos and Nick Mathewson
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+==============================
+
+Portions of Libevent are based on works by others, also made available by
+them under the three-clause BSD license above. The copyright notices are
+available in the corresponding source files; the license is as above. Here's
+a list:
+
+log.c:
+ Copyright (c) 2000 Dug Song <dugsong@monkey.org>
+ Copyright (c) 1993 The Regents of the University of California.
+
+strlcpy.c:
+ Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+
+win32select.c:
+ Copyright (c) 2003 Michael A. Davis <mike@datanerds.net>
+
+evport.c:
+ Copyright (c) 2007 Sun Microsystems
+
+ht-internal.h:
+ Copyright (c) 2002 Christopher Clark
+
+minheap-internal.h:
+ Copyright (c) 2006 Maxim Yegorushkin <maxim.yegorushkin@gmail.com>
+
+==============================
+
+The arc4module is available under the following, sometimes called the
+"OpenBSD" license:
+
+ Copyright (c) 1996, David Mazieres <dm@uun.org>
+ Copyright (c) 2008, Damien Miller <djm@openbsd.org>
+
+ Permission to use, copy, modify, and distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
diff --git a/meta-aarch64/recipes-extra/libevent/files/libevent-1.4.14.fb-changes.diff b/meta-aarch64/recipes-extra/libevent/files/libevent-1.4.14.fb-changes.diff
new file mode 100644
index 00000000..0f29aac2
--- /dev/null
+++ b/meta-aarch64/recipes-extra/libevent/files/libevent-1.4.14.fb-changes.diff
@@ -0,0 +1,611 @@
+diff --git a/event.c b/event.c
+index 74ba5c4..06984b8 100644
+--- a/event.c
++++ b/event.c
+@@ -138,10 +138,12 @@ detect_monotonic(void)
+ static int
+ gettime(struct event_base *base, struct timeval *tp)
+ {
++/*
+ if (base->tv_cache.tv_sec) {
+ *tp = base->tv_cache;
+ return (0);
+ }
++*/
+
+ #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
+ if (use_monotonic) {
+@@ -481,7 +483,7 @@ event_base_loop(struct event_base *base, int flags)
+ int res, done;
+
+ /* clear time cache */
+- base->tv_cache.tv_sec = 0;
++ /* base->tv_cache.tv_sec = 0; */
+
+ if (base->sig.ev_signal_added)
+ evsignal_base = base;
+@@ -533,13 +535,13 @@ event_base_loop(struct event_base *base, int flags)
+ gettime(base, &base->event_tv);
+
+ /* clear time cache */
+- base->tv_cache.tv_sec = 0;
++ /* base->tv_cache.tv_sec = 0; */
+
+ res = evsel->dispatch(base, evbase, tv_p);
+
+ if (res == -1)
+ return (-1);
+- gettime(base, &base->tv_cache);
++ /* gettime(base, &base->tv_cache); */
+
+ timeout_process(base);
+
+@@ -552,7 +554,7 @@ event_base_loop(struct event_base *base, int flags)
+ }
+
+ /* clear time cache */
+- base->tv_cache.tv_sec = 0;
++ /* base->tv_cache.tv_sec = 0; */
+
+ event_debug(("%s: asked to terminate loop.", __func__));
+ return (0);
+diff --git a/evhttp.h b/evhttp.h
+index 7ddf720..13c8b79 100644
+--- a/evhttp.h
++++ b/evhttp.h
+@@ -81,12 +81,50 @@ struct evhttp *evhttp_new(struct event_base *base);
+ * @param http a pointer to an evhttp object
+ * @param address a string containing the IP address to listen(2) on
+ * @param port the port number to listen on
+- * @return a newly allocated evhttp struct
++ * @return 0 on success, -1 on error
+ * @see evhttp_free()
+ */
+ int evhttp_bind_socket(struct evhttp *http, const char *address, u_short port);
+
+ /**
++ * Binds an HTTP server on the specified address and port, using backlog.
++ *
++ * Can be called multiple times to bind the same http server
++ * to multiple different ports.
++ *
++ * @param http a pointer to an evhttp object
++ * @param address a string containing the IP address to listen(2) on
++ * @param port the port number to listen on
++ * @param backlog the backlog value for listen(2)
++ * @return 0 on success, -1 on error
++ * @see evhttp_free()
++ */
++int evhttp_bind_socket_backlog(struct evhttp *http, const char *address, u_short port, int backlog);
++
++/**
++ * Like evhttp_bind_socket(), but returns the socket file descriptor.
++ *
++ * @param http a pointer to an evhttp object
++ * @param address a string containing the IP address to listen(2) on
++ * @param port the port number to listen on
++ * @return Socket file descriptor on success, -1 on failure
++ * @see evhttp_bind_socket()
++ */
++int evhttp_bind_socket_with_fd(struct evhttp *http, const char *address, u_short port);
++
++/**
++ * Like evhttp_bind_socket(), but returns the socket file descriptor.
++ *
++ * @param http a pointer to an evhttp object
++ * @param address a string containing the IP address to listen(2) on
++ * @param port the port number to listen on
++ * @param backlog the backlog value for listen(2)
++ * @return Socket file descriptor on success, -1 on failure
++ * @see evhttp_bind_socket()
++ */
++int evhttp_bind_socket_backlog_fd(struct evhttp *http, const char *address, u_short port, int backlog);
++
++/**
+ * Makes an HTTP server accept connections on the specified socket
+ *
+ * This may be useful to create a socket and then fork multiple instances
+@@ -105,6 +143,21 @@ int evhttp_bind_socket(struct evhttp *http, const char *address, u_short port);
+ int evhttp_accept_socket(struct evhttp *http, int fd);
+
+ /**
++ * Makes an HTTP server stop accepting connections on the specified socket
++ *
++ * This may be useful when a socket has been sent via file descriptor passing
++ * and is no longer needed by the current process.
++ *
++ * This function does not close the socket.
++ *
++ * @param http a pointer to an evhttp object
++ * @param fd a socket fd that is currently accepting connections
++ * @return 0 on success, -1 on failure.
++ * @see evhttp_accept_socket()
++ */
++int evhttp_del_accept_socket(struct evhttp *http, int fd);
++
++/**
+ * Free the previously created HTTP server.
+ *
+ * Works only if no requests are currently being served.
+@@ -134,6 +187,28 @@ void evhttp_set_gencb(struct evhttp *,
+ */
+ void evhttp_set_timeout(struct evhttp *, int timeout_in_secs);
+
++/**
++ * Limit the number of simultaneous connections via this http instance.
++ *
++ * @param http an evhttp object
++ * @param nlimit the maximum number of connections, zero is unlimited
++ */
++int evhttp_set_connection_limit(struct evhttp *http, int nlimit);
++
++/**
++ * Return the maximum number of connections allowed for this instance.
++ *
++ * @param http an evhttp object
++ */
++int evhttp_get_connection_limit(struct evhttp *http);
++
++/**
++ * Return the number of connections in this instance.
++ *
++ * @param http an evhttp object
++ */
++int evhttp_get_connection_count(struct evhttp *http);
++
+ /* Request/Response functionality */
+
+ /**
+@@ -157,6 +232,19 @@ void evhttp_send_error(struct evhttp_request *req, int error,
+ void evhttp_send_reply(struct evhttp_request *req, int code,
+ const char *reason, struct evbuffer *databuf);
+
++/**
++ * Send an HTML reply synchronously as much as possible by calling _begin().
++ * Great for a worker thread to send the reply immediately without queuing up
++ * events back to the loop. Call _end() to send the rest of the packet from
++ * event loop.
++ *
++ * When _begin() returns needs to be fed into _end() as the 1st parameter
++ * "nwritten".
++ */
++int evhttp_send_reply_sync_begin(struct evhttp_request *req, int code,
++ const char *reason, struct evbuffer *databuf);
++void evhttp_send_reply_sync_end(int nwritten, struct evhttp_request *req);
++
+ /* Low-level response interface, for streaming/chunked replies */
+ void evhttp_send_reply_start(struct evhttp_request *, int, const char *);
+ void evhttp_send_reply_chunk(struct evhttp_request *, struct evbuffer *);
+@@ -210,6 +298,7 @@ struct {
+
+ enum evhttp_request_kind kind;
+ enum evhttp_cmd_type type;
++ char *ext_method; /* webdav methods, for example */
+
+ char *uri; /* uri after HTTP request was parsed */
+
+@@ -224,6 +313,8 @@ struct {
+ int chunked:1, /* a chunked request */
+ userdone:1; /* the user has sent all data */
+
++ int referenced;
++
+ struct evbuffer *output_buffer; /* outgoing post or data */
+
+ /* Callback */
+diff --git a/http-internal.h b/http-internal.h
+index 9cd03cd..3f60f54 100644
+--- a/http-internal.h
++++ b/http-internal.h
+@@ -116,6 +116,9 @@ struct evhttp {
+ TAILQ_HEAD(httpcbq, evhttp_cb) callbacks;
+ struct evconq connections;
+
++ int connection_count;
++ int connection_limit;
++
+ int timeout;
+
+ void (*gencb)(struct evhttp_request *req, void *);
+diff --git a/http.c b/http.c
+index efcec40..e10d114 100644
+--- a/http.c
++++ b/http.c
+@@ -219,6 +219,13 @@ static int evhttp_decode_uri_internal(const char *uri, size_t length,
+ void evhttp_read(int, short, void *);
+ void evhttp_write(int, short, void *);
+
++
++void evhttp_server_drop_connection(struct evhttp_connection *evcon);
++void evhttp_server_add_connection(struct evhttp *http,
++ struct evhttp_connection *evcon);
++void evhttp_pause(struct evhttp *http);
++void evhttp_resume(struct evhttp *http);
++
+ #ifndef HAVE_STRSEP
+ /* strsep replacement for platforms that lack it. Only works if
+ * del is one character long. */
+@@ -478,7 +485,6 @@ evhttp_make_header_response(struct evhttp_connection *evcon,
+ evhttp_add_header(req->output_headers,
+ "Connection", "keep-alive");
+
+- if (req->minor == 1 || is_keepalive) {
+ /*
+ * we need to add the content length if the
+ * user did not give it, this is required for
+@@ -488,7 +494,6 @@ evhttp_make_header_response(struct evhttp_connection *evcon,
+ req->output_headers,
+ (long)EVBUFFER_LENGTH(req->output_buffer));
+ }
+- }
+
+ /* Potentially add headers for unidentified content. */
+ if (EVBUFFER_LENGTH(req->output_buffer)) {
+@@ -687,14 +692,14 @@ void
+ evhttp_write(int fd, short what, void *arg)
+ {
+ struct evhttp_connection *evcon = arg;
+- int n;
+
+ if (what == EV_TIMEOUT) {
+ evhttp_connection_fail(evcon, EVCON_HTTP_TIMEOUT);
+ return;
+ }
+
+- n = evbuffer_write(evcon->output_buffer, fd);
++ if (EVBUFFER_LENGTH(evcon->output_buffer) != 0) {
++ int n = evbuffer_write(evcon->output_buffer, fd);
+ if (n == -1) {
+ event_debug(("%s: evbuffer_write", __func__));
+ evhttp_connection_fail(evcon, EVCON_HTTP_EOF);
+@@ -706,6 +711,7 @@ evhttp_write(int fd, short what, void *arg)
+ evhttp_connection_fail(evcon, EVCON_HTTP_EOF);
+ return;
+ }
++ }
+
+ if (EVBUFFER_LENGTH(evcon->output_buffer) != 0) {
+ evhttp_add_event(&evcon->ev,
+@@ -1012,11 +1018,9 @@ evhttp_connection_free(struct evhttp_connection *evcon)
+ TAILQ_REMOVE(&evcon->requests, req, next);
+ evhttp_request_free(req);
+ }
+-
+- if (evcon->http_server != NULL) {
+- struct evhttp *http = evcon->http_server;
+- TAILQ_REMOVE(&http->connections, evcon, next);
+- }
++
++ if (evcon->http_server != NULL)
++ evhttp_server_drop_connection(evcon);
+
+ if (event_initialized(&evcon->close_ev))
+ event_del(&evcon->close_ev);
+@@ -1101,10 +1105,16 @@ evhttp_connection_reset(struct evhttp_connection *evcon)
+ }
+ evcon->state = EVCON_DISCONNECTED;
+
+- evbuffer_drain(evcon->input_buffer,
+- EVBUFFER_LENGTH(evcon->input_buffer));
+- evbuffer_drain(evcon->output_buffer,
+- EVBUFFER_LENGTH(evcon->output_buffer));
++ /*
++ * These can grow quite large if processing a large photo or video
++ * upload/download. Instead of keeping the buffers around, just
++ * free and allocate new.
++ */
++ evbuffer_free(evcon->input_buffer);
++ evcon->input_buffer = evbuffer_new();
++
++ evbuffer_free(evcon->output_buffer);
++ evcon->output_buffer = evbuffer_new();
+ }
+
+ static void
+@@ -1278,19 +1288,52 @@ evhttp_parse_request_line(struct evhttp_request *req, char *line)
+ if (line == NULL)
+ return (-1);
+ uri = strsep(&line, " ");
+- if (line == NULL)
+- return (-1);
++ if (line == NULL) {
++ version = "HTTP/1.0";
++ } else {
+ version = strsep(&line, " ");
+ if (line != NULL)
+ return (-1);
++ }
+
+ /* First line */
++ req->ext_method = NULL;
+ if (strcmp(method, "GET") == 0) {
+ req->type = EVHTTP_REQ_GET;
+ } else if (strcmp(method, "POST") == 0) {
+ req->type = EVHTTP_REQ_POST;
+ } else if (strcmp(method, "HEAD") == 0) {
+ req->type = EVHTTP_REQ_HEAD;
++ } else if (strcmp(method, "OPTIONS") == 0) {
++ req->type = EVHTTP_REQ_POST;
++ req->ext_method = "OPTIONS";
++ } else if (strcmp(method, "REPORT") == 0) {
++ req->type = EVHTTP_REQ_POST;
++ req->ext_method = "REPORT";
++ } else if (strcmp(method, "PROPFIND") == 0) {
++ req->type = EVHTTP_REQ_POST;
++ req->ext_method = "PROPFIND";
++ } else if (strcmp(method, "PROPPATH") == 0) {
++ req->type = EVHTTP_REQ_POST;
++ req->ext_method = "PROPPATH";
++ } else if (strcmp(method, "MKCOL") == 0) {
++ req->type = EVHTTP_REQ_POST;
++ req->ext_method = "MKCOL";
++ } else if (strcmp(method, "MKCALENDAR") == 0) {
++ req->type = EVHTTP_REQ_POST;
++ req->ext_method = "MKCALENDAR";
++ } else if (strcmp(method, "PUT") == 0) {
++ req->type = EVHTTP_REQ_POST;
++ req->ext_method = "PUT";
++ } else if (strcmp(method, "DELETE") == 0) {
++ req->type = EVHTTP_REQ_POST;
++ req->ext_method = "DELETE";
++ } else if (strcmp(method, "LOCK") == 0) {
++ req->type = EVHTTP_REQ_POST;
++ req->ext_method = "LOCK";
++ } else if (strcmp(method, "UNLOCK") == 0) {
++ req->type = EVHTTP_REQ_POST;
++ req->ext_method = "UNLOCK";
+ } else {
+ event_debug(("%s: bad method %s on request %p from %s",
+ __func__, method, req, req->remote_host));
+@@ -1963,10 +2006,44 @@ evhttp_send_reply(struct evhttp_request *req, int code, const char *reason,
+ evhttp_send(req, databuf);
+ }
+
++int
++evhttp_send_reply_sync_begin(struct evhttp_request *req, int code,
++ const char *reason, struct evbuffer *databuf) {
++ evhttp_response_code(req, code, reason);
++ struct evhttp_connection *evcon = req->evcon;
++
++ assert(TAILQ_FIRST(&evcon->requests) == req);
++
++ /* xxx: not sure if we really should expose the data buffer this way */
++ if (databuf != NULL)
++ evbuffer_add_buffer(req->output_buffer, databuf);
++
++ /* Adds headers to the response */
++ evhttp_make_header(evcon, req);
++
++ return evbuffer_write(evcon->output_buffer, evcon->fd);
++}
++
++void
++evhttp_send_reply_sync_end(int nwritten, struct evhttp_request *req) {
++ struct evhttp_connection *evcon = req->evcon;
++
++ if (nwritten <= 0) {
++ evhttp_connection_fail(evcon, EVCON_HTTP_EOF);
++ } else if (EVBUFFER_LENGTH(evcon->output_buffer) == 0) {
++ evhttp_send_done(evcon, NULL);
++ } else {
++ evhttp_write_buffer(evcon, evhttp_send_done, NULL);
++ }
++}
++
++
+ void
+ evhttp_send_reply_start(struct evhttp_request *req, int code,
+ const char *reason)
+ {
++ req->referenced = 1;
++
+ evhttp_response_code(req, code, reason);
+ if (req->major == 1 && req->minor == 1) {
+ /* use chunked encoding for HTTP/1.1 */
+@@ -1986,6 +2063,8 @@ evhttp_send_reply_chunk(struct evhttp_request *req, struct evbuffer *databuf)
+ if (evcon == NULL)
+ return;
+
++ if (req->referenced < 0) return;
++
+ if (req->chunked) {
+ evbuffer_add_printf(evcon->output_buffer, "%x\r\n",
+ (unsigned)EVBUFFER_LENGTH(databuf));
+@@ -2007,7 +2086,14 @@ evhttp_send_reply_end(struct evhttp_request *req)
+ return;
+ }
+
+- /* we expect no more calls form the user on this request */
++ if (req->referenced < 0) {
++ req->referenced = 0;
++ evhttp_request_free(req);
++ return;
++ }
++ req->referenced = 0;
++
++ /* we expect no more calls form the user on this request */
+ req->userdone = 1;
+
+ if (req->chunked) {
+@@ -2293,7 +2379,8 @@ accept_socket(int fd, short what, void *arg)
+ }
+
+ int
+-evhttp_bind_socket(struct evhttp *http, const char *address, u_short port)
++evhttp_bind_socket_backlog_fd(struct evhttp *http, const char *address,
++ u_short port, int backlog)
+ {
+ int fd;
+ int res;
+@@ -2301,7 +2388,7 @@ evhttp_bind_socket(struct evhttp *http, const char *address, u_short port)
+ if ((fd = bind_socket(address, port, 1 /*reuse*/)) == -1)
+ return (-1);
+
+- if (listen(fd, 128) == -1) {
++ if (listen(fd, backlog) == -1) {
+ event_warn("%s: listen", __func__);
+ EVUTIL_CLOSESOCKET(fd);
+ return (-1);
+@@ -2309,13 +2396,42 @@ evhttp_bind_socket(struct evhttp *http, const char *address, u_short port)
+
+ res = evhttp_accept_socket(http, fd);
+
+- if (res != -1)
++ if (res != -1) {
+ event_debug(("Bound to port %d - Awaiting connections ... ",
+ port));
++ return (fd);
++ }
+
+ return (res);
+ }
+
++static int
++mask_fd(int fd)
++{
++ return fd > 0 ? 0 : fd;
++}
++
++int
++evhttp_bind_socket(struct evhttp *http, const char *address, u_short port)
++{
++ return mask_fd(evhttp_bind_socket_backlog_fd(http, address, port, 128));
++}
++
++int
++evhttp_bind_socket_with_fd(struct evhttp *http, const char *address,
++ u_short port)
++{
++ return evhttp_bind_socket_backlog_fd(http, address, port, 128);
++}
++
++int
++evhttp_bind_socket_backlog(struct evhttp *http, const char *address,
++ u_short port, int backlog)
++{
++ return mask_fd(
++ evhttp_bind_socket_backlog_fd(http, address, port, backlog));
++}
++
+ int
+ evhttp_accept_socket(struct evhttp *http, int fd)
+ {
+@@ -2345,6 +2461,25 @@ evhttp_accept_socket(struct evhttp *http, int fd)
+ return (0);
+ }
+
++int
++evhttp_del_accept_socket(struct evhttp *http, int fd)
++{
++ struct evhttp_bound_socket *bound;
++ TAILQ_FOREACH(bound, &http->sockets, next) {
++ if (bound->bind_ev.ev_fd == fd)
++ break;
++ }
++
++ if (bound == NULL)
++ return (-1);
++
++ TAILQ_REMOVE(&http->sockets, bound, next);
++ event_del(&bound->bind_ev);
++ free(bound);
++
++ return (0);
++}
++
+ static struct evhttp*
+ evhttp_new_object(void)
+ {
+@@ -2527,6 +2662,11 @@ evhttp_request_new(void (*cb)(struct evhttp_request *, void *), void *arg)
+ void
+ evhttp_request_free(struct evhttp_request *req)
+ {
++ if (req->referenced) {
++ req->referenced = -1;
++ return;
++ }
++
+ if (req->remote_host != NULL)
+ free(req->remote_host);
+ if (req->uri != NULL)
+@@ -2657,13 +2797,78 @@ evhttp_get_request(struct evhttp *http, int fd,
+ * if we want to accept more than one request on a connection,
+ * we need to know which http server it belongs to.
+ */
+- evcon->http_server = http;
+- TAILQ_INSERT_TAIL(&http->connections, evcon, next);
++
++ evhttp_server_add_connection(http, evcon);
+
+ if (evhttp_associate_new_request_with_connection(evcon) == -1)
+ evhttp_connection_free(evcon);
+ }
+
++void
++evhttp_pause(struct evhttp *http)
++{
++ struct evhttp_bound_socket *bound;
++ TAILQ_FOREACH(bound, &http->sockets, next) {
++ event_del(&bound->bind_ev);
++ }
++}
++
++void
++evhttp_resume(struct evhttp *http)
++{
++ struct evhttp_bound_socket *bound;
++ TAILQ_FOREACH(bound, &http->sockets, next) {
++ event_add(&bound->bind_ev, 0);
++ }
++}
++
++int
++evhttp_get_connection_limit(struct evhttp *http)
++{
++ return http->connection_limit;
++}
++
++int
++evhttp_set_connection_limit(struct evhttp *http, int nlimit)
++{
++ int olimit = http->connection_limit;
++ http->connection_limit = nlimit;
++ return olimit;
++}
++
++int
++evhttp_get_connection_count(struct evhttp *http)
++{
++ return http != NULL ? http->connection_count : 0;
++}
++
++void
++evhttp_server_add_connection(struct evhttp *http,
++ struct evhttp_connection *evcon)
++{
++ evcon->http_server = http;
++ TAILQ_INSERT_TAIL(&http->connections, evcon, next);
++
++ http->connection_count++;
++ if (http->connection_limit > 0
++ && http->connection_count >= http->connection_limit)
++ {
++ evhttp_pause(http);
++ }
++}
++
++void
++evhttp_server_drop_connection(struct evhttp_connection *evcon)
++{
++ struct evhttp *http = evcon->http_server;
++ TAILQ_REMOVE(&http->connections, evcon, next);
++ http->connection_count--;
++ if (http->connection_limit > 0
++ && http->connection_count < http->connection_limit)
++ {
++ evhttp_resume(http);
++ }
++}
+
+ /*
+ * Network helper functions that we do not want to export to the rest of
diff --git a/meta-aarch64/recipes-extra/libevent/libevent-fb_1.4.14b.bb b/meta-aarch64/recipes-extra/libevent/libevent-fb_1.4.14b.bb
new file mode 100644
index 00000000..fda03907
--- /dev/null
+++ b/meta-aarch64/recipes-extra/libevent/libevent-fb_1.4.14b.bb
@@ -0,0 +1,20 @@
+require recipes-support/libevent/libevent_2.0.21.bb
+
+PROVIDES = "libevent"
+
+INC_PR = "1"
+
+SRC_URI = "http://github.com/downloads/libevent/libevent/libevent-${PV}-stable.tar.gz;name=archive \
+ http://libevent.org/LICENSE.txt;name=license \
+ file://libevent-1.4.14.fb-changes.diff"
+
+SRC_URI[archive.md5sum] = "a00e037e4d3f9e4fe9893e8a2d27918c"
+SRC_URI[archive.sha256sum] = "afa61b476a222ba43fc7cca2d24849ab0bbd940124400cb699915d3c60e46301"
+
+SRC_URI[license.md5sum] = "412e611443304db6a338ab32728ae297"
+SRC_URI[license.sha256sum] = "55739d5492273a7058c66b682012330a84c34eaa666f5c7030b0312573235270"
+
+
+S = "${WORKDIR}/libevent-${PV}-stable/"
+
+LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE.txt;md5=412e611443304db6a338ab32728ae297"
diff --git a/meta-aarch64/recipes-extra/libmcrypt/libmcrypt_2.5.8.bb b/meta-aarch64/recipes-extra/libmcrypt/libmcrypt_2.5.8.bb
new file mode 100644
index 00000000..0cbe189f
--- /dev/null
+++ b/meta-aarch64/recipes-extra/libmcrypt/libmcrypt_2.5.8.bb
@@ -0,0 +1,22 @@
+DESCRIPTION = "Replacement for the old crypt() package and crypt(1) command, with extensions."
+HOMEPAGE = "http://mcrypt.sourceforge.net/"
+LICENSE = "LGPLv2.1"
+LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/project/mcrypt/Libmcrypt/${PV}/libmcrypt-${PV}.tar.gz"
+
+SRC_URI[md5sum] = "0821830d930a86a5c69110837c55b7da"
+SRC_URI[sha256sum] = "e4eb6c074bbab168ac47b947c195ff8cef9d51a211cdd18ca9c9ef34d27a373e"
+
+inherit autotools gettext binconfig
+
+do_configure() {
+ gnu-configize --force
+# libtoolize --force --copy
+ autoconf
+ oe_runconf
+}
+
+do_install_append() {
+ rm ${D}${libdir}/libmcrypt -r
+}
diff --git a/meta-aarch64/recipes-extra/libmemcached/libmemcached.inc b/meta-aarch64/recipes-extra/libmemcached/libmemcached.inc
new file mode 100644
index 00000000..448a15d0
--- /dev/null
+++ b/meta-aarch64/recipes-extra/libmemcached/libmemcached.inc
@@ -0,0 +1,10 @@
+DESCRIPTION = "open source C/C++ client library and tools for the memcached server"
+DEPENDS = "libevent util-linux"
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://COPYING;md5=865490941c91ba790f0ea78dec93bd60"
+
+SRC_URI = "http://launchpad.net/libmemcached/1.0/${PV}/+download/libmemcached-${PV}.tar.gz"
+
+TARGET_LDFLAGS += "-luuid"
+
+inherit autotools gettext pkgconfig
diff --git a/meta-aarch64/recipes-extra/libmemcached/libmemcached_1.0.7.bb b/meta-aarch64/recipes-extra/libmemcached/libmemcached_1.0.7.bb
new file mode 100644
index 00000000..0aa30505
--- /dev/null
+++ b/meta-aarch64/recipes-extra/libmemcached/libmemcached_1.0.7.bb
@@ -0,0 +1,8 @@
+require libmemcached.inc
+
+SRC_URI[md5sum] = "d59a462a92d296f76bff2d9bc72b2516"
+SRC_URI[sha256sum] = "3efa86c9733eaad55d7119cb16769424e2aa6c22b3392e8f973946fce6678d81"
+
+do_configure_prepend_aarch64() {
+ export ac_cv_c_endian=little
+}
diff --git a/meta-aarch64/recipes-extra/libunwind/files/aarch64.patch b/meta-aarch64/recipes-extra/libunwind/files/aarch64.patch
new file mode 100644
index 00000000..9ea8d832
--- /dev/null
+++ b/meta-aarch64/recipes-extra/libunwind/files/aarch64.patch
@@ -0,0 +1,19 @@
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- libunwind-1.1.orig/configure.ac
++++ libunwind-1.1/configure.ac
+@@ -135,11 +135,11 @@ AM_CONDITIONAL(OS_HPUX, expr x$target_os
+ AM_CONDITIONAL(OS_FREEBSD, expr x$target_os : xfreebsd >/dev/null)
+
+ AC_MSG_CHECKING([for ELF helper width])
+ case "${target_arch}" in
+ (arm|hppa|ppc32|x86|sh) use_elf32=yes; AC_MSG_RESULT([32]);;
+-(ia64|ppc64|x86_64) use_elf64=yes; AC_MSG_RESULT([64]);;
++(ia64|ppc64|x86_64|aarch64) use_elf64=yes; AC_MSG_RESULT([64]);;
+ (mips) use_elfxx=yes; AC_MSG_RESULT([xx]);;
+ *) AC_MSG_ERROR([Unknown ELF target: ${target_arch}])
+ esac
+ AM_CONDITIONAL(USE_ELF32, [test x$use_elf32 = xyes])
+ AM_CONDITIONAL(USE_ELF64, [test x$use_elf64 = xyes])
diff --git a/meta-aarch64/recipes-extra/libunwind/libunwind.inc b/meta-aarch64/recipes-extra/libunwind/libunwind.inc
new file mode 100644
index 00000000..f028766b
--- /dev/null
+++ b/meta-aarch64/recipes-extra/libunwind/libunwind.inc
@@ -0,0 +1,12 @@
+DESCRIPTION = "a portable and efficient C programming interface (API) to determine the call-chain of a program"
+HOMEPAGE = "http://www.nongnu.org/libunwind"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=3fced11d6df719b47505837a51c16ae5"
+
+SRC_URI = "http://download.savannah.nongnu.org/releases/${BPN}/${BPN}-${PV}.tar.gz"
+
+inherit autotools
+
+EXTRA_OECONF_arm = "--enable-debug-frame"
+
+BBCLASSEXTEND = "native"
diff --git a/meta-aarch64/recipes-extra/libunwind/libunwind_1.1.bb b/meta-aarch64/recipes-extra/libunwind/libunwind_1.1.bb
new file mode 100644
index 00000000..2cca1f89
--- /dev/null
+++ b/meta-aarch64/recipes-extra/libunwind/libunwind_1.1.bb
@@ -0,0 +1,8 @@
+require libunwind.inc
+
+PR = "r1"
+
+SRC_URI += "file://aarch64.patch"
+
+SRC_URI[md5sum] = "fb4ea2f6fbbe45bf032cd36e586883ce"
+SRC_URI[sha256sum] = "9dfe0fcae2a866de9d3942c66995e4b460230446887dbdab302d41a8aee8d09a"
diff --git a/meta-aarch64/recipes-extra/memcached/memcached_1.4.15.bb b/meta-aarch64/recipes-extra/memcached/memcached_1.4.15.bb
new file mode 100644
index 00000000..b6d436e2
--- /dev/null
+++ b/meta-aarch64/recipes-extra/memcached/memcached_1.4.15.bb
@@ -0,0 +1,19 @@
+DESCRIPTION = "Free & open source, high-performance, distributed memory object \
+caching system, generic in nature, but intended for use in speeding up dynamic \
+web applications by alleviating database load."
+HOMEPAGE = "http://memcached.org/"
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://COPYING;md5=7e5ded7363d335e1bb18013ca08046ff"
+
+SRC_URI = "http://memcached.googlecode.com/files/memcached-${PV}.tar.gz"
+
+SRC_URI[md5sum] = "36ea966f5a29655be1746bf4949f7f69"
+SRC_URI[sha256sum] = "169721ab7a7531add6ae9f6b14b6b5641725fe0b1f0bdf5c3a4327725901e2b4"
+
+DEPENDS = "libevent"
+
+inherit autotools
+
+do_configure_prepend_aarch64() {
+ export ac_cv_c_endian=little
+}
diff --git a/meta-aarch64/recipes-extra/meta-toolchain-hhvm/meta-toolchain-hhvm.bb b/meta-aarch64/recipes-extra/meta-toolchain-hhvm/meta-toolchain-hhvm.bb
new file mode 100644
index 00000000..bcb84a58
--- /dev/null
+++ b/meta-aarch64/recipes-extra/meta-toolchain-hhvm/meta-toolchain-hhvm.bb
@@ -0,0 +1,4 @@
+TOOLCHAIN_TARGET_TASK = "packagegroup-core-standalone-hhvm-sdk-target"
+TOOLCHAIN_OUTPUTNAME = "${SDK_NAME}-toolchain-hhvm-${DISTRO_VERSION}"
+PROVIDES = "meta-toolchain-sdk"
+require recipes-core/meta/meta-toolchain.bb
diff --git a/meta-aarch64/recipes-extra/meta-toolchain-hhvm/packagegroup-core-standalone-hhvm-sdk-target.bb b/meta-aarch64/recipes-extra/meta-toolchain-hhvm/packagegroup-core-standalone-hhvm-sdk-target.bb
new file mode 100644
index 00000000..0c36439b
--- /dev/null
+++ b/meta-aarch64/recipes-extra/meta-toolchain-hhvm/packagegroup-core-standalone-hhvm-sdk-target.bb
@@ -0,0 +1,55 @@
+SUMMARY = "HipHop VM porting SDK (target tools)"
+LICENSE = "MIT"
+
+inherit packagegroup
+
+RDEPENDS_${PN} = "\
+ packagegroup-core-standalone-sdk-target \
+ binutils-dev \
+ binutils-staticdev \
+ bison \
+ boost-dev \
+ boost-staticdev \
+ boost \
+ bzip2-dev \
+ cmake \
+ curl-dev \
+ elfutils-dev \
+ elfutils-staticdev \
+ expat \
+ flex \
+ gd-dev \
+ gd-staticdev \
+ google-glog-dev \
+ icu-dev \
+ libcap-dev \
+ libcap-staticdev \
+ libc-client-dev \
+ libc-client-staticdev \
+ libdwarf-dev \
+ libdwarf-staticdev \
+ libevent-fb-dev \
+ libevent-fb-staticdev \
+ libglade-dev \
+ libmcrypt-dev \
+ libmemcached-dev \
+ libmemcached-staticdev \
+ libmysqlclient-dev \
+ libmysqlclient-staticdev \
+ libmysqlclient-r-dev \
+ libmysqlclient-r-staticdev \
+ libpam-dev \
+ libpcre-dev \
+ libpcre-staticdev \
+ libxml2-dev \
+ libxml2-staticdev \
+ ncurses-dev \
+ ncurses-staticdev \
+ onig-dev \
+ openldap-dev \
+ openssl-dev \
+ openssl-staticdev \
+ readline-dev \
+ tbb-dev \
+ zlib-dev \
+ "
diff --git a/meta-aarch64/recipes-extra/onig/files/do-not-use-system-headers.patch b/meta-aarch64/recipes-extra/onig/files/do-not-use-system-headers.patch
new file mode 100644
index 00000000..a9606cc6
--- /dev/null
+++ b/meta-aarch64/recipes-extra/onig/files/do-not-use-system-headers.patch
@@ -0,0 +1,34 @@
+---
+ Makefile.am | 2 +-
+ sample/Makefile.am | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- onig-5.9.3.orig/Makefile.am
++++ onig-5.9.3/Makefile.am
+@@ -4,11 +4,11 @@ sampledir = $(top_srcdir)/sample
+ libname = libonig.la
+
+ ACLOCAL_AMFLAGS = -I m4
+ #AM_CFLAGS = -DNOT_RUBY
+ AM_CFLAGS =
+-INCLUDES = -I$(top_srcdir) -I$(includedir)
++INCLUDES = -I$(top_srcdir)
+
+ SUBDIRS = . sample
+
+ include_HEADERS = oniguruma.h oniggnu.h onigposix.h
+ lib_LTLIBRARIES = $(libname)
+--- onig-5.9.3.orig/sample/Makefile.am
++++ onig-5.9.3/sample/Makefile.am
+@@ -1,10 +1,10 @@
+ noinst_PROGRAMS = encode listcap names posix simple sql syntax crnl
+
+ libname = $(top_builddir)/libonig.la
+ LDADD = $(libname)
+-INCLUDES = -I$(top_srcdir) -I$(includedir)
++INCLUDES = -I$(top_srcdir)
+
+ encode_SOURCES = encode.c
+ listcap_SOURCES = listcap.c
+ names_SOURCES = names.c
+ posix_SOURCES = posix.c
diff --git a/meta-aarch64/recipes-extra/onig/onig_5.9.3.bbappend b/meta-aarch64/recipes-extra/onig/onig_5.9.3.bbappend
new file mode 100644
index 00000000..fd93e391
--- /dev/null
+++ b/meta-aarch64/recipes-extra/onig/onig_5.9.3.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://do-not-use-system-headers.patch"
diff --git a/meta-aarch64/recipes-extra/tbb/tbb/cross-compile.patch b/meta-aarch64/recipes-extra/tbb/tbb/cross-compile.patch
new file mode 100644
index 00000000..b970a374
--- /dev/null
+++ b/meta-aarch64/recipes-extra/tbb/tbb/cross-compile.patch
@@ -0,0 +1,25 @@
+Author: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
+
+Upstream-Status: unsuitable
+---
+ build/linux.gcc.inc | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- tbb41_20121003oss.orig/build/linux.gcc.inc
++++ tbb41_20121003oss/build/linux.gcc.inc
+@@ -40,12 +40,13 @@ DYLIB_KEY = -shared
+ EXPORT_KEY = -Wl,--version-script,
+ LIBDL = -ldl
+
+ TBB_NOSTRICT = 1
+
+-CPLUS = g++
+-CONLY = gcc
++CPLUS = $(CXX)
++CONLY = $(CC)
++CPLUS_FLAGS = $(CXXFLAGS)
+ LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
+ LIBS += -lpthread -lrt
+ LINK_FLAGS = -Wl,-rpath-link=.
+ C_FLAGS = $(CPLUS_FLAGS)
+ # gcc 4.4 and higher support -std=c++0x
diff --git a/meta-aarch64/recipes-extra/tbb/tbb/tbb.pc b/meta-aarch64/recipes-extra/tbb/tbb/tbb.pc
new file mode 100644
index 00000000..644b64fb
--- /dev/null
+++ b/meta-aarch64/recipes-extra/tbb/tbb/tbb.pc
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: Threading Building Blocks
+Description: Intel's parallelism library for C++
+URL: http://www.threadingbuildingblocks.org/
+Version: 3.0+r018
+Libs: -L${libdir} -ltbb
+Cflags: -I${includedir}
diff --git a/meta-aarch64/recipes-extra/tbb/tbb/tbb41-aarch64.patch b/meta-aarch64/recipes-extra/tbb/tbb/tbb41-aarch64.patch
new file mode 100644
index 00000000..3366f874
--- /dev/null
+++ b/meta-aarch64/recipes-extra/tbb/tbb/tbb41-aarch64.patch
@@ -0,0 +1,233 @@
+Author: Leif Lindholm <leif.lindholm@linaro.org>
+
+Upstream-Status: not there yet
+
+https://bugs.launchpad.net/linaro-aarch64/+bug/1091353
+
+diff --git a/build/linux.inc b/build/linux.inc
+index bdad142..7db323c 100644
+--- a/build/linux.inc
++++ b/build/linux.inc
+@@ -104,6 +104,9 @@ endif
+ ifeq ($(arch),sparc)
+ def_prefix = lin64
+ endif
++ifeq ($(arch),aarch64)
++ def_prefix = lin64
++endif
+ ifeq (,$(def_prefix))
+ ifeq (64,$(findstring 64,$(arch)))
+ def_prefix = lin64
+diff --git a/include/tbb/machine/linux_aarch64.h b/include/tbb/machine/linux_aarch64.h
+new file mode 100644
+index 0000000..e3ebc36
+--- /dev/null
++++ b/include/tbb/machine/linux_aarch64.h
+@@ -0,0 +1,153 @@
++/*
++ Copyright 2013 Linaro All Rights Reserved.
++
++ This file is part of Threading Building Blocks.
++
++ Threading Building Blocks is free software; you can redistribute it
++ and/or modify it under the terms of the GNU General Public License
++ version 2 as published by the Free Software Foundation.
++
++ Threading Building Blocks is distributed in the hope that it will be
++ useful, but WITHOUT ANY WARRANTY; without even the implied warranty
++ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with Threading Building Blocks; if not, write to the Free Software
++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
++
++ As a special exception, you may use this file as part of a free software
++ library without restriction. Specifically, if other files instantiate
++ templates or use macros or inline functions from this file, or you compile
++ this file and link it with other files to produce an executable, this
++ file does not by itself cause the resulting executable to be covered by
++ the GNU General Public License. This exception does not however
++ invalidate any other reasons why the executable file might be covered by
++ the GNU General Public License.
++*/
++
++/*
++ This is the TBB implementation for the ARM AArch64 architecture.
++*/
++
++#ifndef __TBB_machine_H
++#error Do not include this file directly; include tbb_machine.h instead
++#endif
++
++#if !(__aarch64__)
++#error Threading Building Blocks AArch64 port requires an AArch64 architecture.
++#endif
++
++#include <sys/param.h>
++#include <unistd.h>
++
++#define __TBB_WORDSIZE 8
++
++#ifndef __BYTE_ORDER__
++ // Hopefully endianness can be validly determined at runtime.
++ // This may silently fail in some embedded systems with page-specific endianness.
++#elif __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
++ #define __TBB_BIG_ENDIAN 1
++#elif __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
++ #define __TBB_BIG_ENDIAN 0
++#else
++ #define __TBB_BIG_ENDIAN -1 // not currently supported
++#endif
++
++
++#define __TBB_compiler_fence() __asm__ __volatile__("": : :"memory")
++#define __TBB_control_consistency_helper() __TBB_compiler_fence()
++
++#define __TBB_aarch64_inner_shareable_barrier() __asm__ __volatile__("dmb ish": : :"memory")
++#define __TBB_acquire_consistency_helper() __TBB_aarch64_inner_shareable_barrier()
++#define __TBB_release_consistency_helper() __TBB_aarch64_inner_shareable_barrier()
++#define __TBB_full_memory_fence() __TBB_aarch64_inner_shareable_barrier()
++
++//--------------------------------------------------
++// Compare and swap
++//--------------------------------------------------
++
++/**
++ * Atomic CAS for 32 bit values, if *ptr==comparand, then *ptr=value,
++ * returns *ptr
++ *
++ * @param ptr pointer to value in memory to be swapped with value
++ * if *ptr==comparand
++ * @param value value to assign *ptr to if *ptr==comparand
++ * @param comparand value to compare with *ptr
++ * @return value originally in memory at ptr, regardless of success
++*/
++static inline int32_t __TBB_machine_cmpswp4(volatile void *ptr, int32_t value, int32_t comparand )
++{
++ int32_t oldval, res;
++
++ do {
++ __asm__ __volatile__(
++ " ldxr %w1, [%2]\n"
++ " mov %w0, #0\n"
++ " cmp %w1, %w3\n"
++ " b.ne 1f\n"
++ " stxr %w0, %w4, [%2]\n"
++ "1:\n"
++ : "=&r" (res), "=&r" (oldval)
++ : "r" (ptr), "Ir" (value), "r" (comparand)
++ : "cc");
++ } while (res);
++
++ return oldval;
++}
++
++/**
++ * Atomic CAS for 64 bit values, if *ptr==comparand, then *ptr=value,
++ * returns *ptr
++ *
++ * @param ptr pointer to value in memory to be swapped with value
++ * if *ptr==comparand
++ * @param value value to assign *ptr to if *ptr==comparand
++ * @param comparand value to compare with *ptr
++ * @return value originally in memory at ptr, regardless of success
++ */
++static inline int64_t __TBB_machine_cmpswp8(volatile void *ptr, int64_t value, int64_t comparand )
++{
++ int64_t oldval;
++ int64_t res;
++
++ do {
++ __asm__ __volatile__(
++ " ldxr %1, [%2]\n"
++ " mov %w0, #0\n"
++ " cmp %1, %3\n"
++ " b.ne 1f\n"
++ " stxr %w0, %4, [%2]\n"
++ "1:\n"
++ : "=&r" (res), "=&r" (oldval)
++ : "r" (ptr), "Ir" (value), "r" (comparand)
++ : "cc");
++ } while (res);
++
++ return oldval;
++}
++
++inline void __TBB_machine_pause (int32_t delay )
++{
++ while(delay>0)
++ {
++ __TBB_compiler_fence();
++ delay--;
++ }
++}
++
++// Machine specific atomic operations
++
++#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4(P,V,C)
++#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8(P,V,C)
++//#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp4(P,V,C)
++#define __TBB_Pause(V) __TBB_machine_pause(V)
++
++// Use generics for some things
++#define __TBB_USE_GENERIC_PART_WORD_CAS 1
++#define __TBB_USE_GENERIC_FETCH_ADD 1
++#define __TBB_USE_GENERIC_FETCH_STORE 1
++#define __TBB_USE_GENERIC_HALF_FENCED_LOAD_STORE 1
++#define __TBB_USE_GENERIC_RELAXED_LOAD_STORE 1
++#define __TBB_USE_GENERIC_SEQUENTIAL_CONSISTENCY_LOAD_STORE 1
+diff --git a/include/tbb/tbb_machine.h b/include/tbb/tbb_machine.h
+index 752062e..5342877 100644
+--- a/include/tbb/tbb_machine.h
++++ b/include/tbb/tbb_machine.h
+@@ -223,6 +223,8 @@ template<> struct atomic_selector<8> {
+ #include "machine/linux_ia64.h"
+ #elif __powerpc__
+ #include "machine/mac_ppc.h"
++ #elif __aarch64__
++ #include "machine/linux_aarch64.h"
+ #elif __TBB_GCC_BUILTIN_ATOMICS_PRESENT
+ #include "machine/gcc_generic.h"
+ #endif
+@@ -391,10 +393,12 @@ void spin_wait_until_eq( const volatile T& location, const U value ) {
+ // - The operation assumes that the architecture consistently uses either little-endian or big-endian:
+ // it does not support mixed-endian or page-specific bi-endian architectures.
+ // This function is the only use of __TBB_BIG_ENDIAN.
+-#if (__TBB_BIG_ENDIAN!=-1)
++#if (__TBB_BIG_ENDIAN==-1)
+ #if ( __TBB_USE_GENERIC_PART_WORD_CAS)
+ #error generic implementation of part-word CAS was explicitly disabled for this configuration
+ #endif
++#endif
++
+ template<typename T>
+ inline T __TBB_MaskedCompareAndSwap (volatile T * const ptr, const T value, const T comparand ) {
+ struct endianness{ static bool is_big_endian(){
+@@ -432,7 +436,6 @@ inline T __TBB_MaskedCompareAndSwap (volatile T * const ptr, const T value, cons
+ else continue; // CAS failed but the bits of interest left unchanged
+ }
+ }
+-#endif
+ template<size_t S, typename T>
+ inline T __TBB_CompareAndSwapGeneric (volatile void *ptr, T value, T comparand );
+
+diff --git a/src/tbbmalloc/frontend.cpp b/src/tbbmalloc/frontend.cpp
+index 4e81870..ddac9e0 100644
+--- a/src/tbbmalloc/frontend.cpp
++++ b/src/tbbmalloc/frontend.cpp
+@@ -653,6 +653,14 @@ static inline unsigned int highestBitPos(unsigned int n)
+ # error highestBitPos() not implemented for this platform
+ # endif
+
++#elif __aarch64__
++ __asm__ __volatile__
++ (
++ "clz %0, %1\n"
++ "mov %1, %2\n"
++ "sub %0, %1, %0\n"
++ :"=&r" (pos), "=&r" (n) :"I" (31)
++ );
+ #else
+ static unsigned int bsr[16] = {0/*N/A*/,6,7,7,8,8,8,8,9,9,9,9,9,9,9,9};
+ pos = bsr[ n>>6 ];
diff --git a/meta-aarch64/recipes-extra/tbb/tbb_4.1.bb b/meta-aarch64/recipes-extra/tbb/tbb_4.1.bb
new file mode 100644
index 00000000..c142721b
--- /dev/null
+++ b/meta-aarch64/recipes-extra/tbb/tbb_4.1.bb
@@ -0,0 +1,31 @@
+DESCRIPTION = "Parallelism library for C++ - runtime files \
+ TBB is a library that helps you leverage multi-core processor \
+ performance without having to be a threading expert. It represents a \
+ higher-level, task-based parallelism that abstracts platform details \
+ and threading mechanism for performance and scalability."
+HOMEPAGE = "http://threadingbuildingblocks.org/"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=2c7f2caf277a3933e3acdf7f89d54cc1"
+PRDATE = "20130116"
+PR = "r${PRDATE}"
+
+SRC_URI = "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_${PRDATE}oss_src.tgz \
+ file://cross-compile.patch \
+ file://tbb.pc"
+
+S = "${WORKDIR}/tbb41_${PRDATE}oss/"
+
+SRC_URI[md5sum] = "3809790e1001a1b32d59c9fee590ee85"
+SRC_URI[sha256sum] = "4ae2c10899e3b6ef2f686013ec5901fc658444ca90178efaca6014b0665c34b6"
+
+do_compile() {
+ oe_runmake compiler=gcc arch=aarch64 runtime=cc4.7_libc2.17_kernel3.8 tbb tbbmalloc
+}
+
+do_install() {
+ install -d ${D}${includedir} ${D}${libdir}/pkgconfig
+ rm ${S}/include/tbb/index.html -f
+ cp -a ${S}/include/tbb ${D}${includedir}
+ install -m 0755 ${B}/build/linux_*_release/lib*.so* ${D}${libdir}
+ install -m 0644 ${WORKDIR}/tbb.pc ${D}${libdir}/pkgconfig
+}
diff --git a/meta-aarch64/recipes-kernel/linux/linux-linaro_git.bb b/meta-aarch64/recipes-kernel/linux/linux-linaro_git.bb
new file mode 100644
index 00000000..ca213fc0
--- /dev/null
+++ b/meta-aarch64/recipes-kernel/linux/linux-linaro_git.bb
@@ -0,0 +1,56 @@
+DESCRIPTION = "Linux Kernel"
+SECTION = "kernel"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
+
+inherit kernel siteinfo
+
+PV = "3.8+git${SRCPV}"
+
+SRC_URI = " \
+ git://git.linaro.org/kernel/linux-linaro-tracking.git;branch=linux-linaro;name=kernel \
+ git://git.linaro.org/arm/models/boot-wrapper-aarch64.git;branch=ubuntu;name=bootwrapper;destsuffix=bootwrapper \
+"
+
+SRCREV_bootwrapper = "${AUTOREV}"
+SRCREV_kernel = "${AUTOREV}"
+SRCREV_FORMAT = "kernel"
+
+S = "${WORKDIR}/git"
+BW = "${WORKDIR}/bootwrapper"
+
+COMPATIBLE_HOST = "aarch64"
+KERNEL_IMAGETYPE = "Image"
+
+BOOTARGS_COMMON = "console=ttyAMA0 mem=2048M devtmpfs.mount=1 earlyprintk rw"
+
+do_configure_prepend() {
+ ARCH=arm64 scripts/kconfig/merge_config.sh -m linaro/configs/linaro-base.conf \
+ linaro/configs/vexpress64.conf
+}
+
+do_compile_append() {
+ install -m 0644 ${S}/arch/arm64/boot/Image ${BW}/
+ cd ${BW}
+ make clean
+ oe_runmake DTC=${S}/scripts/dtc/dtc \
+ FDT_SRC=${S}/arch/arm64/boot/dts/vexpress-foundation-v8.dts \
+ CC="${CC}" LD="${LD}" \
+ IMAGE=linux-system-foundation.axf \
+ BOOTARGS='"${BOOTARGS_COMMON} root=/dev/vda"'
+ make clean
+ oe_runmake DTC=${S}/scripts/dtc/dtc \
+ FDT_SRC=${S}/arch/arm64/boot/dts/vexpress-v2p-aarch64.dts \
+ CC="${CC}" LD="${LD}" \
+ IMAGE=linux-system-ve.axf \
+ BOOTARGS='"${BOOTARGS_COMMON} root=/dev/mmcblk0"'
+}
+
+do_deploy_append() {
+ install -d ${DEPLOYDIR}
+ install -m 0644 ${BW}/linux-system-ve.axf ${DEPLOYDIR}/linux-system-ve-${KERNEL_IMAGE_BASE_NAME}.axf
+ install -m 0644 ${BW}/linux-system-foundation.axf ${DEPLOYDIR}/linux-system-foundation-${KERNEL_IMAGE_BASE_NAME}.axf
+ cd ${DEPLOYDIR}
+ ln -sf linux-system-ve-${KERNEL_IMAGE_BASE_NAME}.axf linux-system-ve.axf
+ ln -sf linux-system-foundation-${KERNEL_IMAGE_BASE_NAME}.axf linux-system-foundation.axf
+}
diff --git a/meta-aarch64/recipes-kernel/sysprof/sysprof_git.bbappend b/meta-aarch64/recipes-kernel/sysprof/sysprof_git.bbappend
new file mode 100644
index 00000000..8db9345e
--- /dev/null
+++ b/meta-aarch64/recipes-kernel/sysprof/sysprof_git.bbappend
@@ -0,0 +1 @@
+COMPATIBLE_HOST_aarch64 = "0"
diff --git a/meta-aarch64/recipes-multimedia/pulseaudio/files/0001-libatomic_ops-Aarch64-basic-port.patch b/meta-aarch64/recipes-multimedia/pulseaudio/files/0001-libatomic_ops-Aarch64-basic-port.patch
new file mode 100644
index 00000000..07693770
--- /dev/null
+++ b/meta-aarch64/recipes-multimedia/pulseaudio/files/0001-libatomic_ops-Aarch64-basic-port.patch
@@ -0,0 +1,232 @@
+From aac120d778ae5fc619b2fb8ef18ea18d3d5d20cc Mon Sep 17 00:00:00 2001
+From: Yvan Roux <yvan.roux@linaro.org>
+Date: Wed, 23 Jan 2013 17:14:16 +0100
+Subject: [PATCH] Aarch64 basic port
+
+Adapted-for-OpenEmbedded-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
+
+---
+ src/atomic_ops.h | 4
+ src/atomic_ops/sysdeps/Makefile.am | 1
+ src/atomic_ops/sysdeps/gcc/aarch64.h | 184 +++++++++++++++++++++++++++++++++++
+ 3 files changed, 189 insertions(+)
+ create mode 100644 src/atomic_ops/sysdeps/gcc/aarch64.h
+
+--- libatomic_ops-7.2.orig/src/atomic_ops.h
++++ libatomic_ops-7.2/src/atomic_ops.h
+@@ -242,10 +242,14 @@
+ # endif /* __m68k__ */
+ # if defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) \
+ || defined(__powerpc64__) || defined(__ppc64__)
+ # include "atomic_ops/sysdeps/gcc/powerpc.h"
+ # endif /* __powerpc__ */
++# if defined(__aarch64__)
++# include "atomic_ops/sysdeps/gcc/aarch64.h"
++# define AO_CAN_EMUL_CAS
++# endif /* __aarch64__ */
+ # if defined(__arm__) && !defined(AO_USE_PTHREAD_DEFS)
+ # include "atomic_ops/sysdeps/gcc/arm.h"
+ # define AO_CAN_EMUL_CAS
+ # endif /* __arm__ */
+ # if defined(__cris__) || defined(CRIS)
+--- libatomic_ops-7.2.orig/src/atomic_ops/sysdeps/Makefile.am
++++ libatomic_ops-7.2/src/atomic_ops/sysdeps/Makefile.am
+@@ -24,10 +24,11 @@ nobase_sysdep_HEADERS= generic_pthread.h
+ standard_ao_double_t.h \
+ README \
+ \
+ armcc/arm_v6.h \
+ \
++ gcc/aarch64.h \
+ gcc/alpha.h gcc/arm.h gcc/avr32.h gcc/cris.h \
+ gcc/hexagon.h gcc/hppa.h gcc/ia64.h gcc/m68k.h \
+ gcc/mips.h gcc/powerpc.h gcc/s390.h \
+ gcc/sh.h gcc/sparc.h gcc/x86.h gcc/x86_64.h \
+ \
+--- /dev/null
++++ libatomic_ops-7.2/src/atomic_ops/sysdeps/gcc/aarch64.h
+@@ -0,0 +1,184 @@
++/*
++ * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
++ * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
++ * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
++ *
++ *
++ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
++ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
++ *
++ * Permission is hereby granted to use or copy this program
++ * for any purpose, provided the above notices are retained on all copies.
++ * Permission to modify the code and to distribute modified code is granted,
++ * provided the above notices are retained, and a notice that the code was
++ * modified is included with the above copyright notice.
++ *
++ */
++
++#include "../read_ordered.h"
++
++#include "../test_and_set_t_is_ao_t.h"
++
++AO_INLINE void
++AO_nop_full(void)
++{
++# ifndef AO_UNIPROCESSOR
++__sync_synchronize ();
++# endif
++}
++#define AO_HAVE_nop_full
++
++AO_INLINE AO_t
++AO_load(const volatile AO_t *addr)
++{
++ return __atomic_load_n (addr, __ATOMIC_RELAXED);
++}
++#define AO_HAVE_load
++
++AO_INLINE AO_t
++AO_load_acquire(const volatile AO_t *addr)
++{
++ return __atomic_load_n (addr, __ATOMIC_ACQUIRE);
++}
++#define AO_HAVE_load_acquire
++
++AO_INLINE void
++ AO_store(volatile AO_t *addr, AO_t value)
++{
++ __atomic_store_n(addr, value, __ATOMIC_RELAXED);
++}
++#define AO_HAVE_store
++
++AO_INLINE void
++ AO_store_release(volatile AO_t *addr, AO_t value)
++{
++ __atomic_store_n(addr, value, __ATOMIC_RELEASE);
++}
++#define AO_HAVE_store_release
++
++AO_INLINE AO_TS_VAL_t
++AO_test_and_set(volatile AO_TS_t *addr)
++{
++ return __atomic_test_and_set(addr, __ATOMIC_RELAXED);
++}
++# define AO_HAVE_test_and_set
++
++AO_INLINE AO_TS_VAL_t
++AO_test_and_set_acquire(volatile AO_TS_t *addr)
++{
++ return __atomic_test_and_set(addr, __ATOMIC_ACQUIRE);
++}
++# define AO_HAVE_test_and_set_acquire
++
++AO_INLINE AO_TS_VAL_t
++AO_test_and_set_release(volatile AO_TS_t *addr)
++{
++ return __atomic_test_and_set(addr, __ATOMIC_RELEASE);
++}
++# define AO_HAVE_test_and_set_release
++
++AO_INLINE AO_TS_VAL_t
++AO_test_and_set_full(volatile AO_TS_t *addr)
++{
++ return __atomic_test_and_set(addr, __ATOMIC_SEQ_CST);
++}
++# define AO_HAVE_test_and_set_full
++
++AO_INLINE AO_t
++AO_fetch_and_add(volatile AO_t *p, AO_t incr)
++{
++ return __atomic_fetch_add(p, incr, __ATOMIC_RELAXED);
++}
++#define AO_HAVE_fetch_and_add
++
++AO_INLINE AO_t
++AO_fetch_and_add_acquire(volatile AO_t *p, AO_t incr)
++{
++ return __atomic_fetch_add(p, incr, __ATOMIC_ACQUIRE);
++}
++#define AO_HAVE_fetch_and_add_acquire
++
++AO_INLINE AO_t
++AO_fetch_and_add_release(volatile AO_t *p, AO_t incr)
++{
++ return __atomic_fetch_add(p, incr, __ATOMIC_RELEASE);
++}
++#define AO_HAVE_fetch_and_add_release
++
++AO_INLINE AO_t
++AO_fetch_and_add_full(volatile AO_t *p, AO_t incr)
++{
++ return __atomic_fetch_add(p, incr, __ATOMIC_SEQ_CST);
++}
++#define AO_HAVE_fetch_and_add_full
++
++AO_INLINE AO_t
++AO_fetch_and_add1(volatile AO_t *p)
++{
++ return __atomic_fetch_add(p, 1, __ATOMIC_RELAXED);
++}
++#define AO_HAVE_fetch_and_add1
++
++AO_INLINE AO_t
++AO_fetch_and_add1_acquire(volatile AO_t *p)
++{
++ return __atomic_fetch_add(p, 1, __ATOMIC_ACQUIRE);
++}
++#define AO_HAVE_fetch_and_add1_acquire
++
++AO_INLINE AO_t
++AO_fetch_and_add1_release(volatile AO_t *p)
++{
++ return __atomic_fetch_add(p, 1, __ATOMIC_RELEASE);
++}
++#define AO_HAVE_fetch_and_add1_release
++
++AO_INLINE AO_t
++AO_fetch_and_add1_full(volatile AO_t *p)
++{
++ return __atomic_fetch_add(p, 1, __ATOMIC_SEQ_CST);
++}
++#define AO_HAVE_fetch_and_add1_full
++
++AO_INLINE AO_t
++AO_fetch_and_sub1(volatile AO_t *p)
++{
++ return __atomic_fetch_sub(p, 1, __ATOMIC_RELAXED);
++}
++#define AO_HAVE_fetch_and_sub1
++
++AO_INLINE AO_t
++AO_fetch_and_sub1_acquire(volatile AO_t *p)
++{
++ return __atomic_fetch_sub(p, 1, __ATOMIC_ACQUIRE);
++}
++#define AO_HAVE_fetch_and_sub1_acquire
++
++AO_INLINE AO_t
++AO_fetch_and_sub1_release(volatile AO_t *p)
++{
++ return __atomic_fetch_sub(p, 1, __ATOMIC_RELEASE);
++}
++#define AO_HAVE_fetch_and_sub1_release
++
++AO_INLINE AO_t
++AO_fetch_and_sub1_full(volatile AO_t *p)
++{
++ return __atomic_fetch_sub(p, 1, __ATOMIC_SEQ_CST);
++}
++#define AO_HAVE_fetch_and_sub1_full
++
++/* Returns nonzero if the comparison succeeded. */
++AO_INLINE int
++AO_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val)
++{
++ return __sync_bool_compare_and_swap(addr, old_val, new_val);
++}
++# define AO_HAVE_compare_and_swap
++
++AO_INLINE AO_t
++AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val)
++{
++ return __sync_val_compare_and_swap(addr, old_val, new_val);
++}
++# define AO_HAVE_fetch_compare_and_swap
diff --git a/meta-aarch64/recipes-multimedia/pulseaudio/libatomics-ops_7.2.bbappend b/meta-aarch64/recipes-multimedia/pulseaudio/libatomics-ops_7.2.bbappend
new file mode 100644
index 00000000..6a7932d6
--- /dev/null
+++ b/meta-aarch64/recipes-multimedia/pulseaudio/libatomics-ops_7.2.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI_append = " \
+ file://0001-libatomic_ops-Aarch64-basic-port.patch \
+"
diff --git a/meta-aarch64/recipes-multimedia/v4l2apps/files/openat.patch b/meta-aarch64/recipes-multimedia/v4l2apps/files/openat.patch
new file mode 100644
index 00000000..2d08f648
--- /dev/null
+++ b/meta-aarch64/recipes-multimedia/v4l2apps/files/openat.patch
@@ -0,0 +1,35 @@
+From ac8eb4d8e1c16b907e795da123a032869c77c56f Mon Sep 17 00:00:00 2001
+From: Riku Voipio <riku.voipio@linaro.org>
+Date: Tue, 22 Jan 2013 12:44:48 +0200
+Subject: [PATCH] libv4lsyscall-priv.h: use openat when available
+
+New architectures such as 64-Bit arm build kernels without legacy
+system calls - Such as the the no-at system calls. Thus, use
+SYS_openat whenever it is available.
+
+Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
+---
+ lib/libv4lconvert/libv4lsyscall-priv.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/lib/libv4lconvert/libv4lsyscall-priv.h b/lib/libv4lconvert/libv4lsyscall-priv.h
+index 2dac49a..cdd38bc 100644
+--- a/lib/libv4lconvert/libv4lsyscall-priv.h
++++ b/lib/libv4lconvert/libv4lsyscall-priv.h
+@@ -72,8 +72,13 @@ typedef off_t __off_t;
+
+ #ifndef CONFIG_SYS_WRAPPER
+
++#ifdef SYS_openat
++#define SYS_OPEN(file, oflag, mode) \
++ syscall(SYS_openat, AT_FDCWD, (const char *)(file), (int)(oflag), (mode_t)(mode))
++#else
+ #define SYS_OPEN(file, oflag, mode) \
+ syscall(SYS_open, (const char *)(file), (int)(oflag), (mode_t)(mode))
++#endif
+ #define SYS_CLOSE(fd) \
+ syscall(SYS_close, (int)(fd))
+ #define SYS_IOCTL(fd, cmd, arg) \
+--
+1.7.10.4
+
diff --git a/meta-aarch64/recipes-multimedia/v4l2apps/v4l-utils_0.8.8.bbappend b/meta-aarch64/recipes-multimedia/v4l2apps/v4l-utils_0.8.8.bbappend
new file mode 100644
index 00000000..73ed3948
--- /dev/null
+++ b/meta-aarch64/recipes-multimedia/v4l2apps/v4l-utils_0.8.8.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI_append = " file://openat.patch"
diff --git a/meta-aarch64/recipes-qt/qt4/files/aarch64.patch b/meta-aarch64/recipes-qt/qt4/files/aarch64.patch
new file mode 100644
index 00000000..7ad10341
--- /dev/null
+++ b/meta-aarch64/recipes-qt/qt4/files/aarch64.patch
@@ -0,0 +1,36 @@
+---
+ src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- qt-everywhere-opensource-src-4.8.4.orig/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h
++++ qt-everywhere-opensource-src-4.8.4/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h
+@@ -367,10 +367,15 @@
+
+ #if CPU(ARM) || CPU(MIPS) || CPU(SH4)
+ #define WTF_CPU_NEEDS_ALIGNED_ACCESS 1
+ #endif
+
++/* CPU(AARCH64) - Aarch64 */
++#if defined(__aarch64__)
++#define WTF_CPU_AARCH64 1
++#endif
++
+ /* ==== OS() - underlying operating system; only to be used for mandated low-level services like
+ virtual memory, not to choose a GUI toolkit ==== */
+
+ /* OS(ANDROID) - Android */
+ #ifdef ANDROID
+@@ -996,11 +1001,12 @@
+ #if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \
+ || (CPU(IA64) && !CPU(IA64_32)) \
+ || CPU(ALPHA) \
+ || CPU(SPARC64) \
+ || CPU(S390X) \
+- || CPU(PPC64)
++ || CPU(PPC64) \
++ || CPU(AARCH64)
+ #define WTF_USE_JSVALUE64 1
+ #else
+ #define WTF_USE_JSVALUE32_64 1
+ #endif
+ #endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64) */
diff --git a/meta-aarch64/recipes-qt/qt4/qt4-x11-free_4.8.4.bbappend b/meta-aarch64/recipes-qt/qt4/qt4-x11-free_4.8.4.bbappend
new file mode 100644
index 00000000..d9691430
--- /dev/null
+++ b/meta-aarch64/recipes-qt/qt4/qt4-x11-free_4.8.4.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI_append = " \
+ file://aarch64.patch \
+"
diff --git a/meta-aarch64/recipes-sato/webkit/files/aarch64.patch b/meta-aarch64/recipes-sato/webkit/files/aarch64.patch
new file mode 100644
index 00000000..86b04561
--- /dev/null
+++ b/meta-aarch64/recipes-sato/webkit/files/aarch64.patch
@@ -0,0 +1,35 @@
+--- a/Source/JavaScriptCore/wtf/Platform.h
++++ b/Source/JavaScriptCore/wtf/Platform.h
+@@ -299,6 +299,11 @@
+ #define WTF_CPU_NEEDS_ALIGNED_ACCESS 1
+ #endif
+
++/* CPU(AARCH64) - Aarch64 */
++#if defined(__aarch64__)
++#define WTF_CPU_AARCH64 1
++#endif
++
+ /* ==== OS() - underlying operating system; only to be used for mandated low-level services like
+ virtual memory, not to choose a GUI toolkit ==== */
+
+@@ -899,7 +904,8 @@
+ || CPU(ALPHA) \
+ || CPU(SPARC64) \
+ || CPU(S390X) \
+- || CPU(PPC64)
++ || CPU(PPC64) \
++ || CPU(AARCH64)
+ #define WTF_USE_JSVALUE64 1
+ #else
+ #define WTF_USE_JSVALUE32_64 1
+--- a/Source/JavaScriptCore/wtf/dtoa/utils.h
++++ b/Source/JavaScriptCore/wtf/dtoa/utils.h
+@@ -49,7 +49,7 @@
+ defined(__ARMEL__) || \
+ defined(_MIPS_ARCH_MIPS32R2)
+ #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+-#elif CPU(MIPS) || CPU(PPC) || CPU(PPC64) || OS(WINCE) || CPU(SH4) || CPU(S390) || CPU(S390X) || CPU(IA64) || CPU(SPARC) || CPU(ALPHA)
++#elif CPU(MIPS) || CPU(PPC) || CPU(PPC64) || OS(WINCE) || CPU(SH4) || CPU(S390) || CPU(S390X) || CPU(IA64) || CPU(SPARC) || CPU(ALPHA) || CPU(AARCH64)
+ #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+ #elif defined(_M_IX86) || defined(__i386__)
+ #if defined(_WIN32)
diff --git a/meta-aarch64/recipes-sato/webkit/webkit-gtk_1.8.3.bbappend b/meta-aarch64/recipes-sato/webkit/webkit-gtk_1.8.3.bbappend
new file mode 100644
index 00000000..540e54b9
--- /dev/null
+++ b/meta-aarch64/recipes-sato/webkit/webkit-gtk_1.8.3.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI_append = " \
+ file://aarch64.patch \
+"
diff --git a/meta-aarch64/recipes-support/emacs/emacs_23.4.bbappend b/meta-aarch64/recipes-support/emacs/emacs_23.4.bbappend
new file mode 100644
index 00000000..8db9345e
--- /dev/null
+++ b/meta-aarch64/recipes-support/emacs/emacs_23.4.bbappend
@@ -0,0 +1 @@
+COMPATIBLE_HOST_aarch64 = "0"
diff --git a/meta-aarch64/recipes-support/gd/gd_2.0.35+2.0.36rc1.bbappend b/meta-aarch64/recipes-support/gd/gd_2.0.35+2.0.36rc1.bbappend
new file mode 100644
index 00000000..18b07e23
--- /dev/null
+++ b/meta-aarch64/recipes-support/gd/gd_2.0.35+2.0.36rc1.bbappend
@@ -0,0 +1 @@
+SRC_URI = "http://people.linaro.org/~hrw/sources/gd-2.0.36RC1.tar.gz"
diff --git a/meta-aarch64/recipes/images/micro-base-image.bb b/meta-aarch64/recipes/images/micro-base-image.bb
new file mode 100644
index 00000000..361b0edf
--- /dev/null
+++ b/meta-aarch64/recipes/images/micro-base-image.bb
@@ -0,0 +1,19 @@
+# micro-base-image
+#
+# Image configuration for the OE Micro Linux Distribuion (micro, micro-uclibc)
+#
+
+# Install basic files only
+IMAGE_INSTALL = "base-files \
+ base-passwd \
+ dropbear \
+ netbase \
+ busybox \
+ sysvinit sysvinit-pidof"
+IMAGE_LINGUAS = ""
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
+ file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+inherit image