cros_setup_toolchains: Add llvm-libunwind as an extra package

Add llvm-libunwind as an extra llvm package.  This is needed so that the
rust compiler can link against libunwind instead of libgcc_s.

BUG=chromium:814480
TEST=cros_setup_toolchains -t sdk
CQ-DEPEND=CL:1135995

Change-Id: I96b5834db0ba116fefb98eb1dc752479436a2a76
Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1135971
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
diff --git a/scripts/cros_setup_toolchains.py b/scripts/cros_setup_toolchains.py
index 3fdf440..4cf5db3 100644
--- a/scripts/cros_setup_toolchains.py
+++ b/scripts/cros_setup_toolchains.py
@@ -77,6 +77,11 @@
 # so we have to list them here and wait.  Once it completes, entries here can
 # be removed so they'll end up on bots & dev's systems.
 NEW_PACKAGES = (
+    'sys-libs/llvm-libunwind',
+    'cross-armv7a-cros-linux-gnueabi/llvm-libunwind',
+    'cross-armv7a-cros-linux-gnueabihf/llvm-libunwind',
+    'cross-aarch64-cros-linux-gnu/llvm-libunwind',
+    'cross-x86_64-cros-linux-gnu/llvm-libunwind',
 )
 
 # Enable the Go compiler for these targets.
@@ -107,6 +112,7 @@
 LLVM_PKGS_TABLE = {
     'ex_libcxxabi' : ['--ex-pkg', 'sys-libs/libcxxabi'],
     'ex_libcxx' : ['--ex-pkg', 'sys-libs/libcxx'],
+    'ex_llvm-libunwind' : ['--ex-pkg', 'sys-libs/llvm-libunwind'],
 }
 
 # Overrides for {gcc,binutils}-config, pick a package with particular suffix.
@@ -135,6 +141,7 @@
       'libcxxabi': 'sys-libs',
       'libcxx': 'sys-libs',
       'elfutils': 'dev-libs',
+      'llvm-libunwind': 'sys-libs',
   }
 
   @classmethod
@@ -1316,6 +1323,13 @@
   boards_wanted = (set(options.include_boards.split(','))
                    if options.include_boards else set())
 
+  # pylint: disable=global-statement
+  global LLVM_PKGS_TABLE
+  if options.usepkg:
+    # For bootstrapping, disable the new package cross-*/llvm-libunwind
+    # Remove after SDK builder uploads new prebuilts.
+    del LLVM_PKGS_TABLE['ex_llvm-libunwind']
+
   if options.cfg_name:
     ShowConfig(options.cfg_name)
   elif options.show_packages is not None: