Update openjdk builds to clang-r416183b

- Pass -fno-delete-null-pointer-checks C flag.  See
https://bugs.openjdk.java.net/browse/JDK-8256836 for details.
- Use -fuse-ld=lld for Linux openjdk11 and jetbrainsruntime.  The linker
in the build server cannot process the R_X86_64_REX_GOTPCRELX relocation
type.

Bug: http://b/185528062
Bug: http://b/192274024
Test: Treehugger, Forrest
Change-Id: I5535e23ce54fb6bbf14b561fd761f3f55e745238
diff --git a/build-jetbrainsruntime-darwin-aarch64.sh b/build-jetbrainsruntime-darwin-aarch64.sh
index 929e7db..ebd3d82 100644
--- a/build-jetbrainsruntime-darwin-aarch64.sh
+++ b/build-jetbrainsruntime-darwin-aarch64.sh
@@ -138,7 +138,8 @@
      --with-extra-cflags="-arch arm64 ${jnf_flags_param}" \
      --with-extra-cxxflags="-arch arm64 ${jnf_flags_param} " \
      --with-extra-ldflags="-arch arm64 ${jnf_flags_param}" \
-     --with-jvm-features="shenandoahgc"
+     --with-jvm-features="shenandoahgc" \
+     --with-extra-cflags="-fno-delete-null-pointer-checks"
 )
 
 # Make
@@ -178,4 +179,4 @@
 
 # Rewrite absolute references to rpath-relative one
 install_name_tool -change @rpath/JavaNativeFoundation.framework/Versions/A/JavaNativeFoundation @loader_path/../Frameworks/JavaNativeFoundation.framework/JavaNativeFoundation ${build_dir}/java-runtime/lib/libawt.dylib
-(cd "${build_dir}/java-runtime" && zip -9rDy${quiet:+q} "${dist_dir}/jdk-runtime.zip" .)
\ No newline at end of file
+(cd "${build_dir}/java-runtime" && zip -9rDy${quiet:+q} "${dist_dir}/jdk-runtime.zip" .)
diff --git a/build-jetbrainsruntime-darwin.sh b/build-jetbrainsruntime-darwin.sh
index 142ec45..dacec17 100755
--- a/build-jetbrainsruntime-darwin.sh
+++ b/build-jetbrainsruntime-darwin.sh
@@ -63,7 +63,7 @@
 declare -r sysroot=$(xcrun --show-sdk-path)
 declare -r build_dir="$out_path/build"
 declare -r top=$(realpath "$(dirname "$0")/../../..")
-declare -r clang_bin="$top/prebuilts/clang/host/darwin-x86/clang-r353983c/bin"
+declare -r clang_bin="$top/prebuilts/clang/host/darwin-x86/clang-r416183b/bin"
 declare -r autoconf_dir=$(make_target_dir "$out_path/autoconf")
 
 # Darwin lacks autoconf, install it for this build.
@@ -90,6 +90,7 @@
      --with-version-opt="$(sed 's/^.*-//' "${top}/external/jetbrains/JetBrainsRuntime/build.txt")-${BUILD_NUMBER}" \
      --with-zlib=bundled \
      --with-jvm-features="shenandoahgc" \
+     --with-extra-cflags="-fno-delete-null-pointer-checks" \
      AR=llvm-ar NM=llvm-nm OBJDUMP=llvm-objdump STRIP=llvm-strip
 )
 
diff --git a/build-jetbrainsruntime-linux.sh b/build-jetbrainsruntime-linux.sh
index fcfcef6..0117a73 100755
--- a/build-jetbrainsruntime-linux.sh
+++ b/build-jetbrainsruntime-linux.sh
@@ -47,7 +47,7 @@
 declare -r sysroot="$out_path/sysroot"
 declare -r build_dir="$out_path/build"
 declare -r top=$(realpath "$(dirname "$0")/../../..")
-declare -r clang_bin="$top/prebuilts/clang/host/linux-x86/clang-r399163b/bin"
+declare -r clang_bin="$top/prebuilts/clang/host/linux-x86/clang-r416183b/bin"
 
 # "Installs" given Debian packages into specified directory.
 function unpack_dependencies() {
@@ -106,6 +106,8 @@
      --with-zlib=bundled \
      --x-libraries="$sysroot/usr/lib/x86_64-linux-gnu" \
      --x-includes="$sysroot/usr/include" \
+     --with-extra-cflags="-fno-delete-null-pointer-checks" \
+     --with-extra-ldflags="-fuse-ld=lld" \
      AR=llvm-ar NM=llvm-nm OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump STRIP=llvm-strip
 )
 
diff --git a/build-openjdk-darwin.sh b/build-openjdk-darwin.sh
index 3d283eb..c168f60 100755
--- a/build-openjdk-darwin.sh
+++ b/build-openjdk-darwin.sh
@@ -2,7 +2,7 @@
 
 source $(dirname $0)/build-openjdk-common.sh
 
-clang_dir=${TOP}/prebuilts/clang/host/darwin-x86/clang-r399163b
+clang_dir=${TOP}/prebuilts/clang/host/darwin-x86/clang-r416183b
 freetype=freetype-2.8
 
 export PATH=${clang_dir}/bin:${PATH}
@@ -51,6 +51,8 @@
   -Wno-mismatched-parameter-types
   -Wno-unguarded-availability-new
   -Wno-void-pointer-to-int-cast
+
+  -fno-delete-null-pointer-checks
 )
 GLOBAL_FLAGS=${GLOBAL_FLAGS[@]}
 
diff --git a/build-openjdk11-darwin.sh b/build-openjdk11-darwin.sh
index 4b589ac..aa10b79 100755
--- a/build-openjdk11-darwin.sh
+++ b/build-openjdk11-darwin.sh
@@ -63,7 +63,7 @@
 declare -r sysroot=$(xcrun --show-sdk-path)
 declare -r build_dir="$out_path/build"
 declare -r top=$(realpath "$(dirname "$0")/../../..")
-declare -r clang_bin="$top/prebuilts/clang/host/darwin-x86/clang-r399163b/bin"
+declare -r clang_bin="$top/prebuilts/clang/host/darwin-x86/clang-r416183b/bin"
 declare -r autoconf_dir=$(make_target_dir "$out_path/autoconf")
 
 # So that configure finds tools like dsymutil in ${clang_bin} instead of /usr/bin
@@ -93,6 +93,7 @@
      --with-version-opt=${BUILD_NUMBER:-0} \
      --with-vendor-version-string=Android_PDK \
      --with-zlib=bundled \
+     --with-extra-cflags="-fno-delete-null-pointer-checks" \
      AR=llvm-ar NM=llvm-nm OBJDUMP=llvm-objdump STRIP=llvm-strip
 )
 
diff --git a/build-openjdk11-linux.sh b/build-openjdk11-linux.sh
index 24338b1..80396ab 100755
--- a/build-openjdk11-linux.sh
+++ b/build-openjdk11-linux.sh
@@ -44,7 +44,7 @@
 declare -r sysroot="$out_path/sysroot"
 declare -r build_dir="$out_path/build"
 declare -r top=$(realpath "$(dirname "$0")/../../..")
-declare -r clang_bin="$top/prebuilts/clang/host/linux-x86/clang-r399163b/bin"
+declare -r clang_bin="$top/prebuilts/clang/host/linux-x86/clang-r416183b/bin"
 
 # "Installs" given Debian packages into specified directory.
 function unpack_dependencies() {
@@ -103,6 +103,8 @@
      --with-zlib=bundled \
      --x-libraries="$sysroot/usr/lib/x86_64-linux-gnu" \
      --x-includes="$sysroot/usr/include" \
+     --with-extra-cflags="-fno-delete-null-pointer-checks" \
+     --with-extra-ldflags="-fuse-ld=lld" \
      AR=llvm-ar NM=llvm-nm OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump STRIP=llvm-strip
 )