Move eu-strip from third_party/ to buildtools/third_party/

The build and builtools directories are provided to standalone projects
such as angle. Move eu-strip into buildtools so that those projects'
copy of build/ can find it.

BUG=angleproject:2475
TEST=build standalone angle with target_os="fuchsia"
NOPRESUBMIT=true

Change-Id: If3d6b9027bd01cdc67db5ef825a304016bd77a7d
Reviewed-on: https://chromium-review.googlesource.com/c/1427781
Commit-Queue: Michael Spang <[email protected]>
Reviewed-by: Dirk Pranke <[email protected]>
Cr-Commit-Position: refs/heads/master@{#627463}
diff --git a/.gn b/.gn
index 40ea9e6..b358758 100644
--- a/.gn
+++ b/.gn
@@ -79,6 +79,7 @@
   "//base/*",
   "//blink/*",
   "//build/*",
+  "//buildtools/*",
   "//cc/*",
 
   #"//chrome/android/*",  # 13 errors
@@ -393,7 +394,6 @@
   "//third_party/elfutils/*",
   "//third_party/errorprone/*",
   "//third_party/espresso/*",
-  "//third_party/eu-strip/*",
   "//third_party/expat/*",
   "//third_party/eyesfree/*",
   "//third_party/feed/*",
diff --git a/DEPS b/DEPS
index 03e7f12..766658ea 100644
--- a/DEPS
+++ b/DEPS
@@ -137,7 +137,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling build tools
   # and whatever else without interference from each other.
-  'buildtools_revision': '2f02e1f363b1af2715536f38e239853f04ec1497',
+  'buildtools_revision': '6fbda1b24c1893a893b17aa219b765b9e7c801d8',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling SwiftShader
   # and whatever else without interference from each other.
diff --git a/build/toolchain/android/BUILD.gn b/build/toolchain/android/BUILD.gn
index d33d85a0..c833c7b8 100644
--- a/build/toolchain/android/BUILD.gn
+++ b/build/toolchain/android/BUILD.gn
@@ -58,7 +58,8 @@
     ld = cxx
     readelf = _tool_prefix + "readelf"
     nm = _tool_prefix + "nm"
-    strip = rebase_path("//third_party/eu-strip/bin/eu-strip", root_build_dir)
+    strip = rebase_path("//buildtools/third_party/eu-strip/bin/eu-strip",
+                        root_build_dir)
     use_unstripped_as_runtime_outputs = android_unstripped_runtime_outputs
 
     # Don't use .cr.so for loadable_modules since they are always loaded via
diff --git a/build/toolchain/fuchsia/BUILD.gn b/build/toolchain/fuchsia/BUILD.gn
index 654073b..d160a83 100644
--- a/build/toolchain/fuchsia/BUILD.gn
+++ b/build/toolchain/fuchsia/BUILD.gn
@@ -17,7 +17,8 @@
     # in runtime_deps to make them available for isolates.
     # TODO(https://crbug.com/877080): Switch to llvm-strip.
     if (host_os == "linux") {
-      strip = rebase_path("//third_party/eu-strip/bin/eu-strip", root_build_dir)
+      strip = rebase_path("//buildtools/third_party/eu-strip/bin/eu-strip",
+                          root_build_dir)
       use_unstripped_as_runtime_outputs = true
     }
 
diff --git a/chrome/installer/linux/BUILD.gn b/chrome/installer/linux/BUILD.gn
index cec51216..05e0c5f 100644
--- a/chrome/installer/linux/BUILD.gn
+++ b/chrome/installer/linux/BUILD.gn
@@ -171,7 +171,8 @@
     stripped_file,
   ]
   args = [
-    rebase_path("//third_party/eu-strip/bin/eu-strip", root_build_dir),
+    rebase_path("//buildtools/third_party/eu-strip/bin/eu-strip",
+                root_build_dir),
     "-o",
     rebase_path(stripped_file, root_build_dir),
     "-f",
@@ -248,7 +249,7 @@
     ]
   }
 
