gn build: Fix Android build.
Remove --unwindlib=none flag that was added by D143598. It is required to not pass this flag when linking binaries. With this flag, linking e.g. llvm-symbolizer will fail. There was a missing dependency from most targets to the implicitly linked libraries (libunwind and builtins), which was causing the build for those targets to fail when they were built on their own. I never noticed this because I always build the implicitly linked libraries together with their dependencies. Make the dependency explicit by introducing a new target //llvm/utils/gn/build/libs/implicit representing the platform's implicitly linked libraries, and depend on that from the LLVM libraries, so that "normal" binaries like llvm-symbolizer will have all of their dependencies available. D143598 set the arch subdirectory to i686 for Android. However, the arch subdirectory on Android is i386, and has been for a long time. $ find android-ndk-r* -name i386 android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/7.0.2/lib/linux/i386 android-ndk-r19/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/8.0.2/lib/linux/i386 android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/8.0.7/lib/linux/i386 android-ndk-r21-beta1/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.8/lib/linux/i386 android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.8/lib/linux/i386 android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/11.0.5/lib/linux/i386 android-ndk-r23-beta5/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/12.0.5/lib/linux/i386 android-ndk-r24/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.1/lib/linux/i386 android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.7/lib/linux/i386 Using the wrong name prevents Clang from being able to find libunwind.a on x86. Fix the code to use i386 as the arch subdirectory, consistent with the NDK. Bring back -Wl,-z,defs which was removed for Android by D143598, presumably because of the missing unwind library. Differential Revision: https://reviews.llvm.org/D146266
Loading
Please sign in to comment