cros_setup_toolchains: add cross-*/libxcrypt

Glibc deprecated libcrypt in favor of libxcrypt and will
remove it in the future. Gentoo upstream has already
migrated to libxcrypt with cross-*/libxcrypt support.

compiler-rt has a crypt.h build dependency which needs
to be supplied by libxcrypt once glibc-libcrypt is
removed, so add it to ensure compiler-rt builds succeed.

BUG=b:187795307
TEST=Local builds with cross-*; emerge-eve/kevin; CQ.

Cq-Depend: chromium:3620993, chromium:3620694, chromium:3629242
Change-Id: I26e27507251b2eb6fe0aa7bc34ba6a3015d4b4b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3620893
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
diff --git a/scripts/cros_setup_toolchains.py b/scripts/cros_setup_toolchains.py
index c7a2ff9..6678e97 100644
--- a/scripts/cros_setup_toolchains.py
+++ b/scripts/cros_setup_toolchains.py
@@ -91,6 +91,8 @@
 )
 CROSSDEV_GO_ARGS = ['--ex-pkg', 'dev-lang/go']
 
+CROSSDEV_LIBXCRYPT_ARGS = ['--ex-pkg', 'sys-libs/libxcrypt']
+
 # Enable llvm's compiler-rt for these targets.
 TARGET_COMPILER_RT_ENABLED = (
     'armv7a-cros-linux-gnueabi',
@@ -206,6 +208,9 @@
       else:
         # Build the crossdev command.
         cmd = ['crossdev', '--show-target-cfg', '--ex-gdb']
+        # Enable libxcrypt for all linux-gnu targets.
+        if 'cros-linux-gnu' in target:
+          cmd.extend(CROSSDEV_LIBXCRYPT_ARGS)
         if target in TARGET_COMPILER_RT_ENABLED:
           cmd.extend(CROSSDEV_COMPILER_RT_ARGS)
         if target in TARGET_LLVM_PKGS_ENABLED:
@@ -289,6 +294,8 @@
       if pkg == 'gdb':
         # Gdb does not have selectable versions.
         cmd.append('--ex-gdb')
+      elif pkg == 'ex_libxcrypt':
+        cmd.extend(CROSSDEV_LIBXCRYPT_ARGS)
       elif pkg == 'ex_compiler-rt':
         cmd.extend(CROSSDEV_COMPILER_RT_ARGS)
       elif pkg == 'ex_go':