Upgrading binutils to 2.25 for -ggnu-pubnames

To make static_library builds fast we need binutils 2.25 to enable
-ggnu-pubnames support.

The ehframe-race.patch is removed because it is now included upstream. Dates
and expected release versions have been added for the remaining patches to make
it easier to upgrade in the future.

(Also use a precise chroot rather than lucid for building binutils.)

BUG=374952

Committed: https://crrev.com/1a4e8c12aa264a54432b38fa009b0aa4814caea1
Cr-Commit-Position: refs/heads/master@{#351019}

Review URL: https://codereview.chromium.org/1368233002

Cr-Original-Commit-Position: refs/heads/master@{#351682}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: c46156fa7b05d0cf3cb1f317e092310e155ed3ad
diff --git a/Linux_ia32/binutils.tar.bz2.sha1 b/Linux_ia32/binutils.tar.bz2.sha1
index f675c4a..ced91d2 100644
--- a/Linux_ia32/binutils.tar.bz2.sha1
+++ b/Linux_ia32/binutils.tar.bz2.sha1
@@ -1 +1 @@
-27e33f55580447b20eac71849a04168274aab7e8
\ No newline at end of file
+a0d516b95f19512a112cdad25259dd56b369863e
\ No newline at end of file
diff --git a/Linux_x64/binutils.tar.bz2.sha1 b/Linux_x64/binutils.tar.bz2.sha1
index f4c6084..769e08b 100644
--- a/Linux_x64/binutils.tar.bz2.sha1
+++ b/Linux_x64/binutils.tar.bz2.sha1
@@ -1 +1 @@
-733c355177167e11c45f7bf49f144153fda335cc
\ No newline at end of file
+3dc3f9f1ba7b3a9df28adb104b4ed37f1c26f68a
\ No newline at end of file
diff --git a/README.chromium b/README.chromium
index d20934b..8273054 100644
--- a/README.chromium
+++ b/README.chromium
@@ -1,6 +1,6 @@
 Name: binutils
 URL: http://www.gnu.org/software/binutils/
-Version: 2.24
+Version: 2.25
 License: GPL v2
 License File: NOT_SHIPPED
 Security Critical: no
@@ -9,21 +9,39 @@
 This directory contains i386 and amd64 binaries of the binutils tools
 (including gold linker).
 
-They were built from binutils-2.24 using the "build-all.sh" script on a Ubuntu
+They were built from binutils-2.25 using the "build-all.sh" script on a Ubuntu
 Precise.
 
-The script creates chroots for 32bit and 64bit Ubuntu Lucid and then builds
+The script creates chroots for 32bit and 64bit Ubuntu Precise and then builds
 binutils inside the roots.
 
-Local patches:
- * ehframe-race.patch for http://crbug.com/161942 from upstream change
-   https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=635aa30e3ae9735e362cfd1cda2be9f7b65b32a2
+Version 2.25 was released on Wed, 24 Dec 2014
 
+Local patches:
  * unlock-thin.patch for http://crbug.com/453195 from upstream change
    https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=2cfbf2fece582c29df348104b28677c38a8301f4
+   (Landed upstream Wed, 4 Feb 2015 - should be in 2.26)
 
  * plugin-dso-fix.patch for http://crbug.com/453195 from upstream change
    https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=3c537f7fdb11f02f7082749f3f21dfdd2c2025e8
+   (Landed upstream Thu, 5 Feb 2015 - should be in 2.26)
 
  * (build-all.sh|build-one.sh|upload.sh) scripts for building the binutils
    binaries and uploading them to Google storage.
+
+Upgrading:
+
+To upgrade binutils, use the following steps:
+
+ * Update build-all.sh with the new binutil version.
+ * Remove any patches which have been merged upstream from build-all.sh
+ * Update this README.chromium file
+ * Run build-all.sh
+ * Run upload.sh
+ * Wait for goma to have new binutils deployed (see http://go/ma).
+    Please notify {ukai,yyanagisawa,shinyak}@chromium.org and await
+    confirmation.
+ * Commit the change
+
+See https://codereview.chromium.org/1368233002/ for an example upgrade.
+
diff --git a/build-all.sh b/build-all.sh
index a39984c..99d1070 100755
--- a/build-all.sh
+++ b/build-all.sh
@@ -22,7 +22,7 @@
 fi
 
 # Download the source
-VERSION=2.24
+VERSION=2.25
 wget -c http://ftp.gnu.org/gnu/binutils/binutils-$VERSION.tar.bz2
 
 # Verify the signature
@@ -43,14 +43,21 @@
   # Patch the source
   (
     cd binutils-$VERSION
-    patch -p1 < ../ehframe-race.patch
+    echo "unlock-thin.patch"
+    echo "=================================="
     patch -p1 < ../unlock-thin.patch
+    echo "----------------------------------"
+    echo
+    echo "plugin-dso-fix.patch"
+    echo "=================================="
     patch -p1 < ../plugin-dso-fix.patch
+    echo "----------------------------------"
+    echo
   )
 fi
 
 for ARCH in i386 amd64; do
-  if [ ! -d lucid-chroot-$ARCH ]; then
+  if [ ! -d precise-chroot-$ARCH ]; then
     # Refresh sudo credentials
     sudo -v
 
@@ -61,11 +68,11 @@
     sudo debootstrap \
         --arch=$ARCH \
         --include=build-essential,flex,bison \
-        lucid lucid-chroot-$ARCH
+        precise precise-chroot-$ARCH
     echo "============================="
   fi
 
-  BUILDDIR=lucid-chroot-$ARCH/build
+  BUILDDIR=precise-chroot-$ARCH/build
 
   # Clean up any previous failed build attempts inside chroot
   if [ -d "$BUILDDIR" ]; then
@@ -92,7 +99,7 @@
   echo ""
   echo "Building binutils for $ARCH"
   LOGFILE="$OUTPUTDIR/build-$ARCH.log"
-  if ! sudo $PREFIX chroot lucid-chroot-$ARCH /build/build-one.sh /build/binutils-$VERSION > $LOGFILE 2>&1; then
+  if ! sudo $PREFIX chroot precise-chroot-$ARCH /build/build-one.sh /build/binutils-$VERSION > $LOGFILE 2>&1; then
     echo "Build failed! See $LOGFILE for details."
     exit 1
   fi
diff --git a/ehframe-race.patch b/ehframe-race.patch
deleted file mode 100644
index ab0d01e..0000000
--- a/ehframe-race.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-diff --git a/gold/gold.cc b/gold/gold.cc
-index 4833aec..bdfb33d 100644
---- a/gold/gold.cc
-+++ b/gold/gold.cc
-@@ -808,6 +808,8 @@ queue_final_tasks(const General_options& options,
-   if (!any_postprocessing_sections)
-     {
-       input_sections_blocker = new Task_token(true);
-+      // Write_symbols_task, Relocate_tasks.
-+      input_sections_blocker->add_blocker();
-       input_sections_blocker->add_blockers(input_objects->number_of_relobjs());
-     }
- 
-@@ -836,6 +838,7 @@ queue_final_tasks(const General_options& options,
- 
-   // Queue a task to write out the output sections.
-   workqueue->queue(new Write_sections_task(layout, of, output_sections_blocker,
-+					   input_sections_blocker,
- 					   final_blocker));
- 
-   // Queue a task to write out everything else.
-diff --git a/gold/layout.cc b/gold/layout.cc
-index 82db775..ef0a879 100644
---- a/gold/layout.cc
-+++ b/gold/layout.cc
-@@ -5532,6 +5532,8 @@ void
- Write_sections_task::locks(Task_locker* tl)
- {
-   tl->add(this, this->output_sections_blocker_);
-+  if (this->input_sections_blocker_ != NULL)
-+    tl->add(this, this->input_sections_blocker_);
-   tl->add(this, this->final_blocker_);
- }
- 
-diff --git a/gold/layout.h b/gold/layout.h
-index 7c0113c..032f5f3 100644
---- a/gold/layout.h
-+++ b/gold/layout.h
-@@ -1454,9 +1454,11 @@ class Write_sections_task : public Task
-  public:
-   Write_sections_task(const Layout* layout, Output_file* of,
- 		      Task_token* output_sections_blocker,
-+		      Task_token* input_sections_blocker,
- 		      Task_token* final_blocker)
-     : layout_(layout), of_(of),
-       output_sections_blocker_(output_sections_blocker),
-+      input_sections_blocker_(input_sections_blocker),
-       final_blocker_(final_blocker)
-   { }
- 
-@@ -1481,6 +1483,7 @@ class Write_sections_task : public Task
-   const Layout* layout_;
-   Output_file* of_;
-   Task_token* output_sections_blocker_;
-+  Task_token* input_sections_blocker_;
-   Task_token* final_blocker_;
- };
- 
-diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
-index dd06d5f..35cd013 100644
---- a/gold/testsuite/Makefile.am
-+++ b/gold/testsuite/Makefile.am
-@@ -2380,10 +2380,9 @@ endif DEFAULT_TARGET_X86_64
- if DEFAULT_TARGET_X86_64
- check_PROGRAMS += exception_x86_64_bnd_test
- exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
--exception_x86_64_bnd_test_DEPENDENCIES = exception_x86_64_bnd_1.o \
--					 exception_x86_64_bnd_2.o
-+exception_x86_64_bnd_test_DEPENDENCIES = gcctestdir/ld exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
- exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS)
--exception_x86_64_bnd_test_LDADD = $(exception_x86_64_bnd_test_DEPENDENCIES)
-+exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
- exception_x86_64_bnd_1.o: exception_test_1.cc gcctestdir/as
- 	$(CXXCOMPILE) -c -fpic -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
- exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
-diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
-index fed610f..8fbb644 100644
---- a/gold/testsuite/Makefile.in
-+++ b/gold/testsuite/Makefile.in
-@@ -2732,11 +2732,9 @@ LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
- @GCC_TRUE@@NATIVE_LINKER_TRUE@ehdr_start_test_5_LDFLAGS = -Bgcctestdir/
- @GCC_TRUE@@NATIVE_LINKER_TRUE@ehdr_start_test_5_LDADD = 
- @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
--@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_DEPENDENCIES = exception_x86_64_bnd_1.o \
--@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@					 exception_x86_64_bnd_2.o
--
-+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_DEPENDENCIES = gcctestdir/ld exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
- @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS)
--@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_LDADD = $(exception_x86_64_bnd_test_DEPENDENCIES)
-+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
- @DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
- @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
- all: $(BUILT_SOURCES)
--- 
-1.7.1
-
diff --git a/upload.sh b/upload.sh
index 5ff10aa..31f1a06 100755
--- a/upload.sh
+++ b/upload.sh
@@ -61,5 +61,8 @@
 done
 
 echo "Please commit the new .sha1 to the Chromium repository"
-echo ""
 echo "# git commit"
+echo ""
+echo "Make sure goma is updated with the new binutils *before* landing."
+echo " Notify {ukai,yyanagisawa,shinyak}@chromium.org with the .sha1 files"
+echo " and await confirmation."