-  sources += [ "//third_party/eu-strip/bin/eu-strip" ]
+  sources += [ "//buildtools/third_party/eu-strip/bin/eu-strip" ]
 
   outputs = [
     "$root_out_dir/installer/common/{{source_file_part}}",
diff --git a/extensions/shell/installer/linux/BUILD.gn b/extensions/shell/installer/linux/BUILD.gn
index 09f39443..1636733 100644
--- a/extensions/shell/installer/linux/BUILD.gn
+++ b/extensions/shell/installer/linux/BUILD.gn
@@ -49,7 +49,8 @@
     stripped_file,
   ]
   args = [
-    rebase_path("//third_party/eu-strip/bin/eu-strip", root_build_dir),
+    rebase_path("//buildtools/third_party/eu-strip/bin/eu-strip",
+                root_build_dir),
     "-o",
     rebase_path(stripped_file, root_build_dir),
     "-f",
diff --git a/third_party/eu-strip/OWNERS b/third_party/eu-strip/OWNERS
deleted file mode 100644
index 4644c96..0000000
--- a/third_party/eu-strip/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
[email protected]
[email protected]
[email protected]
diff --git a/third_party/eu-strip/README.chromium b/third_party/eu-strip/README.chromium
deleted file mode 100644
index 5c621b0a5..0000000
--- a/third_party/eu-strip/README.chromium
+++ /dev/null
@@ -1,12 +0,0 @@
-Name: eu-strip
-URL: https://sourceware.org/elfutils/
-Version: 0.158
-Security Critical: no
-License: LGPL 3
-License File: NOT_SHIPPED
-
-Description:
-
-Patched eu-strip from elfutils.
-
-To build (on Trusty): ./build.sh in this directory.
diff --git a/third_party/eu-strip/bin/eu-strip b/third_party/eu-strip/bin/eu-strip
deleted file mode 100755
index 7dcb3c0..0000000
--- a/third_party/eu-strip/bin/eu-strip
+++ /dev/null
Binary files differ
diff --git a/third_party/eu-strip/build.sh b/third_party/eu-strip/build.sh
deleted file mode 100755
index 86f2b67..0000000
--- a/third_party/eu-strip/build.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh -xe
-
-rm -rf elfutils
-git clone git://sourceware.org/git/elfutils.git
-cd elfutils
-git checkout elfutils-0.170
-autoheader
-aclocal
-autoconf
-automake --add-missing
-patch -p1 < ../fix-elf-size.patch
-mkdir build
-cd build
-../configure --enable-maintainer-mode
-make -j40
-gcc -std=gnu99 -Wall -Wshadow -Wunused -Wextra -fgnu89-inline \
-  -Wformat=2 -Werror -g -O2 -Wl,-rpath-link,libelf:libdw -Wl,--build-id=none -o eu-strip \
-  src/strip.o libebl/libebl.a libelf/libelf.a lib/libeu.a libdw/libdw.a -ldl -lz
-./eu-strip -o ../../bin/eu-strip eu-strip
diff --git a/third_party/eu-strip/fix-elf-size.patch b/third_party/eu-strip/fix-elf-size.patch
deleted file mode 100644
index e3fdc8a..0000000
--- a/third_party/eu-strip/fix-elf-size.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c
-index d83c0b3f..507e707b 100644
---- a/libelf/elf32_updatenull.c
-+++ b/libelf/elf32_updatenull.c
-@@ -137,7 +137,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
-     return -1;
- 
-   /* At least the ELF header is there.  */
--  off_t size = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1);
-+  ElfW2(LIBELFBITS,Off) size = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1);
- 
-   /* Set the program header position.  */
-   if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL)
-@@ -152,7 +152,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
- 	{
- 	  /* The user is supposed to fill out e_phoff.  Use it and
- 	     e_phnum to determine the maximum extend.  */
--	  size = MAX ((size_t) size,
-+	  size = MAX (size,
- 		      ehdr->e_phoff
- 		      + elf_typesize (LIBELFBITS, ELF_T_PHDR, phnum));
- 	}
-@@ -330,7 +330,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
- 
- 	      if (elf->flags & ELF_F_LAYOUT)
- 		{
--		  size = MAX ((GElf_Word) size,
-+		  size = MAX (size,
- 			      (shdr->sh_type != SHT_NOBITS
- 			       ? shdr->sh_offset + shdr->sh_size : 0));
- 
-@@ -352,9 +352,9 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
- 		  update_if_changed (shdr->sh_addralign, sh_align,
- 				     scn->shdr_flags);
- 
--		  size = (size + sh_align - 1) & ~(sh_align - 1);
-+		  size = (size + sh_align - 1) & ~(ElfW2(LIBELFBITS,Off))(sh_align - 1);
- 		  int offset_changed = 0;
--		  update_if_changed (shdr->sh_offset, (GElf_Word) size,
-+		  update_if_changed (shdr->sh_offset, size,
- 				     offset_changed);
- 		  changed |= offset_changed;
- 
-@@ -416,7 +416,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
- 	  /* The user is supposed to fill out e_shoff.  Use it and
- 	     e_shnum (or sh_size of the dummy, first section header)
- 	     to determine the maximum extend.  */
--	  size = MAX ((GElf_Word) size,
-+	  size = MAX (size,
- 		      (ehdr->e_shoff
- 		       + (elf_typesize (LIBELFBITS, ELF_T_SHDR, shnum))));
- 	}
-@@ -430,7 +430,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
- #define SHDR_ALIGN sizeof (ElfW2(LIBELFBITS,Off))
- 	  size = (size + SHDR_ALIGN - 1) & ~(SHDR_ALIGN - 1);
- 
--	  update_if_changed (ehdr->e_shoff, (GElf_Word) size, elf->flags);
-+	  update_if_changed (ehdr->e_shoff, size, elf->flags);
- 
- 	  /* Account for the section header size.  */
- 	  size += elf_typesize (LIBELFBITS, ELF_T_SHDR, shnum);
diff --git a/tools/clang/scripts/package.py b/tools/clang/scripts/package.py
index 31a4fc99..3671709 100755
--- a/tools/clang/scripts/package.py
+++ b/tools/clang/scripts/package.py
@@ -19,13 +19,15 @@
 THIS_DIR = os.path.dirname(__file__)
 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..'))
 THIRD_PARTY_DIR = os.path.join(THIS_DIR, '..', '..', '..', 'third_party')
+BUILDTOOLS_DIR = os.path.join(THIS_DIR, '..', '..', '..', 'buildtools')
 LLVM_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm')
 LLVM_BOOTSTRAP_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-bootstrap')
 LLVM_BOOTSTRAP_INSTALL_DIR = os.path.join(THIRD_PARTY_DIR,
                                           'llvm-bootstrap-install')
 LLVM_BUILD_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-build')
 LLVM_RELEASE_DIR = os.path.join(LLVM_BUILD_DIR, 'Release+Asserts')
-EU_STRIP = os.path.join(THIRD_PARTY_DIR, 'eu-strip', 'bin', 'eu-strip')
+EU_STRIP = os.path.join(BUILDTOOLS_DIR, 'third_party', 'eu-strip', 'bin',
+                        'eu-strip')
 STAMP_FILE = os.path.join(LLVM_BUILD_DIR, 'cr_build_revision')