* [Buildroot] [PATCH 00/13] Toolchain rework, take 2
@ 2010-12-14 19:05 Gustavo Zacarias
2010-12-14 19:05 ` [Buildroot] [PATCH 01/13] gmp: make it a proper package and bump to version 5.0.1 Gustavo Zacarias
` (12 more replies)
0 siblings, 13 replies; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:05 UTC (permalink / raw)
To: buildroot
This is the second batch of patches for the internal toolchain rework.
I've included the first batch since they're not in mainline yet.
The idea is to get testers, feedback and get it in mainline soon.
gmp: converted to package, renamed from libgmp.
php: refer to gmp instead of libgmp.
mpc: converted to package, renamed from libmpc.
mpfr: converted to package, renamed from libmpfr.
sstrip: converted to package.
binutils: converted to package, added version 2.21.
toolchain: move the sysroot to the host directory.
It's now under $HOST_DIR/usr/tuple/sysroot
gcc: minor cleanup, change target and hooks to host dir.
gdb: converted to package, added version 7.2.
uclibc: install tools to host dir,
Also fix a small bug in the package infra to avoid patch duplication between
host and target packages.
TODO: convert gcc, uclibc, kernel-headers, elf2flt & mklibs.
TODO: update documentation.
STATE: working, tested with ARM and PPC targets.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 01/13] gmp: make it a proper package and bump to version 5.0.1
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
@ 2010-12-14 19:05 ` Gustavo Zacarias
2010-12-14 19:05 ` [Buildroot] [PATCH 02/13] php: libgmp was renamed to gmp Gustavo Zacarias
` (11 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:05 UTC (permalink / raw)
To: buildroot
* Convert gmp to a proper autotargets package
* Bump to version 5.0.1
* Hook it up for binutils/gcc to use
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
package/gmp/Config.in | 12 +----
package/gmp/gmp.mk | 109 ++------------------------------------
toolchain/binutils/binutils.mk | 12 ++---
toolchain/gcc/gcc-uclibc-4.x.mk | 6 +-
4 files changed, 16 insertions(+), 123 deletions(-)
diff --git a/package/gmp/Config.in b/package/gmp/Config.in
index 74596f8..226e088 100644
--- a/package/gmp/Config.in
+++ b/package/gmp/Config.in
@@ -1,14 +1,6 @@
-config BR2_PACKAGE_LIBGMP
+config BR2_PACKAGE_GMP
bool "gmp"
help
GNU Multiple Precision Arithmetic Library.
- http://www.swox.com/gmp/
-
-
-config BR2_PACKAGE_LIBGMP_HEADERS
- bool "gmp headers for target"
- depends on BR2_PACKAGE_LIBGMP
- help
- Install the gmp.h for the target.
-
+ http://gmplib.org/
diff --git a/package/gmp/gmp.mk b/package/gmp/gmp.mk
index a3488b8..cdddca1 100644
--- a/package/gmp/gmp.mk
+++ b/package/gmp/gmp.mk
@@ -3,108 +3,11 @@
# gmp
#
#############################################################
-GMP_VERSION:=4.2.4
-GMP_SOURCE:=gmp-$(GMP_VERSION).tar.bz2
-GMP_SITE:=$(BR2_GNU_MIRROR)/gmp
-GMP_CAT:=$(BZCAT)
-GMP_DIR:=$(TOOLCHAIN_DIR)/gmp-$(GMP_VERSION)
-GMP_TARGET_DIR:=$(BUILD_DIR)/gmp-$(GMP_VERSION)
-GMP_BINARY:=libgmp$(LIBTGTEXT)
-GMP_HOST_BINARY:=libgmp$(HOST_LIBEXT)
-GMP_LIBVERSION:=3.4.4
-# this is a workaround for a bug in GMP, please see
-# http://gmplib.org/list-archives/gmp-devel/2006-April/000618.html
-ifeq ($(HOST_EXEEXT),.exe)
-GMP_CPP_FLAGS:=CPPFLAGS=-DDLL_EXPORT
-endif
+GMP_VERSION = 5.0.1
+GMP_SITE = $(BR2_GNU_MIRROR)/gmp
+GMP_SOURCE = gmp-$(GMP_VERSION).tar.bz2
+GMP_INSTALL_STAGING = YES
-$(DL_DIR)/$(GMP_SOURCE):
- $(call DOWNLOAD,$(GMP_SITE),$(GMP_SOURCE))
-
-libgmp-source: $(DL_DIR)/$(GMP_SOURCE)
-
-$(GMP_DIR)/.unpacked: $(DL_DIR)/$(GMP_SOURCE)
- $(GMP_CAT) $(DL_DIR)/$(GMP_SOURCE) | tar -C $(TOOLCHAIN_DIR) $(TAR_OPTIONS) -
- toolchain/patch-kernel.sh $(GMP_DIR) package/gmp/ \*.patch
- $(CONFIG_UPDATE) $(@D)
- touch $@
-
-$(GMP_TARGET_DIR)/.configured: $(GMP_DIR)/.unpacked
- mkdir -p $(GMP_TARGET_DIR)
- (cd $(GMP_TARGET_DIR); rm -rf config.cache; \
- $(TARGET_CONFIGURE_OPTS) \
- $(TARGET_CONFIGURE_ARGS) \
- $(GMP_CPP_FLAGS) \
- $(GMP_DIR)/configure $(QUIET) \
- --target=$(GNU_TARGET_NAME) \
- --host=$(GNU_TARGET_NAME) \
- --build=$(GNU_HOST_NAME) \
- --prefix=/usr \
- $(PREFERRED_LIB_FLAGS) \
- $(DISABLE_NLS) \
- )
- touch $@
-
-$(GMP_TARGET_DIR)/.libs/$(GMP_BINARY): $(GMP_TARGET_DIR)/.configured
- #$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(GMP_TARGET_DIR)
- $(MAKE) -C $(GMP_TARGET_DIR)
-
-$(STAGING_DIR)/usr/lib/$(GMP_BINARY): $(GMP_TARGET_DIR)/.libs/$(GMP_BINARY)
- $(MAKE) DESTDIR=$(STAGING_DIR) -C $(GMP_TARGET_DIR) install
- $(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(STAGING_DIR)/usr/lib/libgmp$(LIBTGTEXT)*
-
-$(TARGET_DIR)/usr/lib/libgmp.so $(TARGET_DIR)/usr/lib/libgmp.so.$(GMP_LIBVERSION) $(TARGET_DIR)/usr/lib/libgmp.a: $(STAGING_DIR)/usr/lib/$(GMP_BINARY)
- cp -dpf $(STAGING_DIR)/usr/lib/libgmp$(LIBTGTEXT)* $(TARGET_DIR)/usr/lib/
-ifeq ($(BR2_PACKAGE_LIBGMP_HEADERS),y)
- test -d $(TARGET_DIR)/usr/include || mkdir -p $(TARGET_DIR)/usr/include
- cp -dpf $(STAGING_DIR)/usr/include/gmp.h $(TARGET_DIR)/usr/include/
-endif
-
-libgmp: $(TARGET_DIR)/usr/lib/libgmp$(LIBTGTEXT)
-stage-libgmp: $(STAGING_DIR)/usr/lib/$(GMP_BINARY)
-
-libgmp-clean:
- rm -f $(TARGET_DIR)/usr/lib/libgmp.* $(TARGET_DIR)/usr/include/gmp.h \
- $(STAGING_DIR)/usr/lib/libgmp* $(STAGING_DIR)/usr/include/gmp.h
- -$(MAKE) -C $(GMP_TARGET_DIR) clean
-
-libgmp-dirclean:
- rm -rf $(GMP_TARGET_DIR) $(GMP_DIR)
-
-GMP_DIR2:=$(TOOLCHAIN_DIR)/gmp-$(GMP_VERSION)-host
-GMP_HOST_DIR:=$(TOOLCHAIN_DIR)/gmp
-$(GMP_DIR2)/.configured: $(GMP_DIR)/.unpacked
- mkdir -p $(GMP_DIR2)
- (cd $(GMP_DIR2); rm -rf config.cache; \
- $(HOST_CONFIGURE_OPTS) \
- $(GMP_CPP_FLAGS) \
- $(GMP_DIR)/configure $(QUIET) \
- --prefix="$(GMP_HOST_DIR)" \
- --build=$(GNU_HOST_NAME) \
- --host=$(GNU_HOST_NAME) \
- --disable-shared \
- --enable-static \
- $(DISABLE_NLS) \
- )
- touch $@
-
-$(GMP_HOST_DIR)/lib/libgmp$(HOST_LIBEXT): $(GMP_DIR2)/.configured
- $(MAKE) -C $(GMP_DIR2) install
-
-host-libgmp: $(GMP_HOST_DIR)/lib/$(GMP_HOST_BINARY)
-host-libgmp-source: libgmp-source
-host-libgmp-clean:
- rm -rf $(GMP_HOST_DIR)
- -$(MAKE) -C $(GMP_DIR2) clean
-host-libgmp-dirclean:
- rm -rf $(GMP_HOST_DIR) $(GMP_DIR2)
-
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
-ifeq ($(BR2_PACKAGE_LIBGMP),y)
-TARGETS+=libgmp
-endif
+$(eval $(call AUTOTARGETS,package,gmp))
+$(eval $(call AUTOTARGETS,package,gmp,host))
diff --git a/toolchain/binutils/binutils.mk b/toolchain/binutils/binutils.mk
index ef9f644..327a0f6 100644
--- a/toolchain/binutils/binutils.mk
+++ b/toolchain/binutils/binutils.mk
@@ -16,17 +16,15 @@ endif
BINUTILS_HOST_PREREQ:=
BINUTILS_TARGET_PREREQ:=
-BINUTILS_HOST_PREREQ:=$(TOOLCHAIN_DIR)/gmp/lib/libgmp$(HOST_LIBEXT) \
- $(TOOLCHAIN_DIR)/mpfr/lib/libmpfr$(HOST_LIBEXT)
-HOST_SOURCE += host-libgmp-source host-libmpfr-source
+BINUTILS_HOST_PREREQ:=host-gmp $(TOOLCHAIN_DIR)/mpfr/lib/libmpfr$(HOST_LIBEXT)
+HOST_SOURCE += host-gmp-source host-libmpfr-source
-BINUTILS_TARGET_PREREQ:=$(TARGET_DIR)/usr/lib/libgmp$(LIBTGTEXT) \
- $(TARGET_DIR)/usr/lib/libmpfr$(LIBTGTEXT)
+BINUTILS_TARGET_PREREQ:=gmp $(TARGET_DIR)/usr/lib/libmpfr$(LIBTGTEXT)
-EXTRA_BINUTILS_CONFIG_OPTIONS+=--with-gmp="$(GMP_HOST_DIR)"
+EXTRA_BINUTILS_CONFIG_OPTIONS+=--with-gmp=$(HOST_DIR)/usr
EXTRA_BINUTILS_CONFIG_OPTIONS+=--with-mpfr="$(MPFR_HOST_DIR)"
-BINUTILS_TARGET_CONFIG_OPTIONS=--with-gmp="$(GMP_TARGET_DIR)"
+BINUTILS_TARGET_CONFIG_OPTIONS=--with-gmp=$(STAGING_DIR)/usr
BINUTILS_TARGET_CONFIG_OPTIONS+=--with-mpfr="$(MPFR_TARGET_DIR)"
ifeq ($(BR2_PACKAGE_LIBMPC),y)
diff --git a/toolchain/gcc/gcc-uclibc-4.x.mk b/toolchain/gcc/gcc-uclibc-4.x.mk
index cd63992..13961bb 100644
--- a/toolchain/gcc/gcc-uclibc-4.x.mk
+++ b/toolchain/gcc/gcc-uclibc-4.x.mk
@@ -106,9 +106,9 @@ ifeq ($(BR2_INSTALL_OBJC),y)
GCC_TARGET_LANGUAGES:=$(GCC_TARGET_LANGUAGES),objc
endif
-GCC_WITH_HOST_GMP=--with-gmp=$(GMP_HOST_DIR)
+GCC_WITH_HOST_GMP = --with-gmp=$(HOST_DIR)/usr
GCC_WITH_HOST_MPFR=--with-mpfr=$(MPFR_HOST_DIR)
-HOST_SOURCE += host-libgmp-source host-libmpfr-source
+HOST_SOURCE += host-gmp-source host-libmpfr-source
ifeq ($(findstring x4.5.,x$(GCC_VERSION)),x4.5.)
GCC_WITH_HOST_MPC=--with-mpc=$(MPC_HOST_DIR)
@@ -119,7 +119,7 @@ ifeq ($(BR2_INSTALL_FORTRAN),y)
GCC_TARGET_LANGUAGES:=$(GCC_TARGET_LANGUAGES),fortran
#GCC_TARGET_PREREQ+=$(TARGET_DIR)/usr/lib/libmpfr.so $(TARGET_DIR)/usr/lib/libgmp.so
#GCC_STAGING_PREREQ+=$(TOOLCHAIN_DIR)/mpfr/lib/libmpfr.so
-GCC_WITH_TARGET_GMP=--with-gmp="$(GMP_TARGET_DIR)"
+GCC_WITH_TARGET_GMP = --with-gmp=$(STAGING_DIR)/usr
GCC_WITH_TARGET_MPFR=--with-mpfr="$(MPFR_TARGET_DIR)"
ifeq ($(findstring x4.5.,x$(GCC_VERSION)),x4.5.)
GCC_WITH_TARGET_MPC=--with-mpc="$(MPC_TARGET_DIR)"
--
1.7.2.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 02/13] php: libgmp was renamed to gmp
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
2010-12-14 19:05 ` [Buildroot] [PATCH 01/13] gmp: make it a proper package and bump to version 5.0.1 Gustavo Zacarias
@ 2010-12-14 19:05 ` Gustavo Zacarias
2010-12-14 19:49 ` Yann E. MORIN
2010-12-14 19:05 ` [Buildroot] [PATCH 03/13] mpfr: make it a proper package and bump to version 3.0.0-p8 Gustavo Zacarias
` (10 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:05 UTC (permalink / raw)
To: buildroot
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
package/php/Config.ext | 2 +-
package/php/php.mk | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/package/php/Config.ext b/package/php/Config.ext
index 5c7f5ea..4f1614e 100644
--- a/package/php/Config.ext
+++ b/package/php/Config.ext
@@ -77,7 +77,7 @@ comment "gettext support requires a toolchain with WCHAR support"
config BR2_PACKAGE_PHP_EXT_GMP
bool "gmp"
- select BR2_PACKAGE_LIBGMP
+ select BR2_PACKAGE_GMP
help
GMP support
diff --git a/package/php/php.mk b/package/php/php.mk
index af4fa29..f3ed0f1 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -89,7 +89,7 @@ endif
ifeq ($(BR2_PACKAGE_PHP_EXT_GMP),y)
PHP_CONF_OPT += --with-gmp=$(STAGING_DIR)/usr
- PHP_DEPENDENCIES += libgmp
+ PHP_DEPENDENCIES += gmp
endif
ifeq ($(BR2_PACKAGE_PHP_EXT_JSON),y)
--
1.7.2.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 03/13] mpfr: make it a proper package and bump to version 3.0.0-p8
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
2010-12-14 19:05 ` [Buildroot] [PATCH 01/13] gmp: make it a proper package and bump to version 5.0.1 Gustavo Zacarias
2010-12-14 19:05 ` [Buildroot] [PATCH 02/13] php: libgmp was renamed to gmp Gustavo Zacarias
@ 2010-12-14 19:05 ` Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 04/13] mpc: make it a proper package Gustavo Zacarias
` (9 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:05 UTC (permalink / raw)
To: buildroot
* Convert mpfr to a proper autotargets package
* Bump to version 3.0.0-p8
* Hook it up for binutils/gcc to use
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
package/mpfr/Config.in | 13 +-
package/mpfr/mpfr-3.0.0-p8.patch | 1950 ++++++++++++++++++++++++++++++++++++++
package/mpfr/mpfr.mk | 126 +---
toolchain/binutils/binutils.mk | 10 +-
toolchain/gcc/gcc-uclibc-4.x.mk | 6 +-
5 files changed, 1969 insertions(+), 136 deletions(-)
create mode 100644 package/mpfr/mpfr-3.0.0-p8.patch
diff --git a/package/mpfr/Config.in b/package/mpfr/Config.in
index 302f79e..9acb0b4 100644
--- a/package/mpfr/Config.in
+++ b/package/mpfr/Config.in
@@ -1,18 +1,9 @@
-config BR2_PACKAGE_LIBMPFR
+config BR2_PACKAGE_MPFR
bool "mpfr"
default y if BR2_INSTALL_FORTRAN
- select BR2_PACKAGE_LIBGMP
+ select BR2_PACKAGE_GMP
help
C library for multiple-precision floating-point computations
with exact rounding.
http://www.mpfr.org/
-
-
-config BR2_PACKAGE_LIBMPFR_HEADERS
- bool "mpfr headers for target"
- depends on BR2_PACKAGE_LIBMPFR
- select BR2_PACKAGE_LIBGMP_HEADERS
- help
- Install the mpfr headers for the target.
-
diff --git a/package/mpfr/mpfr-3.0.0-p8.patch b/package/mpfr/mpfr-3.0.0-p8.patch
new file mode 100644
index 0000000..e521b2e
--- /dev/null
+++ b/package/mpfr/mpfr-3.0.0-p8.patch
@@ -0,0 +1,1950 @@
+This is the cumulative patch available at http://www.mpfr.org/mpfr-3.0.0/
+It's recommended by upstream
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+---
+diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
+--- mpfr-3.0.0-a/PATCHES 2010-06-23 11:02:49.000000000 +0000
++++ mpfr-3.0.0-b/PATCHES 2010-06-23 11:03:36.000000000 +0000
+@@ -0,0 +1 @@
++mpfr_out_str
+diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
+--- mpfr-3.0.0-a/VERSION 2010-06-10 11:00:14.000000000 +0000
++++ mpfr-3.0.0-b/VERSION 2010-06-23 11:03:20.000000000 +0000
+@@ -1 +1 @@
+-3.0.0
++3.0.0-p1
+diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
+--- mpfr-3.0.0-a/mpfr.h 2010-06-10 11:00:14.000000000 +0000
++++ mpfr-3.0.0-b/mpfr.h 2010-06-23 11:03:20.000000000 +0000
+@@ -27,7 +27,7 @@
+ #define MPFR_VERSION_MAJOR 3
+ #define MPFR_VERSION_MINOR 0
+ #define MPFR_VERSION_PATCHLEVEL 0
+-#define MPFR_VERSION_STRING "3.0.0"
++#define MPFR_VERSION_STRING "3.0.0-p1"
+
+ /* Macros dealing with MPFR VERSION */
+ #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
+diff -Naurd mpfr-3.0.0-a/mpfr.texi mpfr-3.0.0-b/mpfr.texi
+--- mpfr-3.0.0-a/mpfr.texi 2010-06-10 11:00:14.000000000 +0000
++++ mpfr-3.0.0-b/mpfr.texi 2010-06-23 11:03:12.000000000 +0000
+@@ -2050,7 +2050,7 @@
+ are printed. If @var{base} is greater than 10, @samp{@@} will be used
+ instead of @samp{e} as exponent delimiter.
+
+-Return the number of bytes written, or if an error occurred, return 0.
++Return the number of characters written, or if an error occurred, return 0.
+ @end deftypefun
+
+ @deftypefun size_t mpfr_inp_str (mpfr_t @var{rop}, FILE *@var{stream}, int @var{base}, mpfr_rnd_t @var{rnd})
+diff -Naurd mpfr-3.0.0-a/out_str.c mpfr-3.0.0-b/out_str.c
+--- mpfr-3.0.0-a/out_str.c 2010-06-10 11:00:14.000000000 +0000
++++ mpfr-3.0.0-b/out_str.c 2010-06-23 11:03:12.000000000 +0000
+@@ -22,6 +22,16 @@
+
+ #include "mpfr-impl.h"
+
++/* Warning! S should not contain "%". */
++#define OUT_STR_RET(S) \
++ do \
++ { \
++ int r; \
++ r = fprintf (stream, (S)); \
++ return r < 0 ? 0 : r; \
++ } \
++ while (0)
++
+ size_t
+ mpfr_out_str (FILE *stream, int base, size_t n_digits, mpfr_srcptr op,
+ mpfr_rnd_t rnd_mode)
+@@ -29,6 +39,7 @@
+ char *s, *s0;
+ size_t l;
+ mpfr_exp_t e;
++ int err;
+
+ MPFR_ASSERTN (base >= 2 && base <= 62);
+
+@@ -36,37 +47,16 @@
+ if (stream == NULL)
+ stream = stdout;
+
+- if (MPFR_IS_NAN(op))
+- {
+- fprintf (stream, "@NaN@");
+- return 3;
+- }
+-
+- if (MPFR_IS_INF(op))
+- {
+- if (MPFR_SIGN(op) > 0)
+- {
+- fprintf (stream, "@Inf@");
+- return 3;
+- }
+- else
+- {
+- fprintf (stream, "- at Inf@");
+- return 4;
+- }
+- }
+-
+- if (MPFR_IS_ZERO(op))
++ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (op)))
+ {
+- if (MPFR_SIGN(op) > 0)
+- {
+- fprintf(stream, "0");
+- return 1;
+- }
++ if (MPFR_IS_NAN (op))
++ OUT_STR_RET ("@NaN@");
++ else if (MPFR_IS_INF (op))
++ OUT_STR_RET (MPFR_IS_POS (op) ? "@Inf@" : "- at Inf@");
+ else
+ {
+- fprintf(stream, "-0");
+- return 2;
++ MPFR_ASSERTD (MPFR_IS_ZERO (op));
++ OUT_STR_RET (MPFR_IS_POS (op) ? "0" : "-0");
+ }
+ }
+
+@@ -77,21 +67,31 @@
+
+ l = strlen (s) + 1; /* size of allocated block returned by mpfr_get_str
+ - may be incorrect, as only an upper bound? */
+- if (*s == '-')
+- fputc (*s++, stream);
+
+- /* outputs mantissa */
+- fputc (*s++, stream); e--; /* leading digit */
+- fputc ((unsigned char) MPFR_DECIMAL_POINT, stream);
+- fputs (s, stream); /* rest of mantissa */
++ /* outputs possible sign and significand */
++ err = (*s == '-' && fputc (*s++, stream) == EOF)
++ || fputc (*s++, stream) == EOF /* leading digit */
++ || fputc ((unsigned char) MPFR_DECIMAL_POINT, stream) == EOF
++ || fputs (s, stream) == EOF; /* trailing significand */
+ (*__gmp_free_func) (s0, l);
++ if (MPFR_UNLIKELY (err))
++ return 0;
++
++ e--; /* due to the leading digit */
+
+ /* outputs exponent */
+ if (e)
+ {
++ int r;
++
+ MPFR_ASSERTN(e >= LONG_MIN);
+ MPFR_ASSERTN(e <= LONG_MAX);
+- l += fprintf (stream, (base <= 10 ? "e%ld" : "@%ld"), (long) e);
++
++ r = fprintf (stream, (base <= 10 ? "e%ld" : "@%ld"), (long) e);
++ if (MPFR_UNLIKELY (r < 0))
++ return 0;
++
++ l += r;
+ }
+
+ return l;
+diff -Naurd mpfr-3.0.0-a/tests/tout_str.c mpfr-3.0.0-b/tests/tout_str.c
+--- mpfr-3.0.0-a/tests/tout_str.c 2010-06-10 11:00:13.000000000 +0000
++++ mpfr-3.0.0-b/tests/tout_str.c 2010-06-23 11:03:12.000000000 +0000
+@@ -46,22 +46,54 @@
+ special (void)
+ {
+ mpfr_t x;
++ unsigned int n;
+
+ mpfr_init (x);
+
+ mpfr_set_nan (x);
+- mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
++ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
++ if (n != 5)
++ {
++ printf ("Error: mpfr_out_str (file, 10, 0, NaN, MPFR_RNDN) wrote %u "
++ "characters instead of 5.\n", n);
++ exit (1);
++ }
+
+ mpfr_set_inf (x, 1);
+- mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
++ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
++ if (n != 5)
++ {
++ printf ("Error: mpfr_out_str (file, 10, 0, +Inf, MPFR_RNDN) wrote %u "
++ "characters instead of 5.\n", n);
++ exit (1);
++ }
+
+ mpfr_set_inf (x, -1);
+- mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
++ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
++ if (n != 6)
++ {
++ printf ("Error: mpfr_out_str (file, 10, 0, -Inf, MPFR_RNDN) wrote %u "
++ "characters instead of 6.\n", n);
++ exit (1);
++ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+- mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
++ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
++ if (n != 1)
++ {
++ printf ("Error: mpfr_out_str (file, 10, 0, +0, MPFR_RNDN) wrote %u "
++ "characters instead of 1.\n", n);
++ exit (1);
++ }
++
+ mpfr_neg (x, x, MPFR_RNDN);
+- mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
++ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
++ if (n != 2)
++ {
++ printf ("Error: mpfr_out_str (file, 10, 0, -0, MPFR_RNDN) wrote %u "
++ "characters instead of 2.\n", n);
++ exit (1);
++ }
+
+ mpfr_clear (x);
+ }
+diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
+--- mpfr-3.0.0-a/version.c 2010-06-10 11:00:14.000000000 +0000
++++ mpfr-3.0.0-b/version.c 2010-06-23 11:03:20.000000000 +0000
+@@ -25,5 +25,5 @@
+ const char *
+ mpfr_get_version (void)
+ {
+- return "3.0.0";
++ return "3.0.0-p1";
+ }
+diff -Naurd mpfr-3.0.0-a/Makefile.in mpfr-3.0.0-b/Makefile.in
+--- mpfr-3.0.0-a/Makefile.in 2010-06-10 11:00:52.000000000 +0000
++++ mpfr-3.0.0-b/Makefile.in 2010-06-10 11:00:52.000000000 +0000
+@@ -239,6 +239,7 @@
+ distuninstallcheck_listfiles = find . -type f -print
+ distcleancheck_listfiles = find . -type f -print
+ ACLOCAL = @ACLOCAL@
++ALLOCA = @ALLOCA@
+ AMTAR = @AMTAR@
+ AR = @AR@
+ AS = @AS@
+diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
+--- mpfr-3.0.0-a/PATCHES 2010-06-23 11:03:36.000000000 +0000
++++ mpfr-3.0.0-b/PATCHES 2010-06-25 13:23:13.000000000 +0000
+@@ -0,0 +1 @@
++alloca
+diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
+--- mpfr-3.0.0-a/VERSION 2010-06-23 11:03:20.000000000 +0000
++++ mpfr-3.0.0-b/VERSION 2010-06-25 13:23:13.000000000 +0000
+@@ -1 +1 @@
+-3.0.0-p1
++3.0.0-p2
+diff -Naurd mpfr-3.0.0-a/acinclude.m4 mpfr-3.0.0-b/acinclude.m4
+--- mpfr-3.0.0-a/acinclude.m4 2010-06-10 11:00:14.000000000 +0000
++++ mpfr-3.0.0-b/acinclude.m4 2010-06-10 11:00:14.000000000 +0000
+@@ -59,6 +59,9 @@
+ dnl sys/fpu.h - MIPS specific
+ AC_CHECK_HEADERS([sys/time.h sys/fpu.h])
+
++dnl Check how to get `alloca'
++AC_FUNC_ALLOCA
++
+ dnl SIZE_MAX macro
+ gl_SIZE_MAX
+
+diff -Naurd mpfr-3.0.0-a/configure mpfr-3.0.0-b/configure
+--- mpfr-3.0.0-a/configure 2010-06-10 11:00:51.000000000 +0000
++++ mpfr-3.0.0-b/configure 2010-06-25 13:23:05.000000000 +0000
+@@ -783,6 +783,7 @@
+ OBJDUMP
+ DLLTOOL
+ AS
++ALLOCA
+ MPFR_LIBM
+ ANSI2KNR
+ U
+@@ -5622,6 +5623,197 @@
+ done
+
+
++# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
++# for constant arguments. Useless!
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
++$as_echo_n "checking for working alloca.h... " >&6; }
++if test "${ac_cv_working_alloca_h+set}" = set; then :
++ $as_echo_n "(cached) " >&6
++else
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++#include <alloca.h>
++int
++main ()
++{
++char *p = (char *) alloca (2 * sizeof (int));
++ if (p) return 0;
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++ ac_cv_working_alloca_h=yes
++else
++ ac_cv_working_alloca_h=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
++$as_echo "$ac_cv_working_alloca_h" >&6; }
++if test $ac_cv_working_alloca_h = yes; then
++
++$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
++
++fi
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
++$as_echo_n "checking for alloca... " >&6; }
++if test "${ac_cv_func_alloca_works+set}" = set; then :
++ $as_echo_n "(cached) " >&6
++else
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++#ifdef __GNUC__
++# define alloca __builtin_alloca
++#else
++# ifdef _MSC_VER
++# include <malloc.h>
++# define alloca _alloca
++# else
++# ifdef HAVE_ALLOCA_H
++# include <alloca.h>
++# else
++# ifdef _AIX
++ #pragma alloca
++# else
++# ifndef alloca /* predefined by HP cc +Olibcalls */
++char *alloca ();
++# endif
++# endif
++# endif
++# endif
++#endif
++
++int
++main ()
++{
++char *p = (char *) alloca (1);
++ if (p) return 0;
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++ ac_cv_func_alloca_works=yes
++else
++ ac_cv_func_alloca_works=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
++$as_echo "$ac_cv_func_alloca_works" >&6; }
++
++if test $ac_cv_func_alloca_works = yes; then
++
++$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
++
++else
++ # The SVR3 libPW and SVR4 libucb both contain incompatible functions
++# that cause trouble. Some versions do not even contain alloca or
++# contain a buggy version. If you still want to use their alloca,
++# use ar to extract alloca.o from them instead of compiling alloca.c.
++
++ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
++
++$as_echo "#define C_ALLOCA 1" >>confdefs.h
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
++$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
++if test "${ac_cv_os_cray+set}" = set; then :
++ $as_echo_n "(cached) " >&6
++else
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++#if defined CRAY && ! defined CRAY2
++webecray
++#else
++wenotbecray
++#endif
++
++_ACEOF
++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
++ $EGREP "webecray" >/dev/null 2>&1; then :
++ ac_cv_os_cray=yes
++else
++ ac_cv_os_cray=no
++fi
++rm -f conftest*
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
++$as_echo "$ac_cv_os_cray" >&6; }
++if test $ac_cv_os_cray = yes; then
++ for ac_func in _getb67 GETB67 getb67; do
++ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
++ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
++eval as_val=\$$as_ac_var
++ if test "x$as_val" = x""yes; then :
++
++cat >>confdefs.h <<_ACEOF
++#define CRAY_STACKSEG_END $ac_func
++_ACEOF
++
++ break
++fi
++
++ done
++fi
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
++$as_echo_n "checking stack direction for C alloca... " >&6; }
++if test "${ac_cv_c_stack_direction+set}" = set; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test "$cross_compiling" = yes; then :
++ ac_cv_c_stack_direction=0
++else
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++$ac_includes_default
++int
++find_stack_direction ()
++{
++ static char *addr = 0;
++ auto char dummy;
++ if (addr == 0)
++ {
++ addr = &dummy;
++ return find_stack_direction ();
++ }
++ else
++ return (&dummy > addr) ? 1 : -1;
++}
++
++int
++main ()
++{
++ return find_stack_direction () < 0;
++}
++_ACEOF
++if ac_fn_c_try_run "$LINENO"; then :
++ ac_cv_c_stack_direction=1
++else
++ ac_cv_c_stack_direction=-1
++fi
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
++ conftest.$ac_objext conftest.beam conftest.$ac_ext
++fi
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
++$as_echo "$ac_cv_c_stack_direction" >&6; }
++cat >>confdefs.h <<_ACEOF
++#define STACK_DIRECTION $ac_cv_c_stack_direction
++_ACEOF
++
++
++fi
++
++
+
+ for ac_header in stdint.h
+ do :
+@@ -7564,13 +7756,13 @@
+ else
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+- (eval echo "\"\$as_me:7567: $ac_compile\"" >&5)
++ (eval echo "\"\$as_me:7759: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+- (eval echo "\"\$as_me:7570: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
++ (eval echo "\"\$as_me:7762: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+- (eval echo "\"\$as_me:7573: output\"" >&5)
++ (eval echo "\"\$as_me:7765: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+@@ -8772,7 +8964,7 @@
+ ;;
+ *-*-irix6*)
+ # Find out which ABI we are using.
+- echo '#line 8775 "configure"' > conftest.$ac_ext
++ echo '#line 8967 "configure"' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+@@ -10032,11 +10224,11 @@
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+- (eval echo "\"\$as_me:10035: $lt_compile\"" >&5)
++ (eval echo "\"\$as_me:10227: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+- echo "$as_me:10039: \$? = $ac_status" >&5
++ echo "$as_me:10231: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+@@ -10371,11 +10563,11 @@
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+- (eval echo "\"\$as_me:10374: $lt_compile\"" >&5)
++ (eval echo "\"\$as_me:10566: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+- echo "$as_me:10378: \$? = $ac_status" >&5
++ echo "$as_me:10570: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+@@ -10476,11 +10668,11 @@
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+- (eval echo "\"\$as_me:10479: $lt_compile\"" >&5)
++ (eval echo "\"\$as_me:10671: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+- echo "$as_me:10483: \$? = $ac_status" >&5
++ echo "$as_me:10675: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+@@ -10531,11 +10723,11 @@
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+- (eval echo "\"\$as_me:10534: $lt_compile\"" >&5)
++ (eval echo "\"\$as_me:10726: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+- echo "$as_me:10538: \$? = $ac_status" >&5
++ echo "$as_me:10730: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+@@ -12915,7 +13107,7 @@
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 12918 "configure"
++#line 13110 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -13011,7 +13203,7 @@
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 13014 "configure"
++#line 13206 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
+--- mpfr-3.0.0-a/mpfr.h 2010-06-23 11:03:20.000000000 +0000
++++ mpfr-3.0.0-b/mpfr.h 2010-06-25 13:23:13.000000000 +0000
+@@ -27,7 +27,7 @@
+ #define MPFR_VERSION_MAJOR 3
+ #define MPFR_VERSION_MINOR 0
+ #define MPFR_VERSION_PATCHLEVEL 0
+-#define MPFR_VERSION_STRING "3.0.0-p1"
++#define MPFR_VERSION_STRING "3.0.0-p2"
+
+ /* Macros dealing with MPFR VERSION */
+ #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
+diff -Naurd mpfr-3.0.0-a/tests/Makefile.in mpfr-3.0.0-b/tests/Makefile.in
+--- mpfr-3.0.0-a/tests/Makefile.in 2010-06-10 11:00:52.000000000 +0000
++++ mpfr-3.0.0-b/tests/Makefile.in 2010-06-10 11:00:52.000000000 +0000
+@@ -960,6 +960,7 @@
+ red=; grn=; lgn=; blu=; std=
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ ACLOCAL = @ACLOCAL@
++ALLOCA = @ALLOCA@
+ AMTAR = @AMTAR@
+ AR = @AR@
+ AS = @AS@
+diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
+--- mpfr-3.0.0-a/version.c 2010-06-23 11:03:20.000000000 +0000
++++ mpfr-3.0.0-b/version.c 2010-06-25 13:23:13.000000000 +0000
+@@ -25,5 +25,5 @@
+ const char *
+ mpfr_get_version (void)
+ {
+- return "3.0.0-p1";
++ return "3.0.0-p2";
+ }
+diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
+--- mpfr-3.0.0-a/PATCHES 2010-07-10 00:11:19.000000000 +0000
++++ mpfr-3.0.0-b/PATCHES 2010-07-10 00:12:50.000000000 +0000
+@@ -0,0 +1 @@
++gamma_underflow
+diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
+--- mpfr-3.0.0-a/VERSION 2010-06-25 13:23:13.000000000 +0000
++++ mpfr-3.0.0-b/VERSION 2010-07-10 00:11:53.000000000 +0000
+@@ -1 +1 @@
+-3.0.0-p2
++3.0.0-p3
+diff -Naurd mpfr-3.0.0-a/gamma.c mpfr-3.0.0-b/gamma.c
+--- mpfr-3.0.0-a/gamma.c 2010-06-10 11:00:14.000000000 +0000
++++ mpfr-3.0.0-b/gamma.c 2010-07-10 00:11:46.000000000 +0000
+@@ -274,7 +274,7 @@
+ /* we want an upper bound for x * [log(2-x)-1].
+ since x < 0, we need a lower bound on log(2-x) */
+ mpfr_ui_sub (xp, 2, x, MPFR_RNDD);
+- mpfr_log (xp, xp, MPFR_RNDD);
++ mpfr_log2 (xp, xp, MPFR_RNDD);
+ mpfr_sub_ui (xp, xp, 1, MPFR_RNDD);
+ mpfr_mul (xp, xp, x, MPFR_RNDU);
+
+@@ -303,8 +303,8 @@
+ {
+ mpfr_sub (tmp, tmp, tmp2, MPFR_RNDZ); /* low bnd on |sin(Pi*(2-x))| */
+ mpfr_ui_div (tmp, 12, tmp, MPFR_RNDU); /* upper bound */
+- mpfr_log (tmp, tmp, MPFR_RNDU);
+- mpfr_add (tmp, tmp, xp, MPFR_RNDU);
++ mpfr_log2 (tmp, tmp, MPFR_RNDU);
++ mpfr_add (xp, tmp, xp, MPFR_RNDU);
+ underflow = mpfr_cmp_si (xp, expo.saved_emin - 2) <= 0;
+ }
+
+diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
+--- mpfr-3.0.0-a/mpfr.h 2010-06-25 13:23:13.000000000 +0000
++++ mpfr-3.0.0-b/mpfr.h 2010-07-10 00:11:53.000000000 +0000
+@@ -27,7 +27,7 @@
+ #define MPFR_VERSION_MAJOR 3
+ #define MPFR_VERSION_MINOR 0
+ #define MPFR_VERSION_PATCHLEVEL 0
+-#define MPFR_VERSION_STRING "3.0.0-p2"
++#define MPFR_VERSION_STRING "3.0.0-p3"
+
+ /* Macros dealing with MPFR VERSION */
+ #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
+diff -Naurd mpfr-3.0.0-a/tests/tgamma.c mpfr-3.0.0-b/tests/tgamma.c
+--- mpfr-3.0.0-a/tests/tgamma.c 2010-06-10 11:00:13.000000000 +0000
++++ mpfr-3.0.0-b/tests/tgamma.c 2010-07-10 00:11:46.000000000 +0000
+@@ -461,6 +461,20 @@
+ mpfr_clear (x);
+ }
+
++/* bug found by Stathis, only occurs on 32-bit machines */
++static void
++test20100709 (void)
++{
++ mpfr_t x;
++ int inex;
++
++ mpfr_init2 (x, 100);
++ mpfr_set_str (x, "-4.6308260837372266e+07", 10, MPFR_RNDN);
++ inex = mpfr_gamma (x, x, MPFR_RNDN);
++ MPFR_ASSERTN(MPFR_IS_ZERO(x) && MPFR_IS_NEG(x) && inex > 0);
++ mpfr_clear (x);
++}
++
+ int
+ main (int argc, char *argv[])
+ {
+@@ -471,6 +485,7 @@
+ test_generic (2, 100, 2);
+ gamma_integer ();
+ test20071231 ();
++ test20100709 ();
+
+ data_check ("data/gamma", mpfr_gamma, "mpfr_gamma");
+
+diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
+--- mpfr-3.0.0-a/version.c 2010-06-25 13:23:13.000000000 +0000
++++ mpfr-3.0.0-b/version.c 2010-07-10 00:11:53.000000000 +0000
+@@ -25,5 +25,5 @@
+ const char *
+ mpfr_get_version (void)
+ {
+- return "3.0.0-p2";
++ return "3.0.0-p3";
+ }
+diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
+--- mpfr-3.0.0-a/PATCHES 2010-09-07 08:44:01.000000000 +0000
++++ mpfr-3.0.0-b/PATCHES 2010-09-07 08:48:46.000000000 +0000
+@@ -0,0 +1 @@
++mpfr_cmp/set_ui/si
+diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
+--- mpfr-3.0.0-a/VERSION 2010-07-10 00:11:53.000000000 +0000
++++ mpfr-3.0.0-b/VERSION 2010-09-07 08:46:06.000000000 +0000
+@@ -1 +1 @@
+-3.0.0-p3
++3.0.0-p4
+diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
+--- mpfr-3.0.0-a/mpfr.h 2010-07-10 00:11:53.000000000 +0000
++++ mpfr-3.0.0-b/mpfr.h 2010-09-07 08:46:06.000000000 +0000
+@@ -27,7 +27,7 @@
+ #define MPFR_VERSION_MAJOR 3
+ #define MPFR_VERSION_MINOR 0
+ #define MPFR_VERSION_PATCHLEVEL 0
+-#define MPFR_VERSION_STRING "3.0.0-p3"
++#define MPFR_VERSION_STRING "3.0.0-p4"
+
+ /* Macros dealing with MPFR VERSION */
+ #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
+@@ -798,35 +798,45 @@
+ anyway. Checking with other ICC versions is needed. Possibly detect
+ whether warnings are produced or not with a configure test.
+ + Remove C++ too, since it complains too much. */
++/* Added casts to improve robustness in case of undefined behavior and
++ compiler extensions based on UB (in particular -fwrapv). MPFR doesn't
++ use such extensions, but these macros will be used by 3rd-party code,
++ where such extensions may be required.
++ Moreover casts to unsigned long have been added to avoid warnings in
++ programs that use MPFR and are compiled with -Wconversion; such casts
++ are OK since if X is a constant expression, then (unsigned long) X is
++ also a constant expression, so that the optimizations still work. */
+ #if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus)
+ #if (__GNUC__ >= 2)
+ #undef mpfr_cmp_ui
+-/* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0. */
+-#define mpfr_cmp_ui(_f,_u) \
+- (__builtin_constant_p (_u) && (_u) == 0 ? \
+- mpfr_sgn (_f) : \
+- mpfr_cmp_ui_2exp ((_f),(_u),0))
++/* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0.
++ But warning! mpfr_sgn is specified as a macro in the API, thus the macro
++ mustn't be used if side effects are possible, like here. */
++#define mpfr_cmp_ui(_f,_u) \
++ (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
++ (mpfr_sgn) (_f) : \
++ mpfr_cmp_ui_2exp ((_f), (unsigned long) (_u), 0))
+ #undef mpfr_cmp_si
+-#define mpfr_cmp_si(_f,_s) \
+- (__builtin_constant_p (_s) && (_s) >= 0 ? \
+- mpfr_cmp_ui ((_f), (_s)) : \
+- mpfr_cmp_si_2exp ((_f), (_s), 0))
++#define mpfr_cmp_si(_f,_s) \
++ (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
++ mpfr_cmp_ui ((_f), (unsigned long) (long) (_s)) : \
++ mpfr_cmp_si_2exp ((_f), (long) (_s), 0))
+ #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
+ #undef mpfr_set_ui
+-#define mpfr_set_ui(_f,_u,_r) \
+- (__builtin_constant_p (_u) && (_u) == 0 ? \
+- __extension__ ({ \
+- mpfr_ptr _p = (_f); \
+- _p->_mpfr_sign = 1; \
+- _p->_mpfr_exp = __MPFR_EXP_ZERO; \
+- (void) (_r); 0; }) : \
+- mpfr_set_ui_2exp ((_f), (_u), 0, (_r)))
++#define mpfr_set_ui(_f,_u,_r) \
++ (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
++ __extension__ ({ \
++ mpfr_ptr _p = (_f); \
++ _p->_mpfr_sign = 1; \
++ _p->_mpfr_exp = __MPFR_EXP_ZERO; \
++ (void) (_r); 0; }) : \
++ mpfr_set_ui_2exp ((_f), (unsigned long) (_u), 0, (_r)))
+ #endif
+ #undef mpfr_set_si
+-#define mpfr_set_si(_f,_s,_r) \
+- (__builtin_constant_p (_s) && (_s) >= 0 ? \
+- mpfr_set_ui ((_f), (_s), (_r)) : \
+- mpfr_set_si_2exp ((_f), (_s), 0, (_r)))
++#define mpfr_set_si(_f,_s,_r) \
++ (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
++ mpfr_set_ui ((_f), (unsigned long) (long) (_s), (_r)) : \
++ mpfr_set_si_2exp ((_f), (long) (_s), 0, (_r)))
+ #endif
+ #endif
+
+diff -Naurd mpfr-3.0.0-a/tests/tcmp_ui.c mpfr-3.0.0-b/tests/tcmp_ui.c
+--- mpfr-3.0.0-a/tests/tcmp_ui.c 2010-06-10 11:00:13.000000000 +0000
++++ mpfr-3.0.0-b/tests/tcmp_ui.c 2010-09-07 08:45:12.000000000 +0000
+@@ -88,6 +88,126 @@
+ mpfr_clear (x);
+ }
+
++/* Since mpfr_cmp_ui and mpfr_cmp_si are also implemented by a macro
++ with __builtin_constant_p for GCC, check that side effects are
++ handled correctly. */
++static void
++check_macros (void)
++{
++ mpfr_t x;
++ int c;
++
++ mpfr_init2 (x, 32);
++
++ c = 0;
++ mpfr_set_ui (x, 17, MPFR_RNDN);
++ if (mpfr_cmp_ui (x, 17) != 0)
++ {
++ printf ("Error 1 on mpfr_cmp_ui(x,17) in check_macros\n");
++ exit (1);
++ }
++ if (mpfr_cmp_ui (x, (c++, 17)) != 0)
++ {
++ printf ("Error 2 on mpfr_cmp_ui(x,17) in check_macros\n");
++ exit (1);
++ }
++ if (c != 1)
++ {
++ printf ("Error 3 on mpfr_cmp_ui(x,17) in check_macros\n"
++ "(c = %d instead of 1)\n", c);
++ exit (1);
++ }
++ if (mpfr_cmp_si (x, 17) != 0)
++ {
++ printf ("Error 1 on mpfr_cmp_si(x,17) in check_macros\n");
++ exit (1);
++ }
++ if (mpfr_cmp_si (x, (c++, 17)) != 0)
++ {
++ printf ("Error 2 on mpfr_cmp_si(x,17) in check_macros\n");
++ exit (1);
++ }
++ if (c != 2)
++ {
++ printf ("Error 3 on mpfr_cmp_si(x,17) in check_macros\n"
++ "(c = %d instead of 2)\n", c);
++ exit (1);
++ }
++
++ c = 0;
++ mpfr_set_ui (x, 0, MPFR_RNDN);
++ if (mpfr_cmp_ui (x, 0) != 0)
++ {
++ printf ("Error 1 on mpfr_cmp_ui(x,0) in check_macros\n");
++ exit (1);
++ }
++ if (mpfr_cmp_ui (x, (c++, 0)) != 0)
++ {
++ printf ("Error 2 on mpfr_cmp_ui(x,0) in check_macros\n");
++ exit (1);
++ }
++ if (c != 1)
++ {
++ printf ("Error 3 on mpfr_cmp_ui(x,0) in check_macros\n"
++ "(c = %d instead of 1)\n", c);
++ exit (1);
++ }
++ if (mpfr_cmp_si (x, 0) != 0)
++ {
++ printf ("Error 1 on mpfr_cmp_si(x,0) in check_macros\n");
++ exit (1);
++ }
++ if (mpfr_cmp_si (x, (c++, 0)) != 0)
++ {
++ printf ("Error 2 on mpfr_cmp_si(x,0) in check_macros\n");
++ exit (1);
++ }
++ if (c != 2)
++ {
++ printf ("Error 3 on mpfr_cmp_si(x,0) in check_macros\n"
++ "(c = %d instead of 2)\n", c);
++ exit (1);
++ }
++
++ mpfr_clear (x);
++}
++
++/* Bug in r7114 */
++static void
++test_macros (void)
++{
++ mpfr_t x[3];
++ mpfr_ptr p;
++
++ mpfr_inits (x[0], x[1], x[2], (mpfr_ptr) 0);
++ mpfr_set_ui (x[0], 0, MPFR_RNDN);
++ p = x[0];
++ if (mpfr_cmp_ui (p++, 0) != 0)
++ {
++ printf ("Error in mpfr_cmp_ui macro: result should be 0.\n");
++ exit (1);
++ }
++ if (p != x[1])
++ {
++ printf ("Error in mpfr_cmp_ui macro: p - x[0] = %d (expecting 1)\n",
++ (int) (p - x[0]));
++ exit (1);
++ }
++ p = x[0];
++ if (mpfr_cmp_si (p++, 0) != 0)
++ {
++ printf ("Error in mpfr_cmp_si macro: result should be 0.\n");
++ exit (1);
++ }
++ if (p != x[1])
++ {
++ printf ("Error in mpfr_cmp_si macro: p - x[0] = %d (expecting 1)\n",
++ (int) (p - x[0]));
++ exit (1);
++ }
++ mpfr_clears (x[0], x[1], x[2], (mpfr_ptr) 0);
++}
++
+ int
+ main (void)
+ {
+@@ -216,6 +336,8 @@
+ mpfr_clear (x);
+
+ check_nan ();
++ check_macros ();
++ test_macros ();
+
+ tests_end_mpfr ();
+ return 0;
+diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
+--- mpfr-3.0.0-a/version.c 2010-07-10 00:11:53.000000000 +0000
++++ mpfr-3.0.0-b/version.c 2010-09-07 08:46:06.000000000 +0000
+@@ -25,5 +25,5 @@
+ const char *
+ mpfr_get_version (void)
+ {
+- return "3.0.0-p3";
++ return "3.0.0-p4";
+ }
+diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
+--- mpfr-3.0.0-a/PATCHES 2010-10-21 20:28:38.000000000 +0000
++++ mpfr-3.0.0-b/PATCHES 2010-10-21 20:28:38.000000000 +0000
+@@ -0,0 +1 @@
++tcan_round
+diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
+--- mpfr-3.0.0-a/VERSION 2010-09-07 08:46:06.000000000 +0000
++++ mpfr-3.0.0-b/VERSION 2010-10-21 20:28:38.000000000 +0000
+@@ -1 +1 @@
+-3.0.0-p4
++3.0.0-p5
+diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
+--- mpfr-3.0.0-a/mpfr.h 2010-09-07 08:46:06.000000000 +0000
++++ mpfr-3.0.0-b/mpfr.h 2010-10-21 20:28:38.000000000 +0000
+@@ -27,7 +27,7 @@
+ #define MPFR_VERSION_MAJOR 3
+ #define MPFR_VERSION_MINOR 0
+ #define MPFR_VERSION_PATCHLEVEL 0
+-#define MPFR_VERSION_STRING "3.0.0-p4"
++#define MPFR_VERSION_STRING "3.0.0-p5"
+
+ /* Macros dealing with MPFR VERSION */
+ #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
+diff -Naurd mpfr-3.0.0-a/tests/tcan_round.c mpfr-3.0.0-b/tests/tcan_round.c
+--- mpfr-3.0.0-a/tests/tcan_round.c 2010-06-10 11:00:13.000000000 +0000
++++ mpfr-3.0.0-b/tests/tcan_round.c 2010-10-21 20:28:38.000000000 +0000
+@@ -41,7 +41,7 @@
+ /* avoid mpn_random which leaks memory */
+ for (i = 0; i < n; i++)
+ buf[i] = randlimb ();
+- p = (mpfr_prec_t) randlimb() % ((n-1) * GMP_NUMB_BITS) + MPFR_PREC_MIN;
++ p = randlimb() % ((n-1) * GMP_NUMB_BITS) + MPFR_PREC_MIN;
+ err = p + randlimb () % GMP_NUMB_BITS;
+ r1 = mpfr_round_p (buf, n, err, p);
+ r2 = mpfr_can_round_raw (buf, n, MPFR_SIGN_POS, err,
+diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
+--- mpfr-3.0.0-a/version.c 2010-09-07 08:46:06.000000000 +0000
++++ mpfr-3.0.0-b/version.c 2010-10-21 20:28:38.000000000 +0000
+@@ -25,5 +25,5 @@
+ const char *
+ mpfr_get_version (void)
+ {
+- return "3.0.0-p4";
++ return "3.0.0-p5";
+ }
+diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
+--- mpfr-3.0.0-a/PATCHES 2010-10-21 20:59:32.000000000 +0000
++++ mpfr-3.0.0-b/PATCHES 2010-10-21 20:59:32.000000000 +0000
+@@ -0,0 +1 @@
++mpfr_sub1
+diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
+--- mpfr-3.0.0-a/VERSION 2010-10-21 20:28:38.000000000 +0000
++++ mpfr-3.0.0-b/VERSION 2010-10-21 20:59:32.000000000 +0000
+@@ -1 +1 @@
+-3.0.0-p5
++3.0.0-p6
+diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
+--- mpfr-3.0.0-a/mpfr.h 2010-10-21 20:28:38.000000000 +0000
++++ mpfr-3.0.0-b/mpfr.h 2010-10-21 20:59:32.000000000 +0000
+@@ -27,7 +27,7 @@
+ #define MPFR_VERSION_MAJOR 3
+ #define MPFR_VERSION_MINOR 0
+ #define MPFR_VERSION_PATCHLEVEL 0
+-#define MPFR_VERSION_STRING "3.0.0-p5"
++#define MPFR_VERSION_STRING "3.0.0-p6"
+
+ /* Macros dealing with MPFR VERSION */
+ #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
+diff -Naurd mpfr-3.0.0-a/sub1.c mpfr-3.0.0-b/sub1.c
+--- mpfr-3.0.0-a/sub1.c 2010-06-10 11:00:14.000000000 +0000
++++ mpfr-3.0.0-b/sub1.c 2010-10-21 20:59:32.000000000 +0000
+@@ -37,7 +37,9 @@
+ mp_size_t cancel2, an, bn, cn, cn0;
+ mp_limb_t *ap, *bp, *cp;
+ mp_limb_t carry, bb, cc, borrow = 0;
+- int inexact, shift_b, shift_c, is_exact = 1, down = 0, add_exp = 0;
++ int inexact, shift_b, shift_c, add_exp = 0;
++ int cmp_low = 0; /* used for rounding to nearest: 0 if low(b) = low(c),
++ negative if low(b) < low(c), positive if low(b)>low(c) */
+ int sh, k;
+ MPFR_TMP_DECL(marker);
+
+@@ -196,7 +198,8 @@
+ }
+
+ #ifdef DEBUG
+- printf ("shift_b=%d shift_c=%d diffexp=%lu\n", shift_b, shift_c,
++ printf ("rnd=%s shift_b=%d shift_c=%d diffexp=%lu\n",
++ mpfr_print_rnd_mode (rnd_mode), shift_b, shift_c,
+ (unsigned long) diff_exp);
+ #endif
+
+@@ -307,17 +310,18 @@
+ {
+ if (MPFR_LIKELY(sh))
+ {
+- is_exact = (carry == 0);
+ /* can decide except when carry = 2^(sh-1) [middle]
+ or carry = 0 [truncate, but cannot decide inexact flag] */
+- down = (carry < (MPFR_LIMB_ONE << (sh - 1)));
+ if (carry > (MPFR_LIMB_ONE << (sh - 1)))
+ goto add_one_ulp;
+- else if ((0 < carry) && down)
++ else if ((0 < carry) && (carry < (MPFR_LIMB_ONE << (sh - 1))))
+ {
+ inexact = -1; /* result if smaller than exact value */
+ goto truncate;
+ }
++ /* now carry = 2^(sh-1), in which case cmp_low=2,
++ or carry = 0, in which case cmp_low=0 */
++ cmp_low = (carry == 0) ? 0 : 2;
+ }
+ }
+ else /* directed rounding: set rnd_mode to RNDZ iff toward zero */
+@@ -344,12 +348,32 @@
+ cn -= (long int) an + cancel2;
+
+ #ifdef DEBUG
+- printf ("last %d bits from a are %lu, bn=%ld, cn=%ld\n",
++ printf ("last sh=%d bits from a are %lu, bn=%ld, cn=%ld\n",
+ sh, (unsigned long) carry, (long) bn, (long) cn);
+ #endif
+
++ /* for rounding to nearest, we couldn't conclude up to here in the following
++ cases:
++ 1. sh = 0, then cmp_low=0: we can either truncate, subtract one ulp
++ or add one ulp: -1 ulp < low(b)-low(c) < 1 ulp
++ 2. sh > 0 but the low sh bits from high(b)-high(c) equal 2^(sh-1):
++ -0.5 ulp <= -1/2^sh < low(b)-low(c)-0.5 < 1/2^sh <= 0.5 ulp
++ we can't decide the rounding, in that case cmp_low=2:
++ either we truncate and flag=-1, or we add one ulp and flag=1
++ 3. the low sh>0 bits from high(b)-high(c) equal 0: we know we have to
++ truncate but we can't decide the ternary value, here cmp_low=0:
++ -0.5 ulp <= -1/2^sh < low(b)-low(c) < 1/2^sh <= 0.5 ulp
++ we always truncate and inexact can be any of -1,0,1
++ */
++
++ /* note: here cn might exceed cn0, in which case we consider a zero limb */
+ for (k = 0; (bn > 0) || (cn > 0); k = 1)
+ {
++ /* if cmp_low < 0, we know low(b) - low(c) < 0
++ if cmp_low > 0, we know low(b) - low(c) > 0
++ (more precisely if cmp_low = 2, low(b) - low(c) = 0.5 ulp so far)
++ if cmp_low = 0, so far low(b) - low(c) = 0 */
++
+ /* get next limbs */
+ bb = (bn > 0) ? bp[--bn] : 0;
+ if ((cn > 0) && (cn-- <= cn0))
+@@ -357,76 +381,115 @@
+ else
+ cc = 0;
+
+- /* down is set when low(b) < low(c) */
+- if (down == 0)
+- down = (bb < cc);
++ /* cmp_low compares low(b) and low(c) */
++ if (cmp_low == 0) /* case 1 or 3 */
++ cmp_low = (bb < cc) ? -2+k : (bb > cc) ? 1 : 0;
++
++ /* Case 1 for k=0 splits into 7 subcases:
++ 1a: bb > cc + half
++ 1b: bb = cc + half
++ 1c: 0 < bb - cc < half
++ 1d: bb = cc
++ 1e: -half < bb - cc < 0
++ 1f: bb - cc = -half
++ 1g: bb - cc < -half
++
++ Case 2 splits into 3 subcases:
++ 2a: bb > cc
++ 2b: bb = cc
++ 2c: bb < cc
++
++ Case 3 splits into 3 subcases:
++ 3a: bb > cc
++ 3b: bb = cc
++ 3c: bb < cc
++ */
+
+ /* the case rounding to nearest with sh=0 is special since one couldn't
+ subtract above 1/2 ulp in the trailing limb of the result */
+- if ((rnd_mode == MPFR_RNDN) && sh == 0 && k == 0)
++ if (rnd_mode == MPFR_RNDN && sh == 0 && k == 0) /* case 1 for k=0 */
+ {
+ mp_limb_t half = MPFR_LIMB_HIGHBIT;
+
+- is_exact = (bb == cc);
+-
+ /* add one ulp if bb > cc + half
+ truncate if cc - half < bb < cc + half
+ sub one ulp if bb < cc - half
+ */
+
+- if (down)
++ if (cmp_low < 0) /* bb < cc: -1 ulp < low(b) - low(c) < 0,
++ cases 1e, 1f and 1g */
+ {
+ if (cc >= half)
+ cc -= half;
+- else
++ else /* since bb < cc < half, bb+half < 2*half */
+ bb += half;
++ /* now we have bb < cc + half:
++ we have to subtract one ulp if bb < cc,
++ and truncate if bb > cc */
+ }
+- else /* bb >= cc */
++ else if (cmp_low >= 0) /* bb >= cc, cases 1a to 1d */
+ {
+ if (cc < half)
+ cc += half;
+- else
++ else /* since bb >= cc >= half, bb - half >= 0 */
+ bb -= half;
++ /* now we have bb > cc - half: we have to add one ulp if bb > cc,
++ and truncate if bb < cc */
++ if (cmp_low > 0)
++ cmp_low = 2;
+ }
+ }
+
+ #ifdef DEBUG
+- printf (" bb=%lu cc=%lu down=%d is_exact=%d\n",
+- (unsigned long) bb, (unsigned long) cc, down, is_exact);
++ printf ("k=%u bb=%lu cc=%lu cmp_low=%d\n", k,
++ (unsigned long) bb, (unsigned long) cc, cmp_low);
+ #endif
+- if (bb < cc)
++ if (cmp_low < 0) /* low(b) - low(c) < 0: either truncate or subtract
++ one ulp */
+ {
+ if (rnd_mode == MPFR_RNDZ)
+- goto sub_one_ulp;
++ goto sub_one_ulp; /* set inexact=-1 */
+ else if (rnd_mode != MPFR_RNDN) /* round away */
+ {
+ inexact = 1;
+ goto truncate;
+ }
+- else /* round to nearest: special case here since for sh=k=0
+- bb = bb0 - MPFR_LIMB_HIGHBIT */
++ else /* round to nearest */
+ {
+- if (is_exact && sh == 0)
+- {
+- /* For k=0 we can't decide exactness since it may depend
+- from low order bits.
+- For k=1, the first low limbs matched: low(b)-low(c)<0. */
+- if (k)
+- {
+- inexact = 1;
+- goto truncate;
+- }
+- }
+- else if (down && sh == 0)
+- goto sub_one_ulp;
+- else
+- {
+- inexact = (is_exact) ? 1 : -1;
++ /* If cmp_low < 0 and bb > cc, then -0.5 ulp < low(b)-low(c) < 0,
++ whatever the value of sh.
++ If sh>0, then cmp_low < 0 implies that the initial neglected
++ sh bits were 0 (otherwise cmp_low=2 initially), thus the
++ weight of the new bits is less than 0.5 ulp too.
++ If k > 0 (and sh=0) this means that either the first neglected
++ limbs bb and cc were equal (thus cmp_low was 0 for k=0),
++ or we had bb - cc = -0.5 ulp or 0.5 ulp.
++ The last case is not possible here since we would have
++ cmp_low > 0 which is sticky.
++ In the first case (where we have cmp_low = -1), we truncate,
++ whereas in the 2nd case we have cmp_low = -2 and we subtract
++ one ulp.
++ */
++ if (bb > cc || sh > 0 || cmp_low == -1)
++ { /* -0.5 ulp < low(b)-low(c) < 0,
++ bb > cc corresponds to cases 1e and 1f1
++ sh > 0 corresponds to cases 3c and 3b3
++ cmp_low = -1 corresponds to case 1d3 (also 3b3) */
++ inexact = 1;
+ goto truncate;
+ }
++ else if (bb < cc) /* here sh = 0 and low(b)-low(c) < -0.5 ulp,
++ this corresponds to cases 1g and 1f3 */
++ goto sub_one_ulp;
++ /* the only case where we can't conclude is sh=0 and bb=cc,
++ i.e., we have low(b) - low(c) = -0.5 ulp (up to now), thus
++ we don't know if we must truncate or subtract one ulp.
++ Note: for sh=0 we can't have low(b) - low(c) = -0.5 ulp up to
++ now, since low(b) - low(c) > 1/2^sh */
+ }
+ }
+- else if (bb > cc)
++ else if (cmp_low > 0) /* 0 < low(b) - low(c): either truncate or
++ add one ulp */
+ {
+ if (rnd_mode == MPFR_RNDZ)
+ {
+@@ -437,34 +500,70 @@
+ goto add_one_ulp;
+ else /* round to nearest */
+ {
+- if (is_exact)
++ if (bb > cc)
+ {
+- inexact = -1;
+- goto truncate;
++ /* if sh=0, then bb>cc means that low(b)-low(c) > 0.5 ulp,
++ and similarly when cmp_low=2 */
++ if (cmp_low == 2) /* cases 1a, 1b1, 2a and 2b1 */
++ goto add_one_ulp;
++ /* sh > 0 and cmp_low > 0: this implies that the sh initial
++ neglected bits were 0, and the remaining low(b)-low(c)>0,
++ but its weight is less than 0.5 ulp */
++ else /* 0 < low(b) - low(c) < 0.5 ulp, this corresponds to
++ cases 3a, 1d1 and 3b1 */
++ {
++ inexact = -1;
++ goto truncate;
++ }
+ }
+- else if (down)
++ else if (bb < cc) /* 0 < low(b) - low(c) < 0.5 ulp, cases 1c,
++ 1b3, 2b3 and 2c */
+ {
+- inexact = 1;
++ inexact = -1;
+ goto truncate;
+ }
+- else
+- goto add_one_ulp;
++ /* the only case where we can't conclude is bb=cc, i.e.,
++ low(b) - low(c) = 0.5 ulp (up to now), thus we don't know
++ if we must truncate or add one ulp. */
+ }
+ }
++ /* after k=0, we cannot conclude in the following cases, we split them
++ according to the values of bb and cc for k=1:
++ 1b. sh=0 and cmp_low = 1 and bb-cc = half [around 0.5 ulp]
++ 1b1. bb > cc: add one ulp, inex = 1
++ 1b2: bb = cc: cannot conclude
++ 1b3: bb < cc: truncate, inex = -1
++ 1d. sh=0 and cmp_low = 0 and bb-cc = 0 [around 0]
++ 1d1: bb > cc: truncate, inex = -1
++ 1d2: bb = cc: cannot conclude
++ 1d3: bb < cc: truncate, inex = +1
++ 1f. sh=0 and cmp_low = -1 and bb-cc = -half [around -0.5 ulp]
++ 1f1: bb > cc: truncate, inex = +1
++ 1f2: bb = cc: cannot conclude
++ 1f3: bb < cc: sub one ulp, inex = -1
++ 2b. sh > 0 and cmp_low = 2 and bb=cc [around 0.5 ulp]
++ 2b1. bb > cc: add one ulp, inex = 1
++ 2b2: bb = cc: cannot conclude
++ 2b3: bb < cc: truncate, inex = -1
++ 3b. sh > 0 and cmp_low = 0 [around 0]
++ 3b1. bb > cc: truncate, inex = -1
++ 3b2: bb = cc: cannot conclude
++ 3b3: bb < cc: truncate, inex = +1
++ */
+ }
+
+- if ((rnd_mode == MPFR_RNDN) && !is_exact)
++ if ((rnd_mode == MPFR_RNDN) && cmp_low != 0)
+ {
+ /* even rounding rule */
+ if ((ap[0] >> sh) & 1)
+ {
+- if (down)
++ if (cmp_low < 0)
+ goto sub_one_ulp;
+ else
+ goto add_one_ulp;
+ }
+ else
+- inexact = (down) ? 1 : -1;
++ inexact = (cmp_low > 0) ? -1 : 1;
+ }
+ else
+ inexact = 0;
+diff -Naurd mpfr-3.0.0-a/tests/tfma.c mpfr-3.0.0-b/tests/tfma.c
+--- mpfr-3.0.0-a/tests/tfma.c 2010-06-10 11:00:13.000000000 +0000
++++ mpfr-3.0.0-b/tests/tfma.c 2010-10-21 20:59:32.000000000 +0000
+@@ -337,6 +337,94 @@
+ mpfr_clears (x, y, z, r, (mpfr_ptr) 0);
+ }
+
++static void
++bug20101018 (void)
++{
++ mpfr_t x, y, z, t, u;
++ int i;
++
++ mpfr_init2 (x, 64);
++ mpfr_init2 (y, 64);
++ mpfr_init2 (z, 64);
++ mpfr_init2 (t, 64);
++ mpfr_init2 (u, 64);
++
++ mpfr_set_str (x, "0xf.fffffffffffffffp-14766", 16, MPFR_RNDN);
++ mpfr_set_str (y, "-0xf.fffffffffffffffp+317", 16, MPFR_RNDN);
++ mpfr_set_str (z, "0x8.3ffffffffffe3ffp-14443", 16, MPFR_RNDN);
++ mpfr_set_str (t, "0x8.7ffffffffffc7ffp-14444", 16, MPFR_RNDN);
++ i = mpfr_fma (u, x, y, z, MPFR_RNDN);
++ if (mpfr_cmp (u, t) != 0)
++ {
++ printf ("Wrong result in bug20101018 (a)\n");
++ printf ("Expected ");
++ mpfr_out_str (stdout, 16, 0, t, MPFR_RNDN);
++ printf ("\nGot ");
++ mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
++ printf ("\n");
++ exit (1);
++ }
++ if (i <= 0)
++ {
++ printf ("Wrong ternary value in bug20101018 (a)\n");
++ printf ("Expected > 0\n");
++ printf ("Got %d\n", i);
++ exit (1);
++ }
++
++ mpfr_set_str (x, "-0xf.fffffffffffffffp-11420", 16, MPFR_RNDN);
++ mpfr_set_str (y, "0xf.fffffffffffffffp+9863", 16, MPFR_RNDN);
++ mpfr_set_str (z, "0x8.fffff80ffffffffp-1551", 16, MPFR_RNDN);
++ mpfr_set_str (t, "0x9.fffff01ffffffffp-1552", 16, MPFR_RNDN);
++ i = mpfr_fma (u, x, y, z, MPFR_RNDN);
++ if (mpfr_cmp (u, t) != 0)
++ {
++ printf ("Wrong result in bug20101018 (b)\n");
++ printf ("Expected ");
++ mpfr_out_str (stdout, 16, 0, t, MPFR_RNDN);
++ printf ("\nGot ");
++ mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
++ printf ("\n");
++ exit (1);
++ }
++ if (i <= 0)
++ {
++ printf ("Wrong ternary value in bug20101018 (b)\n");
++ printf ("Expected > 0\n");
++ printf ("Got %d\n", i);
++ exit (1);
++ }
++
++ mpfr_set_str (x, "0xf.fffffffffffffffp-2125", 16, MPFR_RNDN);
++ mpfr_set_str (y, "-0xf.fffffffffffffffp-6000", 16, MPFR_RNDN);
++ mpfr_set_str (z, "0x8p-8119", 16, MPFR_RNDN);
++ mpfr_set_str (t, "0x8.000000000000001p-8120", 16, MPFR_RNDN);
++ i = mpfr_fma (u, x, y, z, MPFR_RNDN);
++ if (mpfr_cmp (u, t) != 0)
++ {
++ printf ("Wrong result in bug20101018 (c)\n");
++ printf ("Expected ");
++ mpfr_out_str (stdout, 16, 0, t, MPFR_RNDN);
++ printf ("\nGot ");
++ mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
++ printf ("\n");
++ exit (1);
++ }
++ if (i <= 0)
++ {
++ printf ("Wrong ternary value in bug20101018 (c)\n");
++ printf ("Expected > 0\n");
++ printf ("Got %d\n", i);
++ exit (1);
++ }
++
++ mpfr_clear (x);
++ mpfr_clear (y);
++ mpfr_clear (z);
++ mpfr_clear (t);
++ mpfr_clear (u);
++}
++
+ int
+ main (int argc, char *argv[])
+ {
+@@ -345,6 +433,8 @@
+
+ tests_start_mpfr ();
+
++ bug20101018 ();
++
+ mpfr_init (x);
+ mpfr_init (s);
+ mpfr_init (y);
+diff -Naurd mpfr-3.0.0-a/tests/tsub.c mpfr-3.0.0-b/tests/tsub.c
+--- mpfr-3.0.0-a/tests/tsub.c 2010-06-10 11:00:13.000000000 +0000
++++ mpfr-3.0.0-b/tests/tsub.c 2010-10-21 20:59:32.000000000 +0000
+@@ -201,6 +201,8 @@
+ if (mpfr_cmp (z, x))
+ {
+ printf ("Error in mpfr_sub (2)\n");
++ printf ("Expected "); mpfr_print_binary (x); puts ("");
++ printf ("Got "); mpfr_print_binary (z); puts ("");
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "1.1110111011110001110111011111111111101000011001011100101100101101");
+@@ -478,6 +480,156 @@
+ mpfr_clear (u);
+ }
+
++/* Bug found by Jakub Jelinek
++ * http://bugzilla.redhat.com/643657
++ * https://gforge.inria.fr/tracker/index.php?func=detail&aid=11301
++ * The consequence can be either an assertion failure (i = 2 in the
++ * testcase below, in debug mode) or an incorrectly rounded value.
++ */
++static void
++bug20101017 (void)
++{
++ mpfr_t a, b, c;
++ int inex;
++ int i;
++
++ mpfr_init2 (a, GMP_NUMB_BITS * 2);
++ mpfr_init2 (b, GMP_NUMB_BITS);
++ mpfr_init2 (c, GMP_NUMB_BITS);
++
++ /* a = 2^(2N) + k.2^(2N-1) + 2^N and b = 1
++ with N = GMP_NUMB_BITS and k = 0 or 1.
++ c = a - b should round to the same value as a. */
++
++ for (i = 2; i <= 3; i++)
++ {
++ mpfr_set_ui_2exp (a, i, GMP_NUMB_BITS - 1, MPFR_RNDN);
++ mpfr_add_ui (a, a, 1, MPFR_RNDN);
++ mpfr_mul_2ui (a, a, GMP_NUMB_BITS, MPFR_RNDN);
++ mpfr_set_ui (b, 1, MPFR_RNDN);
++ inex = mpfr_sub (c, a, b, MPFR_RNDN);
++ mpfr_set (b, a, MPFR_RNDN);
++ if (! mpfr_equal_p (c, b))
++ {
++ printf ("Error in bug20101017 for i = %d.\n", i);
++ printf ("Expected ");
++ mpfr_out_str (stdout, 16, 0, b, MPFR_RNDN);
++ putchar ('\n');
++ printf ("Got ");
++ mpfr_out_str (stdout, 16, 0, c, MPFR_RNDN);
++ putchar ('\n');
++ exit (1);
++ }
++ if (inex >= 0)
++ {
++ printf ("Error in bug20101017 for i = %d: bad inex value.\n", i);
++ printf ("Expected negative, got %d.\n", inex);
++ exit (1);
++ }
++ }
++
++ mpfr_set_prec (a, 64);
++ mpfr_set_prec (b, 129);
++ mpfr_set_prec (c, 2);
++ mpfr_set_str_binary (b, "0.100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001E65");
++ mpfr_set_str_binary (c, "0.10E1");
++ inex = mpfr_sub (a, b, c, MPFR_RNDN);
++ if (mpfr_cmp_ui_2exp (a, 1, 64) != 0 || inex >= 0)
++ {
++ printf ("Error in mpfr_sub for b-c for b=2^64+1+2^(-64), c=1\n");
++ printf ("Expected result 2^64 with inex < 0\n");
++ printf ("Got "); mpfr_print_binary (a);
++ printf (" with inex=%d\n", inex);
++ exit (1);
++ }
++
++ mpfr_clears (a, b, c, (mpfr_ptr) 0);
++}
++
++/* hard test of rounding */
++static void
++check_rounding (void)
++{
++ mpfr_t a, b, c, res;
++ mpfr_prec_t p;
++ long k, l;
++ int i;
++
++#define MAXKL (2 * GMP_NUMB_BITS)
++ for (p = MPFR_PREC_MIN; p <= GMP_NUMB_BITS; p++)
++ {
++ mpfr_init2 (a, p);
++ mpfr_init2 (res, p);
++ mpfr_init2 (b, p + 1 + MAXKL);
++ mpfr_init2 (c, MPFR_PREC_MIN);
++
++ /* b = 2^p + 1 + 2^(-k), c = 2^(-l) */
++ for (k = 0; k <= MAXKL; k++)
++ for (l = 0; l <= MAXKL; l++)
++ {
++ mpfr_set_ui_2exp (b, 1, p, MPFR_RNDN);
++ mpfr_add_ui (b, b, 1, MPFR_RNDN);
++ mpfr_mul_2ui (b, b, k, MPFR_RNDN);
++ mpfr_add_ui (b, b, 1, MPFR_RNDN);
++ mpfr_div_2ui (b, b, k, MPFR_RNDN);
++ mpfr_set_ui_2exp (c, 1, -l, MPFR_RNDN);
++ i = mpfr_sub (a, b, c, MPFR_RNDN);
++ /* b - c = 2^p + 1 + 2^(-k) - 2^(-l), should be rounded to
++ 2^p for l <= k, and 2^p+2 for l < k */
++ if (l <= k)
++ {
++ if (mpfr_cmp_ui_2exp (a, 1, p) != 0)
++ {
++ printf ("Wrong result in check_rounding\n");
++ printf ("p=%lu k=%ld l=%ld\n", p, k, l);
++ printf ("b="); mpfr_print_binary (b); puts ("");
++ printf ("c="); mpfr_print_binary (c); puts ("");
++ printf ("Expected 2^%lu\n", p);
++ printf ("Got "); mpfr_print_binary (a); puts ("");
++ exit (1);
++ }
++ if (i >= 0)
++ {
++ printf ("Wrong ternary value in check_rounding\n");
++ printf ("p=%lu k=%ld l=%ld\n", p, k, l);
++ printf ("b="); mpfr_print_binary (b); puts ("");
++ printf ("c="); mpfr_print_binary (c); puts ("");
++ printf ("a="); mpfr_print_binary (a); puts ("");
++ printf ("Expected < 0, got %d\n", i);
++ exit (1);
++ }
++ }
++ else /* l < k */
++ {
++ mpfr_set_ui_2exp (res, 1, p, MPFR_RNDN);
++ mpfr_add_ui (res, res, 2, MPFR_RNDN);
++ if (mpfr_cmp (a, res) != 0)
++ {
++ printf ("Wrong result in check_rounding\n");
++ printf ("b="); mpfr_print_binary (b); puts ("");
++ printf ("c="); mpfr_print_binary (c); puts ("");
++ printf ("Expected "); mpfr_print_binary (res); puts ("");
++ printf ("Got "); mpfr_print_binary (a); puts ("");
++ exit (1);
++ }
++ if (i <= 0)
++ {
++ printf ("Wrong ternary value in check_rounding\n");
++ printf ("b="); mpfr_print_binary (b); puts ("");
++ printf ("c="); mpfr_print_binary (c); puts ("");
++ printf ("Expected > 0, got %d\n", i);
++ exit (1);
++ }
++ }
++ }
++
++ mpfr_clear (a);
++ mpfr_clear (res);
++ mpfr_clear (b);
++ mpfr_clear (c);
++ }
++}
++
+ #define TEST_FUNCTION test_sub
+ #define TWO_ARGS
+ #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
+@@ -491,6 +643,8 @@
+
+ tests_start_mpfr ();
+
++ bug20101017 ();
++ check_rounding ();
+ check_diverse ();
+ check_inexact ();
+ bug_ddefour ();
+diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
+--- mpfr-3.0.0-a/version.c 2010-10-21 20:28:38.000000000 +0000
++++ mpfr-3.0.0-b/version.c 2010-10-21 20:59:32.000000000 +0000
+@@ -25,5 +25,5 @@
+ const char *
+ mpfr_get_version (void)
+ {
+- return "3.0.0-p5";
++ return "3.0.0-p6";
+ }
+diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
+--- mpfr-3.0.0-a/PATCHES 2010-10-21 21:18:26.000000000 +0000
++++ mpfr-3.0.0-b/PATCHES 2010-10-21 21:18:26.000000000 +0000
+@@ -0,0 +1 @@
++mpfr_set_ld
+diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
+--- mpfr-3.0.0-a/VERSION 2010-10-21 20:59:32.000000000 +0000
++++ mpfr-3.0.0-b/VERSION 2010-10-21 21:18:26.000000000 +0000
+@@ -1 +1 @@
+-3.0.0-p6
++3.0.0-p7
+diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
+--- mpfr-3.0.0-a/mpfr.h 2010-10-21 20:59:32.000000000 +0000
++++ mpfr-3.0.0-b/mpfr.h 2010-10-21 21:18:26.000000000 +0000
+@@ -27,7 +27,7 @@
+ #define MPFR_VERSION_MAJOR 3
+ #define MPFR_VERSION_MINOR 0
+ #define MPFR_VERSION_PATCHLEVEL 0
+-#define MPFR_VERSION_STRING "3.0.0-p6"
++#define MPFR_VERSION_STRING "3.0.0-p7"
+
+ /* Macros dealing with MPFR VERSION */
+ #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
+diff -Naurd mpfr-3.0.0-a/set_ld.c mpfr-3.0.0-b/set_ld.c
+--- mpfr-3.0.0-a/set_ld.c 2010-06-10 11:00:14.000000000 +0000
++++ mpfr-3.0.0-b/set_ld.c 2010-10-21 21:18:26.000000000 +0000
+@@ -102,21 +102,25 @@
+ {
+ x /= div13; /* exact */
+ shift_exp += 8192;
++ mpfr_div_2si (t, t, 8192, MPFR_RNDZ);
+ }
+ if (ABS (x) >= div12)
+ {
+ x /= div12; /* exact */
+ shift_exp += 4096;
++ mpfr_div_2si (t, t, 4096, MPFR_RNDZ);
+ }
+ if (ABS (x) >= div11)
+ {
+ x /= div11; /* exact */
+ shift_exp += 2048;
++ mpfr_div_2si (t, t, 2048, MPFR_RNDZ);
+ }
+ if (ABS (x) >= div10)
+ {
+ x /= div10; /* exact */
+ shift_exp += 1024;
++ mpfr_div_2si (t, t, 1024, MPFR_RNDZ);
+ }
+ /* warning: we may have DBL_MAX=2^1024*(1-2^(-53)) < x < 2^1024,
+ therefore we have one extra exponent reduction step */
+@@ -124,9 +128,10 @@
+ {
+ x /= div9; /* exact */
+ shift_exp += 512;
++ mpfr_div_2si (t, t, 512, MPFR_RNDZ);
+ }
+ } /* Check overflow of double */
+- else
++ else /* no overflow on double */
+ {
+ long double div9, div10, div11;
+
+@@ -149,29 +154,34 @@
+ {
+ x /= div13; /* exact */
+ shift_exp -= 8192;
++ mpfr_mul_2si (t, t, 8192, MPFR_RNDZ);
+ }
+ if (ABS (x) <= div12)
+ {
+ x /= div12; /* exact */
+ shift_exp -= 4096;
++ mpfr_mul_2si (t, t, 4096, MPFR_RNDZ);
+ }
+ if (ABS (x) <= div11)
+ {
+ x /= div11; /* exact */
+ shift_exp -= 2048;
++ mpfr_mul_2si (t, t, 2048, MPFR_RNDZ);
+ }
+ if (ABS (x) <= div10)
+ {
+ x /= div10; /* exact */
+ shift_exp -= 1024;
++ mpfr_mul_2si (t, t, 1024, MPFR_RNDZ);
+ }
+ if (ABS(x) <= div9)
+ {
+ x /= div9; /* exact */
+ shift_exp -= 512;
++ mpfr_mul_2si (t, t, 512, MPFR_RNDZ);
+ }
+ }
+- else
++ else /* no underflow */
+ {
+ inexact = mpfr_set_d (u, (double) x, MPFR_RNDZ);
+ MPFR_ASSERTD (inexact == 0);
+diff -Naurd mpfr-3.0.0-a/tests/tset_ld.c mpfr-3.0.0-b/tests/tset_ld.c
+--- mpfr-3.0.0-a/tests/tset_ld.c 2010-06-10 11:00:13.000000000 +0000
++++ mpfr-3.0.0-b/tests/tset_ld.c 2010-10-21 21:18:26.000000000 +0000
+@@ -147,12 +147,39 @@
+ test_fixed_bugs (void)
+ {
+ mpfr_t x;
+- long double d;
++ long double l, m;
+
+ /* bug found by Steve Kargl (2009-03-14) */
+ mpfr_init2 (x, 64);
+ mpfr_set_ui_2exp (x, 1, -16447, MPFR_RNDN);
+- d = mpfr_get_ld (x, MPFR_RNDN); /* an assertion failed in init2.c:50 */
++ mpfr_get_ld (x, MPFR_RNDN); /* an assertion failed in init2.c:50 */
++
++ /* bug reported by Jakub Jelinek (2010-10-17)
++ https://gforge.inria.fr/tracker/?func=detail&aid=11300 */
++ mpfr_set_prec (x, MPFR_LDBL_MANT_DIG);
++ /* l = 0x1.23456789abcdef0123456789abcdp-914L; */
++ l = 8.215640181713713164092636634579e-276;
++ mpfr_set_ld (x, l, MPFR_RNDN);
++ m = mpfr_get_ld (x, MPFR_RNDN);
++ if (m != l)
++ {
++ printf ("Error in get_ld o set_ld for l=%Le\n", l);
++ printf ("Got m=%Le instead of l\n", m);
++ exit (1);
++ }
++
++ /* another similar test which failed with extended double precision and the
++ generic code for mpfr_set_ld */
++ /* l = 0x1.23456789abcdef0123456789abcdp-968L; */
++ l = 4.560596445887084662336528403703e-292;
++ mpfr_set_ld (x, l, MPFR_RNDN);
++ m = mpfr_get_ld (x, MPFR_RNDN);
++ if (m != l)
++ {
++ printf ("Error in get_ld o set_ld for l=%Le\n", l);
++ printf ("Got m=%Le instead of l\n", m);
++ exit (1);
++ }
+
+ mpfr_clear (x);
+ }
+diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
+--- mpfr-3.0.0-a/version.c 2010-10-21 20:59:32.000000000 +0000
++++ mpfr-3.0.0-b/version.c 2010-10-21 21:18:26.000000000 +0000
+@@ -25,5 +25,5 @@
+ const char *
+ mpfr_get_version (void)
+ {
+- return "3.0.0-p6";
++ return "3.0.0-p7";
+ }
+diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
+--- mpfr-3.0.0-a/PATCHES 2010-11-09 15:15:07.000000000 +0000
++++ mpfr-3.0.0-b/PATCHES 2010-11-09 15:15:07.000000000 +0000
+@@ -0,0 +1 @@
++macros
+diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
+--- mpfr-3.0.0-a/VERSION 2010-10-21 21:18:26.000000000 +0000
++++ mpfr-3.0.0-b/VERSION 2010-11-09 15:15:07.000000000 +0000
+@@ -1 +1 @@
+-3.0.0-p7
++3.0.0-p8
+diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
+--- mpfr-3.0.0-a/mpfr.h 2010-10-21 21:18:26.000000000 +0000
++++ mpfr-3.0.0-b/mpfr.h 2010-11-09 15:15:07.000000000 +0000
+@@ -27,7 +27,7 @@
+ #define MPFR_VERSION_MAJOR 3
+ #define MPFR_VERSION_MINOR 0
+ #define MPFR_VERSION_PATCHLEVEL 0
+-#define MPFR_VERSION_STRING "3.0.0-p7"
++#define MPFR_VERSION_STRING "3.0.0-p8"
+
+ /* Macros dealing with MPFR VERSION */
+ #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
+@@ -67,6 +67,16 @@
+ # define _MPFR_H_HAVE_INTMAX_T 1
+ #endif
+
++/* Avoid some problems with macro expansion if the user defines macros
++ with the same name as keywords. By convention, identifiers and macro
++ names starting with mpfr_ are reserved by MPFR. */
++typedef void mpfr_void;
++typedef int mpfr_int;
++typedef unsigned int mpfr_uint;
++typedef long mpfr_long;
++typedef unsigned long mpfr_ulong;
++typedef size_t mpfr_size_t;
++
+ /* Definition of rounding modes (DON'T USE MPFR_RNDNA!).
+ Warning! Changing the contents of this enum should be seen as an
+ interface change since the old and the new types are not compatible
+@@ -136,7 +146,7 @@
+ typedef mp_exp_t mpfr_exp_t;
+
+ /* Definition of the standard exponent limits */
+-#define MPFR_EMAX_DEFAULT ((mpfr_exp_t) (((unsigned long) 1 << 30) - 1))
++#define MPFR_EMAX_DEFAULT ((mpfr_exp_t) (((mpfr_ulong) 1 << 30) - 1))
+ #define MPFR_EMIN_DEFAULT (-(MPFR_EMAX_DEFAULT))
+
+ /* Definition of the main structure */
+@@ -725,13 +735,13 @@
+ unexpected results with future compilers and aggressive optimisations.
+ Why not working only with signed types, using INT_MIN and LONG_MIN? */
+ #if __GMP_MP_SIZE_T_INT
+-#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+2))
+-#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+1))
+-#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+3))
++#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(mpfr_uint)0)>>1))+2))
++#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(mpfr_uint)0)>>1))+1))
++#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(mpfr_uint)0)>>1))+3))
+ #else
+-#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+2))
+-#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+1))
+-#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+3))
++#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(mpfr_ulong)0)>>1))+2))
++#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(mpfr_ulong)0)>>1))+1))
++#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(mpfr_ulong)0)>>1))+3))
+ #endif
+
+ /* Define MPFR_USE_EXTENSION to avoid "gcc -pedantic" warnings. */
+@@ -760,9 +770,9 @@
+ #define mpfr_inf_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_INF)
+ #define mpfr_zero_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_ZERO)
+ #define mpfr_regular_p(_x) ((_x)->_mpfr_exp > __MPFR_EXP_INF)
+-#define mpfr_sgn(_x) \
+- ((_x)->_mpfr_exp < __MPFR_EXP_INF ? \
+- (mpfr_nan_p (_x) ? mpfr_set_erangeflag () : (void) 0), 0 : \
++#define mpfr_sgn(_x) \
++ ((_x)->_mpfr_exp < __MPFR_EXP_INF ? \
++ (mpfr_nan_p (_x) ? mpfr_set_erangeflag () : (mpfr_void) 0), 0 : \
+ MPFR_SIGN (_x))
+
+ /* Prevent them from using as lvalues */
+@@ -805,7 +815,19 @@
+ Moreover casts to unsigned long have been added to avoid warnings in
+ programs that use MPFR and are compiled with -Wconversion; such casts
+ are OK since if X is a constant expression, then (unsigned long) X is
+- also a constant expression, so that the optimizations still work. */
++ also a constant expression, so that the optimizations still work. The
++ warnings are probably related to the following two bugs:
++ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210
++ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38470 (possibly a variant)
++ and the casts could be removed once these bugs are fixed.
++ Casts shouldn't be used on the generic calls (to the ..._2exp functions),
++ where implicit conversions are performed. Indeed, having@least one
++ implicit conversion in the macro allows the compiler to emit diagnostics
++ when normally expected, for instance in the following call:
++ mpfr_set_ui (x, "foo", MPFR_RNDN);
++ If this is not possible (for future macros), one of the tricks described
++ on http://groups.google.com/group/comp.std.c/msg/e92abd24bf9eaf7b could
++ be used. */
+ #if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus)
+ #if (__GNUC__ >= 2)
+ #undef mpfr_cmp_ui
+@@ -813,45 +835,45 @@
+ But warning! mpfr_sgn is specified as a macro in the API, thus the macro
+ mustn't be used if side effects are possible, like here. */
+ #define mpfr_cmp_ui(_f,_u) \
+- (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
++ (__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \
+ (mpfr_sgn) (_f) : \
+- mpfr_cmp_ui_2exp ((_f), (unsigned long) (_u), 0))
++ mpfr_cmp_ui_2exp ((_f), (_u), 0))
+ #undef mpfr_cmp_si
+-#define mpfr_cmp_si(_f,_s) \
+- (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
+- mpfr_cmp_ui ((_f), (unsigned long) (long) (_s)) : \
+- mpfr_cmp_si_2exp ((_f), (long) (_s), 0))
++#define mpfr_cmp_si(_f,_s) \
++ (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
++ mpfr_cmp_ui ((_f), (mpfr_ulong) (mpfr_long) (_s)) : \
++ mpfr_cmp_si_2exp ((_f), (_s), 0))
+ #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
+ #undef mpfr_set_ui
+ #define mpfr_set_ui(_f,_u,_r) \
+- (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
++ (__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \
+ __extension__ ({ \
+ mpfr_ptr _p = (_f); \
+ _p->_mpfr_sign = 1; \
+ _p->_mpfr_exp = __MPFR_EXP_ZERO; \
+- (void) (_r); 0; }) : \
+- mpfr_set_ui_2exp ((_f), (unsigned long) (_u), 0, (_r)))
++ (mpfr_void) (_r); 0; }) : \
++ mpfr_set_ui_2exp ((_f), (_u), 0, (_r)))
+ #endif
+ #undef mpfr_set_si
+ #define mpfr_set_si(_f,_s,_r) \
+- (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
+- mpfr_set_ui ((_f), (unsigned long) (long) (_s), (_r)) : \
+- mpfr_set_si_2exp ((_f), (long) (_s), 0, (_r)))
++ (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
++ mpfr_set_ui ((_f), (mpfr_ulong) (mpfr_long) (_s), (_r)) : \
++ mpfr_set_si_2exp ((_f), (_s), 0, (_r)))
+ #endif
+ #endif
+
+ /* Macro version of mpfr_stack interface for fast access */
+-#define mpfr_custom_get_size(p) ((size_t) \
++#define mpfr_custom_get_size(p) ((mpfr_size_t) \
+ (((p)+GMP_NUMB_BITS-1)/GMP_NUMB_BITS*sizeof (mp_limb_t)))
+ #define mpfr_custom_init(m,p) do {} while (0)
+-#define mpfr_custom_get_significand(x) ((void*)((x)->_mpfr_d))
++#define mpfr_custom_get_significand(x) ((mpfr_void*)((x)->_mpfr_d))
+ #define mpfr_custom_get_exp(x) ((x)->_mpfr_exp)
+ #define mpfr_custom_move(x,m) do { ((x)->_mpfr_d = (mp_limb_t*)(m)); } while (0)
+ #define mpfr_custom_init_set(x,k,e,p,m) do { \
+ mpfr_ptr _x = (x); \
+ mpfr_exp_t _e; \
+ mpfr_kind_t _t; \
+- int _s, _k; \
++ mpfr_int _s, _k; \
+ _k = (k); \
+ if (_k >= 0) { \
+ _t = (mpfr_kind_t) _k; \
+@@ -868,11 +890,13 @@
+ _x->_mpfr_exp = _e; \
+ _x->_mpfr_d = (mp_limb_t*) (m); \
+ } while (0)
+-#define mpfr_custom_get_kind(x) \
+- ( (x)->_mpfr_exp > __MPFR_EXP_INF ? (int)MPFR_REGULAR_KIND*MPFR_SIGN (x) \
+- : (x)->_mpfr_exp == __MPFR_EXP_INF ? (int)MPFR_INF_KIND*MPFR_SIGN (x) \
+- : (x)->_mpfr_exp == __MPFR_EXP_NAN ? (int)MPFR_NAN_KIND \
+- : (int) MPFR_ZERO_KIND * MPFR_SIGN (x) )
++#define mpfr_custom_get_kind(x) \
++ ( (x)->_mpfr_exp > __MPFR_EXP_INF ? \
++ (mpfr_int) MPFR_REGULAR_KIND * MPFR_SIGN (x) \
++ : (x)->_mpfr_exp == __MPFR_EXP_INF ? \
++ (mpfr_int) MPFR_INF_KIND * MPFR_SIGN (x) \
++ : (x)->_mpfr_exp == __MPFR_EXP_NAN ? (mpfr_int) MPFR_NAN_KIND \
++ : (mpfr_int) MPFR_ZERO_KIND * MPFR_SIGN (x) )
+
+
+ #endif /* MPFR_USE_NO_MACRO */
+diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
+--- mpfr-3.0.0-a/version.c 2010-10-21 21:18:26.000000000 +0000
++++ mpfr-3.0.0-b/version.c 2010-11-09 15:15:07.000000000 +0000
+@@ -25,5 +25,5 @@
+ const char *
+ mpfr_get_version (void)
+ {
+- return "3.0.0-p7";
++ return "3.0.0-p8";
+ }
diff --git a/package/mpfr/mpfr.mk b/package/mpfr/mpfr.mk
index 6979a9f..15ee48a 100644
--- a/package/mpfr/mpfr.mk
+++ b/package/mpfr/mpfr.mk
@@ -3,122 +3,14 @@
# mpfr
#
#############################################################
-MPFR_VERSION:=2.4.1
-MPFR_PATCH:=patches
-MPFR_PATCH_FILE:=mpfr-$(MPFR_VERSION).patch
-MPFR_SOURCE:=mpfr-$(MPFR_VERSION).tar.bz2
-MPFR_CAT:=$(BZCAT)
-MPFR_SITE:=http://www.mpfr.org/mpfr-$(MPFR_VERSION)
-MPFR_DIR:=$(TOOLCHAIN_DIR)/mpfr-$(MPFR_VERSION)
-MPFR_TARGET_DIR:=$(BUILD_DIR)/mpfr-$(MPFR_VERSION)
-MPFR_BINARY:=libmpfr$(LIBTGTEXT)
-MPFR_HOST_BINARY:=libmpfr$(HOST_LIBEXT)
-MPFR_LIBVERSION:=1.2.0
-# need patch
-ifneq ($(MPFR_PATCH),)
-MPFR_PATCH_SOURCE:=$(DL_DIR)/$(MPFR_PATCH_FILE)
+MPFR_VERSION = 3.0.0
+MPFR_SITE = http://www.mpfr.org/mpfr-$(MPFR_VERSION)
+MPFR_SOURCE = mpfr-$(MPFR_VERSION).tar.bz2
+MPFR_INSTALL_STAGING = YES
+MPFR_DEPENDENCIES = gmp
+MPFR_MAKE_OPT = RANLIB=$(TARGET_RANLIB)
+HOST_MPFR_DEPENDENCIES = host-gmp
-$(MPFR_PATCH_SOURCE):
- $(call DOWNLOAD,$(MPFR_SITE),$(MPFR_PATCH))
-ifeq ($(DL_MODE),DOWNLOAD)
- mv $(DL_DIR)/$(MPFR_PATCH) $@
-endif
-endif
-
-$(DL_DIR)/$(MPFR_SOURCE):
- $(call DOWNLOAD,$(MPFR_SITE),$(MPFR_SOURCE))
-
-$(MPFR_DIR)/.unpacked: $(DL_DIR)/$(MPFR_SOURCE) $(MPFR_PATCH_SOURCE)
- $(MPFR_CAT) $(DL_DIR)/$(MPFR_SOURCE) | tar -C $(TOOLCHAIN_DIR) $(TAR_OPTIONS) -
- toolchain/patch-kernel.sh $(MPFR_DIR) package/mpfr/ \*.patch
- $(CONFIG_UPDATE) $(@D)
-ifneq ($(MPFR_PATCH),)
- toolchain/patch-kernel.sh $(MPFR_DIR) $(DL_DIR)/ $(MPFR_PATCH_FILE)
-endif
- touch $@
-
-$(MPFR_TARGET_DIR)/.configured: $(MPFR_DIR)/.unpacked $(STAGING_DIR)/usr/lib/$(GMP_BINARY)
- mkdir -p $(MPFR_TARGET_DIR)
- (cd $(MPFR_TARGET_DIR); rm -rf config.cache; \
- $(TARGET_CONFIGURE_OPTS) \
- $(TARGET_CONFIGURE_ARGS) \
- $(MPFR_DIR)/configure $(QUIET) \
- --target=$(GNU_TARGET_NAME) \
- --host=$(GNU_TARGET_NAME) \
- --build=$(GNU_HOST_NAME) \
- --prefix=/usr \
- $(PREFERRED_LIB_FLAGS) \
- --with-gmp-build=$(GMP_TARGET_DIR) \
- $(DISABLE_NLS) \
- )
- touch $@
-
-$(MPFR_TARGET_DIR)/.libs/$(MPFR_BINARY): $(MPFR_TARGET_DIR)/.configured
- #$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(MPFR_TARGET_DIR)
- $(MAKE) -C $(MPFR_TARGET_DIR)
-
-$(STAGING_DIR)/usr/lib/$(MPFR_BINARY): $(MPFR_TARGET_DIR)/.libs/$(MPFR_BINARY)
- $(MAKE) DESTDIR=$(STAGING_DIR) -C $(MPFR_TARGET_DIR) install
- $(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(STAGING_DIR)/usr/lib/libmpfr$(LIBTGTEXT)*
-
-$(TARGET_DIR)/usr/lib/libmpfr.so $(TARGET_DIR)/usr/lib/libmpfr.so.$(MPFR_LIBVERSION) $(TARGET_DIR)/usr/lib/libmpfr.a: $(STAGING_DIR)/usr/lib/$(MPFR_BINARY)
- cp -dpf $(STAGING_DIR)/usr/lib/libmpfr$(LIBTGTEXT)* $(TARGET_DIR)/usr/lib/
-ifeq ($(BR2_PACKAGE_LIBMPFR_HEADERS),y)
- cp -dpf $(STAGING_DIR)/usr/include/mpfr.h $(STAGING_DIR)/usr/include/mpf2mpfr.h \
- $(TARGET_DIR)/usr/include/
-endif
-
-.PHONY: libmpfr-source
-
-libmpfr-source: $(DL_DIR)/$(MPFR_SOURCE) $(MPFR_PATCH_SOURCE)
-
-libmpfr: $(TARGET_DIR)/usr/lib/libmpfr$(LIBTGTEXT)
-stage-libmpfr: $(STAGING_DIR)/usr/lib/$(MPFR_BINARY)
-
-libmpfr-clean:
- rm -f $(TARGET_DIR)/usr/lib/libmpfr.* \
- $(TARGET_DIR)/usr/include/mpfr.h \
- $(TARGET_DIR)/usr/include/mpf2mpfr.h \
- $(STAGING_DIR)/usr/lib/libmpfr* $(STAGING_DIR)/usr/include/mpfr*
- -$(MAKE) -C $(MPFR_TARGET_DIR) clean
-
-libmpfr-dirclean:
- rm -rf $(MPFR_TARGET_DIR)
-
-MPFR_DIR2:=$(TOOLCHAIN_DIR)/mpfr-$(MPFR_VERSION)-host
-MPFR_HOST_DIR:=$(TOOLCHAIN_DIR)/mpfr
-$(MPFR_DIR2)/.configured: $(MPFR_DIR)/.unpacked $(GMP_HOST_DIR)/lib/$(GMP_HOST_BINARY)
- mkdir -p $(MPFR_DIR2)
- (cd $(MPFR_DIR2); \
- $(HOST_CONFIGURE_OPTS) \
- $(MPFR_DIR)/configure $(QUIET) \
- --prefix="$(MPFR_HOST_DIR)" \
- --build=$(GNU_HOST_NAME) \
- --host=$(GNU_HOST_NAME) \
- --disable-shared \
- --enable-static \
- --with-gmp=$(GMP_HOST_DIR) \
- $(DISABLE_NLS) \
- )
- touch $@
-
-$(MPFR_HOST_DIR)/lib/libmpfr$(HOST_LIBEXT): $(MPFR_DIR2)/.configured
- $(MAKE) -C $(MPFR_DIR2) install
-
-host-libmpfr: $(MPFR_HOST_DIR)/lib/$(MPFR_HOST_BINARY)
-host-libmpfr-source: libmpfr-source
-host-libmpfr-clean:
- rm -rf $(MPFR_HOST_DIR)
- -$(MAKE) -C $(MPFR_DIR2) clean
-host-libmpfr-dirclean:
- rm -rf $(MPFR_HOST_DIR) $(MPFR_DIR2)
-
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
-ifeq ($(BR2_PACKAGE_LIBMPFR),y)
-TARGETS+=libmpfr
-endif
+$(eval $(call AUTOTARGETS,package,mpfr))
+$(eval $(call AUTOTARGETS,package,mpfr,host))
diff --git a/toolchain/binutils/binutils.mk b/toolchain/binutils/binutils.mk
index 327a0f6..c332590 100644
--- a/toolchain/binutils/binutils.mk
+++ b/toolchain/binutils/binutils.mk
@@ -16,16 +16,16 @@ endif
BINUTILS_HOST_PREREQ:=
BINUTILS_TARGET_PREREQ:=
-BINUTILS_HOST_PREREQ:=host-gmp $(TOOLCHAIN_DIR)/mpfr/lib/libmpfr$(HOST_LIBEXT)
-HOST_SOURCE += host-gmp-source host-libmpfr-source
+BINUTILS_HOST_PREREQ:=host-gmp host-mpfr
+HOST_SOURCE += host-gmp-source host-mpfr-source
-BINUTILS_TARGET_PREREQ:=gmp $(TARGET_DIR)/usr/lib/libmpfr$(LIBTGTEXT)
+BINUTILS_TARGET_PREREQ:=gmp mpfr
EXTRA_BINUTILS_CONFIG_OPTIONS+=--with-gmp=$(HOST_DIR)/usr
-EXTRA_BINUTILS_CONFIG_OPTIONS+=--with-mpfr="$(MPFR_HOST_DIR)"
+EXTRA_BINUTILS_CONFIG_OPTIONS+=--with-mpfr=$(HOST_DIR)/usr
BINUTILS_TARGET_CONFIG_OPTIONS=--with-gmp=$(STAGING_DIR)/usr
-BINUTILS_TARGET_CONFIG_OPTIONS+=--with-mpfr="$(MPFR_TARGET_DIR)"
+BINUTILS_TARGET_CONFIG_OPTIONS+=--with-mpfr=$(STAGING_DIR)/usr
ifeq ($(BR2_PACKAGE_LIBMPC),y)
BINUTILS_ADD_MPC = y
diff --git a/toolchain/gcc/gcc-uclibc-4.x.mk b/toolchain/gcc/gcc-uclibc-4.x.mk
index 13961bb..f454be8 100644
--- a/toolchain/gcc/gcc-uclibc-4.x.mk
+++ b/toolchain/gcc/gcc-uclibc-4.x.mk
@@ -107,8 +107,8 @@ GCC_TARGET_LANGUAGES:=$(GCC_TARGET_LANGUAGES),objc
endif
GCC_WITH_HOST_GMP = --with-gmp=$(HOST_DIR)/usr
-GCC_WITH_HOST_MPFR=--with-mpfr=$(MPFR_HOST_DIR)
-HOST_SOURCE += host-gmp-source host-libmpfr-source
+GCC_WITH_HOST_MPFR = --with-mpfr=$(HOST_DIR)/usr
+HOST_SOURCE += host-gmp-source host-mpfr-source
ifeq ($(findstring x4.5.,x$(GCC_VERSION)),x4.5.)
GCC_WITH_HOST_MPC=--with-mpc=$(MPC_HOST_DIR)
@@ -120,7 +120,7 @@ GCC_TARGET_LANGUAGES:=$(GCC_TARGET_LANGUAGES),fortran
#GCC_TARGET_PREREQ+=$(TARGET_DIR)/usr/lib/libmpfr.so $(TARGET_DIR)/usr/lib/libgmp.so
#GCC_STAGING_PREREQ+=$(TOOLCHAIN_DIR)/mpfr/lib/libmpfr.so
GCC_WITH_TARGET_GMP = --with-gmp=$(STAGING_DIR)/usr
-GCC_WITH_TARGET_MPFR=--with-mpfr="$(MPFR_TARGET_DIR)"
+GCC_WITH_TARGET_MPFR = --with-mpfr=$(STAGING_DIR)/usr
ifeq ($(findstring x4.5.,x$(GCC_VERSION)),x4.5.)
GCC_WITH_TARGET_MPC=--with-mpc="$(MPC_TARGET_DIR)"
endif
--
1.7.2.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 04/13] mpc: make it a proper package
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
` (2 preceding siblings ...)
2010-12-14 19:05 ` [Buildroot] [PATCH 03/13] mpfr: make it a proper package and bump to version 3.0.0-p8 Gustavo Zacarias
@ 2010-12-14 19:06 ` Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 05/13] package infra: fix versioned patches for host packages Gustavo Zacarias
` (8 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:06 UTC (permalink / raw)
To: buildroot
* Convert mpc to a proper autotargets package
* Hook it up for binutils/gcc to use
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
package/mpc/Config.in | 15 +----
package/mpc/mpc.mk | 109 +++------------------------------------
toolchain/binutils/binutils.mk | 10 ++--
toolchain/gcc/gcc-uclibc-4.x.mk | 6 +-
4 files changed, 18 insertions(+), 122 deletions(-)
diff --git a/package/mpc/Config.in b/package/mpc/Config.in
index 61c9638..8377013 100644
--- a/package/mpc/Config.in
+++ b/package/mpc/Config.in
@@ -1,19 +1,10 @@
-config BR2_PACKAGE_LIBMPC
+config BR2_PACKAGE_MPC
bool "mpc"
- select BR2_PACKAGE_LIBMPFR
- select BR2_PACKAGE_LIBGMP
+ select BR2_PACKAGE_MPFR
+ select BR2_PACKAGE_GMP
help
Mpc is a C library for the arithmetic of complex numbers with
arbitrarily high precision and correct rounding of the result.
It is built upon and follows the same principles as Mpfr.
http://www.multiprecision.org/
-
-
-config BR2_PACKAGE_LIBMPC_HEADERS
- bool "mpc headers for target"
- depends on BR2_PACKAGE_LIBMPC
- select BR2_PACKAGE_LIBMPFR_HEADERS
- select BR2_PACKAGE_LIBGMP_HEADERS
- help
- Install the mpc headers for the target.
diff --git a/package/mpc/mpc.mk b/package/mpc/mpc.mk
index 41c0ffa..8c6d486 100644
--- a/package/mpc/mpc.mk
+++ b/package/mpc/mpc.mk
@@ -3,107 +3,12 @@
# mpc
#
#############################################################
-MPC_VERSION:=0.8.2
-MPC_SOURCE:=mpc-$(MPC_VERSION).tar.gz
-MPC_SITE:=http://www.multiprecision.org/mpc/download
-MPC_CAT:=$(ZCAT)
-MPC_DIR:=$(TOOLCHAIN_DIR)/mpc-$(MPC_VERSION)
-MPC_TARGET_DIR:=$(BUILD_DIR)/mpc-$(MPC_VERSION)
-MPC_BINARY:=libmpc$(LIBTGTEXT)
-MPC_HOST_BINARY:=libmpc$(HOST_LIBEXT)
-MPC_LIBVERSION:=2.0.0
-$(DL_DIR)/$(MPC_SOURCE):
- $(call DOWNLOAD,$(MPC_SITE),$(MPC_SOURCE))
+MPC_VERSION = 0.8.2
+MPC_SITE = http://www.multiprecision.org/mpc/download
+MPC_INSTALL_STAGING = YES
+MPC_DEPENDENCIES = gmp mpfr
+HOST_MPC_DEPENDENCIES = host-gmp host-mpfr
-libmpc-source: $(DL_DIR)/$(MPC_SOURCE)
-
-$(MPC_DIR)/.unpacked: $(DL_DIR)/$(MPC_SOURCE)
- $(MPC_CAT) $(DL_DIR)/$(MPC_SOURCE) | tar -C $(TOOLCHAIN_DIR) $(TAR_OPTIONS) -
- toolchain/patch-kernel.sh $(MPC_DIR) package/mpc/ \*.patch
- $(CONFIG_UPDATE) $(@D)
- touch $@
-
-$(MPC_TARGET_DIR)/.configured: $(MPC_DIR)/.unpacked
- mkdir -p $(MPC_TARGET_DIR)
- (cd $(MPC_TARGET_DIR); rm -rf config.cache; \
- $(TARGET_CONFIGURE_OPTS) \
- $(TARGET_CONFIGURE_ARGS) \
- $(MPC_DIR)/configure $(QUIET) \
- --target=$(GNU_TARGET_NAME) \
- --host=$(GNU_TARGET_NAME) \
- --build=$(GNU_HOST_NAME) \
- --prefix=/usr \
- $(PREFERRED_LIB_FLAGS) \
- --with-mpfr-lib=$(TARGET_DIR)/usr/lib/ \
- --with-gmp-lib=$(TARGET_DIR)/usr/lib/ \
- --with-mpfr-include=$(STAGING_DIR)/usr/include/ \
- --with-gmp-include=$(STAGING_DIR)/usr/include/ \
- $(DISABLE_NLS) \
- )
- touch $@
-
-$(MPC_TARGET_DIR)/src/.libs/$(MPC_BINARY): $(MPC_TARGET_DIR)/.configured
- #$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(MPC_TARGET_DIR)
- $(MAKE) -C $(MPC_TARGET_DIR)
-
-$(STAGING_DIR)/usr/lib/$(MPC_BINARY): $(MPC_TARGET_DIR)/src/.libs/$(MPC_BINARY)
- $(MAKE) DESTDIR=$(STAGING_DIR) -C $(MPC_TARGET_DIR) install
- $(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(STAGING_DIR)/usr/lib/libmpc$(LIBTGTEXT)*
-
-$(TARGET_DIR)/usr/lib/libmpc.so $(TARGET_DIR)/usr/lib/libmpc.so.$(MPC_LIBVERSION): $(STAGING_DIR)/usr/lib/$(MPC_BINARY)
- cp -dpf $(STAGING_DIR)/usr/lib/libmpc$(LIBTGTEXT)* $(TARGET_DIR)/usr/lib/
-ifeq ($(BR2_PACKAGE_LIBMPC_HEADERS),y)
- test -d $(TARGET_DIR)/usr/include || mkdir -p $(TARGET_DIR)/usr/include
- cp -dpf $(STAGING_DIR)/usr/include/mpc.h $(TARGET_DIR)/usr/include/
-endif
-
-libmpc: libgmp libmpfr $(TARGET_DIR)/usr/lib/libmpc$(LIBTGTEXT)
-stage-libmpc: $(STAGING_DIR)/usr/lib/$(MPC_BINARY)
-
-libmpc-clean:
- rm -f $(TARGET_DIR)/usr/lib/libmpc.* $(TARGET_DIR)/usr/include/mpc.h \
- $(STAGING_DIR)/usr/lib/libmpc* $(STAGING_DIR)/usr/include/mpc.h
- -$(MAKE) -C $(MPC_TARGET_DIR) clean
-
-libmpc-dirclean:
- rm -rf $(MPC_TARGET_DIR) $(MPC_DIR)
-
-MPC_DIR2:=$(TOOLCHAIN_DIR)/mpc-$(MPC_VERSION)-host
-MPC_HOST_DIR:=$(TOOLCHAIN_DIR)/mpc
-$(MPC_DIR2)/.configured: $(MPC_DIR)/.unpacked
- mkdir -p $(MPC_DIR2)
- (cd $(MPC_DIR2); rm -rf config.cache; \
- $(HOST_CONFIGURE_OPTS) \
- $(MPC_CPP_FLAGS) \
- $(MPC_DIR)/configure $(QUIET) \
- --prefix="$(MPC_HOST_DIR)" \
- --build=$(GNU_HOST_NAME) \
- --host=$(GNU_HOST_NAME) \
- --disable-shared \
- --enable-static \
- --with-mpfr=$(MPFR_HOST_DIR) \
- --with-gmp=$(GMP_HOST_DIR) \
- $(DISABLE_NLS) \
- )
- touch $@
-
-$(MPC_HOST_DIR)/lib/libmpc$(HOST_LIBEXT): $(MPC_DIR2)/.configured
- $(MAKE) -C $(MPC_DIR2) install
-
-host-libmpc: $(MPC_HOST_DIR)/lib/$(MPC_HOST_BINARY)
-host-libmpc-source: libmpc-source
-host-libmpc-clean:
- rm -rf $(MPC_HOST_DIR)
- -$(MAKE) -C $(MPC_DIR2) clean
-host-libmpc-dirclean:
- rm -rf $(MPC_HOST_DIR) $(MPC_DIR2)
-
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
-ifeq ($(BR2_PACKAGE_LIBMPC),y)
-TARGETS+=libmpc
-endif
+$(eval $(call AUTOTARGETS,package,mpc))
+$(eval $(call AUTOTARGETS,package,mpc,host))
diff --git a/toolchain/binutils/binutils.mk b/toolchain/binutils/binutils.mk
index c332590..8ab383b 100644
--- a/toolchain/binutils/binutils.mk
+++ b/toolchain/binutils/binutils.mk
@@ -36,11 +36,11 @@ BINUTILS_ADD_MPC = y
endif
ifeq ($(BINUTILS_ADD_MPC),y)
-BINUTILS_HOST_PREREQ += $(TOOLCHAIN_DIR)/mpc/lib/libmpc$(HOST_LIBEXT)
-HOST_SOURCE += host-libmpc-source
-BINUTILS_TARGET_PREREQ += $(TARGET_DIR)/usr/lib/libmpc$(LIBTGTEXT)
-EXTRA_BINUTILS_CONFIG_OPTIONS += --with-mpc="$(MPC_HOST_DIR)"
-BINUTILS_TARGET_CONFIG_OPTIONS += --with-mpc="$(MPC_TARGET_DIR)"
+BINUTILS_HOST_PREREQ += host-mpc
+HOST_SOURCE += host-mpc-source
+BINUTILS_TARGET_PREREQ += mpc
+EXTRA_BINUTILS_CONFIG_OPTIONS += --with-mpc=$(HOST_DIR)/usr
+BINUTILS_TARGET_CONFIG_OPTIONS += --with-mpc=$(STAGING_DIR)/usr
endif
BINUTILS_PATCH_DIR:=toolchain/binutils/$(BINUTILS_VERSION)
diff --git a/toolchain/gcc/gcc-uclibc-4.x.mk b/toolchain/gcc/gcc-uclibc-4.x.mk
index f454be8..9e7127d 100644
--- a/toolchain/gcc/gcc-uclibc-4.x.mk
+++ b/toolchain/gcc/gcc-uclibc-4.x.mk
@@ -111,8 +111,8 @@ GCC_WITH_HOST_MPFR = --with-mpfr=$(HOST_DIR)/usr
HOST_SOURCE += host-gmp-source host-mpfr-source
ifeq ($(findstring x4.5.,x$(GCC_VERSION)),x4.5.)
-GCC_WITH_HOST_MPC=--with-mpc=$(MPC_HOST_DIR)
-HOST_SOURCE += host-libmpc-source
+GCC_WITH_HOST_MPC = --with-mpc=$(HOST_DIR)/usr
+HOST_SOURCE += host-mpc-source
endif
ifeq ($(BR2_INSTALL_FORTRAN),y)
@@ -122,7 +122,7 @@ GCC_TARGET_LANGUAGES:=$(GCC_TARGET_LANGUAGES),fortran
GCC_WITH_TARGET_GMP = --with-gmp=$(STAGING_DIR)/usr
GCC_WITH_TARGET_MPFR = --with-mpfr=$(STAGING_DIR)/usr
ifeq ($(findstring x4.5.,x$(GCC_VERSION)),x4.5.)
-GCC_WITH_TARGET_MPC=--with-mpc="$(MPC_TARGET_DIR)"
+GCC_WITH_TARGET_MPC = --with-mpc=$(STAGING_DIR)/usr
endif
endif
--
1.7.2.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 05/13] package infra: fix versioned patches for host packages
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
` (3 preceding siblings ...)
2010-12-14 19:06 ` [Buildroot] [PATCH 04/13] mpc: make it a proper package Gustavo Zacarias
@ 2010-12-14 19:06 ` Gustavo Zacarias
2010-12-14 19:54 ` Yann E. MORIN
2010-12-14 19:06 ` [Buildroot] [PATCH 06/13] sstrip: make it a proper package Gustavo Zacarias
` (7 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:06 UTC (permalink / raw)
To: buildroot
Without this patch we'd need separate versioned patch directories for
target and host packages, thus having unwanted duplication.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
package/Makefile.package.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/package/Makefile.package.in b/package/Makefile.package.in
index 816a013..4cb0334 100644
--- a/package/Makefile.package.in
+++ b/package/Makefile.package.in
@@ -250,7 +250,7 @@ $(BUILD_DIR)/%/.stamp_patched:
toolchain/patch-kernel.sh $(@D) $($(PKG)_DIR_PREFIX)/$($(NOHOSTPKG)_NAME) $(NAMEVER)\*.patch $(NAMEVER)\*.patch.$(ARCH) || exit 1; \
else \
toolchain/patch-kernel.sh $(@D) $($(PKG)_DIR_PREFIX)/$($(NOHOSTPKG)_NAME) $($(NOHOSTPKG)_NAME)\*.patch $($(NOHOSTPKG)_NAME)\*.patch.$(ARCH) || exit 1; \
- if test -d $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME)/$(NAMEVER); then \
+ if test -d $($(PKG)_DIR_PREFIX)/$($(NOHOSTPKG)_NAME)/$(NAMEVER); then \
toolchain/patch-kernel.sh $(@D) $($(PKG)_DIR_PREFIX)/$($(NOHOSTPKG)_NAME)/$(NAMEVER) \*.patch \*.patch.$(ARCH) || exit 1; \
fi; \
fi; \
--
1.7.2.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 06/13] sstrip: make it a proper package
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
` (4 preceding siblings ...)
2010-12-14 19:06 ` [Buildroot] [PATCH 05/13] package infra: fix versioned patches for host packages Gustavo Zacarias
@ 2010-12-14 19:06 ` Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 07/13] toolchain: move sysroot to host dir Gustavo Zacarias
` (6 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:06 UTC (permalink / raw)
To: buildroot
* Convert sstrip to a proper gentargets package
* Use openwrt svn version, it's basically the same one we used
* Change the hooks from old toolchain/sstrip to new package/sstrip
* Drop the old toolchain/sstrip directory
* sstrip for the target is now in Package -> Development
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
package/Config.in | 3 +
package/Makefile.in | 2 +-
package/sstrip/Config.in | 7 +
package/sstrip/sstrip.mk | 40 +++
toolchain/dependencies/dependencies.mk | 2 +-
toolchain/sstrip/Config.in | 9 -
toolchain/sstrip/sstrip.c | 467 -----------------------------
toolchain/sstrip/sstrip.mk | 70 -----
toolchain/toolchain-buildroot.mk | 1 -
toolchain/toolchain-buildroot/Config.in.2 | 1 -
toolchain/toolchain-crosstool-ng.mk | 1 -
toolchain/toolchain-external.mk | 1 -
12 files changed, 52 insertions(+), 552 deletions(-)
create mode 100644 package/sstrip/Config.in
create mode 100644 package/sstrip/sstrip.mk
delete mode 100644 toolchain/sstrip/Config.in
delete mode 100644 toolchain/sstrip/sstrip.c
delete mode 100644 toolchain/sstrip/sstrip.mk
diff --git a/package/Config.in b/package/Config.in
index d3ae75e..eb44b0d 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -73,6 +73,9 @@ endif
source "package/pkg-config/Config.in"
if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
source "package/sed/Config.in"
+endif
+source "package/sstrip/Config.in"
+if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
source "package/tar/Config.in"
endif
endmenu
diff --git a/package/Makefile.in b/package/Makefile.in
index 71c8dbc..3fa98fe 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -162,7 +162,7 @@ ifeq ($(BR2_STRIP_sstrip),y)
STRIP_DISCARD_ALL:=
STRIP_STRIP_UNNEEDED:=
STRIP_STRIP_ALL:=
-TARGET_STRIP=$(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-sstrip
+TARGET_STRIP=$(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-sstrip
STRIPCMD=$(TARGET_STRIP)
KSTRIPCMD=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note --strip-unneeded
endif
diff --git a/package/sstrip/Config.in b/package/sstrip/Config.in
new file mode 100644
index 0000000..12a5941
--- /dev/null
+++ b/package/sstrip/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_SSTRIP
+ bool "sstrip"
+ help
+ Small utility that removes a few bytes from an executable that
+ strip leaves behind.
+
+ http://www.muppetlabs.com/~breadbox/software/elfkickers.html
diff --git a/package/sstrip/sstrip.mk b/package/sstrip/sstrip.mk
new file mode 100644
index 0000000..ab6ceac
--- /dev/null
+++ b/package/sstrip/sstrip.mk
@@ -0,0 +1,40 @@
+############################################################
+#
+# sstrip
+#
+############################################################
+
+SSTRIP_SITE = svn://dev.openwrt.org/openwrt/trunk/tools/sstrip
+SSTRIP_VERSION = 20154
+HOST_SSTRIP_BINARY = $(REAL_GNU_TARGET_NAME)-sstrip
+
+define SSTRIP_BUILD_CMDS
+ cd $(@D) ; \
+ $(TARGET_CC) $(TARGET_CFLAGS) -include endian.h -include byteswap.h \
+ -o sstrip src/sstrip.c
+endef
+
+define SSTRIP_INSTALL_TARGET_CMDS
+ $(INSTALL) -D $(@D)/sstrip $(TARGET_DIR)/usr/bin/sstrip
+endef
+
+define SSTRIP_UNINSTALL_TARGET_CMDS
+ rm -f $(TARGET_DIR)/usr/bin/sstrip
+endef
+
+define HOST_SSTRIP_BUILD_CMDS
+ cd $(@D) ; \
+ $(HOSTCC) $(HOST_CFLAGS) -include endian.h -include byteswap.h \
+ -o sstrip src/sstrip.c
+endef
+
+define HOST_SSTRIP_INSTALL_CMDS
+ $(INSTALL) -D $(@D)/sstrip $(HOST_DIR)/usr/bin/$(HOST_SSTRIP_BINARY)
+endef
+
+define HOST_SSTRIP_UNINSTALL_CMDS
+ rm -f $(HOST_DIR)/usr/bin/$(HOST_SSTRIP_BINARY)
+endef
+
+$(eval $(call GENTARGETS,package,sstrip))
+$(eval $(call GENTARGETS,package,sstrip,host))
diff --git a/toolchain/dependencies/dependencies.mk b/toolchain/dependencies/dependencies.mk
index 89ffd88..5b6cbf7 100644
--- a/toolchain/dependencies/dependencies.mk
+++ b/toolchain/dependencies/dependencies.mk
@@ -7,7 +7,7 @@
DEPENDENCIES_HOST_PREREQ:=
ifeq ($(BR2_STRIP_sstrip),y)
-DEPENDENCIES_HOST_PREREQ+=sstrip_host
+DEPENDENCIES_HOST_PREREQ+=host-sstrip
endif
dependencies: $(DEPENDENCIES_HOST_PREREQ)
diff --git a/toolchain/sstrip/Config.in b/toolchain/sstrip/Config.in
deleted file mode 100644
index be4fa28..0000000
--- a/toolchain/sstrip/Config.in
+++ /dev/null
@@ -1,9 +0,0 @@
-config BR2_PACKAGE_SSTRIP_TARGET
- bool "Install sstrip for the target system"
- help
- Maximal 'strip'ing utility.
-
-config BR2_PACKAGE_SSTRIP_HOST
- bool "Install sstrip for the host/build system"
- help
- Maximal 'strip'ing utility.
diff --git a/toolchain/sstrip/sstrip.c b/toolchain/sstrip/sstrip.c
deleted file mode 100644
index 03adc0e..0000000
--- a/toolchain/sstrip/sstrip.c
+++ /dev/null
@@ -1,467 +0,0 @@
-/* http://www.muppetlabs.com/~breadbox/software/elfkickers.html */
-
-/* sstrip: Copyright (C) 1999-2001 by Brian Raiter, under the GNU
- * General Public License. No warranty. See COPYING for details.
- *
- * Aug 23, 2004 Hacked by Manuel Novoa III <mjn3@codepoet.org> to
- * handle targets of different endianness and/or elf class, making
- * it more useful in a cross-devel environment.
- */
-
-/* ============== original README ===================
- *
- * sstrip is a small utility that removes the contents at the end of an
- * ELF file that are not part of the program's memory image.
- *
- * Most ELF executables are built with both a program header table and a
- * section header table. However, only the former is required in order
- * for the OS to load, link and execute a program. sstrip attempts to
- * extract the ELF header, the program header table, and its contents,
- * leaving everything else in the bit bucket. It can only remove parts of
- * the file that occur at the end, after the parts to be saved. However,
- * this almost always includes the section header table, and occasionally
- * a few random sections that are not used when running a program.
- *
- * It should be noted that the GNU bfd library is (understandably)
- * dependent on the section header table as an index to the file's
- * contents. Thus, an executable file that has no section header table
- * cannot be used with gdb, objdump, or any other program based upon the
- * bfd library, at all. In fact, the program will not even recognize the
- * file as a valid executable. (This limitation is noted in the source
- * code comments for bfd, and is marked "FIXME", so this may change at
- * some future date. However, I would imagine that it is a pretty
- * low-priority item, as executables without a section header table are
- * rare in the extreme.) This probably also explains why strip doesn't
- * offer the option to do this.
- *
- * Shared library files may also have their section header table removed.
- * Such a library will still function; however, it will no longer be
- * possible for a compiler to link a new program against it.
- *
- * As an added bonus, sstrip also tries to removes trailing zero bytes
- * from the end of the file. (This normally cannot be done with an
- * executable that has a section header table.)
- *
- * sstrip is a very simplistic program. It depends upon the common
- * practice of putting the parts of the file that contribute to the
- * memory image at the front, and the remaining material at the end. This
- * permits it to discard the latter material without affecting file
- * offsets and memory addresses in what remains. Of course, the ELF
- * standard permits files to be organized in almost any order, so if a
- * pathological linker decided to put its section headers at the top,
- * sstrip would be useless on such executables.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <elf.h>
-#include <endian.h>
-#include <byteswap.h>
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-/* The name of the program.
- */
-static char const *progname;
-
-/* The name of the current file.
- */
-static char const *filename;
-
-
-/* A simple error-handling function. FALSE is always returned for the
- * convenience of the caller.
- */
-static int err(char const *errmsg)
-{
- fprintf(stderr, "%s: %s: %s\n", progname, filename, errmsg);
- return FALSE;
-}
-
-/* A flag to signal the need for endian reversal.
- */
-static int do_reverse_endian;
-
-/* Get a value from the elf header, compensating for endianness.
- */
-#define EGET(X) \
- (__extension__ ({ \
- uint64_t __res; \
- if (!do_reverse_endian) { \
- __res = (X); \
- } else if (sizeof(X) == 1) { \
- __res = (X); \
- } else if (sizeof(X) == 2) { \
- __res = bswap_16((X)); \
- } else if (sizeof(X) == 4) { \
- __res = bswap_32((X)); \
- } else if (sizeof(X) == 8) { \
- __res = bswap_64((X)); \
- } else { \
- fprintf(stderr, "%s: %s: EGET failed for size %d\n", \
- progname, filename, sizeof(X)); \
- exit(EXIT_FAILURE); \
- } \
- __res; \
- }))
-
-/* Set a value 'Y' in the elf header to 'X', compensating for endianness.
- */
-#define ESET(Y,X) \
- do if (!do_reverse_endian) { \
- Y = (X); \
- } else if (sizeof(Y) == 1) { \
- Y = (X); \
- } else if (sizeof(Y) == 2) { \
- Y = bswap_16((uint16_t)(X)); \
- } else if (sizeof(Y) == 4) { \
- Y = bswap_32((uint32_t)(X)); \
- } else if (sizeof(Y) == 8) { \
- Y = bswap_64((uint64_t)(X)); \
- } else { \
- fprintf(stderr, "%s: %s: ESET failed for size %d\n", \
- progname, filename, sizeof(Y)); \
- exit(EXIT_FAILURE); \
- } while (0)
-
-
-/* A macro for I/O errors: The given error message is used only when
- * errno is not set.
- */
-#define ferr(msg) (err(errno ? strerror(errno) : (msg)))
-
-
-
-#define HEADER_FUNCTIONS(CLASS) \
- \
-/* readelfheader() reads the ELF header into our global variable, and \
- * checks to make sure that this is in fact a file that we should be \
- * munging. \
- */ \
-static int readelfheader ## CLASS (int fd, Elf ## CLASS ## _Ehdr *ehdr) \
-{ \
- if (read(fd, ((char *)ehdr)+EI_NIDENT, sizeof(*ehdr) - EI_NIDENT) \
- != sizeof(*ehdr) - EI_NIDENT) \
- return ferr("missing or incomplete ELF header."); \
- \
- /* Verify the sizes of the ELF header and the program segment \
- * header table entries. \
- */ \
- if (EGET(ehdr->e_ehsize) != sizeof(Elf ## CLASS ## _Ehdr)) \
- return err("unrecognized ELF header size."); \
- if (EGET(ehdr->e_phentsize) != sizeof(Elf ## CLASS ## _Phdr)) \
- return err("unrecognized program segment header size."); \
- \
- /* Finally, check the file type. \
- */ \
- if (EGET(ehdr->e_type) != ET_EXEC && EGET(ehdr->e_type) != ET_DYN) \
- return err("not an executable or shared-object library."); \
- \
- return TRUE; \
-} \
- \
-/* readphdrtable() loads the program segment header table into memory. \
- */ \
-static int readphdrtable ## CLASS (int fd, Elf ## CLASS ## _Ehdr const *ehdr, \
- Elf ## CLASS ## _Phdr **phdrs) \
-{ \
- size_t size; \
- \
- if (!EGET(ehdr->e_phoff) || !EGET(ehdr->e_phnum) \
-) return err("ELF file has no program header table."); \
- \
- size = EGET(ehdr->e_phnum) * sizeof **phdrs; \
- if (!(*phdrs = malloc(size))) \
- return err("Out of memory!"); \
- \
- errno = 0; \
- if (read(fd, *phdrs, size) != (ssize_t)size) \
- return ferr("missing or incomplete program segment header table."); \
- \
- return TRUE; \
-} \
- \
-/* getmemorysize() determines the offset of the last byte of the file \
- * that is referenced by an entry in the program segment header table. \
- * (Anything in the file after that point is not used when the program \
- * is executing, and thus can be safely discarded.) \
- */ \
-static int getmemorysize ## CLASS (Elf ## CLASS ## _Ehdr const *ehdr, \
- Elf ## CLASS ## _Phdr const *phdrs, \
- unsigned long *newsize) \
-{ \
- Elf ## CLASS ## _Phdr const *phdr; \
- unsigned long size, n; \
- int i; \
- \
- /* Start by setting the size to include the ELF header and the \
- * complete program segment header table. \
- */ \
- size = EGET(ehdr->e_phoff) + EGET(ehdr->e_phnum) * sizeof *phdrs; \
- if (size < sizeof *ehdr) \
- size = sizeof *ehdr; \
- \
- /* Then keep extending the size to include whatever data the \
- * program segment header table references. \
- */ \
- for (i = 0, phdr = phdrs ; i < EGET(ehdr->e_phnum) ; ++i, ++phdr) { \
- if (EGET(phdr->p_type) != PT_NULL) { \
- n = EGET(phdr->p_offset) + EGET(phdr->p_filesz); \
- if (n > size) \
- size = n; \
- } \
- } \
- \
- *newsize = size; \
- return TRUE; \
-} \
- \
-/* modifyheaders() removes references to the section header table if \
- * it was stripped, and reduces program header table entries that \
- * included truncated bytes at the end of the file. \
- */ \
-static int modifyheaders ## CLASS (Elf ## CLASS ## _Ehdr *ehdr, \
- Elf ## CLASS ## _Phdr *phdrs, \
- unsigned long newsize) \
-{ \
- Elf ## CLASS ## _Phdr *phdr; \
- int i; \
- \
- /* If the section header table is gone, then remove all references \
- * to it in the ELF header. \
- */ \
- if (EGET(ehdr->e_shoff) >= newsize) { \
- ESET(ehdr->e_shoff,0); \
- ESET(ehdr->e_shnum,0); \
- ESET(ehdr->e_shentsize,0); \
- ESET(ehdr->e_shstrndx,0); \
- } \
- \
- /* The program adjusts the file size of any segment that was \
- * truncated. The case of a segment being completely stripped out \
- * is handled separately. \
- */ \
- for (i = 0, phdr = phdrs ; i < EGET(ehdr->e_phnum) ; ++i, ++phdr) { \
- if (EGET(phdr->p_offset) >= newsize) { \
- ESET(phdr->p_offset,newsize); \
- ESET(phdr->p_filesz,0); \
- } else if (EGET(phdr->p_offset) + EGET(phdr->p_filesz) > newsize) { \
- ESET(phdr->p_filesz, newsize - EGET(phdr->p_offset)); \
- } \
- } \
- \
- return TRUE; \
-} \
- \
-/* commitchanges() writes the new headers back to the original file \
- * and sets the file to its new size. \
- */ \
-static int commitchanges ## CLASS (int fd, Elf ## CLASS ## _Ehdr const *ehdr, \
- Elf ## CLASS ## _Phdr *phdrs, \
- unsigned long newsize) \
-{ \
- size_t n; \
- \
- /* Save the changes to the ELF header, if any. \
- */ \
- if (lseek(fd, 0, SEEK_SET)) \
- return ferr("could not rewind file"); \
- errno = 0; \
- if (write(fd, ehdr, sizeof *ehdr) != sizeof *ehdr) \
- return err("could not modify file"); \
- \
- /* Save the changes to the program segment header table, if any. \
- */ \
- if (lseek(fd, EGET(ehdr->e_phoff), SEEK_SET) == (off_t)-1) { \
- err("could not seek in file."); \
- goto warning; \
- } \
- n = EGET(ehdr->e_phnum) * sizeof *phdrs; \
- if (write(fd, phdrs, n) != (ssize_t)n) { \
- err("could not write to file"); \
- goto warning; \
- } \
- \
- /* Eleventh-hour sanity check: don't truncate before the end of \
- * the program segment header table. \
- */ \
- if (newsize < EGET(ehdr->e_phoff) + n) \
- newsize = EGET(ehdr->e_phoff) + n; \
- \
- /* Chop off the end of the file. \
- */ \
- if (ftruncate(fd, newsize)) { \
- err("could not resize file"); \
- goto warning; \
- } \
- \
- return TRUE; \
- \
- warning: \
- return err("ELF file may have been corrupted!"); \
-}
-
-
-/* First elements of Elf32_Ehdr and Elf64_Ehdr are common.
- */
-static int readelfheaderident(int fd, Elf32_Ehdr *ehdr)
-{
- errno = 0;
- if (read(fd, ehdr, EI_NIDENT) != EI_NIDENT)
- return ferr("missing or incomplete ELF header.");
-
- /* Check the ELF signature.
- */
- if (!(ehdr->e_ident[EI_MAG0] == ELFMAG0 &&
- ehdr->e_ident[EI_MAG1] == ELFMAG1 &&
- ehdr->e_ident[EI_MAG2] == ELFMAG2 &&
- ehdr->e_ident[EI_MAG3] == ELFMAG3))
- {
- err("missing ELF signature.");
- return -1;
- }
-
- /* Compare the file's class and endianness with the program's.
- */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
- if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) {
- do_reverse_endian = 0;
- } else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) {
-/* fprintf(stderr, "ELF file has different endianness.\n"); */
- do_reverse_endian = 1;
- }
-#elif __BYTE_ORDER == __BIG_ENDIAN
- if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) {
-/* fprintf(stderr, "ELF file has different endianness.\n"); */
- do_reverse_endian = 1;
- } else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) {
- do_reverse_endian = 0;
- }
-#else
-#error unkown endianness
-#endif
- else {
- err("Unsupported endianness");
- return -1;
- }
-
- /* Check the target architecture.
- */
-/* if (EGET(ehdr->e_machine) != ELF_ARCH) { */
-/* /\* return err("ELF file created for different architecture."); *\/ */
-/* fprintf(stderr, "ELF file created for different architecture.\n"); */
-/* } */
- return ehdr->e_ident[EI_CLASS];
-}
-
-
-HEADER_FUNCTIONS(32)
-
-HEADER_FUNCTIONS(64)
-
-/* truncatezeros() examines the bytes at the end of the file's
- * size-to-be, and reduces the size to exclude any trailing zero
- * bytes.
- */
-static int truncatezeros(int fd, unsigned long *newsize)
-{
- unsigned char contents[1024];
- unsigned long size, n;
-
- size = *newsize;
- do {
- n = sizeof contents;
- if (n > size)
- n = size;
- if (lseek(fd, size - n, SEEK_SET) == (off_t)-1)
- return ferr("cannot seek in file.");
- if (read(fd, contents, n) != (ssize_t)n)
- return ferr("cannot read file contents");
- while (n && !contents[--n])
- --size;
- } while (size && !n);
-
- /* Sanity check.
- */
- if (!size)
- return err("ELF file is completely blank!");
-
- *newsize = size;
- return TRUE;
-}
-
-/* main() loops over the cmdline arguments, leaving all the real work
- * to the other functions.
- */
-int main(int argc, char *argv[])
-{
- int fd;
- union {
- Elf32_Ehdr ehdr32;
- Elf64_Ehdr ehdr64;
- } e;
- union {
- Elf32_Phdr *phdrs32;
- Elf64_Phdr *phdrs64;
- } p;
- unsigned long newsize;
- char **arg;
- int failures = 0;
-
- if (argc < 2 || argv[1][0] == '-') {
- printf("Usage: sstrip FILE...\n"
- "sstrip discards all nonessential bytes from an executable.\n\n"
- "Version 2.0-X Copyright (C) 2000,2001 Brian Raiter.\n"
- "Cross-devel hacks Copyright (C) 2004 Manuel Novoa III.\n"
- "This program is free software, licensed under the GNU\n"
- "General Public License. There is absolutely no warranty.\n");
- return EXIT_SUCCESS;
- }
-
- progname = argv[0];
-
- for (arg = argv + 1 ; *arg != NULL ; ++arg) {
- filename = *arg;
-
- fd = open(*arg, O_RDWR);
- if (fd < 0) {
- ferr("can't open");
- ++failures;
- continue;
- }
-
- switch (readelfheaderident(fd, &e.ehdr32)) {
- case ELFCLASS32:
- if (!(readelfheader32(fd, &e.ehdr32) &&
- readphdrtable32(fd, &e.ehdr32, &p.phdrs32) &&
- getmemorysize32(&e.ehdr32, p.phdrs32, &newsize) &&
- truncatezeros(fd, &newsize) &&
- modifyheaders32(&e.ehdr32, p.phdrs32, newsize) &&
- commitchanges32(fd, &e.ehdr32, p.phdrs32, newsize)))
- ++failures;
- break;
- case ELFCLASS64:
- if (!(readelfheader64(fd, &e.ehdr64) &&
- readphdrtable64(fd, &e.ehdr64, &p.phdrs64) &&
- getmemorysize64(&e.ehdr64, p.phdrs64, &newsize) &&
- truncatezeros(fd, &newsize) &&
- modifyheaders64(&e.ehdr64, p.phdrs64, newsize) &&
- commitchanges64(fd, &e.ehdr64, p.phdrs64, newsize)))
- ++failures;
- break;
- default:
- ++failures;
- break;
- }
- close(fd);
- }
-
- return failures ? EXIT_FAILURE : EXIT_SUCCESS;
-}
diff --git a/toolchain/sstrip/sstrip.mk b/toolchain/sstrip/sstrip.mk
deleted file mode 100644
index f387e2d..0000000
--- a/toolchain/sstrip/sstrip.mk
+++ /dev/null
@@ -1,70 +0,0 @@
-######################################################################
-#
-# sstrip
-#
-######################################################################
-
-SSTRIP_SOURCE_FILE:=$(TOPDIR)/toolchain/sstrip/sstrip.c
-
-######################################################################
-#
-# sstrip host
-#
-######################################################################
-
-SSTRIP_HOST:=$(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-sstrip
-
-$(SSTRIP_HOST): $(SSTRIP_SOURCE_FILE)
- mkdir -p $(@D) $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin
- $(HOSTCC) $(HOST_CFLAGS) $(SSTRIP_SOURCE_FILE) -o $(SSTRIP_HOST)
- ln -snf ../../bin/$(REAL_GNU_TARGET_NAME)-sstrip \
- $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/sstrip
- ln -snf $(REAL_GNU_TARGET_NAME)-sstrip \
- $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-sstrip
-
-sstrip_host: $(SSTRIP_HOST)
-
-sstrip_host-source: $(SSTRIP_SOURCE_FILE)
-
-sstrip_host-clean:
- rm -f $(SSTRIP_HOST)
- rm -f $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/sstrip
- rm -f $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-sstrip
-
-sstrip_host-dirclean:
- true
-
-######################################################################
-#
-# sstrip target
-#
-######################################################################
-
-SSTRIP_TARGET:=$(TARGET_DIR)/usr/bin/sstrip
-
-$(SSTRIP_TARGET): $(SSTRIP_SOURCE_FILE)
- $(TARGET_CC) $(TARGET_CFLAGS) $(SSTRIP_SOURCE_FILE) -o $(SSTRIP_TARGET)
-
-sstrip_target: $(SSTRIP_TARGET)
-
-sstrip_target-source: $(SSTRIP_SOURCE_FILE)
-
-sstrip_target-clean:
- rm -f $(SSTRIP_TARGET)
-
-sstrip_target-dirclean:
- true
-
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
-
-ifeq ($(BR2_PACKAGE_SSTRIP_HOST),y)
-TARGETS+=sstrip_host
-endif
-
-ifeq ($(BR2_PACKAGE_SSTRIP_TARGET),y)
-TARGETS+=sstrip_target
-endif
diff --git a/toolchain/toolchain-buildroot.mk b/toolchain/toolchain-buildroot.mk
index 44044d7..f12a480 100644
--- a/toolchain/toolchain-buildroot.mk
+++ b/toolchain/toolchain-buildroot.mk
@@ -7,5 +7,4 @@ include toolchain/gcc/gcc-uclibc-4.x.mk
include toolchain/gdb/gdb.mk
include toolchain/kernel-headers/kernel-headers.mk
include toolchain/mklibs/mklibs.mk
-include toolchain/sstrip/sstrip.mk
include toolchain/uClibc/uclibc.mk
diff --git a/toolchain/toolchain-buildroot/Config.in.2 b/toolchain/toolchain-buildroot/Config.in.2
index fe93e70..b6407e6 100644
--- a/toolchain/toolchain-buildroot/Config.in.2
+++ b/toolchain/toolchain-buildroot/Config.in.2
@@ -105,7 +105,6 @@ endchoice
source "toolchain/elf2flt/Config.in"
source "toolchain/mklibs/Config.in"
-source "toolchain/sstrip/Config.in"
config BR2_VFP_FLOAT
bool "Use ARM Vector Floating Point unit"
diff --git a/toolchain/toolchain-crosstool-ng.mk b/toolchain/toolchain-crosstool-ng.mk
index 1c80300..1befff2 100644
--- a/toolchain/toolchain-crosstool-ng.mk
+++ b/toolchain/toolchain-crosstool-ng.mk
@@ -9,5 +9,4 @@ include toolchain/gcc/gcc-uclibc-4.x.mk
include toolchain/gdb/gdb.mk
include toolchain/toolchain-crosstool-ng/crosstool-ng.mk
include toolchain/mklibs/mklibs.mk
-include toolchain/sstrip/sstrip.mk
include toolchain/uClibc/uclibc.mk
diff --git a/toolchain/toolchain-external.mk b/toolchain/toolchain-external.mk
index f90b6f1..c43618b 100644
--- a/toolchain/toolchain-external.mk
+++ b/toolchain/toolchain-external.mk
@@ -8,6 +8,5 @@ include toolchain/gcc/gcc-uclibc-4.x.mk
include toolchain/gdb/gdb.mk
include toolchain/kernel-headers/kernel-headers.mk
include toolchain/mklibs/mklibs.mk
-include toolchain/sstrip/sstrip.mk
include toolchain/toolchain-external/ext-tool.mk
include toolchain/uClibc/uclibc.mk
--
1.7.2.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 07/13] toolchain: move sysroot to host dir
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
` (5 preceding siblings ...)
2010-12-14 19:06 ` [Buildroot] [PATCH 06/13] sstrip: make it a proper package Gustavo Zacarias
@ 2010-12-14 19:06 ` Gustavo Zacarias
2010-12-14 19:58 ` Yann E. MORIN
2010-12-16 10:49 ` Thomas Petazzoni
2010-12-14 19:06 ` [Buildroot] [PATCH 08/13] uclibc: move tools " Gustavo Zacarias
` (5 subsequent siblings)
12 siblings, 2 replies; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:06 UTC (permalink / raw)
To: buildroot
* Drop the BR2_STAGING_DIR option
* Hardcode STAGING_DIR to $(HOST_DIR)/usr/TUPLE/sysroot
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
Config.in | 13 -------------
Makefile | 4 ++--
2 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/Config.in b/Config.in
index f6e894e..c1bfa5c 100644
--- a/Config.in
+++ b/Config.in
@@ -73,19 +73,6 @@ config BR2_DL_DIR
The default is $(TOPDIR)/dl
-config BR2_STAGING_DIR
- string "Toolchain and header file location?"
- default "$(BASE_DIR)/staging"
- help
- This is the location where the toolchain will be installed. The
- toolchain will not work if it is moved from this location.
- Therefore, if you wish to package up a uClibc toolchain, it is
- important that is is set to the final location where the toolchain
- will be used.
-
- Most people will leave this set to the default value of
- "$(BASE_DIR)/staging".
-
source "target/device/Config.in.mirrors"
config BR2_JLEVEL
diff --git a/Makefile b/Makefile
index f6ab07e..d7d6f8d 100644
--- a/Makefile
+++ b/Makefile
@@ -268,8 +268,6 @@ TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
GNU_TARGET_SUFFIX:=-$(call qstrip,$(BR2_GNU_TARGET_SUFFIX))
-STAGING_DIR:=$(call qstrip,$(BR2_STAGING_DIR))
-
# packages compiled for the host goes here
HOST_DIR:=$(BASE_DIR)/host
@@ -294,6 +292,8 @@ endif
include toolchain/Makefile.in
include package/Makefile.in
+STAGING_DIR:=$(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/sysroot
+
#############################################################
#
# You should probably leave this stuff alone unless you know
--
1.7.2.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 08/13] uclibc: move tools to host dir
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
` (6 preceding siblings ...)
2010-12-14 19:06 ` [Buildroot] [PATCH 07/13] toolchain: move sysroot to host dir Gustavo Zacarias
@ 2010-12-14 19:06 ` Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 09/13] binutils: make it a proper package Gustavo Zacarias
` (4 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:06 UTC (permalink / raw)
To: buildroot
Move uclibc host tools (ldd/ldconfig) to host dir.
They were previously installed in the staging dir.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
toolchain/uClibc/uclibc.mk | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/toolchain/uClibc/uclibc.mk b/toolchain/uClibc/uclibc.mk
index e05e16c..ec92824 100644
--- a/toolchain/uClibc/uclibc.mk
+++ b/toolchain/uClibc/uclibc.mk
@@ -450,17 +450,17 @@ $(STAGING_DIR)/usr/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a
fi
# Build the host utils. Need to add an install target...
$(MAKE1) -C $(UCLIBC_DIR)/utils \
- PREFIX=$(STAGING_DIR) \
+ PREFIX=$(HOST_DIR) \
HOSTCC="$(HOSTCC)" \
hostutils
if [ -f $(UCLIBC_DIR)/utils/ldd.host ]; then \
- install -c $(UCLIBC_DIR)/utils/ldd.host $(STAGING_DIR)/usr/bin/ldd; \
- ln -sf ldd $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ldd; \
+ install -D $(UCLIBC_DIR)/utils/ldd.host $(HOST_DIR)/usr/bin/ldd; \
+ ln -sf ldd $(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ldd; \
fi
if [ -f $(UCLIBC_DIR)/utils/ldconfig.host ]; then \
- install -c $(UCLIBC_DIR)/utils/ldconfig.host $(STAGING_DIR)/usr/bin/ldconfig; \
- ln -sf ldconfig $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ldconfig; \
- ln -sf ldconfig $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-ldconfig; \
+ install -D $(UCLIBC_DIR)/utils/ldconfig.host $(HOST_DIR)/usr/bin/ldconfig; \
+ ln -sf ldconfig $(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ldconfig; \
+ ln -sf ldconfig $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-ldconfig; \
fi
touch -c $@
--
1.7.2.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 09/13] binutils: make it a proper package
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
` (7 preceding siblings ...)
2010-12-14 19:06 ` [Buildroot] [PATCH 08/13] uclibc: move tools " Gustavo Zacarias
@ 2010-12-14 19:06 ` Gustavo Zacarias
2010-12-14 20:14 ` Yann E. MORIN
2010-12-14 19:06 ` [Buildroot] [PATCH 10/13] gcc: cleanup and hook Gustavo Zacarias
` (3 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:06 UTC (permalink / raw)
To: buildroot
* Convert binutils to a proper autotargets package
* Add version 2.21
* Drop version 2.17
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
Makefile | 4 +-
package/Config.in | 1 +
package/binutils/Config.in | 10 +
package/binutils/Config.in.host | 56 ++++++
.../binutils-2.18/100-makeinfo-version.patch | 32 ++++
.../binutils/binutils-2.18/110-arm-eabi-conf.patch | 24 +++
.../binutils-2.18/300-001_ld_makefile_patch.patch | 24 +++
.../300-012_check_ldrunpath_length.patch | 21 +++
.../binutils-2.19.1/110-arm-eabi-conf.patch | 24 +++
package/binutils/binutils-2.19.1/120-sh-conf.patch | 42 +++++
.../300-001_ld_makefile_patch.patch | 24 +++
.../300-012_check_ldrunpath_length.patch | 21 +++
.../binutils/binutils-2.19/110-arm-eabi-conf.patch | 24 +++
package/binutils/binutils-2.19/120-sh-conf.patch | 42 +++++
.../binutils-2.19/300-001_ld_makefile_patch.patch | 24 +++
.../300-012_check_ldrunpath_length.patch | 21 +++
.../binutils-2.20.1/110-arm-eabi-conf.patch | 24 +++
package/binutils/binutils-2.20.1/120-sh-conf.patch | 42 +++++
.../300-001_ld_makefile_patch.patch | 24 +++
.../300-012_check_ldrunpath_length.patch | 21 +++
.../binutils-2.20.1/400-arm_link_speed.patch | 183 ++++++++++++++++++++
.../binutils/binutils-2.20/110-arm-eabi-conf.patch | 24 +++
package/binutils/binutils-2.20/120-sh-conf.patch | 42 +++++
.../binutils-2.20/300-001_ld_makefile_patch.patch | 24 +++
.../300-012_check_ldrunpath_length.patch | 21 +++
.../binutils-2.20/400-arm_link_speed.patch | 183 ++++++++++++++++++++
.../binutils/binutils-2.21/110-arm-eabi-conf.patch | 24 +++
package/binutils/binutils-2.21/120-sh-conf.patch | 42 +++++
.../binutils-2.21/300-001_ld_makefile_patch.patch | 24 +++
.../300-012_check_ldrunpath_length.patch | 21 +++
package/binutils/binutils.mk | 42 +++++
toolchain/binutils/2.17/100-uclibc-conf.patch | 139 ---------------
toolchain/binutils/2.17/110-arm-eabi-conf.patch | 24 ---
.../binutils/2.17/300-001_ld_makefile_patch.patch | 50 ------
.../binutils/2.17/300-006_better_file_error.patch | 43 -----
.../2.17/300-012_check_ldrunpath_length.patch | 47 -----
.../2.17/400-mips-ELF_MAXPAGESIZE-4K.patch | 26 ---
.../binutils/2.17/500-fix-makeinfo-check.patch | 17 --
toolchain/binutils/2.18/100-makeinfo-version.patch | 32 ----
toolchain/binutils/2.18/110-arm-eabi-conf.patch | 24 ---
.../binutils/2.18/300-001_ld_makefile_patch.patch | 24 ---
.../2.18/300-012_check_ldrunpath_length.patch | 21 ---
toolchain/binutils/2.19.1/110-arm-eabi-conf.patch | 24 ---
toolchain/binutils/2.19.1/120-sh-conf.patch | 42 -----
.../2.19.1/300-001_ld_makefile_patch.patch | 24 ---
.../2.19.1/300-012_check_ldrunpath_length.patch | 21 ---
toolchain/binutils/2.19/110-arm-eabi-conf.patch | 24 ---
toolchain/binutils/2.19/120-sh-conf.patch | 42 -----
.../binutils/2.19/300-001_ld_makefile_patch.patch | 24 ---
.../2.19/300-012_check_ldrunpath_length.patch | 21 ---
toolchain/binutils/2.20.1/110-arm-eabi-conf.patch | 24 ---
toolchain/binutils/2.20.1/120-sh-conf.patch | 42 -----
.../2.20.1/300-001_ld_makefile_patch.patch | 24 ---
.../2.20.1/300-012_check_ldrunpath_length.patch | 21 ---
toolchain/binutils/2.20.1/400-arm_link_speed.patch | 183 --------------------
toolchain/binutils/2.20/110-arm-eabi-conf.patch | 24 ---
toolchain/binutils/2.20/120-sh-conf.patch | 42 -----
.../binutils/2.20/300-001_ld_makefile_patch.patch | 24 ---
.../2.20/300-012_check_ldrunpath_length.patch | 21 ---
toolchain/binutils/2.20/400-arm_link_speed.patch | 183 --------------------
toolchain/binutils/Config.in | 59 -------
toolchain/binutils/binutils.mk | 179 -------------------
toolchain/toolchain-buildroot.mk | 1 -
toolchain/toolchain-buildroot/Config.in | 2 +-
toolchain/toolchain-crosstool-ng.mk | 1 -
toolchain/toolchain-external.mk | 1 -
66 files changed, 1134 insertions(+), 1501 deletions(-)
create mode 100644 package/binutils/Config.in
create mode 100644 package/binutils/Config.in.host
create mode 100644 package/binutils/binutils-2.18/100-makeinfo-version.patch
create mode 100644 package/binutils/binutils-2.18/110-arm-eabi-conf.patch
create mode 100644 package/binutils/binutils-2.18/300-001_ld_makefile_patch.patch
create mode 100644 package/binutils/binutils-2.18/300-012_check_ldrunpath_length.patch
create mode 100644 package/binutils/binutils-2.19.1/110-arm-eabi-conf.patch
create mode 100644 package/binutils/binutils-2.19.1/120-sh-conf.patch
create mode 100644 package/binutils/binutils-2.19.1/300-001_ld_makefile_patch.patch
create mode 100644 package/binutils/binutils-2.19.1/300-012_check_ldrunpath_length.patch
create mode 100644 package/binutils/binutils-2.19/110-arm-eabi-conf.patch
create mode 100644 package/binutils/binutils-2.19/120-sh-conf.patch
create mode 100644 package/binutils/binutils-2.19/300-001_ld_makefile_patch.patch
create mode 100644 package/binutils/binutils-2.19/300-012_check_ldrunpath_length.patch
create mode 100644 package/binutils/binutils-2.20.1/110-arm-eabi-conf.patch
create mode 100644 package/binutils/binutils-2.20.1/120-sh-conf.patch
create mode 100644 package/binutils/binutils-2.20.1/300-001_ld_makefile_patch.patch
create mode 100644 package/binutils/binutils-2.20.1/300-012_check_ldrunpath_length.patch
create mode 100644 package/binutils/binutils-2.20.1/400-arm_link_speed.patch
create mode 100644 package/binutils/binutils-2.20/110-arm-eabi-conf.patch
create mode 100644 package/binutils/binutils-2.20/120-sh-conf.patch
create mode 100644 package/binutils/binutils-2.20/300-001_ld_makefile_patch.patch
create mode 100644 package/binutils/binutils-2.20/300-012_check_ldrunpath_length.patch
create mode 100644 package/binutils/binutils-2.20/400-arm_link_speed.patch
create mode 100644 package/binutils/binutils-2.21/110-arm-eabi-conf.patch
create mode 100644 package/binutils/binutils-2.21/120-sh-conf.patch
create mode 100644 package/binutils/binutils-2.21/300-001_ld_makefile_patch.patch
create mode 100644 package/binutils/binutils-2.21/300-012_check_ldrunpath_length.patch
create mode 100644 package/binutils/binutils.mk
delete mode 100644 toolchain/binutils/2.17/100-uclibc-conf.patch
delete mode 100644 toolchain/binutils/2.17/110-arm-eabi-conf.patch
delete mode 100644 toolchain/binutils/2.17/300-001_ld_makefile_patch.patch
delete mode 100644 toolchain/binutils/2.17/300-006_better_file_error.patch
delete mode 100644 toolchain/binutils/2.17/300-012_check_ldrunpath_length.patch
delete mode 100644 toolchain/binutils/2.17/400-mips-ELF_MAXPAGESIZE-4K.patch
delete mode 100644 toolchain/binutils/2.17/500-fix-makeinfo-check.patch
delete mode 100644 toolchain/binutils/2.18/100-makeinfo-version.patch
delete mode 100644 toolchain/binutils/2.18/110-arm-eabi-conf.patch
delete mode 100644 toolchain/binutils/2.18/300-001_ld_makefile_patch.patch
delete mode 100644 toolchain/binutils/2.18/300-012_check_ldrunpath_length.patch
delete mode 100644 toolchain/binutils/2.19.1/110-arm-eabi-conf.patch
delete mode 100644 toolchain/binutils/2.19.1/120-sh-conf.patch
delete mode 100644 toolchain/binutils/2.19.1/300-001_ld_makefile_patch.patch
delete mode 100644 toolchain/binutils/2.19.1/300-012_check_ldrunpath_length.patch
delete mode 100644 toolchain/binutils/2.19/110-arm-eabi-conf.patch
delete mode 100644 toolchain/binutils/2.19/120-sh-conf.patch
delete mode 100644 toolchain/binutils/2.19/300-001_ld_makefile_patch.patch
delete mode 100644 toolchain/binutils/2.19/300-012_check_ldrunpath_length.patch
delete mode 100644 toolchain/binutils/2.20.1/110-arm-eabi-conf.patch
delete mode 100644 toolchain/binutils/2.20.1/120-sh-conf.patch
delete mode 100644 toolchain/binutils/2.20.1/300-001_ld_makefile_patch.patch
delete mode 100644 toolchain/binutils/2.20.1/300-012_check_ldrunpath_length.patch
delete mode 100644 toolchain/binutils/2.20.1/400-arm_link_speed.patch
delete mode 100644 toolchain/binutils/2.20/110-arm-eabi-conf.patch
delete mode 100644 toolchain/binutils/2.20/120-sh-conf.patch
delete mode 100644 toolchain/binutils/2.20/300-001_ld_makefile_patch.patch
delete mode 100644 toolchain/binutils/2.20/300-012_check_ldrunpath_length.patch
delete mode 100644 toolchain/binutils/2.20/400-arm_link_speed.patch
delete mode 100644 toolchain/binutils/Config.in
delete mode 100644 toolchain/binutils/binutils.mk
diff --git a/Makefile b/Makefile
index d7d6f8d..b12ea6d 100644
--- a/Makefile
+++ b/Makefile
@@ -239,7 +239,7 @@ BASE_TARGETS += host-ccache
endif
ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
-BASE_TARGETS += uclibc-configured binutils cross_compiler uclibc-target-utils kernel-headers
+BASE_TARGETS += uclibc-configured host-binutils cross_compiler uclibc-target-utils kernel-headers
else
BASE_TARGETS += uclibc
endif
@@ -614,7 +614,7 @@ endif
configured: dirs kernel-headers uclibc-config busybox-config linux26-config
-prepatch: gcc-patched binutils-patched gdb-patched uclibc-patched
+prepatch: gcc-patched gdb-patched uclibc-patched
cross: $(BASE_TARGETS)
diff --git a/package/Config.in b/package/Config.in
index eb44b0d..6d6e72a 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -35,6 +35,7 @@ endmenu
menu "Development tools"
source "package/autoconf/Config.in"
source "package/automake/Config.in"
+source "package/binutils/Config.in"
source "package/bison/Config.in"
source "package/bsdiff/Config.in"
source "package/ccache/Config.in"
diff --git a/package/binutils/Config.in b/package/binutils/Config.in
new file mode 100644
index 0000000..a4cf1fb
--- /dev/null
+++ b/package/binutils/Config.in
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_BINUTILS
+ bool "binutils"
+ depends on BR2_TOOLCHAIN_BUILDROOT
+ select BR2_PACKAGE_MPC if BR2_GCC_VERSION_4_5_X
+ select BR2_PACKAGE_MPFR
+ select BR2_PACKAGE_GMP
+ help
+ The GNU Binutils are a collection of binary tools.
+
+ http://www.gnu.org/software/binutils/
diff --git a/package/binutils/Config.in.host b/package/binutils/Config.in.host
new file mode 100644
index 0000000..4a5e8ef
--- /dev/null
+++ b/package/binutils/Config.in.host
@@ -0,0 +1,56 @@
+comment "Binutils Options"
+
+choice
+ prompt "Binutils Version"
+ default BR2_BINUTILS_VERSION_2_21
+ help
+ Select the version of binutils you wish to use.
+
+ config BR2_BINUTILS_VERSION_2_18
+ depends on !BR2_avr32
+ depends on BR2_DEPRECATED
+ bool "binutils 2.18"
+
+ config BR2_BINUTILS_VERSION_2_18_AVR32_1_0_1
+ depends on BR2_avr32
+ bool "binutils 2.18-avr32-1.0.1"
+
+ config BR2_BINUTILS_VERSION_2_19
+ depends on !BR2_avr32
+ depends on BR2_DEPRECATED
+ bool "binutils 2.19"
+
+ config BR2_BINUTILS_VERSION_2_19_1
+ depends on !BR2_avr32
+ depends on BR2_DEPRECATED
+ bool "binutils 2.19.1"
+
+ config BR2_BINUTILS_VERSION_2_20
+ depends on !BR2_avr32
+ bool "binutils 2.20"
+
+ config BR2_BINUTILS_VERSION_2_20_1
+ depends on !BR2_avr32
+ bool "binutils 2.20.1"
+
+ config BR2_BINUTILS_VERSION_2_21
+ depends on !BR2_avr32
+ bool "binutils 2.21"
+
+endchoice
+
+config BR2_BINUTILS_VERSION
+ string
+ default "2.18" if BR2_BINUTILS_VERSION_2_18
+ default "2.18-avr32-1.0.1" if BR2_BINUTILS_VERSION_2_18_AVR32_1_0_1
+ default "2.19" if BR2_BINUTILS_VERSION_2_19
+ default "2.19.1" if BR2_BINUTILS_VERSION_2_19_1
+ default "2.20" if BR2_BINUTILS_VERSION_2_20
+ default "2.20.1" if BR2_BINUTILS_VERSION_2_20_1
+ default "2.21" if BR2_BINUTILS_VERSION_2_21
+
+config BR2_BINUTILS_EXTRA_CONFIG_OPTIONS
+ string "Additional binutils options"
+ default ""
+ help
+ Any additional binutils options you may want to include.
diff --git a/package/binutils/binutils-2.18/100-makeinfo-version.patch b/package/binutils/binutils-2.18/100-makeinfo-version.patch
new file mode 100644
index 0000000..d911d62
--- /dev/null
+++ b/package/binutils/binutils-2.18/100-makeinfo-version.patch
@@ -0,0 +1,32 @@
+diff -u binutils-2.18-orig/configure binutils-2.18/configure
+--- binutils-2.18-orig/configure 2007-08-06 16:29:40.000000000 -0400
++++ binutils-2.18/configure 2007-09-27 22:41:51.000000000 -0400
+@@ -6125,10 +6125,10 @@
+ *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
+ *)
+
+- # For an installed makeinfo, we require it to be from texinfo 4.4 or
++ # For an installed makeinfo, we require it to be from texinfo 4.6 or
+ # higher, else we use the "missing" dummy.
+ if ${MAKEINFO} --version \
+- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
++ | egrep 'texinfo[^0-9]*(4\.([6-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
+ :
+ else
+ MAKEINFO="$MISSING makeinfo"
+diff -u binutils-2.18-orig/configure.ac binutils-2.18/configure.ac
+--- binutils-2.18-orig/configure.ac 2007-08-28 16:24:26.000000000 -0400
++++ binutils-2.18/configure.ac 2007-09-27 22:41:00.000000000 -0400
+@@ -2400,10 +2400,10 @@
+ *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
+ *)
+ changequote(,)
+- # For an installed makeinfo, we require it to be from texinfo 4.4 or
++ # For an installed makeinfo, we require it to be from texinfo 4.6 or
+ # higher, else we use the "missing" dummy.
+ if ${MAKEINFO} --version \
+- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
++ | egrep 'texinfo[^0-9]*(4\.([6-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
+ :
+ else
+ MAKEINFO="$MISSING makeinfo"
diff --git a/package/binutils/binutils-2.18/110-arm-eabi-conf.patch b/package/binutils/binutils-2.18/110-arm-eabi-conf.patch
new file mode 100644
index 0000000..04e19be
--- /dev/null
+++ b/package/binutils/binutils-2.18/110-arm-eabi-conf.patch
@@ -0,0 +1,24 @@
+diff -u binutils-2.17.50.0.17.oorig/configure binutils-2.17.50.0.17/configure
+--- binutils-2.17.50.0.17.oorig/configure 2007-06-18 19:29:28.000000000 +0200
++++ binutils-2.17.50.0.17/configure 2007-06-25 09:58:36.000000000 +0200
+@@ -2224,7 +2224,7 @@
+ arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ noconfigdirs="$noconfigdirs target-libjava target-libobjc"
+ ;;
+diff -u binutils-2.17.50.0.17.oorig/configure.ac binutils-2.17.50.0.17/configure.ac
+--- binutils-2.17.50.0.17.oorig/configure.ac 2007-06-18 19:29:28.000000000 +0200
++++ binutils-2.17.50.0.17/configure.ac 2007-06-25 09:58:36.000000000 +0200
+@@ -513,7 +513,7 @@
+ arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ noconfigdirs="$noconfigdirs target-libjava target-libobjc"
+ ;;
diff --git a/package/binutils/binutils-2.18/300-001_ld_makefile_patch.patch b/package/binutils/binutils-2.18/300-001_ld_makefile_patch.patch
new file mode 100644
index 0000000..5cb0f61
--- /dev/null
+++ b/package/binutils/binutils-2.18/300-001_ld_makefile_patch.patch
@@ -0,0 +1,24 @@
+diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.am binutils-2.17.50.0.17/ld/Makefile.am
+--- binutils-2.17.50.0.17.oorig/ld/Makefile.am 2007-06-18 19:29:29.000000000 +0200
++++ binutils-2.17.50.0.17/ld/Makefile.am 2007-06-25 10:00:36.000000000 +0200
+@@ -18,7 +18,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+
+ EMUL = @EMUL@
+ EMULATION_OFILES = @EMULATION_OFILES@
+diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.in binutils-2.17.50.0.17/ld/Makefile.in
+--- binutils-2.17.50.0.17.oorig/ld/Makefile.in 2007-06-18 19:29:29.000000000 +0200
++++ binutils-2.17.50.0.17/ld/Makefile.in 2007-06-25 10:00:36.000000000 +0200
+@@ -287,7 +287,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+ BASEDIR = $(srcdir)/..
+ BFDDIR = $(BASEDIR)/bfd
+ INCDIR = $(BASEDIR)/include
diff --git a/package/binutils/binutils-2.18/300-012_check_ldrunpath_length.patch b/package/binutils/binutils-2.18/300-012_check_ldrunpath_length.patch
new file mode 100644
index 0000000..6e80921
--- /dev/null
+++ b/package/binutils/binutils-2.18/300-012_check_ldrunpath_length.patch
@@ -0,0 +1,21 @@
+diff -u binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em binutils-2.17.50.0.17/ld/emultempl/elf32.em
+--- binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em 2007-06-18 19:31:40.000000000 +0200
++++ binutils-2.17.50.0.17/ld/emultempl/elf32.em 2007-06-25 10:01:25.000000000 +0200
+@@ -1007,6 +1007,8 @@
+ && command_line.rpath == NULL)
+ {
+ lib_path = (const char *) getenv ("LD_RUN_PATH");
++ if ((lib_path) && (strlen (lib_path) == 0))
++ lib_path = NULL;
+ if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
+ force))
+ break;
+@@ -1191,6 +1193,8 @@
+ rpath = command_line.rpath;
+ if (rpath == NULL)
+ rpath = (const char *) getenv ("LD_RUN_PATH");
++ if ((rpath) && (strlen (rpath) == 0))
++ rpath = NULL;
+ if (! (bfd_elf_size_dynamic_sections
+ (output_bfd, command_line.soname, rpath,
+ command_line.filter_shlib,
diff --git a/package/binutils/binutils-2.19.1/110-arm-eabi-conf.patch b/package/binutils/binutils-2.19.1/110-arm-eabi-conf.patch
new file mode 100644
index 0000000..af26329
--- /dev/null
+++ b/package/binutils/binutils-2.19.1/110-arm-eabi-conf.patch
@@ -0,0 +1,24 @@
+diff -rdup binutils-2.18.50.0.3.orig/configure binutils-2.18.50.0.3/configure
+--- binutils-2.18.50.0.3.orig/configure 2007-11-22 12:41:26.000000000 +0100
++++ binutils-2.18.50.0.3/configure 2007-11-22 12:45:01.000000000 +0100
+@@ -2245,7 +2245,7 @@ case "${target}" in
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ libgloss_dir=arm
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-*gnueabi)
+ noconfigdirs="$noconfigdirs target-qthreads"
+ noconfigdirs="$noconfigdirs target-libobjc"
+ case ${with_newlib} in
+diff -rdup binutils-2.18.50.0.3.orig/configure.ac binutils-2.18.50.0.3/configure.ac
+--- binutils-2.18.50.0.3.orig/configure.ac 2007-11-22 12:41:26.000000000 +0100
++++ binutils-2.18.50.0.3/configure.ac 2007-11-22 12:44:54.000000000 +0100
+@@ -522,7 +522,7 @@ case "${target}" in
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ libgloss_dir=arm
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-*gnueabi)
+ noconfigdirs="$noconfigdirs target-qthreads"
+ noconfigdirs="$noconfigdirs target-libobjc"
+ case ${with_newlib} in
diff --git a/package/binutils/binutils-2.19.1/120-sh-conf.patch b/package/binutils/binutils-2.19.1/120-sh-conf.patch
new file mode 100644
index 0000000..071d15a
--- /dev/null
+++ b/package/binutils/binutils-2.19.1/120-sh-conf.patch
@@ -0,0 +1,42 @@
+diff -rdup binutils-2.18.50.0.9.old/configure binutils-2.18.50.0.9/configure
+--- binutils-2.18.50.0.9.old/configure 2008-08-23 17:36:13.000000000 +0200
++++ binutils-2.18.50.0.9/configure 2008-10-14 14:25:22.000000000 +0200
+@@ -2281,7 +2281,7 @@ case "${target}" in
+ am33_2.0-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+- sh-*-linux*)
++ sh*-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+ sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+@@ -2606,7 +2606,7 @@ case "${target}" in
+ romp-*-*)
+ noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${host}" in
+ i[3456789]86-*-vsta) ;; # don't add gprof back in
+ i[3456789]86-*-go32*) ;; # don't add gprof back in
+diff -rdup binutils-2.18.50.0.9.old/configure.ac binutils-2.18.50.0.9/configure.ac
+--- binutils-2.18.50.0.9.old/configure.ac 2008-08-23 17:36:13.000000000 +0200
++++ binutils-2.18.50.0.9/configure.ac 2008-10-14 14:25:11.000000000 +0200
+@@ -530,7 +530,7 @@ case "${target}" in
+ am33_2.0-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+- sh-*-linux*)
++ sh*-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+ sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+@@ -855,7 +855,7 @@ case "${target}" in
+ romp-*-*)
+ noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${host}" in
+ i[[3456789]]86-*-vsta) ;; # don't add gprof back in
+ i[[3456789]]86-*-go32*) ;; # don't add gprof back in
diff --git a/package/binutils/binutils-2.19.1/300-001_ld_makefile_patch.patch b/package/binutils/binutils-2.19.1/300-001_ld_makefile_patch.patch
new file mode 100644
index 0000000..5cb0f61
--- /dev/null
+++ b/package/binutils/binutils-2.19.1/300-001_ld_makefile_patch.patch
@@ -0,0 +1,24 @@
+diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.am binutils-2.17.50.0.17/ld/Makefile.am
+--- binutils-2.17.50.0.17.oorig/ld/Makefile.am 2007-06-18 19:29:29.000000000 +0200
++++ binutils-2.17.50.0.17/ld/Makefile.am 2007-06-25 10:00:36.000000000 +0200
+@@ -18,7 +18,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+
+ EMUL = @EMUL@
+ EMULATION_OFILES = @EMULATION_OFILES@
+diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.in binutils-2.17.50.0.17/ld/Makefile.in
+--- binutils-2.17.50.0.17.oorig/ld/Makefile.in 2007-06-18 19:29:29.000000000 +0200
++++ binutils-2.17.50.0.17/ld/Makefile.in 2007-06-25 10:00:36.000000000 +0200
+@@ -287,7 +287,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+ BASEDIR = $(srcdir)/..
+ BFDDIR = $(BASEDIR)/bfd
+ INCDIR = $(BASEDIR)/include
diff --git a/package/binutils/binutils-2.19.1/300-012_check_ldrunpath_length.patch b/package/binutils/binutils-2.19.1/300-012_check_ldrunpath_length.patch
new file mode 100644
index 0000000..6e80921
--- /dev/null
+++ b/package/binutils/binutils-2.19.1/300-012_check_ldrunpath_length.patch
@@ -0,0 +1,21 @@
+diff -u binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em binutils-2.17.50.0.17/ld/emultempl/elf32.em
+--- binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em 2007-06-18 19:31:40.000000000 +0200
++++ binutils-2.17.50.0.17/ld/emultempl/elf32.em 2007-06-25 10:01:25.000000000 +0200
+@@ -1007,6 +1007,8 @@
+ && command_line.rpath == NULL)
+ {
+ lib_path = (const char *) getenv ("LD_RUN_PATH");
++ if ((lib_path) && (strlen (lib_path) == 0))
++ lib_path = NULL;
+ if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
+ force))
+ break;
+@@ -1191,6 +1193,8 @@
+ rpath = command_line.rpath;
+ if (rpath == NULL)
+ rpath = (const char *) getenv ("LD_RUN_PATH");
++ if ((rpath) && (strlen (rpath) == 0))
++ rpath = NULL;
+ if (! (bfd_elf_size_dynamic_sections
+ (output_bfd, command_line.soname, rpath,
+ command_line.filter_shlib,
diff --git a/package/binutils/binutils-2.19/110-arm-eabi-conf.patch b/package/binutils/binutils-2.19/110-arm-eabi-conf.patch
new file mode 100644
index 0000000..af26329
--- /dev/null
+++ b/package/binutils/binutils-2.19/110-arm-eabi-conf.patch
@@ -0,0 +1,24 @@
+diff -rdup binutils-2.18.50.0.3.orig/configure binutils-2.18.50.0.3/configure
+--- binutils-2.18.50.0.3.orig/configure 2007-11-22 12:41:26.000000000 +0100
++++ binutils-2.18.50.0.3/configure 2007-11-22 12:45:01.000000000 +0100
+@@ -2245,7 +2245,7 @@ case "${target}" in
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ libgloss_dir=arm
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-*gnueabi)
+ noconfigdirs="$noconfigdirs target-qthreads"
+ noconfigdirs="$noconfigdirs target-libobjc"
+ case ${with_newlib} in
+diff -rdup binutils-2.18.50.0.3.orig/configure.ac binutils-2.18.50.0.3/configure.ac
+--- binutils-2.18.50.0.3.orig/configure.ac 2007-11-22 12:41:26.000000000 +0100
++++ binutils-2.18.50.0.3/configure.ac 2007-11-22 12:44:54.000000000 +0100
+@@ -522,7 +522,7 @@ case "${target}" in
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ libgloss_dir=arm
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-*gnueabi)
+ noconfigdirs="$noconfigdirs target-qthreads"
+ noconfigdirs="$noconfigdirs target-libobjc"
+ case ${with_newlib} in
diff --git a/package/binutils/binutils-2.19/120-sh-conf.patch b/package/binutils/binutils-2.19/120-sh-conf.patch
new file mode 100644
index 0000000..071d15a
--- /dev/null
+++ b/package/binutils/binutils-2.19/120-sh-conf.patch
@@ -0,0 +1,42 @@
+diff -rdup binutils-2.18.50.0.9.old/configure binutils-2.18.50.0.9/configure
+--- binutils-2.18.50.0.9.old/configure 2008-08-23 17:36:13.000000000 +0200
++++ binutils-2.18.50.0.9/configure 2008-10-14 14:25:22.000000000 +0200
+@@ -2281,7 +2281,7 @@ case "${target}" in
+ am33_2.0-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+- sh-*-linux*)
++ sh*-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+ sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+@@ -2606,7 +2606,7 @@ case "${target}" in
+ romp-*-*)
+ noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${host}" in
+ i[3456789]86-*-vsta) ;; # don't add gprof back in
+ i[3456789]86-*-go32*) ;; # don't add gprof back in
+diff -rdup binutils-2.18.50.0.9.old/configure.ac binutils-2.18.50.0.9/configure.ac
+--- binutils-2.18.50.0.9.old/configure.ac 2008-08-23 17:36:13.000000000 +0200
++++ binutils-2.18.50.0.9/configure.ac 2008-10-14 14:25:11.000000000 +0200
+@@ -530,7 +530,7 @@ case "${target}" in
+ am33_2.0-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+- sh-*-linux*)
++ sh*-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+ sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+@@ -855,7 +855,7 @@ case "${target}" in
+ romp-*-*)
+ noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${host}" in
+ i[[3456789]]86-*-vsta) ;; # don't add gprof back in
+ i[[3456789]]86-*-go32*) ;; # don't add gprof back in
diff --git a/package/binutils/binutils-2.19/300-001_ld_makefile_patch.patch b/package/binutils/binutils-2.19/300-001_ld_makefile_patch.patch
new file mode 100644
index 0000000..5cb0f61
--- /dev/null
+++ b/package/binutils/binutils-2.19/300-001_ld_makefile_patch.patch
@@ -0,0 +1,24 @@
+diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.am binutils-2.17.50.0.17/ld/Makefile.am
+--- binutils-2.17.50.0.17.oorig/ld/Makefile.am 2007-06-18 19:29:29.000000000 +0200
++++ binutils-2.17.50.0.17/ld/Makefile.am 2007-06-25 10:00:36.000000000 +0200
+@@ -18,7 +18,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+
+ EMUL = @EMUL@
+ EMULATION_OFILES = @EMULATION_OFILES@
+diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.in binutils-2.17.50.0.17/ld/Makefile.in
+--- binutils-2.17.50.0.17.oorig/ld/Makefile.in 2007-06-18 19:29:29.000000000 +0200
++++ binutils-2.17.50.0.17/ld/Makefile.in 2007-06-25 10:00:36.000000000 +0200
+@@ -287,7 +287,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+ BASEDIR = $(srcdir)/..
+ BFDDIR = $(BASEDIR)/bfd
+ INCDIR = $(BASEDIR)/include
diff --git a/package/binutils/binutils-2.19/300-012_check_ldrunpath_length.patch b/package/binutils/binutils-2.19/300-012_check_ldrunpath_length.patch
new file mode 100644
index 0000000..6e80921
--- /dev/null
+++ b/package/binutils/binutils-2.19/300-012_check_ldrunpath_length.patch
@@ -0,0 +1,21 @@
+diff -u binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em binutils-2.17.50.0.17/ld/emultempl/elf32.em
+--- binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em 2007-06-18 19:31:40.000000000 +0200
++++ binutils-2.17.50.0.17/ld/emultempl/elf32.em 2007-06-25 10:01:25.000000000 +0200
+@@ -1007,6 +1007,8 @@
+ && command_line.rpath == NULL)
+ {
+ lib_path = (const char *) getenv ("LD_RUN_PATH");
++ if ((lib_path) && (strlen (lib_path) == 0))
++ lib_path = NULL;
+ if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
+ force))
+ break;
+@@ -1191,6 +1193,8 @@
+ rpath = command_line.rpath;
+ if (rpath == NULL)
+ rpath = (const char *) getenv ("LD_RUN_PATH");
++ if ((rpath) && (strlen (rpath) == 0))
++ rpath = NULL;
+ if (! (bfd_elf_size_dynamic_sections
+ (output_bfd, command_line.soname, rpath,
+ command_line.filter_shlib,
diff --git a/package/binutils/binutils-2.20.1/110-arm-eabi-conf.patch b/package/binutils/binutils-2.20.1/110-arm-eabi-conf.patch
new file mode 100644
index 0000000..af26329
--- /dev/null
+++ b/package/binutils/binutils-2.20.1/110-arm-eabi-conf.patch
@@ -0,0 +1,24 @@
+diff -rdup binutils-2.18.50.0.3.orig/configure binutils-2.18.50.0.3/configure
+--- binutils-2.18.50.0.3.orig/configure 2007-11-22 12:41:26.000000000 +0100
++++ binutils-2.18.50.0.3/configure 2007-11-22 12:45:01.000000000 +0100
+@@ -2245,7 +2245,7 @@ case "${target}" in
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ libgloss_dir=arm
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-*gnueabi)
+ noconfigdirs="$noconfigdirs target-qthreads"
+ noconfigdirs="$noconfigdirs target-libobjc"
+ case ${with_newlib} in
+diff -rdup binutils-2.18.50.0.3.orig/configure.ac binutils-2.18.50.0.3/configure.ac
+--- binutils-2.18.50.0.3.orig/configure.ac 2007-11-22 12:41:26.000000000 +0100
++++ binutils-2.18.50.0.3/configure.ac 2007-11-22 12:44:54.000000000 +0100
+@@ -522,7 +522,7 @@ case "${target}" in
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ libgloss_dir=arm
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-*gnueabi)
+ noconfigdirs="$noconfigdirs target-qthreads"
+ noconfigdirs="$noconfigdirs target-libobjc"
+ case ${with_newlib} in
diff --git a/package/binutils/binutils-2.20.1/120-sh-conf.patch b/package/binutils/binutils-2.20.1/120-sh-conf.patch
new file mode 100644
index 0000000..071d15a
--- /dev/null
+++ b/package/binutils/binutils-2.20.1/120-sh-conf.patch
@@ -0,0 +1,42 @@
+diff -rdup binutils-2.18.50.0.9.old/configure binutils-2.18.50.0.9/configure
+--- binutils-2.18.50.0.9.old/configure 2008-08-23 17:36:13.000000000 +0200
++++ binutils-2.18.50.0.9/configure 2008-10-14 14:25:22.000000000 +0200
+@@ -2281,7 +2281,7 @@ case "${target}" in
+ am33_2.0-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+- sh-*-linux*)
++ sh*-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+ sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+@@ -2606,7 +2606,7 @@ case "${target}" in
+ romp-*-*)
+ noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${host}" in
+ i[3456789]86-*-vsta) ;; # don't add gprof back in
+ i[3456789]86-*-go32*) ;; # don't add gprof back in
+diff -rdup binutils-2.18.50.0.9.old/configure.ac binutils-2.18.50.0.9/configure.ac
+--- binutils-2.18.50.0.9.old/configure.ac 2008-08-23 17:36:13.000000000 +0200
++++ binutils-2.18.50.0.9/configure.ac 2008-10-14 14:25:11.000000000 +0200
+@@ -530,7 +530,7 @@ case "${target}" in
+ am33_2.0-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+- sh-*-linux*)
++ sh*-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+ sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+@@ -855,7 +855,7 @@ case "${target}" in
+ romp-*-*)
+ noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${host}" in
+ i[[3456789]]86-*-vsta) ;; # don't add gprof back in
+ i[[3456789]]86-*-go32*) ;; # don't add gprof back in
diff --git a/package/binutils/binutils-2.20.1/300-001_ld_makefile_patch.patch b/package/binutils/binutils-2.20.1/300-001_ld_makefile_patch.patch
new file mode 100644
index 0000000..5cb0f61
--- /dev/null
+++ b/package/binutils/binutils-2.20.1/300-001_ld_makefile_patch.patch
@@ -0,0 +1,24 @@
+diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.am binutils-2.17.50.0.17/ld/Makefile.am
+--- binutils-2.17.50.0.17.oorig/ld/Makefile.am 2007-06-18 19:29:29.000000000 +0200
++++ binutils-2.17.50.0.17/ld/Makefile.am 2007-06-25 10:00:36.000000000 +0200
+@@ -18,7 +18,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+
+ EMUL = @EMUL@
+ EMULATION_OFILES = @EMULATION_OFILES@
+diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.in binutils-2.17.50.0.17/ld/Makefile.in
+--- binutils-2.17.50.0.17.oorig/ld/Makefile.in 2007-06-18 19:29:29.000000000 +0200
++++ binutils-2.17.50.0.17/ld/Makefile.in 2007-06-25 10:00:36.000000000 +0200
+@@ -287,7 +287,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+ BASEDIR = $(srcdir)/..
+ BFDDIR = $(BASEDIR)/bfd
+ INCDIR = $(BASEDIR)/include
diff --git a/package/binutils/binutils-2.20.1/300-012_check_ldrunpath_length.patch b/package/binutils/binutils-2.20.1/300-012_check_ldrunpath_length.patch
new file mode 100644
index 0000000..6e80921
--- /dev/null
+++ b/package/binutils/binutils-2.20.1/300-012_check_ldrunpath_length.patch
@@ -0,0 +1,21 @@
+diff -u binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em binutils-2.17.50.0.17/ld/emultempl/elf32.em
+--- binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em 2007-06-18 19:31:40.000000000 +0200
++++ binutils-2.17.50.0.17/ld/emultempl/elf32.em 2007-06-25 10:01:25.000000000 +0200
+@@ -1007,6 +1007,8 @@
+ && command_line.rpath == NULL)
+ {
+ lib_path = (const char *) getenv ("LD_RUN_PATH");
++ if ((lib_path) && (strlen (lib_path) == 0))
++ lib_path = NULL;
+ if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
+ force))
+ break;
+@@ -1191,6 +1193,8 @@
+ rpath = command_line.rpath;
+ if (rpath == NULL)
+ rpath = (const char *) getenv ("LD_RUN_PATH");
++ if ((rpath) && (strlen (rpath) == 0))
++ rpath = NULL;
+ if (! (bfd_elf_size_dynamic_sections
+ (output_bfd, command_line.soname, rpath,
+ command_line.filter_shlib,
diff --git a/package/binutils/binutils-2.20.1/400-arm_link_speed.patch b/package/binutils/binutils-2.20.1/400-arm_link_speed.patch
new file mode 100644
index 0000000..d03385a
--- /dev/null
+++ b/package/binutils/binutils-2.20.1/400-arm_link_speed.patch
@@ -0,0 +1,183 @@
+From Binutils CVS:
+
+http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-arm.c?rev=1.230&content-type=text/x-cvsweb-markup&cvsroot=src
+
+Improves linking time from large projects on ARM.
+diff -dupr binutils-2.20.orig/bfd/elf32-arm.c binutils-2.20/bfd/elf32-arm.c
+--- binutils-2.20.orig/bfd/elf32-arm.c 2010-04-19 10:08:50.000000000 -0700
++++ binutils-2.20/bfd/elf32-arm.c 2010-04-19 10:12:45.000000000 -0700
+@@ -12736,108 +12736,15 @@ elf32_arm_section_from_shdr (bfd *abfd,
+ return TRUE;
+ }
+
+-/* A structure used to record a list of sections, independently
+- of the next and prev fields in the asection structure. */
+-typedef struct section_list
+-{
+- asection * sec;
+- struct section_list * next;
+- struct section_list * prev;
+-}
+-section_list;
+-
+-/* Unfortunately we need to keep a list of sections for which
+- an _arm_elf_section_data structure has been allocated. This
+- is because it is possible for functions like elf32_arm_write_section
+- to be called on a section which has had an elf_data_structure
+- allocated for it (and so the used_by_bfd field is valid) but
+- for which the ARM extended version of this structure - the
+- _arm_elf_section_data structure - has not been allocated. */
+-static section_list * sections_with_arm_elf_section_data = NULL;
+-
+-static void
+-record_section_with_arm_elf_section_data (asection * sec)
+-{
+- struct section_list * entry;
+-
+- entry = bfd_malloc (sizeof (* entry));
+- if (entry == NULL)
+- return;
+- entry->sec = sec;
+- entry->next = sections_with_arm_elf_section_data;
+- entry->prev = NULL;
+- if (entry->next != NULL)
+- entry->next->prev = entry;
+- sections_with_arm_elf_section_data = entry;
+-}
+-
+-static struct section_list *
+-find_arm_elf_section_entry (asection * sec)
+-{
+- struct section_list * entry;
+- static struct section_list * last_entry = NULL;
+-
+- /* This is a short cut for the typical case where the sections are added
+- to the sections_with_arm_elf_section_data list in forward order and
+- then looked up here in backwards order. This makes a real difference
+- to the ld-srec/sec64k.exp linker test. */
+- entry = sections_with_arm_elf_section_data;
+- if (last_entry != NULL)
+- {
+- if (last_entry->sec == sec)
+- entry = last_entry;
+- else if (last_entry->next != NULL
+- && last_entry->next->sec == sec)
+- entry = last_entry->next;
+- }
+-
+- for (; entry; entry = entry->next)
+- if (entry->sec == sec)
+- break;
+-
+- if (entry)
+- /* Record the entry prior to this one - it is the entry we are most
+- likely to want to locate next time. Also this way if we have been
+- called from unrecord_section_with_arm_elf_section_data() we will not
+- be caching a pointer that is about to be freed. */
+- last_entry = entry->prev;
+-
+- return entry;
+-}
+-
+ static _arm_elf_section_data *
+ get_arm_elf_section_data (asection * sec)
+ {
+- struct section_list * entry;
+-
+- entry = find_arm_elf_section_entry (sec);
+-
+- if (entry)
+- return elf32_arm_section_data (entry->sec);
++ if (sec && sec->owner && is_arm_elf (sec->owner))
++ return elf32_arm_section_data (sec);
+ else
+ return NULL;
+ }
+
+-static void
+-unrecord_section_with_arm_elf_section_data (asection * sec)
+-{
+- struct section_list * entry;
+-
+- entry = find_arm_elf_section_entry (sec);
+-
+- if (entry)
+- {
+- if (entry->prev != NULL)
+- entry->prev->next = entry->next;
+- if (entry->next != NULL)
+- entry->next->prev = entry->prev;
+- if (entry == sections_with_arm_elf_section_data)
+- sections_with_arm_elf_section_data = entry->next;
+- free (entry);
+- }
+-}
+-
+-
+ typedef struct
+ {
+ void *finfo;
+@@ -13230,8 +13137,6 @@ elf32_arm_new_section_hook (bfd *abfd, a
+ sec->used_by_bfd = sdata;
+ }
+
+- record_section_with_arm_elf_section_data (sec);
+-
+ return _bfd_elf_new_section_hook (abfd, sec);
+ }
+
+@@ -13659,44 +13564,13 @@ elf32_arm_write_section (bfd *output_bfd
+ }
+
+ free (map);
+- arm_data->mapcount = 0;
++ arm_data->mapcount = -1;
+ arm_data->mapsize = 0;
+ arm_data->map = NULL;
+- unrecord_section_with_arm_elf_section_data (sec);
+
+ return FALSE;
+ }
+
+-static void
+-unrecord_section_via_map_over_sections (bfd * abfd ATTRIBUTE_UNUSED,
+- asection * sec,
+- void * ignore ATTRIBUTE_UNUSED)
+-{
+- unrecord_section_with_arm_elf_section_data (sec);
+-}
+-
+-static bfd_boolean
+-elf32_arm_close_and_cleanup (bfd * abfd)
+-{
+- if (abfd->sections)
+- bfd_map_over_sections (abfd,
+- unrecord_section_via_map_over_sections,
+- NULL);
+-
+- return _bfd_elf_close_and_cleanup (abfd);
+-}
+-
+-static bfd_boolean
+-elf32_arm_bfd_free_cached_info (bfd * abfd)
+-{
+- if (abfd->sections)
+- bfd_map_over_sections (abfd,
+- unrecord_section_via_map_over_sections,
+- NULL);
+-
+- return _bfd_free_cached_info (abfd);
+-}
+-
+ /* Display STT_ARM_TFUNC symbols as functions. */
+
+ static void
+@@ -13882,8 +13756,6 @@ const struct elf_size_info elf32_arm_siz
+ #define bfd_elf32_find_inliner_info elf32_arm_find_inliner_info
+ #define bfd_elf32_new_section_hook elf32_arm_new_section_hook
+ #define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol
+-#define bfd_elf32_close_and_cleanup elf32_arm_close_and_cleanup
+-#define bfd_elf32_bfd_free_cached_info elf32_arm_bfd_free_cached_info
+ #define bfd_elf32_bfd_final_link elf32_arm_final_link
+
+ #define elf_backend_get_symbol_type elf32_arm_get_symbol_type
diff --git a/package/binutils/binutils-2.20/110-arm-eabi-conf.patch b/package/binutils/binutils-2.20/110-arm-eabi-conf.patch
new file mode 100644
index 0000000..af26329
--- /dev/null
+++ b/package/binutils/binutils-2.20/110-arm-eabi-conf.patch
@@ -0,0 +1,24 @@
+diff -rdup binutils-2.18.50.0.3.orig/configure binutils-2.18.50.0.3/configure
+--- binutils-2.18.50.0.3.orig/configure 2007-11-22 12:41:26.000000000 +0100
++++ binutils-2.18.50.0.3/configure 2007-11-22 12:45:01.000000000 +0100
+@@ -2245,7 +2245,7 @@ case "${target}" in
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ libgloss_dir=arm
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-*gnueabi)
+ noconfigdirs="$noconfigdirs target-qthreads"
+ noconfigdirs="$noconfigdirs target-libobjc"
+ case ${with_newlib} in
+diff -rdup binutils-2.18.50.0.3.orig/configure.ac binutils-2.18.50.0.3/configure.ac
+--- binutils-2.18.50.0.3.orig/configure.ac 2007-11-22 12:41:26.000000000 +0100
++++ binutils-2.18.50.0.3/configure.ac 2007-11-22 12:44:54.000000000 +0100
+@@ -522,7 +522,7 @@ case "${target}" in
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ libgloss_dir=arm
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-*gnueabi)
+ noconfigdirs="$noconfigdirs target-qthreads"
+ noconfigdirs="$noconfigdirs target-libobjc"
+ case ${with_newlib} in
diff --git a/package/binutils/binutils-2.20/120-sh-conf.patch b/package/binutils/binutils-2.20/120-sh-conf.patch
new file mode 100644
index 0000000..071d15a
--- /dev/null
+++ b/package/binutils/binutils-2.20/120-sh-conf.patch
@@ -0,0 +1,42 @@
+diff -rdup binutils-2.18.50.0.9.old/configure binutils-2.18.50.0.9/configure
+--- binutils-2.18.50.0.9.old/configure 2008-08-23 17:36:13.000000000 +0200
++++ binutils-2.18.50.0.9/configure 2008-10-14 14:25:22.000000000 +0200
+@@ -2281,7 +2281,7 @@ case "${target}" in
+ am33_2.0-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+- sh-*-linux*)
++ sh*-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+ sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+@@ -2606,7 +2606,7 @@ case "${target}" in
+ romp-*-*)
+ noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${host}" in
+ i[3456789]86-*-vsta) ;; # don't add gprof back in
+ i[3456789]86-*-go32*) ;; # don't add gprof back in
+diff -rdup binutils-2.18.50.0.9.old/configure.ac binutils-2.18.50.0.9/configure.ac
+--- binutils-2.18.50.0.9.old/configure.ac 2008-08-23 17:36:13.000000000 +0200
++++ binutils-2.18.50.0.9/configure.ac 2008-10-14 14:25:11.000000000 +0200
+@@ -530,7 +530,7 @@ case "${target}" in
+ am33_2.0-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+- sh-*-linux*)
++ sh*-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+ sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+@@ -855,7 +855,7 @@ case "${target}" in
+ romp-*-*)
+ noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${host}" in
+ i[[3456789]]86-*-vsta) ;; # don't add gprof back in
+ i[[3456789]]86-*-go32*) ;; # don't add gprof back in
diff --git a/package/binutils/binutils-2.20/300-001_ld_makefile_patch.patch b/package/binutils/binutils-2.20/300-001_ld_makefile_patch.patch
new file mode 100644
index 0000000..5cb0f61
--- /dev/null
+++ b/package/binutils/binutils-2.20/300-001_ld_makefile_patch.patch
@@ -0,0 +1,24 @@
+diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.am binutils-2.17.50.0.17/ld/Makefile.am
+--- binutils-2.17.50.0.17.oorig/ld/Makefile.am 2007-06-18 19:29:29.000000000 +0200
++++ binutils-2.17.50.0.17/ld/Makefile.am 2007-06-25 10:00:36.000000000 +0200
+@@ -18,7 +18,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+
+ EMUL = @EMUL@
+ EMULATION_OFILES = @EMULATION_OFILES@
+diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.in binutils-2.17.50.0.17/ld/Makefile.in
+--- binutils-2.17.50.0.17.oorig/ld/Makefile.in 2007-06-18 19:29:29.000000000 +0200
++++ binutils-2.17.50.0.17/ld/Makefile.in 2007-06-25 10:00:36.000000000 +0200
+@@ -287,7 +287,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+ BASEDIR = $(srcdir)/..
+ BFDDIR = $(BASEDIR)/bfd
+ INCDIR = $(BASEDIR)/include
diff --git a/package/binutils/binutils-2.20/300-012_check_ldrunpath_length.patch b/package/binutils/binutils-2.20/300-012_check_ldrunpath_length.patch
new file mode 100644
index 0000000..6e80921
--- /dev/null
+++ b/package/binutils/binutils-2.20/300-012_check_ldrunpath_length.patch
@@ -0,0 +1,21 @@
+diff -u binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em binutils-2.17.50.0.17/ld/emultempl/elf32.em
+--- binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em 2007-06-18 19:31:40.000000000 +0200
++++ binutils-2.17.50.0.17/ld/emultempl/elf32.em 2007-06-25 10:01:25.000000000 +0200
+@@ -1007,6 +1007,8 @@
+ && command_line.rpath == NULL)
+ {
+ lib_path = (const char *) getenv ("LD_RUN_PATH");
++ if ((lib_path) && (strlen (lib_path) == 0))
++ lib_path = NULL;
+ if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
+ force))
+ break;
+@@ -1191,6 +1193,8 @@
+ rpath = command_line.rpath;
+ if (rpath == NULL)
+ rpath = (const char *) getenv ("LD_RUN_PATH");
++ if ((rpath) && (strlen (rpath) == 0))
++ rpath = NULL;
+ if (! (bfd_elf_size_dynamic_sections
+ (output_bfd, command_line.soname, rpath,
+ command_line.filter_shlib,
diff --git a/package/binutils/binutils-2.20/400-arm_link_speed.patch b/package/binutils/binutils-2.20/400-arm_link_speed.patch
new file mode 100644
index 0000000..d03385a
--- /dev/null
+++ b/package/binutils/binutils-2.20/400-arm_link_speed.patch
@@ -0,0 +1,183 @@
+From Binutils CVS:
+
+http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-arm.c?rev=1.230&content-type=text/x-cvsweb-markup&cvsroot=src
+
+Improves linking time from large projects on ARM.
+diff -dupr binutils-2.20.orig/bfd/elf32-arm.c binutils-2.20/bfd/elf32-arm.c
+--- binutils-2.20.orig/bfd/elf32-arm.c 2010-04-19 10:08:50.000000000 -0700
++++ binutils-2.20/bfd/elf32-arm.c 2010-04-19 10:12:45.000000000 -0700
+@@ -12736,108 +12736,15 @@ elf32_arm_section_from_shdr (bfd *abfd,
+ return TRUE;
+ }
+
+-/* A structure used to record a list of sections, independently
+- of the next and prev fields in the asection structure. */
+-typedef struct section_list
+-{
+- asection * sec;
+- struct section_list * next;
+- struct section_list * prev;
+-}
+-section_list;
+-
+-/* Unfortunately we need to keep a list of sections for which
+- an _arm_elf_section_data structure has been allocated. This
+- is because it is possible for functions like elf32_arm_write_section
+- to be called on a section which has had an elf_data_structure
+- allocated for it (and so the used_by_bfd field is valid) but
+- for which the ARM extended version of this structure - the
+- _arm_elf_section_data structure - has not been allocated. */
+-static section_list * sections_with_arm_elf_section_data = NULL;
+-
+-static void
+-record_section_with_arm_elf_section_data (asection * sec)
+-{
+- struct section_list * entry;
+-
+- entry = bfd_malloc (sizeof (* entry));
+- if (entry == NULL)
+- return;
+- entry->sec = sec;
+- entry->next = sections_with_arm_elf_section_data;
+- entry->prev = NULL;
+- if (entry->next != NULL)
+- entry->next->prev = entry;
+- sections_with_arm_elf_section_data = entry;
+-}
+-
+-static struct section_list *
+-find_arm_elf_section_entry (asection * sec)
+-{
+- struct section_list * entry;
+- static struct section_list * last_entry = NULL;
+-
+- /* This is a short cut for the typical case where the sections are added
+- to the sections_with_arm_elf_section_data list in forward order and
+- then looked up here in backwards order. This makes a real difference
+- to the ld-srec/sec64k.exp linker test. */
+- entry = sections_with_arm_elf_section_data;
+- if (last_entry != NULL)
+- {
+- if (last_entry->sec == sec)
+- entry = last_entry;
+- else if (last_entry->next != NULL
+- && last_entry->next->sec == sec)
+- entry = last_entry->next;
+- }
+-
+- for (; entry; entry = entry->next)
+- if (entry->sec == sec)
+- break;
+-
+- if (entry)
+- /* Record the entry prior to this one - it is the entry we are most
+- likely to want to locate next time. Also this way if we have been
+- called from unrecord_section_with_arm_elf_section_data() we will not
+- be caching a pointer that is about to be freed. */
+- last_entry = entry->prev;
+-
+- return entry;
+-}
+-
+ static _arm_elf_section_data *
+ get_arm_elf_section_data (asection * sec)
+ {
+- struct section_list * entry;
+-
+- entry = find_arm_elf_section_entry (sec);
+-
+- if (entry)
+- return elf32_arm_section_data (entry->sec);
++ if (sec && sec->owner && is_arm_elf (sec->owner))
++ return elf32_arm_section_data (sec);
+ else
+ return NULL;
+ }
+
+-static void
+-unrecord_section_with_arm_elf_section_data (asection * sec)
+-{
+- struct section_list * entry;
+-
+- entry = find_arm_elf_section_entry (sec);
+-
+- if (entry)
+- {
+- if (entry->prev != NULL)
+- entry->prev->next = entry->next;
+- if (entry->next != NULL)
+- entry->next->prev = entry->prev;
+- if (entry == sections_with_arm_elf_section_data)
+- sections_with_arm_elf_section_data = entry->next;
+- free (entry);
+- }
+-}
+-
+-
+ typedef struct
+ {
+ void *finfo;
+@@ -13230,8 +13137,6 @@ elf32_arm_new_section_hook (bfd *abfd, a
+ sec->used_by_bfd = sdata;
+ }
+
+- record_section_with_arm_elf_section_data (sec);
+-
+ return _bfd_elf_new_section_hook (abfd, sec);
+ }
+
+@@ -13659,44 +13564,13 @@ elf32_arm_write_section (bfd *output_bfd
+ }
+
+ free (map);
+- arm_data->mapcount = 0;
++ arm_data->mapcount = -1;
+ arm_data->mapsize = 0;
+ arm_data->map = NULL;
+- unrecord_section_with_arm_elf_section_data (sec);
+
+ return FALSE;
+ }
+
+-static void
+-unrecord_section_via_map_over_sections (bfd * abfd ATTRIBUTE_UNUSED,
+- asection * sec,
+- void * ignore ATTRIBUTE_UNUSED)
+-{
+- unrecord_section_with_arm_elf_section_data (sec);
+-}
+-
+-static bfd_boolean
+-elf32_arm_close_and_cleanup (bfd * abfd)
+-{
+- if (abfd->sections)
+- bfd_map_over_sections (abfd,
+- unrecord_section_via_map_over_sections,
+- NULL);
+-
+- return _bfd_elf_close_and_cleanup (abfd);
+-}
+-
+-static bfd_boolean
+-elf32_arm_bfd_free_cached_info (bfd * abfd)
+-{
+- if (abfd->sections)
+- bfd_map_over_sections (abfd,
+- unrecord_section_via_map_over_sections,
+- NULL);
+-
+- return _bfd_free_cached_info (abfd);
+-}
+-
+ /* Display STT_ARM_TFUNC symbols as functions. */
+
+ static void
+@@ -13882,8 +13756,6 @@ const struct elf_size_info elf32_arm_siz
+ #define bfd_elf32_find_inliner_info elf32_arm_find_inliner_info
+ #define bfd_elf32_new_section_hook elf32_arm_new_section_hook
+ #define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol
+-#define bfd_elf32_close_and_cleanup elf32_arm_close_and_cleanup
+-#define bfd_elf32_bfd_free_cached_info elf32_arm_bfd_free_cached_info
+ #define bfd_elf32_bfd_final_link elf32_arm_final_link
+
+ #define elf_backend_get_symbol_type elf32_arm_get_symbol_type
diff --git a/package/binutils/binutils-2.21/110-arm-eabi-conf.patch b/package/binutils/binutils-2.21/110-arm-eabi-conf.patch
new file mode 100644
index 0000000..af26329
--- /dev/null
+++ b/package/binutils/binutils-2.21/110-arm-eabi-conf.patch
@@ -0,0 +1,24 @@
+diff -rdup binutils-2.18.50.0.3.orig/configure binutils-2.18.50.0.3/configure
+--- binutils-2.18.50.0.3.orig/configure 2007-11-22 12:41:26.000000000 +0100
++++ binutils-2.18.50.0.3/configure 2007-11-22 12:45:01.000000000 +0100
+@@ -2245,7 +2245,7 @@ case "${target}" in
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ libgloss_dir=arm
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-*gnueabi)
+ noconfigdirs="$noconfigdirs target-qthreads"
+ noconfigdirs="$noconfigdirs target-libobjc"
+ case ${with_newlib} in
+diff -rdup binutils-2.18.50.0.3.orig/configure.ac binutils-2.18.50.0.3/configure.ac
+--- binutils-2.18.50.0.3.orig/configure.ac 2007-11-22 12:41:26.000000000 +0100
++++ binutils-2.18.50.0.3/configure.ac 2007-11-22 12:44:54.000000000 +0100
+@@ -522,7 +522,7 @@ case "${target}" in
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ libgloss_dir=arm
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-*gnueabi)
+ noconfigdirs="$noconfigdirs target-qthreads"
+ noconfigdirs="$noconfigdirs target-libobjc"
+ case ${with_newlib} in
diff --git a/package/binutils/binutils-2.21/120-sh-conf.patch b/package/binutils/binutils-2.21/120-sh-conf.patch
new file mode 100644
index 0000000..071d15a
--- /dev/null
+++ b/package/binutils/binutils-2.21/120-sh-conf.patch
@@ -0,0 +1,42 @@
+diff -rdup binutils-2.18.50.0.9.old/configure binutils-2.18.50.0.9/configure
+--- binutils-2.18.50.0.9.old/configure 2008-08-23 17:36:13.000000000 +0200
++++ binutils-2.18.50.0.9/configure 2008-10-14 14:25:22.000000000 +0200
+@@ -2281,7 +2281,7 @@ case "${target}" in
+ am33_2.0-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+- sh-*-linux*)
++ sh*-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+ sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+@@ -2606,7 +2606,7 @@ case "${target}" in
+ romp-*-*)
+ noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${host}" in
+ i[3456789]86-*-vsta) ;; # don't add gprof back in
+ i[3456789]86-*-go32*) ;; # don't add gprof back in
+diff -rdup binutils-2.18.50.0.9.old/configure.ac binutils-2.18.50.0.9/configure.ac
+--- binutils-2.18.50.0.9.old/configure.ac 2008-08-23 17:36:13.000000000 +0200
++++ binutils-2.18.50.0.9/configure.ac 2008-10-14 14:25:11.000000000 +0200
+@@ -530,7 +530,7 @@ case "${target}" in
+ am33_2.0-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+- sh-*-linux*)
++ sh*-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+ sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+@@ -855,7 +855,7 @@ case "${target}" in
+ romp-*-*)
+ noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${host}" in
+ i[[3456789]]86-*-vsta) ;; # don't add gprof back in
+ i[[3456789]]86-*-go32*) ;; # don't add gprof back in
diff --git a/package/binutils/binutils-2.21/300-001_ld_makefile_patch.patch b/package/binutils/binutils-2.21/300-001_ld_makefile_patch.patch
new file mode 100644
index 0000000..5cb0f61
--- /dev/null
+++ b/package/binutils/binutils-2.21/300-001_ld_makefile_patch.patch
@@ -0,0 +1,24 @@
+diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.am binutils-2.17.50.0.17/ld/Makefile.am
+--- binutils-2.17.50.0.17.oorig/ld/Makefile.am 2007-06-18 19:29:29.000000000 +0200
++++ binutils-2.17.50.0.17/ld/Makefile.am 2007-06-25 10:00:36.000000000 +0200
+@@ -18,7 +18,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+
+ EMUL = @EMUL@
+ EMULATION_OFILES = @EMULATION_OFILES@
+diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.in binutils-2.17.50.0.17/ld/Makefile.in
+--- binutils-2.17.50.0.17.oorig/ld/Makefile.in 2007-06-18 19:29:29.000000000 +0200
++++ binutils-2.17.50.0.17/ld/Makefile.in 2007-06-25 10:00:36.000000000 +0200
+@@ -287,7 +287,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+ BASEDIR = $(srcdir)/..
+ BFDDIR = $(BASEDIR)/bfd
+ INCDIR = $(BASEDIR)/include
diff --git a/package/binutils/binutils-2.21/300-012_check_ldrunpath_length.patch b/package/binutils/binutils-2.21/300-012_check_ldrunpath_length.patch
new file mode 100644
index 0000000..df78310
--- /dev/null
+++ b/package/binutils/binutils-2.21/300-012_check_ldrunpath_length.patch
@@ -0,0 +1,21 @@
+diff -Nura binutils-2.21.orig/ld/emultempl/elf32.em binutils-2.21/ld/emultempl/elf32.em
+--- binutils-2.21.orig/ld/emultempl/elf32.em 2010-10-29 09:10:36.000000000 -0300
++++ binutils-2.21/ld/emultempl/elf32.em 2010-12-10 09:26:56.746102724 -0300
+@@ -1270,6 +1270,8 @@
+ && command_line.rpath == NULL)
+ {
+ lib_path = (const char *) getenv ("LD_RUN_PATH");
++ if ((lib_path) && (strlen (lib_path) == 0))
++ lib_path = NULL;
+ if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
+ force))
+ break;
+@@ -1497,6 +1499,8 @@
+ rpath = command_line.rpath;
+ if (rpath == NULL)
+ rpath = (const char *) getenv ("LD_RUN_PATH");
++ if ((rpath) && (strlen (rpath) == 0))
++ rpath = NULL;
+
+ for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next)
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
diff --git a/package/binutils/binutils.mk b/package/binutils/binutils.mk
new file mode 100644
index 0000000..5f51f44
--- /dev/null
+++ b/package/binutils/binutils.mk
@@ -0,0 +1,42 @@
+#############################################################
+#
+# binutils
+#
+#############################################################
+
+BINUTILS_VERSION = $(call qstrip,$(BR2_BINUTILS_VERSION))
+BINUTILS_SOURCE = binutils-$(BINUTILS_VERSION).tar.bz2
+BINUTILS_SITE = $(BR2_GNU_MIRROR)/binutils
+ifeq ($(ARCH),avr32)
+BINUTILS_SITE = ftp://www.at91.com/pub/buildroot
+endif
+
+BINUTILS_EXTRA_CONFIG_OPTIONS = $(call qstrip,$(BR2_BINUTILS_EXTRA_CONFIG_OPTIONS))
+BINUTILS_DEPENDENCIES = gmp mpfr
+# We need to specify host & target to avoid breaking ARM EABI
+BINUTILS_CONF_OPT = --disable-multilib --disable-werror \
+ --host=$(REAL_GNU_TARGET_NAME) \
+ --target=$(REAL_GNU_TARGET_NAME) \
+ $(BINUTILS_EXTRA_CONFIG_OPTIONS)
+
+# Install binutils after busybox to prefer full-blown utilities
+ifeq ($(BR2_PACKAGE_BUSYBOX),y)
+BINUTILS_DEPENDENCIES += busybox
+endif
+
+# "host" binutils should actually be "cross"
+# We just keep the convention of "host utility" for now
+HOST_BINUTILS_EXTRA_CONFIG_OPTIONS = $(call qstrip,$(BR2_BINUTILS_EXTRA_CONFIG_OPTIONS))
+HOST_BINUTILS_DEPENDENCIES = host-gmp host-mpfr
+HOST_BINUTILS_CONF_OPT = --disable-multilib --disable-werror \
+ --target=$(REAL_GNU_TARGET_NAME) \
+ $(BR2_CONFIGURE_STAGING_SYSROOT) \
+ $(HOST_BINUTILS_EXTRA_CONFIG_OPTIONS)
+
+ifeq ($(BR2_GCC_VERSION_4_5_X),y)
+BINUTILS_DEPENDENCIES += mpc
+HOST_BINUTILS_DEPENDENCIES += host-mpc
+endif
+
+$(eval $(call AUTOTARGETS,package,binutils))
+$(eval $(call AUTOTARGETS,package,binutils,host))
diff --git a/toolchain/binutils/2.17/100-uclibc-conf.patch b/toolchain/binutils/2.17/100-uclibc-conf.patch
deleted file mode 100644
index 25222e5..0000000
--- a/toolchain/binutils/2.17/100-uclibc-conf.patch
+++ /dev/null
@@ -1,139 +0,0 @@
---- binutils-2.16.91.0.7/bfd/configure
-+++ binutils-2.16.91.0.7/bfd/configure
-@@ -3576,7 +3576,7 @@
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux-gnu*|linux-uclibc*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- binutils-2.16.91.0.7/binutils/configure
-+++ binutils-2.16.91.0.7/binutils/configure
-@@ -3411,7 +3411,7 @@
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux-gnu*|linux-uclibc*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- binutils-2.16.91.0.7/configure
-+++ binutils-2.16.91.0.7/configure
-@@ -1270,7 +1270,7 @@
- am33_2.0-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
-- sh-*-linux*)
-+ sh*-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
- sh*-*-pe|mips*-*-pe|*arm-wince-pe)
-@@ -1578,7 +1578,7 @@
- romp-*-*)
- noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
- ;;
-- sh-*-* | sh64-*-*)
-+ sh*-*-* | sh64-*-*)
- case "${host}" in
- i[3456789]86-*-vsta) ;; # don't add gprof back in
- i[3456789]86-*-go32*) ;; # don't add gprof back in
---- binutils-2.16.91.0.7/configure.in
-+++ binutils-2.16.91.0.7/configure.in
-@@ -468,7 +468,7 @@
- am33_2.0-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
-- sh-*-linux*)
-+ sh*-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
- sh*-*-pe|mips*-*-pe|*arm-wince-pe)
-@@ -776,7 +776,7 @@
- romp-*-*)
- noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
- ;;
-- sh-*-* | sh64-*-*)
-+ sh*-*-* | sh64-*-*)
- case "${host}" in
- i[[3456789]]86-*-vsta) ;; # don't add gprof back in
- i[[3456789]]86-*-go32*) ;; # don't add gprof back in
---- binutils-2.16.91.0.7/gas/configure
-+++ binutils-2.16.91.0.7/gas/configure
-@@ -3411,7 +3411,7 @@
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux-gnu*|linux-uclibc*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- binutils-2.16.91.0.7/gprof/configure
-+++ binutils-2.16.91.0.7/gprof/configure
-@@ -3419,6 +3419,11 @@
- lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
- ;;
-
-+linux-uclibc*)
-+ lt_cv_deplibs_check_method=pass_all
-+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
-+ ;;
-+
- netbsd* | knetbsd*-gnu)
- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
- lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
---- binutils-2.16.91.0.7/ld/configure
-+++ binutils-2.16.91.0.7/ld/configure
-@@ -3413,7 +3413,7 @@
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux-gnu*|linux-uclibc*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- binutils-2.16.91.0.7/libtool.m4
-+++ binutils-2.16.91.0.7/libtool.m4
-@@ -739,7 +739,7 @@
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux-gnu*|linux-uclibc*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- binutils-2.16.91.0.7/ltconfig
-+++ binutils-2.16.91.0.7/ltconfig
-@@ -602,6 +602,7 @@
-
- # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
- case $host_os in
-+linux-uclibc*) ;;
- linux-gnu*) ;;
- linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
- esac
-@@ -1247,7 +1248,7 @@
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux-gnu*|linux-uclibc*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
---- binutils-2.16.91.0.7/opcodes/configure
-+++ binutils-2.16.91.0.7/opcodes/configure
-@@ -3579,7 +3579,7 @@
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux-gnu*|linux-uclibc*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
diff --git a/toolchain/binutils/2.17/110-arm-eabi-conf.patch b/toolchain/binutils/2.17/110-arm-eabi-conf.patch
deleted file mode 100644
index be85ceb..0000000
--- a/toolchain/binutils/2.17/110-arm-eabi-conf.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -urN binutils-2.16.91.0.7.orig/configure binutils-2.16.91.0.7/configure
---- binutils-2.16.91.0.7.orig/configure 2006-05-31 14:54:24.000000000 +0300
-+++ binutils-2.16.91.0.7/configure 2006-05-31 14:55:53.000000000 +0300
-@@ -1299,7 +1299,7 @@
- arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- ;;
-- arm*-*-linux-gnueabi)
-+ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- noconfigdirs="$noconfigdirs target-libjava target-libobjc"
- ;;
-diff -urN binutils-2.16.91.0.7.orig/configure.in binutils-2.16.91.0.7/configure.in
---- binutils-2.16.91.0.7.orig/configure.in 2006-05-31 14:54:24.000000000 +0300
-+++ binutils-2.16.91.0.7/configure.in 2006-05-31 14:55:53.000000000 +0300
-@@ -497,7 +497,7 @@
- arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- ;;
-- arm*-*-linux-gnueabi)
-+ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- noconfigdirs="$noconfigdirs target-libjava target-libobjc"
- ;;
diff --git a/toolchain/binutils/2.17/300-001_ld_makefile_patch.patch b/toolchain/binutils/2.17/300-001_ld_makefile_patch.patch
deleted file mode 100644
index 04a7e61..0000000
--- a/toolchain/binutils/2.17/300-001_ld_makefile_patch.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/sh -e
-## 001_ld_makefile_patch.dpatch
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Description: correct where ld scripts are installed
-## DP: Author: Chris Chimelis <chris@debian.org>
-## DP: Upstream status: N/A
-## DP: Date: ??
-
-if [ $# -ne 1 ]; then
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1
-fi
-
-[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
-patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
-
-case "$1" in
- -patch) patch $patch_opts -p1 < $0;;
- -unpatch) patch $patch_opts -p1 -R < $0;;
- *)
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1;;
-esac
-
-exit 0
-
- at DPATCH@
---- binutils-2.16.91.0.1/ld/Makefile.am
-+++ binutils-2.16.91.0.1/ld/Makefile.am
-@@ -20,7 +20,7 @@
- # We put the scripts in the directory $(scriptdir)/ldscripts.
- # We can't put the scripts in $(datadir) because the SEARCH_DIR
- # directives need to be different for native and cross linkers.
--scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
-
- EMUL = @EMUL@
- EMULATION_OFILES = @EMULATION_OFILES@
---- binutils-2.16.91.0.1/ld/Makefile.in
-+++ binutils-2.16.91.0.1/ld/Makefile.in
-@@ -268,7 +268,7 @@
- # We put the scripts in the directory $(scriptdir)/ldscripts.
- # We can't put the scripts in $(datadir) because the SEARCH_DIR
- # directives need to be different for native and cross linkers.
--scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
- BASEDIR = $(srcdir)/..
- BFDDIR = $(BASEDIR)/bfd
- INCDIR = $(BASEDIR)/include
diff --git a/toolchain/binutils/2.17/300-006_better_file_error.patch b/toolchain/binutils/2.17/300-006_better_file_error.patch
deleted file mode 100644
index f337611..0000000
--- a/toolchain/binutils/2.17/300-006_better_file_error.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh -e
-## 006_better_file_error.dpatch by David Kimdon <dwhedon@gordian.com>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Specify which filename is causing an error if the filename is a
-## DP: directory. (#45832)
-
-if [ $# -ne 1 ]; then
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1
-fi
-
-[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
-patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
-
-case "$1" in
- -patch) patch $patch_opts -p1 < $0;;
- -unpatch) patch $patch_opts -p1 -R < $0;;
- *)
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1;;
-esac
-
-exit 0
-
- at DPATCH@
-diff -urNad /home/james/debian/packages/binutils/binutils-2.14.90.0.6/bfd/opncls.c binutils-2.14.90.0.6/bfd/opncls.c
---- /home/james/debian/packages/binutils/binutils-2.14.90.0.6/bfd/opncls.c 2003-07-23 16:08:09.000000000 +0100
-+++ binutils-2.14.90.0.6/bfd/opncls.c 2003-09-10 22:35:00.000000000 +0100
-@@ -150,6 +150,13 @@
- {
- bfd *nbfd;
- const bfd_target *target_vec;
-+ struct stat s;
-+
-+ if (stat (filename, &s) == 0)
-+ if (S_ISDIR(s.st_mode)) {
-+ bfd_set_error (bfd_error_file_not_recognized);
-+ return NULL;
-+ }
-
- nbfd = _bfd_new_bfd ();
- if (nbfd == NULL)
diff --git a/toolchain/binutils/2.17/300-012_check_ldrunpath_length.patch b/toolchain/binutils/2.17/300-012_check_ldrunpath_length.patch
deleted file mode 100644
index 498651a..0000000
--- a/toolchain/binutils/2.17/300-012_check_ldrunpath_length.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh -e
-## 012_check_ldrunpath_length.dpatch by Chris Chimelis <chris@debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for
-## DP: cases where -rpath isn't specified. (#151024)
-
-if [ $# -ne 1 ]; then
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1
-fi
-
-[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
-patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
-
-case "$1" in
- -patch) patch $patch_opts -p1 < $0;;
- -unpatch) patch $patch_opts -p1 -R < $0;;
- *)
- echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
- exit 1;;
-esac
-
-exit 0
-
- at DPATCH@
-diff -urNad /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em binutils-2.15/ld/emultempl/elf32.em
---- /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:58.000000000 +0100
-+++ binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:59.000000000 +0100
-@@ -692,6 +692,8 @@
- && command_line.rpath == NULL)
- {
- lib_path = (const char *) getenv ("LD_RUN_PATH");
-+ if ((lib_path) && (strlen (lib_path) == 0))
-+ lib_path = NULL;
- if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
- force))
- break;
-@@ -871,6 +873,8 @@
- rpath = command_line.rpath;
- if (rpath == NULL)
- rpath = (const char *) getenv ("LD_RUN_PATH");
-+ if ((rpath) && (strlen (rpath) == 0))
-+ rpath = NULL;
- if (! (bfd_elf_size_dynamic_sections
- (output_bfd, command_line.soname, rpath,
- command_line.filter_shlib,
diff --git a/toolchain/binutils/2.17/400-mips-ELF_MAXPAGESIZE-4K.patch b/toolchain/binutils/2.17/400-mips-ELF_MAXPAGESIZE-4K.patch
deleted file mode 100644
index 5959c71..0000000
--- a/toolchain/binutils/2.17/400-mips-ELF_MAXPAGESIZE-4K.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- binutils/bfd/elf32-mips.c~
-+++ binutils/bfd/elf32-mips.c
-@@ -1613,7 +1613,9 @@
-
- /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
- page sizes of up to that limit, so we need to respect it. */
--#define ELF_MAXPAGESIZE 0x10000
-+/*#define ELF_MAXPAGESIZE 0x10000*/
-+/* Use 4K to shrink the elf header. NOT for general use! */
-+#define ELF_MAXPAGESIZE 0x1000
- #define elf32_bed elf32_tradbed
-
- /* Include the target file again for this target. */
---- binutils/bfd/elfn32-mips.c~
-+++ binutils/bfd/elfn32-mips.c
-@@ -2399,7 +2399,9 @@
-
- /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
- page sizes of up to that limit, so we need to respect it. */
--#define ELF_MAXPAGESIZE 0x10000
-+/*#define ELF_MAXPAGESIZE 0x10000*/
-+/* Use 4K to shrink the elf header. NOT for general use! */
-+#define ELF_MAXPAGESIZE 0x1000
- #define elf32_bed elf32_tradbed
-
- /* Include the target file again for this target. */
diff --git a/toolchain/binutils/2.17/500-fix-makeinfo-check.patch b/toolchain/binutils/2.17/500-fix-makeinfo-check.patch
deleted file mode 100644
index c4c8888..0000000
--- a/toolchain/binutils/2.17/500-fix-makeinfo-check.patch
+++ /dev/null
@@ -1,17 +0,0 @@
----
- configure | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-Index: binutils-2.17/configure
-===================================================================
---- binutils-2.17.orig/configure
-+++ binutils-2.17/configure
-@@ -3637,7 +3637,7 @@
- # For an installed makeinfo, we require it to be from texinfo 4.4 or
- # higher, else we use the "missing" dummy.
- if ${MAKEINFO} --version \
-- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
-+ | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|4\.[1-9][0-9]|[5-9])' >/dev/null 2>&1; then
- :
- else
- MAKEINFO="$MISSING makeinfo"
diff --git a/toolchain/binutils/2.18/100-makeinfo-version.patch b/toolchain/binutils/2.18/100-makeinfo-version.patch
deleted file mode 100644
index d911d62..0000000
--- a/toolchain/binutils/2.18/100-makeinfo-version.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-diff -u binutils-2.18-orig/configure binutils-2.18/configure
---- binutils-2.18-orig/configure 2007-08-06 16:29:40.000000000 -0400
-+++ binutils-2.18/configure 2007-09-27 22:41:51.000000000 -0400
-@@ -6125,10 +6125,10 @@
- *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
- *)
-
-- # For an installed makeinfo, we require it to be from texinfo 4.4 or
-+ # For an installed makeinfo, we require it to be from texinfo 4.6 or
- # higher, else we use the "missing" dummy.
- if ${MAKEINFO} --version \
-- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
-+ | egrep 'texinfo[^0-9]*(4\.([6-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
- :
- else
- MAKEINFO="$MISSING makeinfo"
-diff -u binutils-2.18-orig/configure.ac binutils-2.18/configure.ac
---- binutils-2.18-orig/configure.ac 2007-08-28 16:24:26.000000000 -0400
-+++ binutils-2.18/configure.ac 2007-09-27 22:41:00.000000000 -0400
-@@ -2400,10 +2400,10 @@
- *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
- *)
- changequote(,)
-- # For an installed makeinfo, we require it to be from texinfo 4.4 or
-+ # For an installed makeinfo, we require it to be from texinfo 4.6 or
- # higher, else we use the "missing" dummy.
- if ${MAKEINFO} --version \
-- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
-+ | egrep 'texinfo[^0-9]*(4\.([6-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
- :
- else
- MAKEINFO="$MISSING makeinfo"
diff --git a/toolchain/binutils/2.18/110-arm-eabi-conf.patch b/toolchain/binutils/2.18/110-arm-eabi-conf.patch
deleted file mode 100644
index 04e19be..0000000
--- a/toolchain/binutils/2.18/110-arm-eabi-conf.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -u binutils-2.17.50.0.17.oorig/configure binutils-2.17.50.0.17/configure
---- binutils-2.17.50.0.17.oorig/configure 2007-06-18 19:29:28.000000000 +0200
-+++ binutils-2.17.50.0.17/configure 2007-06-25 09:58:36.000000000 +0200
-@@ -2224,7 +2224,7 @@
- arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- ;;
-- arm*-*-linux-gnueabi)
-+ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- noconfigdirs="$noconfigdirs target-libjava target-libobjc"
- ;;
-diff -u binutils-2.17.50.0.17.oorig/configure.ac binutils-2.17.50.0.17/configure.ac
---- binutils-2.17.50.0.17.oorig/configure.ac 2007-06-18 19:29:28.000000000 +0200
-+++ binutils-2.17.50.0.17/configure.ac 2007-06-25 09:58:36.000000000 +0200
-@@ -513,7 +513,7 @@
- arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- ;;
-- arm*-*-linux-gnueabi)
-+ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- noconfigdirs="$noconfigdirs target-libjava target-libobjc"
- ;;
diff --git a/toolchain/binutils/2.18/300-001_ld_makefile_patch.patch b/toolchain/binutils/2.18/300-001_ld_makefile_patch.patch
deleted file mode 100644
index 5cb0f61..0000000
--- a/toolchain/binutils/2.18/300-001_ld_makefile_patch.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.am binutils-2.17.50.0.17/ld/Makefile.am
---- binutils-2.17.50.0.17.oorig/ld/Makefile.am 2007-06-18 19:29:29.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/Makefile.am 2007-06-25 10:00:36.000000000 +0200
-@@ -18,7 +18,7 @@
- # We put the scripts in the directory $(scriptdir)/ldscripts.
- # We can't put the scripts in $(datadir) because the SEARCH_DIR
- # directives need to be different for native and cross linkers.
--scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
-
- EMUL = @EMUL@
- EMULATION_OFILES = @EMULATION_OFILES@
-diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.in binutils-2.17.50.0.17/ld/Makefile.in
---- binutils-2.17.50.0.17.oorig/ld/Makefile.in 2007-06-18 19:29:29.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/Makefile.in 2007-06-25 10:00:36.000000000 +0200
-@@ -287,7 +287,7 @@
- # We put the scripts in the directory $(scriptdir)/ldscripts.
- # We can't put the scripts in $(datadir) because the SEARCH_DIR
- # directives need to be different for native and cross linkers.
--scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
- BASEDIR = $(srcdir)/..
- BFDDIR = $(BASEDIR)/bfd
- INCDIR = $(BASEDIR)/include
diff --git a/toolchain/binutils/2.18/300-012_check_ldrunpath_length.patch b/toolchain/binutils/2.18/300-012_check_ldrunpath_length.patch
deleted file mode 100644
index 6e80921..0000000
--- a/toolchain/binutils/2.18/300-012_check_ldrunpath_length.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -u binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em binutils-2.17.50.0.17/ld/emultempl/elf32.em
---- binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em 2007-06-18 19:31:40.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/emultempl/elf32.em 2007-06-25 10:01:25.000000000 +0200
-@@ -1007,6 +1007,8 @@
- && command_line.rpath == NULL)
- {
- lib_path = (const char *) getenv ("LD_RUN_PATH");
-+ if ((lib_path) && (strlen (lib_path) == 0))
-+ lib_path = NULL;
- if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
- force))
- break;
-@@ -1191,6 +1193,8 @@
- rpath = command_line.rpath;
- if (rpath == NULL)
- rpath = (const char *) getenv ("LD_RUN_PATH");
-+ if ((rpath) && (strlen (rpath) == 0))
-+ rpath = NULL;
- if (! (bfd_elf_size_dynamic_sections
- (output_bfd, command_line.soname, rpath,
- command_line.filter_shlib,
diff --git a/toolchain/binutils/2.19.1/110-arm-eabi-conf.patch b/toolchain/binutils/2.19.1/110-arm-eabi-conf.patch
deleted file mode 100644
index af26329..0000000
--- a/toolchain/binutils/2.19.1/110-arm-eabi-conf.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -rdup binutils-2.18.50.0.3.orig/configure binutils-2.18.50.0.3/configure
---- binutils-2.18.50.0.3.orig/configure 2007-11-22 12:41:26.000000000 +0100
-+++ binutils-2.18.50.0.3/configure 2007-11-22 12:45:01.000000000 +0100
-@@ -2245,7 +2245,7 @@ case "${target}" in
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- libgloss_dir=arm
- ;;
-- arm*-*-linux-gnueabi)
-+ arm*-*-linux-*gnueabi)
- noconfigdirs="$noconfigdirs target-qthreads"
- noconfigdirs="$noconfigdirs target-libobjc"
- case ${with_newlib} in
-diff -rdup binutils-2.18.50.0.3.orig/configure.ac binutils-2.18.50.0.3/configure.ac
---- binutils-2.18.50.0.3.orig/configure.ac 2007-11-22 12:41:26.000000000 +0100
-+++ binutils-2.18.50.0.3/configure.ac 2007-11-22 12:44:54.000000000 +0100
-@@ -522,7 +522,7 @@ case "${target}" in
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- libgloss_dir=arm
- ;;
-- arm*-*-linux-gnueabi)
-+ arm*-*-linux-*gnueabi)
- noconfigdirs="$noconfigdirs target-qthreads"
- noconfigdirs="$noconfigdirs target-libobjc"
- case ${with_newlib} in
diff --git a/toolchain/binutils/2.19.1/120-sh-conf.patch b/toolchain/binutils/2.19.1/120-sh-conf.patch
deleted file mode 100644
index 071d15a..0000000
--- a/toolchain/binutils/2.19.1/120-sh-conf.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-diff -rdup binutils-2.18.50.0.9.old/configure binutils-2.18.50.0.9/configure
---- binutils-2.18.50.0.9.old/configure 2008-08-23 17:36:13.000000000 +0200
-+++ binutils-2.18.50.0.9/configure 2008-10-14 14:25:22.000000000 +0200
-@@ -2281,7 +2281,7 @@ case "${target}" in
- am33_2.0-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
-- sh-*-linux*)
-+ sh*-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
- sh*-*-pe|mips*-*-pe|*arm-wince-pe)
-@@ -2606,7 +2606,7 @@ case "${target}" in
- romp-*-*)
- noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
- ;;
-- sh-*-* | sh64-*-*)
-+ sh*-*-* | sh64-*-*)
- case "${host}" in
- i[3456789]86-*-vsta) ;; # don't add gprof back in
- i[3456789]86-*-go32*) ;; # don't add gprof back in
-diff -rdup binutils-2.18.50.0.9.old/configure.ac binutils-2.18.50.0.9/configure.ac
---- binutils-2.18.50.0.9.old/configure.ac 2008-08-23 17:36:13.000000000 +0200
-+++ binutils-2.18.50.0.9/configure.ac 2008-10-14 14:25:11.000000000 +0200
-@@ -530,7 +530,7 @@ case "${target}" in
- am33_2.0-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
-- sh-*-linux*)
-+ sh*-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
- sh*-*-pe|mips*-*-pe|*arm-wince-pe)
-@@ -855,7 +855,7 @@ case "${target}" in
- romp-*-*)
- noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
- ;;
-- sh-*-* | sh64-*-*)
-+ sh*-*-* | sh64-*-*)
- case "${host}" in
- i[[3456789]]86-*-vsta) ;; # don't add gprof back in
- i[[3456789]]86-*-go32*) ;; # don't add gprof back in
diff --git a/toolchain/binutils/2.19.1/300-001_ld_makefile_patch.patch b/toolchain/binutils/2.19.1/300-001_ld_makefile_patch.patch
deleted file mode 100644
index 5cb0f61..0000000
--- a/toolchain/binutils/2.19.1/300-001_ld_makefile_patch.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.am binutils-2.17.50.0.17/ld/Makefile.am
---- binutils-2.17.50.0.17.oorig/ld/Makefile.am 2007-06-18 19:29:29.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/Makefile.am 2007-06-25 10:00:36.000000000 +0200
-@@ -18,7 +18,7 @@
- # We put the scripts in the directory $(scriptdir)/ldscripts.
- # We can't put the scripts in $(datadir) because the SEARCH_DIR
- # directives need to be different for native and cross linkers.
--scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
-
- EMUL = @EMUL@
- EMULATION_OFILES = @EMULATION_OFILES@
-diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.in binutils-2.17.50.0.17/ld/Makefile.in
---- binutils-2.17.50.0.17.oorig/ld/Makefile.in 2007-06-18 19:29:29.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/Makefile.in 2007-06-25 10:00:36.000000000 +0200
-@@ -287,7 +287,7 @@
- # We put the scripts in the directory $(scriptdir)/ldscripts.
- # We can't put the scripts in $(datadir) because the SEARCH_DIR
- # directives need to be different for native and cross linkers.
--scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
- BASEDIR = $(srcdir)/..
- BFDDIR = $(BASEDIR)/bfd
- INCDIR = $(BASEDIR)/include
diff --git a/toolchain/binutils/2.19.1/300-012_check_ldrunpath_length.patch b/toolchain/binutils/2.19.1/300-012_check_ldrunpath_length.patch
deleted file mode 100644
index 6e80921..0000000
--- a/toolchain/binutils/2.19.1/300-012_check_ldrunpath_length.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -u binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em binutils-2.17.50.0.17/ld/emultempl/elf32.em
---- binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em 2007-06-18 19:31:40.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/emultempl/elf32.em 2007-06-25 10:01:25.000000000 +0200
-@@ -1007,6 +1007,8 @@
- && command_line.rpath == NULL)
- {
- lib_path = (const char *) getenv ("LD_RUN_PATH");
-+ if ((lib_path) && (strlen (lib_path) == 0))
-+ lib_path = NULL;
- if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
- force))
- break;
-@@ -1191,6 +1193,8 @@
- rpath = command_line.rpath;
- if (rpath == NULL)
- rpath = (const char *) getenv ("LD_RUN_PATH");
-+ if ((rpath) && (strlen (rpath) == 0))
-+ rpath = NULL;
- if (! (bfd_elf_size_dynamic_sections
- (output_bfd, command_line.soname, rpath,
- command_line.filter_shlib,
diff --git a/toolchain/binutils/2.19/110-arm-eabi-conf.patch b/toolchain/binutils/2.19/110-arm-eabi-conf.patch
deleted file mode 100644
index af26329..0000000
--- a/toolchain/binutils/2.19/110-arm-eabi-conf.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -rdup binutils-2.18.50.0.3.orig/configure binutils-2.18.50.0.3/configure
---- binutils-2.18.50.0.3.orig/configure 2007-11-22 12:41:26.000000000 +0100
-+++ binutils-2.18.50.0.3/configure 2007-11-22 12:45:01.000000000 +0100
-@@ -2245,7 +2245,7 @@ case "${target}" in
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- libgloss_dir=arm
- ;;
-- arm*-*-linux-gnueabi)
-+ arm*-*-linux-*gnueabi)
- noconfigdirs="$noconfigdirs target-qthreads"
- noconfigdirs="$noconfigdirs target-libobjc"
- case ${with_newlib} in
-diff -rdup binutils-2.18.50.0.3.orig/configure.ac binutils-2.18.50.0.3/configure.ac
---- binutils-2.18.50.0.3.orig/configure.ac 2007-11-22 12:41:26.000000000 +0100
-+++ binutils-2.18.50.0.3/configure.ac 2007-11-22 12:44:54.000000000 +0100
-@@ -522,7 +522,7 @@ case "${target}" in
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- libgloss_dir=arm
- ;;
-- arm*-*-linux-gnueabi)
-+ arm*-*-linux-*gnueabi)
- noconfigdirs="$noconfigdirs target-qthreads"
- noconfigdirs="$noconfigdirs target-libobjc"
- case ${with_newlib} in
diff --git a/toolchain/binutils/2.19/120-sh-conf.patch b/toolchain/binutils/2.19/120-sh-conf.patch
deleted file mode 100644
index 071d15a..0000000
--- a/toolchain/binutils/2.19/120-sh-conf.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-diff -rdup binutils-2.18.50.0.9.old/configure binutils-2.18.50.0.9/configure
---- binutils-2.18.50.0.9.old/configure 2008-08-23 17:36:13.000000000 +0200
-+++ binutils-2.18.50.0.9/configure 2008-10-14 14:25:22.000000000 +0200
-@@ -2281,7 +2281,7 @@ case "${target}" in
- am33_2.0-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
-- sh-*-linux*)
-+ sh*-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
- sh*-*-pe|mips*-*-pe|*arm-wince-pe)
-@@ -2606,7 +2606,7 @@ case "${target}" in
- romp-*-*)
- noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
- ;;
-- sh-*-* | sh64-*-*)
-+ sh*-*-* | sh64-*-*)
- case "${host}" in
- i[3456789]86-*-vsta) ;; # don't add gprof back in
- i[3456789]86-*-go32*) ;; # don't add gprof back in
-diff -rdup binutils-2.18.50.0.9.old/configure.ac binutils-2.18.50.0.9/configure.ac
---- binutils-2.18.50.0.9.old/configure.ac 2008-08-23 17:36:13.000000000 +0200
-+++ binutils-2.18.50.0.9/configure.ac 2008-10-14 14:25:11.000000000 +0200
-@@ -530,7 +530,7 @@ case "${target}" in
- am33_2.0-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
-- sh-*-linux*)
-+ sh*-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
- sh*-*-pe|mips*-*-pe|*arm-wince-pe)
-@@ -855,7 +855,7 @@ case "${target}" in
- romp-*-*)
- noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
- ;;
-- sh-*-* | sh64-*-*)
-+ sh*-*-* | sh64-*-*)
- case "${host}" in
- i[[3456789]]86-*-vsta) ;; # don't add gprof back in
- i[[3456789]]86-*-go32*) ;; # don't add gprof back in
diff --git a/toolchain/binutils/2.19/300-001_ld_makefile_patch.patch b/toolchain/binutils/2.19/300-001_ld_makefile_patch.patch
deleted file mode 100644
index 5cb0f61..0000000
--- a/toolchain/binutils/2.19/300-001_ld_makefile_patch.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.am binutils-2.17.50.0.17/ld/Makefile.am
---- binutils-2.17.50.0.17.oorig/ld/Makefile.am 2007-06-18 19:29:29.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/Makefile.am 2007-06-25 10:00:36.000000000 +0200
-@@ -18,7 +18,7 @@
- # We put the scripts in the directory $(scriptdir)/ldscripts.
- # We can't put the scripts in $(datadir) because the SEARCH_DIR
- # directives need to be different for native and cross linkers.
--scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
-
- EMUL = @EMUL@
- EMULATION_OFILES = @EMULATION_OFILES@
-diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.in binutils-2.17.50.0.17/ld/Makefile.in
---- binutils-2.17.50.0.17.oorig/ld/Makefile.in 2007-06-18 19:29:29.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/Makefile.in 2007-06-25 10:00:36.000000000 +0200
-@@ -287,7 +287,7 @@
- # We put the scripts in the directory $(scriptdir)/ldscripts.
- # We can't put the scripts in $(datadir) because the SEARCH_DIR
- # directives need to be different for native and cross linkers.
--scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
- BASEDIR = $(srcdir)/..
- BFDDIR = $(BASEDIR)/bfd
- INCDIR = $(BASEDIR)/include
diff --git a/toolchain/binutils/2.19/300-012_check_ldrunpath_length.patch b/toolchain/binutils/2.19/300-012_check_ldrunpath_length.patch
deleted file mode 100644
index 6e80921..0000000
--- a/toolchain/binutils/2.19/300-012_check_ldrunpath_length.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -u binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em binutils-2.17.50.0.17/ld/emultempl/elf32.em
---- binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em 2007-06-18 19:31:40.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/emultempl/elf32.em 2007-06-25 10:01:25.000000000 +0200
-@@ -1007,6 +1007,8 @@
- && command_line.rpath == NULL)
- {
- lib_path = (const char *) getenv ("LD_RUN_PATH");
-+ if ((lib_path) && (strlen (lib_path) == 0))
-+ lib_path = NULL;
- if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
- force))
- break;
-@@ -1191,6 +1193,8 @@
- rpath = command_line.rpath;
- if (rpath == NULL)
- rpath = (const char *) getenv ("LD_RUN_PATH");
-+ if ((rpath) && (strlen (rpath) == 0))
-+ rpath = NULL;
- if (! (bfd_elf_size_dynamic_sections
- (output_bfd, command_line.soname, rpath,
- command_line.filter_shlib,
diff --git a/toolchain/binutils/2.20.1/110-arm-eabi-conf.patch b/toolchain/binutils/2.20.1/110-arm-eabi-conf.patch
deleted file mode 100644
index af26329..0000000
--- a/toolchain/binutils/2.20.1/110-arm-eabi-conf.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -rdup binutils-2.18.50.0.3.orig/configure binutils-2.18.50.0.3/configure
---- binutils-2.18.50.0.3.orig/configure 2007-11-22 12:41:26.000000000 +0100
-+++ binutils-2.18.50.0.3/configure 2007-11-22 12:45:01.000000000 +0100
-@@ -2245,7 +2245,7 @@ case "${target}" in
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- libgloss_dir=arm
- ;;
-- arm*-*-linux-gnueabi)
-+ arm*-*-linux-*gnueabi)
- noconfigdirs="$noconfigdirs target-qthreads"
- noconfigdirs="$noconfigdirs target-libobjc"
- case ${with_newlib} in
-diff -rdup binutils-2.18.50.0.3.orig/configure.ac binutils-2.18.50.0.3/configure.ac
---- binutils-2.18.50.0.3.orig/configure.ac 2007-11-22 12:41:26.000000000 +0100
-+++ binutils-2.18.50.0.3/configure.ac 2007-11-22 12:44:54.000000000 +0100
-@@ -522,7 +522,7 @@ case "${target}" in
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- libgloss_dir=arm
- ;;
-- arm*-*-linux-gnueabi)
-+ arm*-*-linux-*gnueabi)
- noconfigdirs="$noconfigdirs target-qthreads"
- noconfigdirs="$noconfigdirs target-libobjc"
- case ${with_newlib} in
diff --git a/toolchain/binutils/2.20.1/120-sh-conf.patch b/toolchain/binutils/2.20.1/120-sh-conf.patch
deleted file mode 100644
index 071d15a..0000000
--- a/toolchain/binutils/2.20.1/120-sh-conf.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-diff -rdup binutils-2.18.50.0.9.old/configure binutils-2.18.50.0.9/configure
---- binutils-2.18.50.0.9.old/configure 2008-08-23 17:36:13.000000000 +0200
-+++ binutils-2.18.50.0.9/configure 2008-10-14 14:25:22.000000000 +0200
-@@ -2281,7 +2281,7 @@ case "${target}" in
- am33_2.0-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
-- sh-*-linux*)
-+ sh*-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
- sh*-*-pe|mips*-*-pe|*arm-wince-pe)
-@@ -2606,7 +2606,7 @@ case "${target}" in
- romp-*-*)
- noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
- ;;
-- sh-*-* | sh64-*-*)
-+ sh*-*-* | sh64-*-*)
- case "${host}" in
- i[3456789]86-*-vsta) ;; # don't add gprof back in
- i[3456789]86-*-go32*) ;; # don't add gprof back in
-diff -rdup binutils-2.18.50.0.9.old/configure.ac binutils-2.18.50.0.9/configure.ac
---- binutils-2.18.50.0.9.old/configure.ac 2008-08-23 17:36:13.000000000 +0200
-+++ binutils-2.18.50.0.9/configure.ac 2008-10-14 14:25:11.000000000 +0200
-@@ -530,7 +530,7 @@ case "${target}" in
- am33_2.0-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
-- sh-*-linux*)
-+ sh*-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
- sh*-*-pe|mips*-*-pe|*arm-wince-pe)
-@@ -855,7 +855,7 @@ case "${target}" in
- romp-*-*)
- noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
- ;;
-- sh-*-* | sh64-*-*)
-+ sh*-*-* | sh64-*-*)
- case "${host}" in
- i[[3456789]]86-*-vsta) ;; # don't add gprof back in
- i[[3456789]]86-*-go32*) ;; # don't add gprof back in
diff --git a/toolchain/binutils/2.20.1/300-001_ld_makefile_patch.patch b/toolchain/binutils/2.20.1/300-001_ld_makefile_patch.patch
deleted file mode 100644
index 5cb0f61..0000000
--- a/toolchain/binutils/2.20.1/300-001_ld_makefile_patch.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.am binutils-2.17.50.0.17/ld/Makefile.am
---- binutils-2.17.50.0.17.oorig/ld/Makefile.am 2007-06-18 19:29:29.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/Makefile.am 2007-06-25 10:00:36.000000000 +0200
-@@ -18,7 +18,7 @@
- # We put the scripts in the directory $(scriptdir)/ldscripts.
- # We can't put the scripts in $(datadir) because the SEARCH_DIR
- # directives need to be different for native and cross linkers.
--scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
-
- EMUL = @EMUL@
- EMULATION_OFILES = @EMULATION_OFILES@
-diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.in binutils-2.17.50.0.17/ld/Makefile.in
---- binutils-2.17.50.0.17.oorig/ld/Makefile.in 2007-06-18 19:29:29.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/Makefile.in 2007-06-25 10:00:36.000000000 +0200
-@@ -287,7 +287,7 @@
- # We put the scripts in the directory $(scriptdir)/ldscripts.
- # We can't put the scripts in $(datadir) because the SEARCH_DIR
- # directives need to be different for native and cross linkers.
--scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
- BASEDIR = $(srcdir)/..
- BFDDIR = $(BASEDIR)/bfd
- INCDIR = $(BASEDIR)/include
diff --git a/toolchain/binutils/2.20.1/300-012_check_ldrunpath_length.patch b/toolchain/binutils/2.20.1/300-012_check_ldrunpath_length.patch
deleted file mode 100644
index 6e80921..0000000
--- a/toolchain/binutils/2.20.1/300-012_check_ldrunpath_length.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -u binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em binutils-2.17.50.0.17/ld/emultempl/elf32.em
---- binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em 2007-06-18 19:31:40.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/emultempl/elf32.em 2007-06-25 10:01:25.000000000 +0200
-@@ -1007,6 +1007,8 @@
- && command_line.rpath == NULL)
- {
- lib_path = (const char *) getenv ("LD_RUN_PATH");
-+ if ((lib_path) && (strlen (lib_path) == 0))
-+ lib_path = NULL;
- if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
- force))
- break;
-@@ -1191,6 +1193,8 @@
- rpath = command_line.rpath;
- if (rpath == NULL)
- rpath = (const char *) getenv ("LD_RUN_PATH");
-+ if ((rpath) && (strlen (rpath) == 0))
-+ rpath = NULL;
- if (! (bfd_elf_size_dynamic_sections
- (output_bfd, command_line.soname, rpath,
- command_line.filter_shlib,
diff --git a/toolchain/binutils/2.20.1/400-arm_link_speed.patch b/toolchain/binutils/2.20.1/400-arm_link_speed.patch
deleted file mode 100644
index d03385a..0000000
--- a/toolchain/binutils/2.20.1/400-arm_link_speed.patch
+++ /dev/null
@@ -1,183 +0,0 @@
-From Binutils CVS:
-
-http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-arm.c?rev=1.230&content-type=text/x-cvsweb-markup&cvsroot=src
-
-Improves linking time from large projects on ARM.
-diff -dupr binutils-2.20.orig/bfd/elf32-arm.c binutils-2.20/bfd/elf32-arm.c
---- binutils-2.20.orig/bfd/elf32-arm.c 2010-04-19 10:08:50.000000000 -0700
-+++ binutils-2.20/bfd/elf32-arm.c 2010-04-19 10:12:45.000000000 -0700
-@@ -12736,108 +12736,15 @@ elf32_arm_section_from_shdr (bfd *abfd,
- return TRUE;
- }
-
--/* A structure used to record a list of sections, independently
-- of the next and prev fields in the asection structure. */
--typedef struct section_list
--{
-- asection * sec;
-- struct section_list * next;
-- struct section_list * prev;
--}
--section_list;
--
--/* Unfortunately we need to keep a list of sections for which
-- an _arm_elf_section_data structure has been allocated. This
-- is because it is possible for functions like elf32_arm_write_section
-- to be called on a section which has had an elf_data_structure
-- allocated for it (and so the used_by_bfd field is valid) but
-- for which the ARM extended version of this structure - the
-- _arm_elf_section_data structure - has not been allocated. */
--static section_list * sections_with_arm_elf_section_data = NULL;
--
--static void
--record_section_with_arm_elf_section_data (asection * sec)
--{
-- struct section_list * entry;
--
-- entry = bfd_malloc (sizeof (* entry));
-- if (entry == NULL)
-- return;
-- entry->sec = sec;
-- entry->next = sections_with_arm_elf_section_data;
-- entry->prev = NULL;
-- if (entry->next != NULL)
-- entry->next->prev = entry;
-- sections_with_arm_elf_section_data = entry;
--}
--
--static struct section_list *
--find_arm_elf_section_entry (asection * sec)
--{
-- struct section_list * entry;
-- static struct section_list * last_entry = NULL;
--
-- /* This is a short cut for the typical case where the sections are added
-- to the sections_with_arm_elf_section_data list in forward order and
-- then looked up here in backwards order. This makes a real difference
-- to the ld-srec/sec64k.exp linker test. */
-- entry = sections_with_arm_elf_section_data;
-- if (last_entry != NULL)
-- {
-- if (last_entry->sec == sec)
-- entry = last_entry;
-- else if (last_entry->next != NULL
-- && last_entry->next->sec == sec)
-- entry = last_entry->next;
-- }
--
-- for (; entry; entry = entry->next)
-- if (entry->sec == sec)
-- break;
--
-- if (entry)
-- /* Record the entry prior to this one - it is the entry we are most
-- likely to want to locate next time. Also this way if we have been
-- called from unrecord_section_with_arm_elf_section_data() we will not
-- be caching a pointer that is about to be freed. */
-- last_entry = entry->prev;
--
-- return entry;
--}
--
- static _arm_elf_section_data *
- get_arm_elf_section_data (asection * sec)
- {
-- struct section_list * entry;
--
-- entry = find_arm_elf_section_entry (sec);
--
-- if (entry)
-- return elf32_arm_section_data (entry->sec);
-+ if (sec && sec->owner && is_arm_elf (sec->owner))
-+ return elf32_arm_section_data (sec);
- else
- return NULL;
- }
-
--static void
--unrecord_section_with_arm_elf_section_data (asection * sec)
--{
-- struct section_list * entry;
--
-- entry = find_arm_elf_section_entry (sec);
--
-- if (entry)
-- {
-- if (entry->prev != NULL)
-- entry->prev->next = entry->next;
-- if (entry->next != NULL)
-- entry->next->prev = entry->prev;
-- if (entry == sections_with_arm_elf_section_data)
-- sections_with_arm_elf_section_data = entry->next;
-- free (entry);
-- }
--}
--
--
- typedef struct
- {
- void *finfo;
-@@ -13230,8 +13137,6 @@ elf32_arm_new_section_hook (bfd *abfd, a
- sec->used_by_bfd = sdata;
- }
-
-- record_section_with_arm_elf_section_data (sec);
--
- return _bfd_elf_new_section_hook (abfd, sec);
- }
-
-@@ -13659,44 +13564,13 @@ elf32_arm_write_section (bfd *output_bfd
- }
-
- free (map);
-- arm_data->mapcount = 0;
-+ arm_data->mapcount = -1;
- arm_data->mapsize = 0;
- arm_data->map = NULL;
-- unrecord_section_with_arm_elf_section_data (sec);
-
- return FALSE;
- }
-
--static void
--unrecord_section_via_map_over_sections (bfd * abfd ATTRIBUTE_UNUSED,
-- asection * sec,
-- void * ignore ATTRIBUTE_UNUSED)
--{
-- unrecord_section_with_arm_elf_section_data (sec);
--}
--
--static bfd_boolean
--elf32_arm_close_and_cleanup (bfd * abfd)
--{
-- if (abfd->sections)
-- bfd_map_over_sections (abfd,
-- unrecord_section_via_map_over_sections,
-- NULL);
--
-- return _bfd_elf_close_and_cleanup (abfd);
--}
--
--static bfd_boolean
--elf32_arm_bfd_free_cached_info (bfd * abfd)
--{
-- if (abfd->sections)
-- bfd_map_over_sections (abfd,
-- unrecord_section_via_map_over_sections,
-- NULL);
--
-- return _bfd_free_cached_info (abfd);
--}
--
- /* Display STT_ARM_TFUNC symbols as functions. */
-
- static void
-@@ -13882,8 +13756,6 @@ const struct elf_size_info elf32_arm_siz
- #define bfd_elf32_find_inliner_info elf32_arm_find_inliner_info
- #define bfd_elf32_new_section_hook elf32_arm_new_section_hook
- #define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol
--#define bfd_elf32_close_and_cleanup elf32_arm_close_and_cleanup
--#define bfd_elf32_bfd_free_cached_info elf32_arm_bfd_free_cached_info
- #define bfd_elf32_bfd_final_link elf32_arm_final_link
-
- #define elf_backend_get_symbol_type elf32_arm_get_symbol_type
diff --git a/toolchain/binutils/2.20/110-arm-eabi-conf.patch b/toolchain/binutils/2.20/110-arm-eabi-conf.patch
deleted file mode 100644
index af26329..0000000
--- a/toolchain/binutils/2.20/110-arm-eabi-conf.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -rdup binutils-2.18.50.0.3.orig/configure binutils-2.18.50.0.3/configure
---- binutils-2.18.50.0.3.orig/configure 2007-11-22 12:41:26.000000000 +0100
-+++ binutils-2.18.50.0.3/configure 2007-11-22 12:45:01.000000000 +0100
-@@ -2245,7 +2245,7 @@ case "${target}" in
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- libgloss_dir=arm
- ;;
-- arm*-*-linux-gnueabi)
-+ arm*-*-linux-*gnueabi)
- noconfigdirs="$noconfigdirs target-qthreads"
- noconfigdirs="$noconfigdirs target-libobjc"
- case ${with_newlib} in
-diff -rdup binutils-2.18.50.0.3.orig/configure.ac binutils-2.18.50.0.3/configure.ac
---- binutils-2.18.50.0.3.orig/configure.ac 2007-11-22 12:41:26.000000000 +0100
-+++ binutils-2.18.50.0.3/configure.ac 2007-11-22 12:44:54.000000000 +0100
-@@ -522,7 +522,7 @@ case "${target}" in
- noconfigdirs="$noconfigdirs target-libffi target-qthreads"
- libgloss_dir=arm
- ;;
-- arm*-*-linux-gnueabi)
-+ arm*-*-linux-*gnueabi)
- noconfigdirs="$noconfigdirs target-qthreads"
- noconfigdirs="$noconfigdirs target-libobjc"
- case ${with_newlib} in
diff --git a/toolchain/binutils/2.20/120-sh-conf.patch b/toolchain/binutils/2.20/120-sh-conf.patch
deleted file mode 100644
index 071d15a..0000000
--- a/toolchain/binutils/2.20/120-sh-conf.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-diff -rdup binutils-2.18.50.0.9.old/configure binutils-2.18.50.0.9/configure
---- binutils-2.18.50.0.9.old/configure 2008-08-23 17:36:13.000000000 +0200
-+++ binutils-2.18.50.0.9/configure 2008-10-14 14:25:22.000000000 +0200
-@@ -2281,7 +2281,7 @@ case "${target}" in
- am33_2.0-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
-- sh-*-linux*)
-+ sh*-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
- sh*-*-pe|mips*-*-pe|*arm-wince-pe)
-@@ -2606,7 +2606,7 @@ case "${target}" in
- romp-*-*)
- noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
- ;;
-- sh-*-* | sh64-*-*)
-+ sh*-*-* | sh64-*-*)
- case "${host}" in
- i[3456789]86-*-vsta) ;; # don't add gprof back in
- i[3456789]86-*-go32*) ;; # don't add gprof back in
-diff -rdup binutils-2.18.50.0.9.old/configure.ac binutils-2.18.50.0.9/configure.ac
---- binutils-2.18.50.0.9.old/configure.ac 2008-08-23 17:36:13.000000000 +0200
-+++ binutils-2.18.50.0.9/configure.ac 2008-10-14 14:25:11.000000000 +0200
-@@ -530,7 +530,7 @@ case "${target}" in
- am33_2.0-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
-- sh-*-linux*)
-+ sh*-*-linux*)
- noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
- ;;
- sh*-*-pe|mips*-*-pe|*arm-wince-pe)
-@@ -855,7 +855,7 @@ case "${target}" in
- romp-*-*)
- noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
- ;;
-- sh-*-* | sh64-*-*)
-+ sh*-*-* | sh64-*-*)
- case "${host}" in
- i[[3456789]]86-*-vsta) ;; # don't add gprof back in
- i[[3456789]]86-*-go32*) ;; # don't add gprof back in
diff --git a/toolchain/binutils/2.20/300-001_ld_makefile_patch.patch b/toolchain/binutils/2.20/300-001_ld_makefile_patch.patch
deleted file mode 100644
index 5cb0f61..0000000
--- a/toolchain/binutils/2.20/300-001_ld_makefile_patch.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.am binutils-2.17.50.0.17/ld/Makefile.am
---- binutils-2.17.50.0.17.oorig/ld/Makefile.am 2007-06-18 19:29:29.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/Makefile.am 2007-06-25 10:00:36.000000000 +0200
-@@ -18,7 +18,7 @@
- # We put the scripts in the directory $(scriptdir)/ldscripts.
- # We can't put the scripts in $(datadir) because the SEARCH_DIR
- # directives need to be different for native and cross linkers.
--scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
-
- EMUL = @EMUL@
- EMULATION_OFILES = @EMULATION_OFILES@
-diff -u binutils-2.17.50.0.17.oorig/ld/Makefile.in binutils-2.17.50.0.17/ld/Makefile.in
---- binutils-2.17.50.0.17.oorig/ld/Makefile.in 2007-06-18 19:29:29.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/Makefile.in 2007-06-25 10:00:36.000000000 +0200
-@@ -287,7 +287,7 @@
- # We put the scripts in the directory $(scriptdir)/ldscripts.
- # We can't put the scripts in $(datadir) because the SEARCH_DIR
- # directives need to be different for native and cross linkers.
--scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
- BASEDIR = $(srcdir)/..
- BFDDIR = $(BASEDIR)/bfd
- INCDIR = $(BASEDIR)/include
diff --git a/toolchain/binutils/2.20/300-012_check_ldrunpath_length.patch b/toolchain/binutils/2.20/300-012_check_ldrunpath_length.patch
deleted file mode 100644
index 6e80921..0000000
--- a/toolchain/binutils/2.20/300-012_check_ldrunpath_length.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -u binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em binutils-2.17.50.0.17/ld/emultempl/elf32.em
---- binutils-2.17.50.0.17.oorig/ld/emultempl/elf32.em 2007-06-18 19:31:40.000000000 +0200
-+++ binutils-2.17.50.0.17/ld/emultempl/elf32.em 2007-06-25 10:01:25.000000000 +0200
-@@ -1007,6 +1007,8 @@
- && command_line.rpath == NULL)
- {
- lib_path = (const char *) getenv ("LD_RUN_PATH");
-+ if ((lib_path) && (strlen (lib_path) == 0))
-+ lib_path = NULL;
- if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
- force))
- break;
-@@ -1191,6 +1193,8 @@
- rpath = command_line.rpath;
- if (rpath == NULL)
- rpath = (const char *) getenv ("LD_RUN_PATH");
-+ if ((rpath) && (strlen (rpath) == 0))
-+ rpath = NULL;
- if (! (bfd_elf_size_dynamic_sections
- (output_bfd, command_line.soname, rpath,
- command_line.filter_shlib,
diff --git a/toolchain/binutils/2.20/400-arm_link_speed.patch b/toolchain/binutils/2.20/400-arm_link_speed.patch
deleted file mode 100644
index d03385a..0000000
--- a/toolchain/binutils/2.20/400-arm_link_speed.patch
+++ /dev/null
@@ -1,183 +0,0 @@
-From Binutils CVS:
-
-http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-arm.c?rev=1.230&content-type=text/x-cvsweb-markup&cvsroot=src
-
-Improves linking time from large projects on ARM.
-diff -dupr binutils-2.20.orig/bfd/elf32-arm.c binutils-2.20/bfd/elf32-arm.c
---- binutils-2.20.orig/bfd/elf32-arm.c 2010-04-19 10:08:50.000000000 -0700
-+++ binutils-2.20/bfd/elf32-arm.c 2010-04-19 10:12:45.000000000 -0700
-@@ -12736,108 +12736,15 @@ elf32_arm_section_from_shdr (bfd *abfd,
- return TRUE;
- }
-
--/* A structure used to record a list of sections, independently
-- of the next and prev fields in the asection structure. */
--typedef struct section_list
--{
-- asection * sec;
-- struct section_list * next;
-- struct section_list * prev;
--}
--section_list;
--
--/* Unfortunately we need to keep a list of sections for which
-- an _arm_elf_section_data structure has been allocated. This
-- is because it is possible for functions like elf32_arm_write_section
-- to be called on a section which has had an elf_data_structure
-- allocated for it (and so the used_by_bfd field is valid) but
-- for which the ARM extended version of this structure - the
-- _arm_elf_section_data structure - has not been allocated. */
--static section_list * sections_with_arm_elf_section_data = NULL;
--
--static void
--record_section_with_arm_elf_section_data (asection * sec)
--{
-- struct section_list * entry;
--
-- entry = bfd_malloc (sizeof (* entry));
-- if (entry == NULL)
-- return;
-- entry->sec = sec;
-- entry->next = sections_with_arm_elf_section_data;
-- entry->prev = NULL;
-- if (entry->next != NULL)
-- entry->next->prev = entry;
-- sections_with_arm_elf_section_data = entry;
--}
--
--static struct section_list *
--find_arm_elf_section_entry (asection * sec)
--{
-- struct section_list * entry;
-- static struct section_list * last_entry = NULL;
--
-- /* This is a short cut for the typical case where the sections are added
-- to the sections_with_arm_elf_section_data list in forward order and
-- then looked up here in backwards order. This makes a real difference
-- to the ld-srec/sec64k.exp linker test. */
-- entry = sections_with_arm_elf_section_data;
-- if (last_entry != NULL)
-- {
-- if (last_entry->sec == sec)
-- entry = last_entry;
-- else if (last_entry->next != NULL
-- && last_entry->next->sec == sec)
-- entry = last_entry->next;
-- }
--
-- for (; entry; entry = entry->next)
-- if (entry->sec == sec)
-- break;
--
-- if (entry)
-- /* Record the entry prior to this one - it is the entry we are most
-- likely to want to locate next time. Also this way if we have been
-- called from unrecord_section_with_arm_elf_section_data() we will not
-- be caching a pointer that is about to be freed. */
-- last_entry = entry->prev;
--
-- return entry;
--}
--
- static _arm_elf_section_data *
- get_arm_elf_section_data (asection * sec)
- {
-- struct section_list * entry;
--
-- entry = find_arm_elf_section_entry (sec);
--
-- if (entry)
-- return elf32_arm_section_data (entry->sec);
-+ if (sec && sec->owner && is_arm_elf (sec->owner))
-+ return elf32_arm_section_data (sec);
- else
- return NULL;
- }
-
--static void
--unrecord_section_with_arm_elf_section_data (asection * sec)
--{
-- struct section_list * entry;
--
-- entry = find_arm_elf_section_entry (sec);
--
-- if (entry)
-- {
-- if (entry->prev != NULL)
-- entry->prev->next = entry->next;
-- if (entry->next != NULL)
-- entry->next->prev = entry->prev;
-- if (entry == sections_with_arm_elf_section_data)
-- sections_with_arm_elf_section_data = entry->next;
-- free (entry);
-- }
--}
--
--
- typedef struct
- {
- void *finfo;
-@@ -13230,8 +13137,6 @@ elf32_arm_new_section_hook (bfd *abfd, a
- sec->used_by_bfd = sdata;
- }
-
-- record_section_with_arm_elf_section_data (sec);
--
- return _bfd_elf_new_section_hook (abfd, sec);
- }
-
-@@ -13659,44 +13564,13 @@ elf32_arm_write_section (bfd *output_bfd
- }
-
- free (map);
-- arm_data->mapcount = 0;
-+ arm_data->mapcount = -1;
- arm_data->mapsize = 0;
- arm_data->map = NULL;
-- unrecord_section_with_arm_elf_section_data (sec);
-
- return FALSE;
- }
-
--static void
--unrecord_section_via_map_over_sections (bfd * abfd ATTRIBUTE_UNUSED,
-- asection * sec,
-- void * ignore ATTRIBUTE_UNUSED)
--{
-- unrecord_section_with_arm_elf_section_data (sec);
--}
--
--static bfd_boolean
--elf32_arm_close_and_cleanup (bfd * abfd)
--{
-- if (abfd->sections)
-- bfd_map_over_sections (abfd,
-- unrecord_section_via_map_over_sections,
-- NULL);
--
-- return _bfd_elf_close_and_cleanup (abfd);
--}
--
--static bfd_boolean
--elf32_arm_bfd_free_cached_info (bfd * abfd)
--{
-- if (abfd->sections)
-- bfd_map_over_sections (abfd,
-- unrecord_section_via_map_over_sections,
-- NULL);
--
-- return _bfd_free_cached_info (abfd);
--}
--
- /* Display STT_ARM_TFUNC symbols as functions. */
-
- static void
-@@ -13882,8 +13756,6 @@ const struct elf_size_info elf32_arm_siz
- #define bfd_elf32_find_inliner_info elf32_arm_find_inliner_info
- #define bfd_elf32_new_section_hook elf32_arm_new_section_hook
- #define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol
--#define bfd_elf32_close_and_cleanup elf32_arm_close_and_cleanup
--#define bfd_elf32_bfd_free_cached_info elf32_arm_bfd_free_cached_info
- #define bfd_elf32_bfd_final_link elf32_arm_final_link
-
- #define elf_backend_get_symbol_type elf32_arm_get_symbol_type
diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in
deleted file mode 100644
index 165b43e..0000000
--- a/toolchain/binutils/Config.in
+++ /dev/null
@@ -1,59 +0,0 @@
-# Choose binutils version.
-
-comment "Binutils Options"
-
-choice
- prompt "Binutils Version"
- default BR2_BINUTILS_VERSION_2_20_1
- help
- Select the version of binutils you wish to use.
-
- config BR2_BINUTILS_VERSION_2_17
- depends on !BR2_avr32
- depends on BR2_DEPRECATED
- bool "binutils 2.17"
-
- config BR2_BINUTILS_VERSION_2_18
- depends on !BR2_avr32
- depends on BR2_DEPRECATED
- bool "binutils 2.18"
-
- config BR2_BINUTILS_VERSION_2_18_AVR32_1_0_1
- depends on BR2_avr32
- bool "binutils 2.18-avr32-1.0.1"
-
- config BR2_BINUTILS_VERSION_2_19
- depends on !BR2_avr32
- depends on BR2_DEPRECATED
- bool "binutils 2.19"
-
- config BR2_BINUTILS_VERSION_2_19_1
- depends on !BR2_avr32
- depends on BR2_DEPRECATED
- bool "binutils 2.19.1"
-
- config BR2_BINUTILS_VERSION_2_20
- depends on !BR2_avr32
- bool "binutils 2.20"
-
- config BR2_BINUTILS_VERSION_2_20_1
- depends on !BR2_avr32
- bool "binutils 2.20.1"
-
-endchoice
-
-config BR2_BINUTILS_VERSION
- string
- default "2.17" if BR2_BINUTILS_VERSION_2_17
- default "2.18" if BR2_BINUTILS_VERSION_2_18
- default "2.18-avr32-1.0.1" if BR2_BINUTILS_VERSION_2_18_AVR32_1_0_1
- default "2.19" if BR2_BINUTILS_VERSION_2_19
- default "2.19.1" if BR2_BINUTILS_VERSION_2_19_1
- default "2.20" if BR2_BINUTILS_VERSION_2_20
- default "2.20.1" if BR2_BINUTILS_VERSION_2_20_1
-
-config BR2_EXTRA_BINUTILS_CONFIG_OPTIONS
- string "Additional binutils options"
- default ""
- help
- Any additional binutils options you may want to include.
diff --git a/toolchain/binutils/binutils.mk b/toolchain/binutils/binutils.mk
deleted file mode 100644
index 8ab383b..0000000
--- a/toolchain/binutils/binutils.mk
+++ /dev/null
@@ -1,179 +0,0 @@
-#############################################################
-#
-# build binutils for use on the host system
-#
-#############################################################
-BINUTILS_VERSION:=$(call qstrip,$(BR2_BINUTILS_VERSION))
-
-EXTRA_BINUTILS_CONFIG_OPTIONS=$(call qstrip,$(BR2_EXTRA_BINUTILS_CONFIG_OPTIONS))
-ifeq ($(findstring avr32,$(BINUTILS_VERSION)),avr32)
-BINUTILS_SITE:=ftp://www.at91.com/pub/buildroot/
-else
-BINUTILS_SITE:=$(BR2_GNU_MIRROR)/binutils/
-endif
-
-# We do not rely on the host's gmp/mpfr but use a known working one
-BINUTILS_HOST_PREREQ:=
-BINUTILS_TARGET_PREREQ:=
-
-BINUTILS_HOST_PREREQ:=host-gmp host-mpfr
-HOST_SOURCE += host-gmp-source host-mpfr-source
-
-BINUTILS_TARGET_PREREQ:=gmp mpfr
-
-EXTRA_BINUTILS_CONFIG_OPTIONS+=--with-gmp=$(HOST_DIR)/usr
-EXTRA_BINUTILS_CONFIG_OPTIONS+=--with-mpfr=$(HOST_DIR)/usr
-
-BINUTILS_TARGET_CONFIG_OPTIONS=--with-gmp=$(STAGING_DIR)/usr
-BINUTILS_TARGET_CONFIG_OPTIONS+=--with-mpfr=$(STAGING_DIR)/usr
-
-ifeq ($(BR2_PACKAGE_LIBMPC),y)
-BINUTILS_ADD_MPC = y
-endif
-
-ifeq ($(findstring x4.5.,x$(GCC_VERSION)),x4.5.)
-BINUTILS_ADD_MPC = y
-endif
-
-ifeq ($(BINUTILS_ADD_MPC),y)
-BINUTILS_HOST_PREREQ += host-mpc
-HOST_SOURCE += host-mpc-source
-BINUTILS_TARGET_PREREQ += mpc
-EXTRA_BINUTILS_CONFIG_OPTIONS += --with-mpc=$(HOST_DIR)/usr
-BINUTILS_TARGET_CONFIG_OPTIONS += --with-mpc=$(STAGING_DIR)/usr
-endif
-
-BINUTILS_PATCH_DIR:=toolchain/binutils/$(BINUTILS_VERSION)
-
-ifneq ($(filter xtensa%,$(ARCH)),)
-include target/xtensa/patch.in
-BINUTILS_PATCH_EXTRA:=$(call XTENSA_PATCH,binutils,$(BINUTILS_PATCH_DIR),. ..)
-endif
-
-BINUTILS_SOURCE:=binutils-$(BINUTILS_VERSION).tar.bz2
-BINUTILS_DIR:=$(TOOLCHAIN_DIR)/binutils-$(BINUTILS_VERSION)
-BINUTILS_CAT:=$(BZCAT)
-
-BINUTILS_DIR1:=$(TOOLCHAIN_DIR)/binutils-$(BINUTILS_VERSION)-build
-
-$(DL_DIR)/$(BINUTILS_SOURCE):
- mkdir -p $(DL_DIR)
- $(call DOWNLOAD,$(BINUTILS_SITE),$(BINUTILS_SOURCE))
-
-binutils-unpacked: $(BINUTILS_DIR)/.patched
-$(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE)
- mkdir -p $(TOOLCHAIN_DIR)
- rm -rf $(BINUTILS_DIR)
- $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOLCHAIN_DIR) $(TAR_OPTIONS) -
- $(CONFIG_UPDATE) $(@D)
- touch $@
-
-binutils-patched: $(BINUTILS_DIR)/.patched
-$(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked
- # Apply appropriate binutils patches.
-ifneq ($(wildcard $(BINUTILS_PATCH_DIR)),)
- toolchain/patch-kernel.sh $(BINUTILS_DIR) $(BINUTILS_PATCH_DIR) \*.patch $(BINUTILS_PATCH_EXTRA)
-endif
- touch $@
-
-$(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched
- mkdir -p $(BINUTILS_DIR1)
- (cd $(BINUTILS_DIR1); rm -rf config.cache; \
- $(HOST_CONFIGURE_OPTS) \
- $(BINUTILS_DIR)/configure $(QUIET) \
- --prefix=$(STAGING_DIR)/usr \
- --build=$(GNU_HOST_NAME) \
- --host=$(GNU_HOST_NAME) \
- --target=$(REAL_GNU_TARGET_NAME) \
- $(BR2_CONFIGURE_DEVEL_SYSROOT) \
- $(BR2_CONFIGURE_STAGING_SYSROOT) \
- $(DISABLE_NLS) \
- --disable-multilib \
- --disable-werror \
- $(SOFT_FLOAT_CONFIG_OPTION) \
- $(EXTRA_BINUTILS_CONFIG_OPTIONS) \
- $(QUIET) \
- )
- touch $@
-
-$(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured
- $(MAKE) -C $(BINUTILS_DIR1) all
-
-# Make install will put gettext data in staging_dir/share/locale.
-# Unfortunatey, it isn't configureable.
-$(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ld: $(BINUTILS_DIR1)/binutils/objdump
- $(MAKE) -C $(BINUTILS_DIR1) install
- # tooldir=/usr build_tooldir=/usr install
- #rm -f $(STAGING_DIR)/usr/bin/{ar,as,ld,nm,objdump,ranlib,strip}
-
-binutils: $(BINUTILS_HOST_PREREQ) $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ld
-
-binutils-source: $(DL_DIR)/$(BINUTILS_SOURCE)
-
-binutils-clean:
- -$(MAKE) -C $(BINUTILS_DIR1) DESTDIR=$(STAGING_DIR) \
- tooldir=/usr build_tooldir=/usr uninstall
- -$(MAKE) -C $(BINUTILS_DIR1) clean
- rm -rf $(wildcard $(patsubst %,$(STAGING_DIR)/usr/bin/*%,ar as ld nm objdump ranlib strip c++filt)) \
- $(wildcard $(patsubst %,$(STAGING_DIR)/usr/lib/%*,libiberty ldscripts))
-
-binutils-dirclean:
- rm -rf $(BINUTILS_DIR1)
-
-binutils-src-dirclean:
- rm -rf $(BINUTILS_DIR)
-
-#############################################################
-#
-# build binutils for use on the target system
-#
-#############################################################
-BINUTILS_DIR2:=$(BUILD_DIR)/binutils-$(BINUTILS_VERSION)-target
-$(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched
- mkdir -p $(BINUTILS_DIR2)
- (cd $(BINUTILS_DIR2); rm -rf config.cache; \
- $(TARGET_CONFIGURE_OPTS) \
- $(BINUTILS_DIR)/configure $(QUIET) \
- --prefix=/usr \
- --exec-prefix=/usr \
- --build=$(GNU_HOST_NAME) \
- --host=$(REAL_GNU_TARGET_NAME) \
- --target=$(REAL_GNU_TARGET_NAME) \
- --mandir=/usr/share/man \
- --infodir=/usr/share/info \
- $(DISABLE_NLS) \
- $(BINUTILS_TARGET_CONFIG_OPTIONS) \
- --disable-multilib \
- --disable-werror \
- $(SOFT_FLOAT_CONFIG_OPTION) \
- )
- touch $@
-
-$(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured
- PATH=$(TARGET_PATH) $(MAKE) -C $(BINUTILS_DIR2) all
-
-$(TARGET_DIR)/usr/bin/ld: $(BINUTILS_DIR2)/binutils/objdump
- PATH=$(TARGET_PATH) \
- $(MAKE) DESTDIR=$(TARGET_DIR) \
- tooldir=/usr build_tooldir=/usr \
- -C $(BINUTILS_DIR2) install
- rm -rf $(TARGET_DIR)/share/locale
- -$(STRIPCMD) $(TARGET_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/* > /dev/null 2>&1
- -$(STRIPCMD) $(TARGET_DIR)/usr/bin/* > /dev/null 2>&1
-
-# If both binutils-target and busybox are selected, make certain binutils
-# gets to run after busybox, so it can overwrite the busybox symlink for
-# ar if enabled
-ifeq ($(BR2_PACKAGE_BUSYBOX),y)
-BINUTILS_TARGET_PREREQ += busybox
-endif
-
-binutils_target: $(BINUTILS_TARGET_PREREQ) $(TARGET_DIR)/usr/bin/ld
-
-binutils_target-clean:
- -$(MAKE) -C $(BINUTILS_DIR2) clean
- rm -f $(TARGET_DIR)/bin/$(REAL_GNU_TARGET_NAME)* \
- $(addprefix $(TARGET_DIR)/usr/bin/, addr2line ar as gprof ld nm objcopy objdump ranlib readelf size strings strip c++filt)
-
-binutils_target-dirclean:
- rm -rf $(BINUTILS_DIR2)
diff --git a/toolchain/toolchain-buildroot.mk b/toolchain/toolchain-buildroot.mk
index f12a480..c611562 100644
--- a/toolchain/toolchain-buildroot.mk
+++ b/toolchain/toolchain-buildroot.mk
@@ -1,7 +1,6 @@
# Include files required for the internal toolchain backend
include toolchain/dependencies/dependencies.mk
-include toolchain/binutils/binutils.mk
include toolchain/elf2flt/elf2flt.mk
include toolchain/gcc/gcc-uclibc-4.x.mk
include toolchain/gdb/gdb.mk
diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in
index c458251..3894890 100644
--- a/toolchain/toolchain-buildroot/Config.in
+++ b/toolchain/toolchain-buildroot/Config.in
@@ -3,6 +3,6 @@
if BR2_TOOLCHAIN_BUILDROOT
source "toolchain/kernel-headers/Config.in"
source "toolchain/uClibc/Config.in"
-source "toolchain/binutils/Config.in"
+source "package/binutils/Config.in.host"
source "toolchain/gcc/Config.in"
endif
diff --git a/toolchain/toolchain-crosstool-ng.mk b/toolchain/toolchain-crosstool-ng.mk
index 1befff2..e480da9 100644
--- a/toolchain/toolchain-crosstool-ng.mk
+++ b/toolchain/toolchain-crosstool-ng.mk
@@ -2,7 +2,6 @@
# Explicit ordering:
include toolchain/helpers.mk
-include toolchain/binutils/binutils.mk
include toolchain/dependencies/dependencies.mk
include toolchain/elf2flt/elf2flt.mk
include toolchain/gcc/gcc-uclibc-4.x.mk
diff --git a/toolchain/toolchain-external.mk b/toolchain/toolchain-external.mk
index c43618b..d67405b 100644
--- a/toolchain/toolchain-external.mk
+++ b/toolchain/toolchain-external.mk
@@ -1,7 +1,6 @@
# Required includes for the external toolchain backend
include toolchain/helpers.mk
-include toolchain/binutils/binutils.mk
include toolchain/dependencies/dependencies.mk
include toolchain/elf2flt/elf2flt.mk
include toolchain/gcc/gcc-uclibc-4.x.mk
--
1.7.2.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 10/13] gcc: cleanup and hook
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
` (8 preceding siblings ...)
2010-12-14 19:06 ` [Buildroot] [PATCH 09/13] binutils: make it a proper package Gustavo Zacarias
@ 2010-12-14 19:06 ` Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 11/13] gcc: install copies of libgcc, libstdc++ and libgcj to the sysroot too Gustavo Zacarias
` (2 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:06 UTC (permalink / raw)
To: buildroot
* Clean up some unneeded steps in gcc build
* Hook up packaged binutils for target gcc
* Build tools are on HOST_DIR now so change it
* TARGET_CROSS is now in HOST_DIR too
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
package/Makefile.in | 2 +-
toolchain/Makefile.in | 2 +-
toolchain/gcc/Config.in.2 | 1 +
toolchain/gcc/gcc-uclibc-4.x.mk | 66 +++++++++++++-------------------------
4 files changed, 26 insertions(+), 45 deletions(-)
diff --git a/package/Makefile.in b/package/Makefile.in
index 3fa98fe..12a25f8 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -112,7 +112,7 @@ endif
REAL_GNU_TARGET_NAME=$(ARCH)-unknown-linux-$(LIBC)$(ABI)
ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
-TARGET_CROSS=$(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-
+TARGET_CROSS=$(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
TOOLCHAIN_EXTERNAL_PREFIX=$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX))
ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y)
diff --git a/toolchain/Makefile.in b/toolchain/Makefile.in
index 2cb6e95..a7ca558 100644
--- a/toolchain/Makefile.in
+++ b/toolchain/Makefile.in
@@ -1,6 +1,6 @@
BR2_CONFIGURE_DEVEL_SYSROOT=--with-sysroot=$(TOOLCHAIN_DIR)/uClibc_dev/
BR2_CONFIGURE_STAGING_SYSROOT=--with-sysroot=$(STAGING_DIR)
-BR2_CONFIGURE_BUILD_TOOLS=--with-build-time-tools=$(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin
+BR2_CONFIGURE_BUILD_TOOLS=--with-build-time-tools=$(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin
# gcc has a bunch of needed stuff....
include toolchain/gcc/Makefile.in
diff --git a/toolchain/gcc/Config.in.2 b/toolchain/gcc/Config.in.2
index d9ebfcd..4a81086 100644
--- a/toolchain/gcc/Config.in.2
+++ b/toolchain/gcc/Config.in.2
@@ -1,6 +1,7 @@
config BR2_PACKAGE_GCC_TARGET
bool "native toolchain in the target filesystem"
depends on BR2_HAVE_DEVFILES
+ select BR2_PACKAGE_BINUTILS
help
If you want the target system to be able to run
binutils/gcc and compile native code, say Y here.
diff --git a/toolchain/gcc/gcc-uclibc-4.x.mk b/toolchain/gcc/gcc-uclibc-4.x.mk
index 9e7127d..543454b 100644
--- a/toolchain/gcc/gcc-uclibc-4.x.mk
+++ b/toolchain/gcc/gcc-uclibc-4.x.mk
@@ -53,9 +53,6 @@ else
GCC_OPTSPACE=--enable-target-optspace
endif
-GCC_TARGET_PREREQ=
-GCC_STAGING_PREREQ=
-
#############################################################
#
# Setup some initial stuff
@@ -203,17 +200,12 @@ endif
#############################################################
GCC_BUILD_DIR1:=$(TOOLCHAIN_DIR)/gcc-$(GCC_VERSION)-initial
-
-# The --without-headers option stopped working with gcc 3.0 and has never been
-# fixed, so we need to actually have working C library header files prior to
-# the step or libgcc will not build...
-
$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.patched
mkdir -p $(GCC_BUILD_DIR1)
(cd $(GCC_BUILD_DIR1); rm -rf config.cache; \
$(HOST_CONFIGURE_OPTS) \
$(GCC_DIR)/configure $(QUIET) \
- --prefix=$(STAGING_DIR)/usr \
+ --prefix=$(HOST_DIR)/usr \
--build=$(GNU_HOST_NAME) \
--host=$(GNU_HOST_NAME) \
--target=$(REAL_GNU_TARGET_NAME) \
@@ -243,7 +235,6 @@ $(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.patched
touch $@
$(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured
- # gcc >= 4.3.0 have to also build all-target-libgcc
ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y)
$(GCC_CONF_ENV) $(MAKE) -C $(GCC_BUILD_DIR1) all-gcc
else
@@ -252,16 +243,11 @@ endif
touch $@
gcc_initial=$(GCC_BUILD_DIR1)/.installed
-$(gcc_initial) $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc: $(GCC_BUILD_DIR1)/.compiled
- # gcc >= 4.3.0 have to also install install-target-libgcc
-ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y)
- PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) install-gcc
-else
+$(gcc_initial) $(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc: $(GCC_BUILD_DIR1)/.compiled
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) install-gcc
-endif
touch $(gcc_initial)
-gcc_initial: binutils $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc
+gcc_initial: host-binutils $(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc
gcc_initial-clean:
rm -rf $(GCC_BUILD_DIR1)
@@ -276,22 +262,16 @@ gcc_initial-dirclean:
#############################################################
GCC_BUILD_DIR2:=$(TOOLCHAIN_DIR)/gcc-$(GCC_VERSION)-intermediate
-
# The --without-headers option stopped working with gcc 3.0 and has never been
# fixed, so we need to actually have working C library header files prior to
# the step or libgcc will not build...
$(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.patched
mkdir -p $(GCC_BUILD_DIR2)
- -rmdir $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib
- mkdir -p $(STAGING_DIR)/lib
- ln -snf ../../lib $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib
- $(if $(BR2_ARCH_IS_64),mkdir -p $(STAGING_DIR)/lib64)
- $(if $(BR2_ARCH_IS_64),ln -snf ../../lib64 $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib64)
(cd $(GCC_BUILD_DIR2); rm -rf config.cache; \
$(HOST_CONFIGURE_OPTS) \
$(GCC_DIR)/configure $(QUIET) \
- --prefix=$(STAGING_DIR)/usr \
+ --prefix=$(HOST_DIR)/usr \
--build=$(GNU_HOST_NAME) \
--host=$(GNU_HOST_NAME) \
--target=$(REAL_GNU_TARGET_NAME) \
@@ -338,7 +318,7 @@ else
endif
touch $(gcc_intermediate)
-gcc_intermediate: uclibc-configured $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc
+gcc_intermediate: uclibc-configured $(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc
gcc_intermediate-clean:
rm -rf $(GCC_BUILD_DIR2)
@@ -363,11 +343,11 @@ GCC_BUILD_DIR3:=$(TOOLCHAIN_DIR)/gcc-$(GCC_VERSION)-final
$(GCC_BUILD_DIR3)/.configured: $(GCC_SRC_DIR)/.patched $(GCC_STAGING_PREREQ)
mkdir -p $(GCC_BUILD_DIR3)
# Important! Required for limits.h to be fixed.
- ln -snf ../include/ $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/sys-include
+ ln -snf ../include/ $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/sys-include
(cd $(GCC_BUILD_DIR3); rm -rf config.cache; \
$(HOST_CONFIGURE_OPTS) \
$(GCC_SRC_DIR)/configure $(QUIET) \
- --prefix=$(STAGING_DIR)/usr \
+ --prefix=$(HOST_DIR)/usr \
--build=$(GNU_HOST_NAME) \
--host=$(GNU_HOST_NAME) \
--target=$(REAL_GNU_TARGET_NAME) \
@@ -412,19 +392,19 @@ $(GCC_BUILD_DIR3)/.installed: $(GCC_BUILD_DIR3)/.compiled
fi
# Strip the host binaries
ifeq ($(GCC_STRIP_HOST_BINARIES),true)
- strip --strip-all -R .note -R .comment $(filter-out %-gccbug %-embedspu,$(wildcard $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-*))
+ strip --strip-all -R .note -R .comment $(filter-out %-gccbug %-embedspu,$(wildcard $(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-*))
endif
# Make sure we have 'cc'.
- if [ ! -e $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-cc ]; then \
+ if [ ! -e $(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-cc ]; then \
ln -snf $(REAL_GNU_TARGET_NAME)-gcc \
- $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-cc; \
+ $(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-cc; \
fi
- if [ ! -e $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/cc ]; then \
- ln -snf gcc $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/cc; \
+ if [ ! -e $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/cc ]; then \
+ ln -snf gcc $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/cc; \
fi
# Set up the symlinks to enable lying about target name.
set -e; \
- (cd $(STAGING_DIR)/usr; \
+ (cd $(HOST_DIR)/usr; \
ln -snf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
cd bin; \
for app in $(REAL_GNU_TARGET_NAME)-*; do \
@@ -438,31 +418,31 @@ endif
$(STAMP_DIR)/gcc_libs_target_installed: $(GCC_BUILD_DIR3)/.installed
ifeq ($(BR2_GCC_SHARED_LIBGCC),y)
- # These are in /lib, so...
+ # These go in /lib, so...
rm -rf $(TARGET_DIR)/usr/lib/libgcc_s*.so*
- -cp -dpf $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libgcc_s* \
+ -cp -dpf $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libgcc_s* \
$(TARGET_DIR)/lib/
-$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/lib/libgcc_s*
endif
ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
ifeq ($(BR2_GCC_SHARED_LIBGCC),y)
mkdir -p $(TARGET_DIR)/usr/lib
- -cp -dpf $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libstdc++.so* \
+ -cp -dpf $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libstdc++.so* \
$(TARGET_DIR)/usr/lib/
-$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/lib/libstdc++.so*
endif
endif
ifeq ($(BR2_INSTALL_LIBGCJ),y)
- cp -dpf $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libgcj.so* $(TARGET_DIR)/usr/lib/
+ cp -dpf $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libgcj.so* $(TARGET_DIR)/usr/lib/
mkdir -p $(TARGET_DIR)/usr/lib/security
- cp -dpf $(STAGING_DIR)/usr/lib/security/classpath.security \
+ cp -dpf $(HOST_DIR)/usr/lib/security/classpath.security \
$(TARGET_DIR)/usr/lib/security/
-$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/lib/libgcj.so*
endif
mkdir -p $(@D)
touch $@
-cross_compiler:=$(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc
+cross_compiler:=$(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc
cross_compiler gcc: gcc_intermediate \
$(LIBFLOAT_TARGET) uclibc $(GCC_BUILD_DIR3)/.installed \
$(STAMP_DIR)/gcc_libs_target_installed \
@@ -473,8 +453,8 @@ gcc-source: $(DL_DIR)/$(GCC_SOURCE)
gcc-clean:
rm -rf $(GCC_BUILD_DIR3)
for prog in cpp gcc gcc-[0-9]* protoize unprotoize gcov gccbug cc; do \
- rm -f $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-$$prog; \
- rm -f $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-$$prog; \
+ rm -f $(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-$$prog; \
+ rm -f $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-$$prog; \
done
gcc-dirclean: gcc_initial-dirclean
@@ -556,7 +536,7 @@ $(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR4)/.compiled
# Work around problem of missing syslimits.h
if [ ! -f $(TARGET_DIR)/usr/$(GCC_LIB_SUBDIR)/$(GCC_INCLUDE_DIR)/syslimits.h ]; then \
echo "warning: working around missing syslimits.h"; \
- cp -f $(STAGING_DIR)/$(GCC_LIB_SUBDIR)/$(GCC_INCLUDE_DIR)/syslimits.h \
+ cp -f $(HOST_DIR)/$(GCC_LIB_SUBDIR)/$(GCC_INCLUDE_DIR)/syslimits.h \
$(TARGET_DIR)/usr/$(GCC_LIB_SUBDIR)/$(GCC_INCLUDE_DIR)/; \
fi
# Make sure we have 'cc'.
@@ -567,7 +547,7 @@ $(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR4)/.compiled
#rm -rf $(TARGET_DIR)/usr/lib/libgcc_s*.so*
touch -c $@
-gcc_target: uclibc_target binutils_target $(TARGET_DIR)/usr/bin/gcc
+gcc_target: uclibc_target binutils $(TARGET_DIR)/usr/bin/gcc
gcc_target-clean:
rm -rf $(GCC_BUILD_DIR4)
--
1.7.2.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 11/13] gcc: install copies of libgcc, libstdc++ and libgcj to the sysroot too
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
` (9 preceding siblings ...)
2010-12-14 19:06 ` [Buildroot] [PATCH 10/13] gcc: cleanup and hook Gustavo Zacarias
@ 2010-12-14 19:06 ` Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 12/13] uclibc: fix program invocation name config option for the snapshot version Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 13/13] gdb: make it a proper package Gustavo Zacarias
12 siblings, 0 replies; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:06 UTC (permalink / raw)
To: buildroot
We want to keep a copy around for the future SDK functionality.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
toolchain/gcc/gcc-uclibc-4.x.mk | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/toolchain/gcc/gcc-uclibc-4.x.mk b/toolchain/gcc/gcc-uclibc-4.x.mk
index 543454b..215915d 100644
--- a/toolchain/gcc/gcc-uclibc-4.x.mk
+++ b/toolchain/gcc/gcc-uclibc-4.x.mk
@@ -421,6 +421,8 @@ ifeq ($(BR2_GCC_SHARED_LIBGCC),y)
# These go in /lib, so...
rm -rf $(TARGET_DIR)/usr/lib/libgcc_s*.so*
-cp -dpf $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libgcc_s* \
+ $(STAGING_DIR)/lib/
+ -cp -dpf $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libgcc_s* \
$(TARGET_DIR)/lib/
-$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/lib/libgcc_s*
endif
@@ -428,14 +430,20 @@ ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
ifeq ($(BR2_GCC_SHARED_LIBGCC),y)
mkdir -p $(TARGET_DIR)/usr/lib
-cp -dpf $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libstdc++.so* \
+ $(STAGING_DIR)/usr/lib/
+ -cp -dpf $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libstdc++.so* \
$(TARGET_DIR)/usr/lib/
-$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/lib/libstdc++.so*
endif
endif
ifeq ($(BR2_INSTALL_LIBGCJ),y)
+ cp -dpf $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libgcj.so* $(STAGING_DIR)/usr/lib/
cp -dpf $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib*/libgcj.so* $(TARGET_DIR)/usr/lib/
+ mkdir -p $(STAGING_DIR)/usr/lib/security
mkdir -p $(TARGET_DIR)/usr/lib/security
cp -dpf $(HOST_DIR)/usr/lib/security/classpath.security \
+ $(STAGING_DIR)/usr/lib/security/
+ cp -dpf $(HOST_DIR)/usr/lib/security/classpath.security \
$(TARGET_DIR)/usr/lib/security/
-$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/lib/libgcj.so*
endif
--
1.7.2.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 12/13] uclibc: fix program invocation name config option for the snapshot version
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
` (10 preceding siblings ...)
2010-12-14 19:06 ` [Buildroot] [PATCH 11/13] gcc: install copies of libgcc, libstdc++ and libgcj to the sysroot too Gustavo Zacarias
@ 2010-12-14 19:06 ` Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 13/13] gdb: make it a proper package Gustavo Zacarias
12 siblings, 0 replies; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:06 UTC (permalink / raw)
To: buildroot
We didn't have UCLIBC_HAS___PROGNAME in the sample config so when
program invocation name was enabled we got a stalling point.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
toolchain/uClibc/uClibc-snapshot.config | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/toolchain/uClibc/uClibc-snapshot.config b/toolchain/uClibc/uClibc-snapshot.config
index e5d2bea..9d6acc4 100644
--- a/toolchain/uClibc/uClibc-snapshot.config
+++ b/toolchain/uClibc/uClibc-snapshot.config
@@ -111,6 +111,7 @@ UCLIBC_SUSV4_LEGACY=y
# UCLIBC_HAS_STUBS is not set
UCLIBC_HAS_SHADOW=y
# UCLIBC_HAS_PROGRAM_INVOCATION_NAME is not set
+# UCLIBC_HAS___PROGNAME is not set
UCLIBC_HAS_PTY=y
ASSUME_DEVPTS=y
UNIX98PTY_ONLY=y
--
1.7.2.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 13/13] gdb: make it a proper package
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
` (11 preceding siblings ...)
2010-12-14 19:06 ` [Buildroot] [PATCH 12/13] uclibc: fix program invocation name config option for the snapshot version Gustavo Zacarias
@ 2010-12-14 19:06 ` Gustavo Zacarias
12 siblings, 0 replies; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-14 19:06 UTC (permalink / raw)
To: buildroot
* Convert gdb to a proper autotargets package
* Add version 7.2
* Drop version 6.6
* Mark version 6.7.1 (non-avr32) as deprecated
Kconfig can't handle duplicate choices and we can't make source depend
on anything.
To fix this we suffix the different version choices for each case (in
the toolchain menu with internal toolchain, in the package menu for
target gdb/gdbserver for internal and external toolchains.
TODO: copy gdbserver from external toolchains
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
Makefile | 2 +-
package/Config.in | 6 +
package/gdb/Config.in.external | 66 ++++++
package/gdb/Config.in.host | 49 ++++
package/gdb/Config.in.internal | 70 ++++++
.../gdb-6.7.1/600-fix-compile-flag-mismatch.patch | 31 +++
.../gdb-6.8/600-fix-compile-flag-mismatch.patch | 31 +++
package/gdb/gdb-7.2/100-fix-ipa.patch | 25 ++
.../gdb/gdb-7.2/101-fix-gdbserver-uninstall.patch | 23 ++
package/gdb/gdb.mk | 62 +++++
toolchain/gdb/6.6/100-uclibc-conf.patch | 82 -------
.../gdb/6.6/600-fix-compile-flag-mismatch.patch | 69 ------
.../gdb/6.7.1/600-fix-compile-flag-mismatch.patch | 31 ---
.../gdb/6.8/600-fix-compile-flag-mismatch.patch | 31 ---
toolchain/gdb/Config.in | 69 ------
toolchain/gdb/gdb.mk | 237 --------------------
toolchain/toolchain-buildroot.mk | 1 -
toolchain/toolchain-buildroot/Config.in | 1 +
toolchain/toolchain-common.in | 5 -
toolchain/toolchain-crosstool-ng.mk | 1 -
toolchain/toolchain-external.mk | 1 -
21 files changed, 365 insertions(+), 528 deletions(-)
create mode 100644 package/gdb/Config.in.external
create mode 100644 package/gdb/Config.in.host
create mode 100644 package/gdb/Config.in.internal
create mode 100644 package/gdb/gdb-6.7.1/600-fix-compile-flag-mismatch.patch
create mode 100644 package/gdb/gdb-6.8/600-fix-compile-flag-mismatch.patch
create mode 100644 package/gdb/gdb-7.2/100-fix-ipa.patch
create mode 100644 package/gdb/gdb-7.2/101-fix-gdbserver-uninstall.patch
create mode 100644 package/gdb/gdb.mk
delete mode 100644 toolchain/gdb/6.6/100-uclibc-conf.patch
delete mode 100644 toolchain/gdb/6.6/600-fix-compile-flag-mismatch.patch
delete mode 100644 toolchain/gdb/6.7.1/600-fix-compile-flag-mismatch.patch
delete mode 100644 toolchain/gdb/6.8/600-fix-compile-flag-mismatch.patch
delete mode 100644 toolchain/gdb/Config.in
delete mode 100644 toolchain/gdb/gdb.mk
diff --git a/Makefile b/Makefile
index b12ea6d..42fc5c2 100644
--- a/Makefile
+++ b/Makefile
@@ -614,7 +614,7 @@ endif
configured: dirs kernel-headers uclibc-config busybox-config linux26-config
-prepatch: gcc-patched gdb-patched uclibc-patched
+prepatch: gcc-patched uclibc-patched
cross: $(BASE_TARGETS)
diff --git a/package/Config.in b/package/Config.in
index 6d6e72a..ef4aca3 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -55,6 +55,12 @@ source "package/flex/Config.in"
if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
source "package/gawk/Config.in"
endif
+if BR2_TOOLCHAIN_BUILDROOT
+source "package/gdb/Config.in.internal"
+endif
+if !BR2_TOOLCHAIN_BUILDROOT
+source "package/gdb/Config.in.external"
+endif
source "toolchain/gcc/Config.in.2"
source "package/gettext/Config.in"
source "package/gmp/Config.in"
diff --git a/package/gdb/Config.in.external b/package/gdb/Config.in.external
new file mode 100644
index 0000000..9f7b0bf
--- /dev/null
+++ b/package/gdb/Config.in.external
@@ -0,0 +1,66 @@
+config BR2_PACKAGE_GDB
+ bool
+ default y if BR2_PACKAGE_GDB_TARGET || BR2_PACKAGE_GDB_SERVER
+
+config BR2_PACKAGE_GDB_TARGET
+ bool "gdb"
+ select BR2_PACKAGE_NCURSES
+ select BR2_PACKAGE_GDB
+ depends on BR2_USE_WCHAR
+ help
+ Build the full gdb debugger to run on the target.
+
+comment "GDB debugger for the target needs WCHAR support in toolchain"
+ depends on !BR2_USE_WCHAR
+
+config BR2_PACKAGE_GDB_SERVER
+ bool "gdbserver"
+ select BR2_PACKAGE_GDB
+ help
+ Build the gdbserver stub to run on the target.
+ A full gdb is needed to debug the progam.
+
+choice
+ prompt "GDB debugger Version"
+ depends on BR2_PACKAGE_GDB
+ default BR2_GDB_VERSION_6_8_e if !BR2_avr32
+ default BR2_GDB_VERSION_6_7_1_AVR32_2_1_5_e if BR2_avr32
+ help
+ Select the version of gdb you wish to use.
+
+ config BR2_GDB_VERSION_6_7_1_e
+ depends on !BR2_avr32
+ bool "gdb 6.7.1"
+ depends on BR2_DEPRECATED
+
+ config BR2_GDB_VERSION_6_7_1_AVR32_2_1_5_e
+ depends on BR2_avr32
+ bool "gdb 6.7.1-avr32-2.1.5"
+
+ config BR2_GDB_VERSION_6_8_e
+ bool "gdb 6.8"
+ depends on !BR2_avr32
+
+ config BR2_GDB_VERSION_7_0_1_e
+ bool "gdb 7.0.1"
+ select BR2_PTHREAD_DEBUG if !BR2_PTHREADS_NONE
+
+ config BR2_GDB_VERSION_7_1_e
+ bool "gdb 7.1"
+ select BR2_PTHREAD_DEBUG if !BR2_PTHREADS_NONE
+
+ config BR2_GDB_VERSION_7_2_e
+ bool "gdb 7.2"
+ select BR2_PTHREAD_DEBUG if !BR2_PTHREADS_NONE
+
+endchoice
+
+config BR2_GDB_VERSION
+ depends on BR2_PACKAGE_GDB
+ string
+ default "6.7.1" if BR2_GDB_VERSION_6_7_1_e
+ default "6.7.1-avr32-2.1.5" if BR2_GDB_VERSION_6_7_1_AVR32_2_1_5_e
+ default "6.8" if BR2_GDB_VERSION_6_8_e
+ default "7.0.1" if BR2_GDB_VERSION_7_0_1_e
+ default "7.1" if BR2_GDB_VERSION_7_1_e
+ default "7.2" if BR2_GDB_VERSION_7_2_e
diff --git a/package/gdb/Config.in.host b/package/gdb/Config.in.host
new file mode 100644
index 0000000..78182ae
--- /dev/null
+++ b/package/gdb/Config.in.host
@@ -0,0 +1,49 @@
+config BR2_PACKAGE_HOST_GDB
+ bool "Build/install gdb for the host"
+ help
+ Build gdb to run on the host to debug programs run on the target.
+
+choice
+ prompt "GDB debugger Version"
+ depends on BR2_PACKAGE_HOST_GDB
+ default BR2_GDB_VERSION_6_8 if !BR2_avr32
+ default BR2_GDB_VERSION_6_7_1_AVR32_2_1_5 if BR2_avr32
+ help
+ Select the version of gdb you wish to use.
+
+ config BR2_GDB_VERSION_6_7_1
+ depends on !BR2_avr32
+ bool "gdb 6.7.1"
+ depends on BR2_DEPRECATED
+
+ config BR2_GDB_VERSION_6_7_1_AVR32_2_1_5
+ depends on BR2_avr32
+ bool "gdb 6.7.1-avr32-2.1.5"
+
+ config BR2_GDB_VERSION_6_8
+ bool "gdb 6.8"
+ depends on !BR2_avr32
+
+ config BR2_GDB_VERSION_7_0_1
+ bool "gdb 7.0.1"
+ select BR2_PTHREAD_DEBUG if !BR2_PTHREADS_NONE
+
+ config BR2_GDB_VERSION_7_1
+ bool "gdb 7.1"
+ select BR2_PTHREAD_DEBUG if !BR2_PTHREADS_NONE
+
+ config BR2_GDB_VERSION_7_2
+ bool "gdb 7.2"
+ select BR2_PTHREAD_DEBUG if !BR2_PTHREADS_NONE
+
+endchoice
+
+config BR2_GDB_VERSION
+ depends on BR2_PACKAGE_HOST_GDB
+ string
+ default "6.7.1" if BR2_GDB_VERSION_6_7_1
+ default "6.7.1-avr32-2.1.5" if BR2_GDB_VERSION_6_7_1_AVR32_2_1_5
+ default "6.8" if BR2_GDB_VERSION_6_8
+ default "7.0.1" if BR2_GDB_VERSION_7_0_1
+ default "7.1" if BR2_GDB_VERSION_7_1
+ default "7.2" if BR2_GDB_VERSION_7_2
diff --git a/package/gdb/Config.in.internal b/package/gdb/Config.in.internal
new file mode 100644
index 0000000..d3d8de5
--- /dev/null
+++ b/package/gdb/Config.in.internal
@@ -0,0 +1,70 @@
+config BR2_PACKAGE_GDB
+ bool
+ default y if BR2_PACKAGE_GDB_TARGET || BR2_PACKAGE_GDB_SERVER
+
+config BR2_PACKAGE_GDB_TARGET
+ bool "gdb"
+ select BR2_PACKAGE_NCURSES
+ select BR2_PACKAGE_GDB
+ depends on BR2_USE_WCHAR
+ help
+ Build the full gdb debugger to run on the target.
+
+comment "GDB debugger for the target needs WCHAR support in toolchain"
+ depends on !BR2_USE_WCHAR
+
+config BR2_PACKAGE_GDB_SERVER
+ bool "gdbserver"
+ depends on BR2_PACKAGE_HOST_GDB
+ select BR2_PACKAGE_GDB
+ help
+ Build the gdbserver stub to run on the target.
+ A full gdb is needed to debug the progam.
+
+comment "GDB server needs you to build a host GDB in toolchain"
+ depends on !BR2_PACKAGE_HOST_GDB
+
+choice
+ prompt "GDB debugger Version"
+ depends on !BR2_PACKAGE_HOST_GDB && BR2_PACKAGE_GDB
+ default BR2_GDB_VERSION_6_8_i if !BR2_avr32
+ default BR2_GDB_VERSION_6_7_1_AVR32_2_1_5_i if BR2_avr32
+ help
+ Select the version of gdb you wish to use.
+
+ config BR2_GDB_VERSION_6_7_1_i
+ depends on !BR2_avr32
+ bool "gdb 6.7.1"
+ depends on BR2_DEPRECATED
+
+ config BR2_GDB_VERSION_6_7_1_AVR32_2_1_5_i
+ depends on BR2_avr32
+ bool "gdb 6.7.1-avr32-2.1.5"
+
+ config BR2_GDB_VERSION_6_8_i
+ bool "gdb 6.8"
+ depends on !BR2_avr32
+
+ config BR2_GDB_VERSION_7_0_1_i
+ bool "gdb 7.0.1"
+ select BR2_PTHREAD_DEBUG if !BR2_PTHREADS_NONE
+
+ config BR2_GDB_VERSION_7_1_i
+ bool "gdb 7.1"
+ select BR2_PTHREAD_DEBUG if !BR2_PTHREADS_NONE
+
+ config BR2_GDB_VERSION_7_2_i
+ bool "gdb 7.2"
+ select BR2_PTHREAD_DEBUG if !BR2_PTHREADS_NONE
+
+endchoice
+
+config BR2_GDB_VERSION
+ depends on !BR2_PACKAGE_HOST_GDB && BR2_PACKAGE_GDB
+ string
+ default "6.7.1" if BR2_GDB_VERSION_6_7_1_i
+ default "6.7.1-avr32-2.1.5" if BR2_GDB_VERSION_6_7_1_AVR32_2_1_5_i
+ default "6.8" if BR2_GDB_VERSION_6_8_i
+ default "7.0.1" if BR2_GDB_VERSION_7_0_1_i
+ default "7.1" if BR2_GDB_VERSION_7_1_i
+ default "7.2" if BR2_GDB_VERSION_7_2_i
diff --git a/package/gdb/gdb-6.7.1/600-fix-compile-flag-mismatch.patch b/package/gdb/gdb-6.7.1/600-fix-compile-flag-mismatch.patch
new file mode 100644
index 0000000..13b72bb
--- /dev/null
+++ b/package/gdb/gdb-6.7.1/600-fix-compile-flag-mismatch.patch
@@ -0,0 +1,31 @@
+--- a/gdb/gdbserver/configure
++++ b/gdb/gdbserver/configure
+@@ -1239,7 +1239,7 @@
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+- if test "x$ac_old_val" != "x$ac_new_val"; then
++ if test "`echo x$ac_old_val`" != "`echo x$ac_new_val`"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+ echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+--- a/gdb/configure
++++ b/gdb/configure
+@@ -272,7 +272,7 @@
+ PACKAGE_BUGREPORT=
+
+ ac_unique_file="main.c"
+-ac_subdirs_all="$ac_subdirs_all doc testsuite"
++ac_subdirs_all="$ac_subdirs_all doc"
+ # Factoring default headers for most tests.
+ ac_includes_default="\
+ #include <stdio.h>
+@@ -3077,7 +3077,7 @@
+
+
+
+-subdirs="$subdirs doc testsuite"
++subdirs="$subdirs doc"
+
+
+ # Provide defaults for some variables set by the per-host and per-target
diff --git a/package/gdb/gdb-6.8/600-fix-compile-flag-mismatch.patch b/package/gdb/gdb-6.8/600-fix-compile-flag-mismatch.patch
new file mode 100644
index 0000000..13b72bb
--- /dev/null
+++ b/package/gdb/gdb-6.8/600-fix-compile-flag-mismatch.patch
@@ -0,0 +1,31 @@
+--- a/gdb/gdbserver/configure
++++ b/gdb/gdbserver/configure
+@@ -1239,7 +1239,7 @@
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+- if test "x$ac_old_val" != "x$ac_new_val"; then
++ if test "`echo x$ac_old_val`" != "`echo x$ac_new_val`"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+ echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+--- a/gdb/configure
++++ b/gdb/configure
+@@ -272,7 +272,7 @@
+ PACKAGE_BUGREPORT=
+
+ ac_unique_file="main.c"
+-ac_subdirs_all="$ac_subdirs_all doc testsuite"
++ac_subdirs_all="$ac_subdirs_all doc"
+ # Factoring default headers for most tests.
+ ac_includes_default="\
+ #include <stdio.h>
+@@ -3077,7 +3077,7 @@
+
+
+
+-subdirs="$subdirs doc testsuite"
++subdirs="$subdirs doc"
+
+
+ # Provide defaults for some variables set by the per-host and per-target
diff --git a/package/gdb/gdb-7.2/100-fix-ipa.patch b/package/gdb/gdb-7.2/100-fix-ipa.patch
new file mode 100644
index 0000000..96037a9
--- /dev/null
+++ b/package/gdb/gdb-7.2/100-fix-ipa.patch
@@ -0,0 +1,25 @@
+Fix gdbserver standalone
+
+See http://www.cygwin.com/ml/gdb-patches/2010-09/msg00148.html
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+---
+ gdb/gdbserver/Makefile.in | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
+index 76577cf..c2fc245 100644
+--- a/gdb/gdbserver/Makefile.in
++++ b/gdb/gdbserver/Makefile.in
+@@ -164,7 +164,7 @@ install: all install-only
+ install-only:
+ n=`echo gdbserver | sed '$(program_transform_name)'`; \
+ if [ x$$n = x ]; then n=gdbserver; else true; fi; \
+- if [ x$IPA_DEPFILES != x ]; then \
++ if [ x$$IPA_DEPFILES != x ]; then \
+ $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir); \
+ $(INSTALL_PROGRAM) $(IPA_LIB) $(DESTDIR)$(libdir)/$(IPA_LIB); \
+ fi; \
+--
+1.7.2.2
+
diff --git a/package/gdb/gdb-7.2/101-fix-gdbserver-uninstall.patch b/package/gdb/gdb-7.2/101-fix-gdbserver-uninstall.patch
new file mode 100644
index 0000000..c42fddc
--- /dev/null
+++ b/package/gdb/gdb-7.2/101-fix-gdbserver-uninstall.patch
@@ -0,0 +1,23 @@
+Fix uninstall target of gdbserver... meaning honor DESTDIR.
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+---
+ gdb/gdbserver/Makefile.in | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
+index 76577cf..43024fe 100644
+--- a/gdb/gdbserver/Makefile.in
++++ b/gdb/gdbserver/Makefile.in
+@@ -176,7 +176,7 @@ install-only:
+ uninstall: force
+ n=`echo gdbserver | sed '$(program_transform_name)'`; \
+ if [ x$$n = x ]; then n=gdbserver; else true; fi; \
+- rm -f $(bindir)/$$n$(EXEEXT) $(DESTDIR)$(man1dir)/$$n.1
++ rm -f $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(man1dir)/$$n.1
+
+ installcheck:
+ check:
+--
+1.7.2.2
+
diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk
new file mode 100644
index 0000000..92cc4af
--- /dev/null
+++ b/package/gdb/gdb.mk
@@ -0,0 +1,62 @@
+#############################################################
+#
+# gdb
+#
+#############################################################
+
+GDB_VERSION = $(call qstrip,$(BR2_GDB_VERSION))
+GDB_SOURCE = gdb-$(GDB_VERSION).tar.bz2
+GDB_SITE = $(BR2_GNU_MIRROR)/gdb
+ifeq ($(ARCH),avr32)
+GDB_SITE = ftp://www.at91.com/pub/buildroot
+endif
+GDB_TARGET_BINS = gdb gdbserver gdbtui
+
+HOST_GDB_CONF_ENV = gdb_cv_func_sigsetjmp=yes \
+ bash_cv_have_mbstate_t=yes
+HOST_GDB_CONF_OPT = --without-uiout --disable-werror \
+ --disable-gdbtk --without-x \
+ --without-included-gettext --enable-threads \
+ --target=$(REAL_GNU_TARGET_NAME)
+
+define HOST_GDB_SYMLINK_CREATE
+ cd $(HOST_DIR)/usr/bin ; \
+ ln -sf $(REAL_GNU_TARGET_NAME)-gdb gdb ; \
+ ln -sf $(REAL_GNU_TARGET_NAME)-gdbtui gdbtui
+endef
+
+HOST_GDB_POST_INSTALL_HOOKS += HOST_GDB_SYMLINK_CREATE
+
+# If it's not full gdb then it's just gdbserver (if built at all)
+ifeq ($(BR2_PACKAGE_GDB_TARGET),y)
+GDB_DEPENDENCIES = ncurses
+GDB_CONF_ENV = ac_cv_type_uintptr_t=yes \
+ gt_cv_func_gettext_libintl=yes \
+ ac_cv_func_dcgettext=yes \
+ gdb_cv_func_sigsetjmp=yes \
+ bash_cv_func_strcoll_broken=no \
+ bash_cv_must_reinstall_sighandlers=no \
+ bash_cv_func_sigsetjmp=present \
+ bash_cv_have_mbstate_t=yes
+GDB_CONF_OPT = --cache-file=/dev/null --without-uiout \
+ --disable-sim --enable-gdbserver \
+ --without-included-gettext --disable-werror \
+ --program-transform-name=''
+else
+GDB_CONF_ENV = gdb_cv_func_sigsetjmp=yes \
+ bash_cv_have_mbstate_t=yes
+GDB_CONF_OPT = --cache-file=/dev/null --without-uiout \
+ --disable-tui --disable-gdbtk \
+ --without-included-gettext \
+ --includedir=$(STAGING_DIR)/usr/include \
+ --program-transform-name=''
+GDB_SUBDIR = gdb/gdbserver
+endif
+
+define GDB_UNINSTALL_TARGET_CMDS
+ rm -rf $(TARGET_DIR)/usr/share/gdb
+ rm -f $(addprefix $(TARGET_DIR)/usr/bin/, $(GDB_TARGET_BINS))
+endef
+
+$(eval $(call AUTOTARGETS,package,gdb))
+$(eval $(call AUTOTARGETS,package,gdb,host))
diff --git a/toolchain/gdb/6.6/100-uclibc-conf.patch b/toolchain/gdb/6.6/100-uclibc-conf.patch
deleted file mode 100644
index a790b6f..0000000
--- a/toolchain/gdb/6.6/100-uclibc-conf.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-diff -rNdup gdb-6.6.orig/bfd/configure gdb-6.6/bfd/configure
---- gdb-6.6.orig/bfd/configure 2006-10-25 08:49:20.000000000 +0200
-+++ gdb-6.6/bfd/configure 2007-05-14 10:35:50.000000000 +0200
-@@ -3579,6 +3579,11 @@ linux-gnu*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-+linux-uclibc*)
-+ lt_cv_deplibs_check_method=pass_all
-+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
-+ ;;
-+
- netbsd* | knetbsd*-gnu)
- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
- lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
-diff -rNdup gdb-6.6.orig/libtool.m4 gdb-6.6/libtool.m4
---- gdb-6.6.orig/libtool.m4 2005-12-27 17:37:57.000000000 +0100
-+++ gdb-6.6/libtool.m4 2007-05-14 10:35:50.000000000 +0200
-@@ -751,6 +751,11 @@ netbsd* | knetbsd*-gnu)
- fi
- ;;
-
-+linux-uclibc*)
-+ lt_cv_deplibs_check_method=pass_all
-+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
-+ ;;
-+
- newsos6)
- [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)']
- lt_cv_file_magic_cmd=/usr/bin/file
-diff -rNdup gdb-6.6.orig/ltconfig gdb-6.6/ltconfig
---- gdb-6.6.orig/ltconfig 2006-07-04 22:31:03.000000000 +0200
-+++ gdb-6.6/ltconfig 2007-05-14 10:35:50.000000000 +0200
-@@ -602,7 +602,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
-
-@@ -1270,6 +1270,24 @@ linux-gnu*)
- dynamic_linker='GNU/Linux ld.so'
- ;;
-
-+linux-uclibc*)
-+ version_type=linux
-+ need_lib_prefix=no
-+ need_version=no
-+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
-+ soname_spec='${libname}${release}.so$major'
-+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-+ shlibpath_var=LD_LIBRARY_PATH
-+ shlibpath_overrides_runpath=no
-+ # This implies no fast_install, which is unacceptable.
-+ # Some rework will be needed to allow for fast_install
-+ # before this can be enabled.
-+ # Note: copied from linux-gnu, and may not be appropriate.
-+ hardcode_into_libs=yes
-+ # Assume using the uClibc dynamic linker.
-+ dynamic_linker="uClibc ld.so"
-+ ;;
-+
- netbsd*)
- need_lib_prefix=no
- need_version=no
-diff -rNdup gdb-6.6.orig/opcodes/configure gdb-6.6/opcodes/configure
---- gdb-6.6.orig/opcodes/configure 2006-10-25 08:49:20.000000000 +0200
-+++ gdb-6.6/opcodes/configure 2007-05-14 10:35:50.000000000 +0200
-@@ -3590,6 +3590,11 @@ netbsd* | knetbsd*-gnu)
- fi
- ;;
-
-+linux-uclibc*)
-+ lt_cv_deplibs_check_method=pass_all
-+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
-+ ;;
-+
- newsos6)
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
- lt_cv_file_magic_cmd=/usr/bin/file
diff --git a/toolchain/gdb/6.6/600-fix-compile-flag-mismatch.patch b/toolchain/gdb/6.6/600-fix-compile-flag-mismatch.patch
deleted file mode 100644
index 60f0ace..0000000
--- a/toolchain/gdb/6.6/600-fix-compile-flag-mismatch.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-diff -rduNp gdb-6.6-100/Makefile.in gdb-6.6/Makefile.in
---- gdb-6.6-100/Makefile.in 2006-12-18 08:21:19.000000000 +0100
-+++ gdb-6.6/Makefile.in 2007-05-14 10:54:29.000000000 +0200
-@@ -331,7 +331,7 @@ COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_
- # CFLAGS will be just -g. We want to ensure that TARGET libraries
- # (which we know are built with gcc) are built with optimizations so
- # prepend -O2 when setting CFLAGS_FOR_TARGET.
--CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
-+CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET))
- SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
- CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
- LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
-diff -rduNp gdb-6.6-100/Makefile.tpl gdb-6.6/Makefile.tpl
---- gdb-6.6-100/Makefile.tpl 2006-11-15 00:26:39.000000000 +0100
-+++ gdb-6.6/Makefile.tpl 2007-05-14 10:54:29.000000000 +0200
-@@ -334,7 +334,7 @@ COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_
- # CFLAGS will be just -g. We want to ensure that TARGET libraries
- # (which we know are built with gcc) are built with optimizations so
- # prepend -O2 when setting CFLAGS_FOR_TARGET.
--CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
-+CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET))
- SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
- CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
- LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
-diff -rduNp gdb-6.6-100/gdb/configure gdb-6.6/gdb/configure
---- gdb-6.6-100/gdb/configure 2006-12-17 16:38:59.000000000 +0100
-+++ gdb-6.6/gdb/configure 2007-05-14 10:55:41.000000000 +0200
-@@ -272,7 +272,7 @@ PACKAGE_STRING=
- PACKAGE_BUGREPORT=
-
- ac_unique_file="main.c"
--ac_subdirs_all="$ac_subdirs_all doc testsuite"
-+ac_subdirs_all="$ac_subdirs_all doc"
- # Factoring default headers for most tests.
- ac_includes_default="\
- #include <stdio.h>
-@@ -3055,7 +3055,7 @@ _ACEOF
-
-
-
--subdirs="$subdirs doc testsuite"
-+subdirs="$subdirs doc"
-
-
- # Provide defaults for some variables set by the per-host and per-target
-diff -rduNp gdb-6.6-100/gdb/gdbserver/configure gdb-6.6/gdb/gdbserver/configure
---- gdb-6.6-100/gdb/gdbserver/configure 2006-11-22 01:10:19.000000000 +0100
-+++ gdb-6.6/gdb/gdbserver/configure 2007-05-14 10:54:29.000000000 +0200
-@@ -1239,7 +1239,7 @@ echo "$as_me: error: \`$ac_var' was not
- ac_cache_corrupted=: ;;
- ,);;
- *)
-- if test "x$ac_old_val" != "x$ac_new_val"; then
-+ if test "`echo $ac_old_val`" != "`echo $ac_new_val`"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
- echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
-diff -rduNp gdb-6.6-100/gdb/testsuite/configure gdb-6.6/gdb/testsuite/configure
---- gdb-6.6-100/gdb/testsuite/configure 2006-06-21 15:57:21.000000000 +0200
-+++ gdb-6.6/gdb/testsuite/configure 2007-05-14 10:54:29.000000000 +0200
-@@ -1248,7 +1248,7 @@ echo "$as_me: error: \`$ac_var' was not
- ac_cache_corrupted=: ;;
- ,);;
- *)
-- if test "x$ac_old_val" != "x$ac_new_val"; then
-+ if test "`echo $ac_old_val" != "`echo $ac_new_val"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
- echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
diff --git a/toolchain/gdb/6.7.1/600-fix-compile-flag-mismatch.patch b/toolchain/gdb/6.7.1/600-fix-compile-flag-mismatch.patch
deleted file mode 100644
index 13b72bb..0000000
--- a/toolchain/gdb/6.7.1/600-fix-compile-flag-mismatch.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/gdb/gdbserver/configure
-+++ b/gdb/gdbserver/configure
-@@ -1239,7 +1239,7 @@
- ac_cache_corrupted=: ;;
- ,);;
- *)
-- if test "x$ac_old_val" != "x$ac_new_val"; then
-+ if test "`echo x$ac_old_val`" != "`echo x$ac_new_val`"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
- echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
---- a/gdb/configure
-+++ b/gdb/configure
-@@ -272,7 +272,7 @@
- PACKAGE_BUGREPORT=
-
- ac_unique_file="main.c"
--ac_subdirs_all="$ac_subdirs_all doc testsuite"
-+ac_subdirs_all="$ac_subdirs_all doc"
- # Factoring default headers for most tests.
- ac_includes_default="\
- #include <stdio.h>
-@@ -3077,7 +3077,7 @@
-
-
-
--subdirs="$subdirs doc testsuite"
-+subdirs="$subdirs doc"
-
-
- # Provide defaults for some variables set by the per-host and per-target
diff --git a/toolchain/gdb/6.8/600-fix-compile-flag-mismatch.patch b/toolchain/gdb/6.8/600-fix-compile-flag-mismatch.patch
deleted file mode 100644
index 13b72bb..0000000
--- a/toolchain/gdb/6.8/600-fix-compile-flag-mismatch.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/gdb/gdbserver/configure
-+++ b/gdb/gdbserver/configure
-@@ -1239,7 +1239,7 @@
- ac_cache_corrupted=: ;;
- ,);;
- *)
-- if test "x$ac_old_val" != "x$ac_new_val"; then
-+ if test "`echo x$ac_old_val`" != "`echo x$ac_new_val`"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
- echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
---- a/gdb/configure
-+++ b/gdb/configure
-@@ -272,7 +272,7 @@
- PACKAGE_BUGREPORT=
-
- ac_unique_file="main.c"
--ac_subdirs_all="$ac_subdirs_all doc testsuite"
-+ac_subdirs_all="$ac_subdirs_all doc"
- # Factoring default headers for most tests.
- ac_includes_default="\
- #include <stdio.h>
-@@ -3077,7 +3077,7 @@
-
-
-
--subdirs="$subdirs doc testsuite"
-+subdirs="$subdirs doc"
-
-
- # Provide defaults for some variables set by the per-host and per-target
diff --git a/toolchain/gdb/Config.in b/toolchain/gdb/Config.in
deleted file mode 100644
index b45de9a..0000000
--- a/toolchain/gdb/Config.in
+++ /dev/null
@@ -1,69 +0,0 @@
-comment "Gdb Options"
-
-config BR2_PACKAGE_GDB
- bool "Build gdb debugger for the Target"
- select BR2_PACKAGE_NCURSES
- depends on BR2_USE_WCHAR
- help
- Build the full gdb debugger to run on the target.
-
-comment "Gdb debugger for the target needs WCHAR support in toolchain"
- depends on !BR2_USE_WCHAR
-
-config BR2_PACKAGE_GDB_SERVER
- bool "Build gdb server for the Target"
- help
- Build the gdbserver stub to run on the target.
- A full gdb is needed to debug the progam.
-
-config BR2_PACKAGE_GDB_HOST
- bool "Build gdb for the Host"
- # cross-gdb is supposed to be part of the external
- # toolchain. And the build currently fails.
- depends on !BR2_TOOLCHAIN_EXTERNAL
- help
- Build gdb to run on the host to debug programs run on the target.
-
-choice
- prompt "GDB debugger Version"
- default BR2_GDB_VERSION_6_8 if !BR2_avr32
- default BR2_GDB_VERSION_6_7_1_AVR32_2_1_5 if BR2_avr32
- depends on BR2_PACKAGE_GDB || BR2_PACKAGE_GDB_SERVER || BR2_PACKAGE_GDB_HOST
- help
- Select the version of gdb you wish to use.
-
- config BR2_GDB_VERSION_6_6
- bool "gdb 6.6"
- depends on !BR2_avr32
- depends on BR2_DEPRECATED
-
- config BR2_GDB_VERSION_6_7_1
- depends on !BR2_avr32
- bool "gdb 6.7.1"
-
- config BR2_GDB_VERSION_6_7_1_AVR32_2_1_5
- depends on BR2_avr32
- bool "gdb 6.7.1-avr32-2.1.5"
-
- config BR2_GDB_VERSION_6_8
- bool "gdb 6.8"
- depends on !BR2_avr32
-
- config BR2_GDB_VERSION_7_0_1
- bool "gdb 7.0.1"
- select BR2_PTHREAD_DEBUG if !BR2_PTHREADS_NONE
-
- config BR2_GDB_VERSION_7_1
- bool "gdb 7.1"
- select BR2_PTHREAD_DEBUG if !BR2_PTHREADS_NONE
-
-endchoice
-
-config BR2_GDB_VERSION
- string
- default "6.6" if BR2_GDB_VERSION_6_6
- default "6.7.1" if BR2_GDB_VERSION_6_7_1
- default "6.7.1-avr32-2.1.5" if BR2_GDB_VERSION_6_7_1_AVR32_2_1_5
- default "6.8" if BR2_GDB_VERSION_6_8
- default "7.0.1" if BR2_GDB_VERSION_7_0_1
- default "7.1" if BR2_GDB_VERSION_7_1
diff --git a/toolchain/gdb/gdb.mk b/toolchain/gdb/gdb.mk
deleted file mode 100644
index af08d1e..0000000
--- a/toolchain/gdb/gdb.mk
+++ /dev/null
@@ -1,237 +0,0 @@
-######################################################################
-#
-# gdb
-#
-######################################################################
-GDB_VERSION:=$(call qstrip,$(BR2_GDB_VERSION))
-
-GDB_SOURCE:=gdb-$(GDB_VERSION).tar.bz2
-GDB_CAT:=$(BZCAT)
-
-ifeq ($(findstring avr32,$(GDB_VERSION)),avr32)
- GDB_SITE:=ftp://www.at91.com/pub/buildroot/
- GDB_PATCH_DIR:=toolchain/gdb/$(GDB_VERSION)
-else
- GDB_SITE:=$(BR2_GNU_MIRROR)/gdb
- GDB_PATCH_DIR:=toolchain/gdb/$(GDB_VERSION)
-endif
-
-ifneq ($(filter xtensa%,$(ARCH)),)
-include target/xtensa/patch.in
-GDB_PATCH_EXTRA:=$(call XTENSA_PATCH,gdb,$(GDB_PATCH_DIR),. ..)
-endif
-
-GDB_DIR:=$(TOOLCHAIN_DIR)/gdb-$(GDB_VERSION)
-
-$(DL_DIR)/$(GDB_SOURCE):
- $(call DOWNLOAD,$(GDB_SITE),$(GDB_SOURCE))
-
-gdb-unpacked: $(GDB_DIR)/.unpacked
-$(GDB_DIR)/.unpacked: $(DL_DIR)/$(GDB_SOURCE)
- mkdir -p $(TOOLCHAIN_DIR)
- $(GDB_CAT) $(DL_DIR)/$(GDB_SOURCE) | tar -C $(TOOLCHAIN_DIR) $(TAR_OPTIONS) -
-ifeq ($(GDB_VERSION),snapshot)
- GDB_REAL_DIR=$(shell \
- tar jtf $(DL_DIR)/$(GDB_SOURCE) | head -1 | cut -d"/" -f1)
- ln -sf $(TOOLCHAIN_DIR)/$(shell tar jtf $(DL_DIR)/$(GDB_SOURCE) | head -1 | cut -d"/" -f1) $(GDB_DIR)
-endif
-ifneq ($(wildcard $(GDB_PATCH_DIR)),)
- toolchain/patch-kernel.sh $(GDB_DIR) $(GDB_PATCH_DIR) \*.patch $(GDB_PATCH_EXTRA)
-endif
- $(CONFIG_UPDATE) $(@D)
- touch $@
-
-gdb-patched: $(GDB_DIR)/.unpacked
-
-gdb-source: $(DL_DIR)/$(GDB_SOURCE)
-gdb-dirclean:
- rm -rf $(GDB_DIR)
-
-######################################################################
-#
-# gdb target
-#
-######################################################################
-
-GDB_TARGET_DIR:=$(BUILD_DIR)/gdb-$(GDB_VERSION)-target
-
-GDB_TARGET_CONFIGURE_VARS:= \
- ac_cv_type_uintptr_t=yes \
- gt_cv_func_gettext_libintl=yes \
- ac_cv_func_dcgettext=yes \
- gdb_cv_func_sigsetjmp=yes \
- bash_cv_func_strcoll_broken=no \
- bash_cv_must_reinstall_sighandlers=no \
- bash_cv_func_sigsetjmp=present \
- bash_cv_have_mbstate_t=yes
-
-$(GDB_TARGET_DIR)/.configured: $(GDB_DIR)/.unpacked
- mkdir -p $(GDB_TARGET_DIR)
- (cd $(GDB_TARGET_DIR); \
- gdb_cv_func_sigsetjmp=yes \
- $(TARGET_CONFIGURE_OPTS) \
- CFLAGS_FOR_TARGET="$(TARGET_CFLAGS) $(TARGET_LDFLAGS) -Wno-error" \
- CFLAGS="$(TARGET_CFLAGS) $(TARGET_LDFLAGS) -Wno-error" \
- $(GDB_TARGET_CONFIGURE_VARS) \
- $(GDB_DIR)/configure $(QUIET) \
- --cache-file=/dev/null \
- --build=$(GNU_HOST_NAME) \
- --host=$(REAL_GNU_TARGET_NAME) \
- --target=$(REAL_GNU_TARGET_NAME) \
- --prefix=/usr \
- $(DISABLE_NLS) \
- --without-uiout $(DISABLE_GDBMI) \
- --disable-tui --disable-gdbtk --without-x \
- --disable-sim --enable-gdbserver \
- --without-included-gettext \
- --disable-werror \
- $(QUIET) \
- )
-ifeq ($(BR2_ENABLE_LOCALE),y)
- -$(SED) "s,^INTL *=.*,INTL = -lintl,g;" $(GDB_DIR)/gdb/Makefile
-endif
- touch $@
-
-$(GDB_TARGET_DIR)/gdb/gdb: $(GDB_TARGET_DIR)/.configured
- # force ELF support since it fails due to BFD linking problems
- gdb_cv_var_elf=yes \
- $(MAKE) CC="$(TARGET_CC)" MT_CFLAGS="$(TARGET_CFLAGS)" \
- -C $(GDB_TARGET_DIR)
-
-$(TARGET_DIR)/usr/bin/gdb: $(GDB_TARGET_DIR)/gdb/gdb
- install -c -D $(GDB_TARGET_DIR)/gdb/gdb $(TARGET_DIR)/usr/bin/gdb
-
-gdb_target: ncurses $(TARGET_DIR)/usr/bin/gdb
-
-gdb_target-source: $(DL_DIR)/$(GDB_SOURCE)
-
-gdb_target-clean:
- -$(MAKE) -C $(GDB_DIR) clean
-
-gdb_target-dirclean:
- rm -rf $(GDB_DIR)
-
-######################################################################
-#
-# gdbserver
-#
-######################################################################
-
-GDB_SERVER_DIR:=$(BUILD_DIR)/gdbserver-$(GDB_VERSION)
-
-$(GDB_SERVER_DIR)/.configured: $(GDB_DIR)/.unpacked
- mkdir -p $(GDB_SERVER_DIR)
- (cd $(GDB_SERVER_DIR); \
- $(TARGET_CONFIGURE_OPTS) \
- gdb_cv_func_sigsetjmp=yes \
- bash_cv_have_mbstate_t=yes \
- $(GDB_DIR)/gdb/gdbserver/configure $(QUIET) \
- --cache-file=/dev/null \
- --build=$(GNU_HOST_NAME) \
- --host=$(REAL_GNU_TARGET_NAME) \
- --target=$(REAL_GNU_TARGET_NAME) \
- --prefix=/usr \
- --exec-prefix=/usr \
- --bindir=/usr/bin \
- --sbindir=/usr/sbin \
- --libexecdir=/usr/lib \
- --sysconfdir=/etc \
- --datadir=/usr/share \
- --localstatedir=/var \
- --mandir=/usr/man \
- --infodir=/usr/info \
- --includedir=$(STAGING_DIR)/usr/include \
- $(DISABLE_NLS) \
- --without-uiout $(DISABLE_GDBMI) \
- --disable-tui --disable-gdbtk --without-x \
- --without-included-gettext \
- )
- touch $@
-
-$(GDB_SERVER_DIR)/gdbserver: $(GDB_SERVER_DIR)/.configured
- $(MAKE) CC="$(TARGET_CC)" MT_CFLAGS="$(TARGET_CFLAGS)" \
- -C $(GDB_SERVER_DIR)
-
-$(TARGET_DIR)/usr/bin/gdbserver: $(GDB_SERVER_DIR)/gdbserver
-ifeq ($(BR2_CROSS_TOOLCHAIN_TARGET_UTILS),y)
- mkdir -p $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/target_utils
- install -c $(GDB_SERVER_DIR)/gdbserver \
- $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/target_utils/gdbserver
-endif
- install -c -D $(GDB_SERVER_DIR)/gdbserver $(TARGET_DIR)/usr/bin/gdbserver
-
-gdbserver: $(TARGET_DIR)/usr/bin/gdbserver
-
-gdbserver-source: $(DL_DIR)/$(GDB_SOURCE)
-
-gdbserver-clean:
- -$(MAKE) -C $(GDB_SERVER_DIR) clean
-
-gdbserver-dirclean:
- rm -rf $(GDB_SERVER_DIR)
-
-######################################################################
-#
-# gdb on host
-#
-######################################################################
-
-GDB_HOST_DIR:=$(TOOLCHAIN_DIR)/gdbhost-$(GDB_VERSION)
-
-$(GDB_HOST_DIR)/.configured: $(GDB_DIR)/.unpacked
- mkdir -p $(GDB_HOST_DIR)
- (cd $(GDB_HOST_DIR); \
- gdb_cv_func_sigsetjmp=yes \
- bash_cv_have_mbstate_t=yes \
- $(GDB_DIR)/configure $(QUIET) \
- --cache-file=/dev/null \
- --prefix=$(STAGING_DIR) \
- --build=$(GNU_HOST_NAME) \
- --host=$(GNU_HOST_NAME) \
- --target=$(REAL_GNU_TARGET_NAME) \
- $(DISABLE_NLS) \
- --without-uiout $(DISABLE_GDBMI) \
- --disable-tui --disable-gdbtk --without-x \
- --without-included-gettext \
- --enable-threads \
- --disable-werror \
- )
- touch $@
-
-$(GDB_HOST_DIR)/gdb/gdb: $(GDB_HOST_DIR)/.configured
- $(MAKE) -C $(GDB_HOST_DIR)
- strip $(GDB_HOST_DIR)/gdb/gdb
-
-$(TARGET_CROSS)gdb: $(GDB_HOST_DIR)/gdb/gdb
- install -c $(GDB_HOST_DIR)/gdb/gdb $(TARGET_CROSS)gdb
- ln -snf ../../bin/$(REAL_GNU_TARGET_NAME)-gdb \
- $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/gdb
- ln -snf $(REAL_GNU_TARGET_NAME)-gdb \
- $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-gdb
-
-gdbhost: $(TARGET_CROSS)gdb
-
-gdbhost-source: $(DL_DIR)/$(GDB_SOURCE)
-
-gdbhost-clean:
- -$(MAKE) -C $(GDB_HOST_DIR) clean
-
-gdbhost-dirclean:
- rm -rf $(GDB_HOST_DIR)
-
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
-ifeq ($(BR2_PACKAGE_GDB),y)
-TARGETS+=gdb_target
-endif
-
-ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
-TARGETS+=gdbserver
-endif
-
-ifeq ($(BR2_PACKAGE_GDB_HOST),y)
-TARGETS+=gdbhost
-endif
diff --git a/toolchain/toolchain-buildroot.mk b/toolchain/toolchain-buildroot.mk
index c611562..764a1da 100644
--- a/toolchain/toolchain-buildroot.mk
+++ b/toolchain/toolchain-buildroot.mk
@@ -3,7 +3,6 @@
include toolchain/dependencies/dependencies.mk
include toolchain/elf2flt/elf2flt.mk
include toolchain/gcc/gcc-uclibc-4.x.mk
-include toolchain/gdb/gdb.mk
include toolchain/kernel-headers/kernel-headers.mk
include toolchain/mklibs/mklibs.mk
include toolchain/uClibc/uclibc.mk
diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in
index 3894890..485ab7c 100644
--- a/toolchain/toolchain-buildroot/Config.in
+++ b/toolchain/toolchain-buildroot/Config.in
@@ -5,4 +5,5 @@ source "toolchain/kernel-headers/Config.in"
source "toolchain/uClibc/Config.in"
source "package/binutils/Config.in.host"
source "toolchain/gcc/Config.in"
+source "package/gdb/Config.in.host"
endif
diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
index bdc6e76..1276305 100644
--- a/toolchain/toolchain-common.in
+++ b/toolchain/toolchain-common.in
@@ -1,10 +1,5 @@
# Generic toolchain options
-# we want gdb config in the middle of both source and external
-# toolchains, but mconf won't let us source the same file twice,
-# so put it here instead
-source "toolchain/gdb/Config.in"
-
config BR2_LARGEFILE
bool
diff --git a/toolchain/toolchain-crosstool-ng.mk b/toolchain/toolchain-crosstool-ng.mk
index e480da9..5b0cc4e 100644
--- a/toolchain/toolchain-crosstool-ng.mk
+++ b/toolchain/toolchain-crosstool-ng.mk
@@ -5,7 +5,6 @@ include toolchain/helpers.mk
include toolchain/dependencies/dependencies.mk
include toolchain/elf2flt/elf2flt.mk
include toolchain/gcc/gcc-uclibc-4.x.mk
-include toolchain/gdb/gdb.mk
include toolchain/toolchain-crosstool-ng/crosstool-ng.mk
include toolchain/mklibs/mklibs.mk
include toolchain/uClibc/uclibc.mk
diff --git a/toolchain/toolchain-external.mk b/toolchain/toolchain-external.mk
index d67405b..4ade92a 100644
--- a/toolchain/toolchain-external.mk
+++ b/toolchain/toolchain-external.mk
@@ -4,7 +4,6 @@ include toolchain/helpers.mk
include toolchain/dependencies/dependencies.mk
include toolchain/elf2flt/elf2flt.mk
include toolchain/gcc/gcc-uclibc-4.x.mk
-include toolchain/gdb/gdb.mk
include toolchain/kernel-headers/kernel-headers.mk
include toolchain/mklibs/mklibs.mk
include toolchain/toolchain-external/ext-tool.mk
--
1.7.2.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 02/13] php: libgmp was renamed to gmp
2010-12-14 19:05 ` [Buildroot] [PATCH 02/13] php: libgmp was renamed to gmp Gustavo Zacarias
@ 2010-12-14 19:49 ` Yann E. MORIN
0 siblings, 0 replies; 22+ messages in thread
From: Yann E. MORIN @ 2010-12-14 19:49 UTC (permalink / raw)
To: buildroot
Gustavo, All,
On Tuesday 14 December 2010 20:05:58 Gustavo Zacarias wrote:
> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
> ---
> package/php/Config.ext | 2 +-
> package/php/php.mk | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
I think this should be folded into the previous patch.
First, with only the first patch, the build is broken.
Second, as a direct consequennce, it breaks bisecting.
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 05/13] package infra: fix versioned patches for host packages
2010-12-14 19:06 ` [Buildroot] [PATCH 05/13] package infra: fix versioned patches for host packages Gustavo Zacarias
@ 2010-12-14 19:54 ` Yann E. MORIN
0 siblings, 0 replies; 22+ messages in thread
From: Yann E. MORIN @ 2010-12-14 19:54 UTC (permalink / raw)
To: buildroot
Gustavo, All,
On Tuesday 14 December 2010 20:06:01 Gustavo Zacarias wrote:
> Without this patch we'd need separate versioned patch directories for
> target and host packages, thus having unwanted duplication.
Maybe this should come first, before the gmp/mpfr/mpc patches?
I believe it is not related to making toolchain components proper packages.
I mean, it can be seen as a bug in the existing infra, so has to come before
the actual changes that do need it, or uncovered the issue, no?
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 07/13] toolchain: move sysroot to host dir
2010-12-14 19:06 ` [Buildroot] [PATCH 07/13] toolchain: move sysroot to host dir Gustavo Zacarias
@ 2010-12-14 19:58 ` Yann E. MORIN
2010-12-14 20:45 ` Yann E. MORIN
2010-12-16 10:49 ` Thomas Petazzoni
1 sibling, 1 reply; 22+ messages in thread
From: Yann E. MORIN @ 2010-12-14 19:58 UTC (permalink / raw)
To: buildroot
Gustavo, All,
On Tuesday 14 December 2010 20:06:03 Gustavo Zacarias wrote:
> * Drop the BR2_STAGING_DIR option
> * Hardcode STAGING_DIR to $(HOST_DIR)/usr/TUPLE/sysroot
Why do you need that?
The fact that the user can set this location is to be able to use the
toolchain outside of buildroot, without need to relocate it.
Something to do with what we wanted to do for the SDK, IIRC.
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 09/13] binutils: make it a proper package
2010-12-14 19:06 ` [Buildroot] [PATCH 09/13] binutils: make it a proper package Gustavo Zacarias
@ 2010-12-14 20:14 ` Yann E. MORIN
0 siblings, 0 replies; 22+ messages in thread
From: Yann E. MORIN @ 2010-12-14 20:14 UTC (permalink / raw)
To: buildroot
On Tuesday 14 December 2010 20:06:05 Gustavo Zacarias wrote:
> * Convert binutils to a proper autotargets package
> * Add version 2.21
> * Drop version 2.17
I won't speak for Peter, but I'd suggest at least two patches:
- one to convert
- one to add/drop
This will make it easier to review, because: TL-DR. :-p
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 07/13] toolchain: move sysroot to host dir
2010-12-14 19:58 ` Yann E. MORIN
@ 2010-12-14 20:45 ` Yann E. MORIN
0 siblings, 0 replies; 22+ messages in thread
From: Yann E. MORIN @ 2010-12-14 20:45 UTC (permalink / raw)
To: buildroot
Gustavo, All,
On Tuesday 14 December 2010 20:58:45 Yann E. MORIN wrote:
> On Tuesday 14 December 2010 20:06:03 Gustavo Zacarias wrote:
> > * Drop the BR2_STAGING_DIR option
> > * Hardcode STAGING_DIR to $(HOST_DIR)/usr/TUPLE/sysroot
> Why do you need that?
> The fact that the user can set this location is to be able to use the
> toolchain outside of buildroot, without need to relocate it.
> Something to do with what we wanted to do for the SDK, IIRC.
OK, forget my comment. Resolved on IRC:
- have the _staging_ to be the sysroot
- later, offer an option to move the _toolchain_
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 07/13] toolchain: move sysroot to host dir
2010-12-14 19:06 ` [Buildroot] [PATCH 07/13] toolchain: move sysroot to host dir Gustavo Zacarias
2010-12-14 19:58 ` Yann E. MORIN
@ 2010-12-16 10:49 ` Thomas Petazzoni
2010-12-16 11:00 ` Gustavo Zacarias
1 sibling, 1 reply; 22+ messages in thread
From: Thomas Petazzoni @ 2010-12-16 10:49 UTC (permalink / raw)
To: buildroot
Gustavo,
On Tue, 14 Dec 2010 16:06:03 -0300
Gustavo Zacarias <gustavo@zacarias.com.ar> wrote:
> diff --git a/Makefile b/Makefile
> index f6ab07e..d7d6f8d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -268,8 +268,6 @@ TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
>
> GNU_TARGET_SUFFIX:=-$(call qstrip,$(BR2_GNU_TARGET_SUFFIX))
>
> -STAGING_DIR:=$(call qstrip,$(BR2_STAGING_DIR))
> -
> # packages compiled for the host goes here
> HOST_DIR:=$(BASE_DIR)/host
>
> @@ -294,6 +292,8 @@ endif
> include toolchain/Makefile.in
> include package/Makefile.in
>
> +STAGING_DIR:=$(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/sysroot
This change breaks the ccache support, because when
--sysroot=$(STAGING_DIR) is used, STAGING_DIR expands to nothing,
because the definition of STAGING_DIR has been moved *after* the
inclusion of package/Makefile.in. Any reason why you moved the
definition ?
Regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 07/13] toolchain: move sysroot to host dir
2010-12-16 10:49 ` Thomas Petazzoni
@ 2010-12-16 11:00 ` Gustavo Zacarias
2010-12-16 14:13 ` Gustavo Zacarias
0 siblings, 1 reply; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-16 11:00 UTC (permalink / raw)
To: buildroot
On 12/16/2010 07:49 AM, Thomas Petazzoni wrote:
>> include toolchain/Makefile.in
>> include package/Makefile.in
>>
>> +STAGING_DIR:=$(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/sysroot
>
> This change breaks the ccache support, because when
> --sysroot=$(STAGING_DIR) is used, STAGING_DIR expands to nothing,
> because the definition of STAGING_DIR has been moved *after* the
> inclusion of package/Makefile.in. Any reason why you moved the
> definition ?
>
> Regards,
>
> Thomas
Yes, REAL_GNU_TARGET_NAME is filled in package/Makefile.in and we need it.
Maybe we can move it to the toolchain directory where it even sounds
more appropiate?
Regards.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Buildroot] [PATCH 07/13] toolchain: move sysroot to host dir
2010-12-16 11:00 ` Gustavo Zacarias
@ 2010-12-16 14:13 ` Gustavo Zacarias
0 siblings, 0 replies; 22+ messages in thread
From: Gustavo Zacarias @ 2010-12-16 14:13 UTC (permalink / raw)
To: buildroot
On 12/16/10 08:00, Gustavo Zacarias wrote:
> On 12/16/2010 07:49 AM, Thomas Petazzoni wrote:
>
>>> include toolchain/Makefile.in
>>> include package/Makefile.in
>>>
>>> +STAGING_DIR:=$(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/sysroot
>>
>> This change breaks the ccache support, because when
>> --sysroot=$(STAGING_DIR) is used, STAGING_DIR expands to nothing,
>> because the definition of STAGING_DIR has been moved *after* the
>> inclusion of package/Makefile.in. Any reason why you moved the
>> definition ?
>>
>> Regards,
>>
>> Thomas
>
> Yes, REAL_GNU_TARGET_NAME is filled in package/Makefile.in and we need it.
> Maybe we can move it to the toolchain directory where it even sounds
> more appropiate?
> Regards.
After a small chat on IRC we decided to move STAGING_DIR computation to
package/Makefile.in and moved GNU_TARGET_NAME/REAL_GNU_TARGET_NAME
computation before other bits in the same place.
Thanks.
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2010-12-16 14:13 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-14 19:05 [Buildroot] [PATCH 00/13] Toolchain rework, take 2 Gustavo Zacarias
2010-12-14 19:05 ` [Buildroot] [PATCH 01/13] gmp: make it a proper package and bump to version 5.0.1 Gustavo Zacarias
2010-12-14 19:05 ` [Buildroot] [PATCH 02/13] php: libgmp was renamed to gmp Gustavo Zacarias
2010-12-14 19:49 ` Yann E. MORIN
2010-12-14 19:05 ` [Buildroot] [PATCH 03/13] mpfr: make it a proper package and bump to version 3.0.0-p8 Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 04/13] mpc: make it a proper package Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 05/13] package infra: fix versioned patches for host packages Gustavo Zacarias
2010-12-14 19:54 ` Yann E. MORIN
2010-12-14 19:06 ` [Buildroot] [PATCH 06/13] sstrip: make it a proper package Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 07/13] toolchain: move sysroot to host dir Gustavo Zacarias
2010-12-14 19:58 ` Yann E. MORIN
2010-12-14 20:45 ` Yann E. MORIN
2010-12-16 10:49 ` Thomas Petazzoni
2010-12-16 11:00 ` Gustavo Zacarias
2010-12-16 14:13 ` Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 08/13] uclibc: move tools " Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 09/13] binutils: make it a proper package Gustavo Zacarias
2010-12-14 20:14 ` Yann E. MORIN
2010-12-14 19:06 ` [Buildroot] [PATCH 10/13] gcc: cleanup and hook Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 11/13] gcc: install copies of libgcc, libstdc++ and libgcj to the sysroot too Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 12/13] uclibc: fix program invocation name config option for the snapshot version Gustavo Zacarias
2010-12-14 19:06 ` [Buildroot] [PATCH 13/13] gdb: make it a proper package Gustavo Zacarias
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox