From 824d75a2ed2a9f182355ce1dfad712aad74781ff Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Mon, 5 Mar 2018 13:05:37 -0800 Subject: [PATCH] Update Clang to build 4630689. Test: ./checkbuild.py && ./run_tests.py Bug: https://github.com/android-ndk/ndk/issues/593 Bug: http://b/72512648 Change-Id: I01df21b47da547efc6c8b029fc389423e9a63c23 (cherry picked from commit fa3562bbdad17357fb7fb01cb77ac546abfa99a2) --- CHANGELOG.md | 15 ++++++--------- build/cmake/android.toolchain.cmake | 6 ------ build/core/build-binary.mk | 6 ------ build/tools/make_standalone_toolchain.py | 6 ------ build/tools/prebuilt-common.sh | 2 +- checkbuild.py | 6 +----- 6 files changed, 8 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5540163b..f089bb7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,12 +29,14 @@ Announcements August 2019. Start porting now to avoid surprises when the time comes. For more information, see [this blog post](https://android-developers.googleblog.com/2017/12/improving-app-security-and-performance.html). -NDK ---- +Changes +------- - * Updated Clang to build 4579689. + * Updated Clang to build 4630689. * [Issue 313]: LTO now works on Windows. * [Issue 527]: [Undefined Behavior Sanitizer] now works for NDK binaries. + * [Issue 593]: Clang now automatically passes `--eh-frame-hdr` to the + linker even for static executables, fixing exception handling. * Updated gtest to upstream revision 0fe96607d85cf3a25ac40da369db62bbee2939a5. * `libandroid_support` is no longer used when your NDK API level is greater than or equal to 21 (Lollipop). Build system maintainers: be sure to update @@ -82,6 +84,7 @@ NDK [Issue 313]: https://github.com/android-ndk/ndk/issues/313 [Issue 527]: https://github.com/android-ndk/ndk/issues/527 [Issue 540]: https://github.com/android-ndk/ndk/issues/540 +[Issue 593]: https://github.com/android-ndk/ndk/issues/593 [Issue 614]: https://github.com/android-ndk/ndk/issues/614 Known Issues @@ -92,14 +95,8 @@ Known Issues segfaults if the containing library is `dlclose`ed on devices running M or newer, or devices before M when using a static STL. The simple workaround is to not call `dlclose`. - * [Issue 593]: Exception handling does not work out-of-the-box with non-arm32 - static executables. Clang does not pass `--eh-frame-hdr` to the linker for - static executables. This will be fixed in a future Clang update, but for now - this issue can be worked around by adding `-Wl,--eh-frame-hdr` to your - ldflags. * [Issue 70838247]: Gold emits broken debug information for AArch64. AArch64 still uses BFD by default. [Issue 360]: https://github.com/android-ndk/ndk/issues/360 -[Issue 593]: https://github.com/android-ndk/ndk/issues/593 [Issue 70838247]: https://issuetracker.google.com/70838247 diff --git a/build/cmake/android.toolchain.cmake b/build/cmake/android.toolchain.cmake index 6bf7c9df..a759b3a7 100644 --- a/build/cmake/android.toolchain.cmake +++ b/build/cmake/android.toolchain.cmake @@ -499,12 +499,6 @@ list(APPEND ANDROID_LINKER_FLAGS_EXE -Wl,--gc-sections -Wl,-z,nocopyreloc) -# Clang does not automatically pass --eh-frame-hdr to the linker for static -# executables. -# https://github.com/android-ndk/ndk/issues/593 -# http://b/72512648 -list(APPEND ANDROID_LINKER_FLAGS_EXE -Wl,--eh-frame-hdr) - # Debug and release flags. list(APPEND ANDROID_COMPILER_FLAGS_DEBUG -O0) if(ANDROID_ABI MATCHES "^armeabi") diff --git a/build/core/build-binary.mk b/build/core/build-binary.mk index 22cc2d5b..f65e5636 100644 --- a/build/core/build-binary.mk +++ b/build/core/build-binary.mk @@ -245,12 +245,6 @@ ifneq (,$(filter true,$(NDK_APP_PIE) $(TARGET_PIE))) LOCAL_CFLAGS += -fpie LOCAL_LDFLAGS += -fpie -pie endif - else - # Clang does not automatically pass --eh-frame-hdr to the linker for - # static executables. - # https://github.com/android-ndk/ndk/issues/593 - # http://b/72512648 - LOCAL_LDFLAGS += -Wl,--eh-frame-hdr endif endif endif diff --git a/build/tools/make_standalone_toolchain.py b/build/tools/make_standalone_toolchain.py index cb5707ae..47053749 100755 --- a/build/tools/make_standalone_toolchain.py +++ b/build/tools/make_standalone_toolchain.py @@ -212,12 +212,6 @@ def make_clang_scripts(install_dir, triple, api, windows): if arch == 'i686': common_flags += ' -mstackrealign' - # Clang does not automatically pass --eh-frame-hdr to the linker for static - # executables. - # https://github.com/android-ndk/ndk/issues/593 - # http://b/72512648 - common_flags += ' -Wl,--eh-frame-hdr' - unix_flags = common_flags unix_flags += ' --sysroot `dirname $0`/../sysroot' diff --git a/build/tools/prebuilt-common.sh b/build/tools/prebuilt-common.sh index 73b9405d..2db756ce 100644 --- a/build/tools/prebuilt-common.sh +++ b/build/tools/prebuilt-common.sh @@ -1272,7 +1272,7 @@ get_llvm_toolchain_binprefix () { local NAME DIR BINPREFIX local SYSTEM=${1:-$(get_prebuilt_host_tag)} - local VERSION=4579689 + local VERSION=4630689 SYSTEM=${SYSTEM%_64} # Trim _64 suffix. We only have one LLVM. BINPREFIX=$ANDROID_BUILD_TOP/prebuilts/clang/host/$SYSTEM/clang-$VERSION/bin echo "$BINPREFIX" diff --git a/checkbuild.py b/checkbuild.py index 58411001..0ba08673 100755 --- a/checkbuild.py +++ b/checkbuild.py @@ -254,7 +254,7 @@ def _install_file(src_file, dst_file): class Clang(ndk.builds.Module): name = 'clang' path = 'toolchains/llvm/prebuilt/{host}' - version = 'clang-4579689' + version = 'clang-4630689' def get_prebuilt_path(self, host): # The 32-bit Windows Clang is a part of the 64-bit Clang package in @@ -515,18 +515,14 @@ def install_arch(self, out_dir, host, arch): shutil.copy2(llvmgold, bfd_plugins) if not is_win: - libcxx = os.path.join(clang_libs, 'libc++' + so) libcxx_1 = os.path.join( clang_libs, versioned_so(host, 'libc++', '1')) - libllvm = os.path.join(clang_libs, 'libLLVM' + so) # The rpath on LLVMgold.so is ../lib64, so we have to install to # lib/lib64 to have it be in the right place :( lib_dir = os.path.join(install_path, 'lib/lib64') os.makedirs(lib_dir) - shutil.copy2(libcxx, lib_dir) shutil.copy2(libcxx_1, lib_dir) - shutil.copy2(libllvm, lib_dir) else: libwinpthread = os.path.join(clang_bin, 'libwinpthread-1.dll') shutil.copy2(libwinpthread, bfd_plugins)