Project import
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..aa0f4ba
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,166 @@
+#
+#    Copyright (c) 2010-2014 Nest Labs, Inc.
+#    All rights reserved.
+#
+#    This document is the property of Nest. It is considered
+#    confidential and proprietary information.
+#
+#    This document may not be reproduced or transmitted in any form,
+#    in whole or in part, without the express written permission of
+#    Nest.
+#
+#    Description:
+#      This file is the makefile for the GNU binary utilities
+#      (binutils).
+#
+#      The following set of packages MUST be a matched set:
+#
+#	 * Target Binary Utilities
+#        * Target GNU C Standard Library
+#        * Target GNU C++ Standard Library
+#        * Target GDB server and client
+#	 * Host Cross Binary Utilities
+#	 * Host Cross Compilers
+#        * Host Cross GDB client
+#
+#      These are presumed provided by the tool chain and are simply
+#      sourced from it rather than built anew from source.
+#
+#      However, for tool chains that do NOT provide target-based
+#      binutils (e.g. CodeSourcery Sourcery G++), this source-built
+#      instance should provide a reasonable alternative. NOTE though, not
+#      having binutils matched to the tool chain can result in sometimes
+#      undefined results.
+#
+
+include pre.mak
+
+EnableImplicitRules = N
+
+PackageName		:= binutils
+
+PackageExtension	:= tar.bz2
+PackageSeparator	:= -
+
+PackagePatchArgs	:= -p1
+
+PackageArchive		:= $(PackageName).$(PackageExtension)
+PackageSourceDir	:= $(PackageName)$(PackageSeparator)$(PackageVersion)
+
+PackageBuildMakefile	= $(call GenerateBuildPaths,Makefile)
+
+LicenseSourceFiles	:= COPYING COPYING3 COPYING3.LIB COPYING.LIB
+LicenseSourcePaths	:= $(addprefix $(PackageSourceDir)/,$(LicenseSourceFiles))
+
+CleanPaths		+= $(PackageLicenseFile)
+
+LibibertyHeaderName	= libiberty.h
+LibibertySourcePath	= $(PackageSourceDir)/include/$(LibibertyHeaderName)
+LibibertyResultPath	= $(ResultDirectory)/usr/include/$(LibibertyHeaderName)
+
+SOURCEDIRS                      = $(PackageSourceDir)
+$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure
+
+all: $(PackageDefaultGoal)
+
+# Generate the package license contents.
+
+$(LicenseSourcePaths): $(BuildDirectory)/source
+
+$(PackageLicenseFile): $(LicenseSourcePaths)
+	$(Verbose)touch $@
+	$(Verbose)for file in $(LicenseSourcePaths); do	\
+		cat $${file} >> $@;			\
+	done
+
+# Extract the source from the archive and apply patches, if any.
+
+$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
+	$(expand-and-patch-package)
+
+# Prepare the sources.
+
+$(BuildDirectory)/source: | $(PackageSourceDir) $(BuildDirectory)
+	$(Verbose)touch $@
+
+# Patch the sources, if necessary.
+
+$(BuildDirectory)/patch: $(BuildDirectory)/source | $(BuildDirectory)
+	$(Verbose)touch $@
+
+# Generate the package build makefile.
+BinutilsCFlags += '-Wno-error'
+
+# Configure the source for building.
+
+$(BuildDirectory)/configure: $(BuildDirectory)/source | $(PackageSourceDir) $(BuildDirectory)
+	$(Verbose)cd $(BuildDirectory) && \
+	$(CURDIR)/$(PackageSourceDir)/configure \
+	CC="$(CC) $(CPPOPTFLAGS)" CXX="$(CXX) $(CPPOPTFLAGS)" AR=$(AR) NM=$(NM) RANLIB=$(RANLIB) STRIP=$(STRIP) \
+	CPPFLAGS="$(call ToolGenerateIncludeArgument,$(LinuxIncludePath))" \
+	CFLAGS=$(BinutilsCFlags) \
+	--build=$(HostTuple) \
+	--host=$(TargetTuple) \
+	--enable-shared \
+	--prefix=/usr \
+	--sysconfdir=/etc \
+	--disable-static
+	$(Verbose)touch $@
+
+# Build the source.
+
+$(BuildDirectory)/build: $(BuildDirectory)/configure | $(BuildDirectory)
+	$(Verbose)$(MAKE) -C $(BuildDirectory) all
+	$(Verbose)touch $@
+
+# Stage the build to a temporary installation area.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+#
+# We explictly remove 'libfoo.la' because some packages that depend on
+# these libraries use libtool. If libtool finds a 'libfoo.la' file for
+# a library, it uses the value of 'libdir=<dir>' it finds. In our
+# case, since '--prefix=/usr' this value is '/usr/lib'. It then
+# resolves '-lfoo'. In a cross-compilation environment, this is likely
+# to be neither the right architecture nor the right version to link
+# against. In short, we lose.
+#
+# We could also handle this by removing DESTDIR and setting the prefix
+# to $(ResultDirectory); however, that results in libtool hard-coding
+# $(ResultDirectory) as the RPATH in the linked executables which is
+# NOT what we want either. We lose again.
+#
+# By removing the '*.la' file, we win by ensuring neither a misdirected
+# link nor an RPATH.
+
+.PHONY: stage
+stage: $(BuildDirectory)/stage-default $(BuildDirectory)/stage-headers
+
+$(BuildDirectory)/stage-default: $(BuildDirectory)/build | $(ResultDirectory) $(BuildDirectory)
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) -C $(BuildDirectory) \
+	DESTDIR=$(ResultDirectory) \
+	install
+	$(Verbose)$(RM) $(RMFLAGS) $(call GenerateResultPaths,,usr/lib/libbfd.la usr/lib/libopcodes.la)
+	$(Verbose)touch $@
+
+# For some reason, binutils refuses to install the development headers
+# associated with the libiberty library, despite all attempts to get
+# it to do so automatically. Consquently, we have a dedicated target
+# here to ensure it happens as some debug and performance packages
+# depend on the presence of this header.
+
+$(BuildDirectory)/stage-headers: $(LibibertyResultPath) | $(BuildDirectory)
+	$(Verbose)touch $@
+
+$(LibibertySourcePath): | $(PackageSourceDir)
+
+$(LibibertyResultPath): $(LibibertySourcePath) $(BuildDirectory)/stage-default | $(ResultDirectory)
+	$(copy-result)
+
+clean:
+	$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
+
+include post.mak
diff --git a/binutils.patches/binutils-50.description b/binutils.patches/binutils-50.description
new file mode 100644
index 0000000..102e697
--- /dev/null
+++ b/binutils.patches/binutils-50.description
@@ -0,0 +1 @@
+This patch addresses a compiler error for GCC 4.5 in which firsttype may be used uninitialized.
diff --git a/binutils.patches/binutils-50.patch b/binutils.patches/binutils-50.patch
new file mode 100644
index 0000000..c59b420
--- /dev/null
+++ b/binutils.patches/binutils-50.patch
@@ -0,0 +1,12 @@
+diff -aruN a/gas/config/tc-arm.c b/gas/config/tc-arm.c
+--- a/gas/config/tc-arm.c	2010-02-22 00:06:52.000000000 -0800
++++ b/gas/config/tc-arm.c	2011-08-02 13:11:39.000000000 -0700
+@@ -1878,6 +1878,8 @@
+   if (skip_past_char (&ptr, '{') == SUCCESS)
+     leading_brace = 1;
+ 
++  memset(&firsttype, 0, sizeof (firsttype));
++
+   do
+     {
+       struct neon_typed_alias atype;
diff --git a/binutils.patches/binutils-51.description b/binutils.patches/binutils-51.description
new file mode 100644
index 0000000..35cb6db
--- /dev/null
+++ b/binutils.patches/binutils-51.description
@@ -0,0 +1 @@
+Fixes errors in compilation of tex documentation on Ubuntu 14.04 hosts
diff --git a/binutils.patches/binutils-51.patch b/binutils.patches/binutils-51.patch
new file mode 100644
index 0000000..54651fd
--- /dev/null
+++ b/binutils.patches/binutils-51.patch
@@ -0,0 +1,42 @@
+diff -Naur a/bfd/doc/bfd.texinfo b/bfd/doc/bfd.texinfo
+--- a/bfd/doc/bfd.texinfo	2014-07-08 20:16:50.816554234 -0700
++++ b/bfd/doc/bfd.texinfo	2014-07-08 20:24:18.179356445 -0700
+@@ -323,7 +323,7 @@
+ @printindex cp
+ 
+ @tex
+-% I think something like @colophon should be in texinfo.  In the
++% I think something like @@colophon should be in texinfo.  In the
+ % meantime:
+ \long\def\colophon{\hbox to0pt{}\vfill
+ \centerline{The body of this manual is set in}
+@@ -334,7 +334,7 @@
+ \centerline{{\sl\fontname\tensl\/}}
+ \centerline{are used for emphasis.}\vfill}
+ \page\colophon
+-% Blame: doc@cygnus.com, 28mar91.
++% Blame: doc@@cygnus.com, 28mar91.
+ @end tex
+ 
+ @bye
+diff -Naur a/ld/ld.texinfo b/ld/ld.texinfo
+--- a/ld/ld.texinfo	2014-07-08 20:16:50.768553990 -0700
++++ b/ld/ld.texinfo	2014-07-08 20:24:18.143356161 -0700
+@@ -7509,7 +7509,7 @@
+ @printindex cp
+ 
+ @tex
+-% I think something like @colophon should be in texinfo.  In the
++% I think something like @@colophon should be in texinfo.  In the
+ % meantime:
+ \long\def\colophon{\hbox to0pt{}\vfill
+ \centerline{The body of this manual is set in}
+@@ -7520,7 +7520,7 @@
+ \centerline{{\sl\fontname\tensl\/}}
+ \centerline{are used for emphasis.}\vfill}
+ \page\colophon
+-% Blame: doc@cygnus.com, 28mar91.
++% Blame: doc@@cygnus.com, 28mar91.
+ @end tex
+ 
+ @bye
diff --git a/binutils.patches/binutils-52.description b/binutils.patches/binutils-52.description
new file mode 100644
index 0000000..bb44b6a
--- /dev/null
+++ b/binutils.patches/binutils-52.description
@@ -0,0 +1 @@
+Support Local Linux Headers
diff --git a/binutils.patches/binutils-52.patch b/binutils.patches/binutils-52.patch
new file mode 100644
index 0000000..f87cebc
--- /dev/null
+++ b/binutils.patches/binutils-52.patch
@@ -0,0 +1,19 @@
+diff -Naur a/Makefile.in b/Makefile.in
+--- a/Makefile.in	2016-09-14 15:05:50.120686685 -0700
++++ b/Makefile.in	2016-09-14 17:00:11.602847507 -0700
+@@ -188,6 +188,7 @@
+ 	ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
+ 	CFLAGS="$(CFLAGS)"; export CFLAGS; \
+ 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
++	CPPFLAGS="$(CPPFLAGS)"; export CPPFLAGS; \
+ 	CXX="$(CXX)"; export CXX; \
+ 	CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
+ 	GCJ="$(GCJ)"; export GCJ; \
+@@ -375,6 +376,7 @@
+ GNATBIND = @GNATBIND@
+ GNATMAKE = @GNATMAKE@
+ 
++CPPFLAGS = @CPPFLAGS@
+ CFLAGS = @CFLAGS@
+ LDFLAGS = @LDFLAGS@
+ LIBCFLAGS = $(CFLAGS)
diff --git a/binutils.patches/binutils-53.description b/binutils.patches/binutils-53.description
new file mode 100644
index 0000000..dc8ebe1
--- /dev/null
+++ b/binutils.patches/binutils-53.description
@@ -0,0 +1,8 @@
+Backport of upstream fix for -Werror=redundant-decls errors.
+
+2012-03-29  Alan Modra  <amodra@gmail.com>
+
+   * bfd-in.h (bfd_get_arch_size, bfd_get_sign_extend_vma): Delete.
+   * bfd-in2.h: Regenerate.
+
+https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=f67f98b55b74d346ef535a01efdcc467f220b356
diff --git a/binutils.patches/binutils-53.patch b/binutils.patches/binutils-53.patch
new file mode 100644
index 0000000..0050b66
--- /dev/null
+++ b/binutils.patches/binutils-53.patch
@@ -0,0 +1,36 @@
+diff -Naur a/bfd/bfd-in2.h b/bfd/bfd-in2.h
+--- a/bfd/bfd-in2.h	2017-05-01 17:52:58.882686963 -0700
++++ b/bfd/bfd-in2.h	2017-05-01 17:52:31.334345847 -0700
+@@ -694,14 +694,6 @@
+   (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+    int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len));
+ 
+-/* Return the arch_size field of an elf bfd, or -1 if not elf.  */
+-extern int bfd_get_arch_size
+-  (bfd *);
+-
+-/* Return TRUE if address "naturally" sign extends, or -1 if not elf.  */
+-extern int bfd_get_sign_extend_vma
+-  (bfd *);
+-
+ extern struct bfd_section *_bfd_elf_tls_setup
+   (bfd *, struct bfd_link_info *);
+ 
+diff -Naur a/bfd/bfd-in.h b/bfd/bfd-in.h
+--- a/bfd/bfd-in.h	2017-05-01 17:52:58.886687012 -0700
++++ b/bfd/bfd-in.h	2017-05-01 17:52:31.334345847 -0700
+@@ -687,14 +687,6 @@
+   (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+    int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len));
+ 
+-/* Return the arch_size field of an elf bfd, or -1 if not elf.  */
+-extern int bfd_get_arch_size
+-  (bfd *);
+-
+-/* Return TRUE if address "naturally" sign extends, or -1 if not elf.  */
+-extern int bfd_get_sign_extend_vma
+-  (bfd *);
+-
+ extern struct bfd_section *_bfd_elf_tls_setup
+   (bfd *, struct bfd_link_info *);
+ 
diff --git a/binutils.tar.bz2 b/binutils.tar.bz2
new file mode 100644
index 0000000..a5ddf7f
--- /dev/null
+++ b/binutils.tar.bz2
Binary files differ
diff --git a/binutils.url b/binutils.url
new file mode 100644
index 0000000..7ef7bf4
--- /dev/null
+++ b/binutils.url
@@ -0,0 +1 @@
+http://ftp.gnu.org/gnu/binutils/binutils-2.20.1.tar.bz2
diff --git a/binutils.version b/binutils.version
new file mode 100644
index 0000000..4e2200b
--- /dev/null
+++ b/binutils.version
@@ -0,0 +1 @@
+2.20.1