platform_build/core/use_lld_setup.mk
Chih-Hung Hsieh 4ad173788e Third try to enable clang lld as default linker.
Note of existing configurations:
  * When lld is used, llvm-strip and llvm-objcopy are also used.
  * darwin host modules do not use lld.
  * lld can be disabled locally with use_clang_lld:false in Android.bp
    or LOCAL_USE_CLANG_LLD:=false in Android.mk.

Bug: 73768157
Test: make checkbuild, boot and run bionic and system/core native tests
Change-Id: I3067ff8021dd6e1598f2447b80aea66a3f7e1677
2018-06-12 10:50:10 -07:00

27 lines
917 B
Makefile

#############################################################
## Set up flags based on USE_CLANG_LLD and LOCAL_USE_CLANG_LLD.
## Input variables: USE_CLANG_LLD,LOCAL_USE_CLANG_LLD.
## Output variables: my_use_clang_lld
#############################################################
# Use LLD by default.
# Do not use LLD if LOCAL_USE_CLANG_LLD is false or 0,
# of if LOCAL_USE_CLANG_LLD is not set and USE_CLANG_LLD is 0 or false.
my_use_clang_lld := true
ifneq (,$(LOCAL_USE_CLANG_LLD))
ifneq (,$(filter 0 false,$(LOCAL_USE_CLANG_LLD)))
my_use_clang_lld := false
endif
else
ifneq (,$(filter 0 false,$(USE_CLANG_LLD)))
my_use_clang_lld := false
endif
endif
# Do not use LLD for Darwin host executables or shared libraries.
# See https://lld.llvm.org/AtomLLD.html for status of lld for Mach-O.
ifeq ($(LOCAL_IS_HOST_MODULE),true)
ifeq ($(HOST_OS),darwin)
my_use_clang_lld := false
endif
endif