Use a different linker for ASan binaries.
Another change in bionic/linker adds linker_asan/linker_asan64 that know where to find ASan shared libraries. Also, include linker_asan to the required packages list when building for ASan. Change-Id: I8ebe7c0091bbeb0c135708a891d33d9844373d37
This commit is contained in:
parent
832fa5d714
commit
8f5e67a98c
|
@ -201,6 +201,8 @@ $(foreach lib, $(LOCAL_HAL_STATIC_LIBRARIES), \
|
|||
b_lib :=
|
||||
endif
|
||||
|
||||
my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LINKER)
|
||||
|
||||
include $(BUILD_SYSTEM)/config_sanitizers.mk
|
||||
|
||||
ifeq ($(strip $($(LOCAL_2ND_ARCH_VAR_PREFIX)WITHOUT_$(my_prefix)CLANG)),true)
|
||||
|
@ -361,6 +363,7 @@ ifneq ($(LOCAL_NO_SYNTAX_CHECK),true)
|
|||
my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-syntax $(my_syntax_arch) "$(my_cxx)"
|
||||
endif
|
||||
endif
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLANG := $(my_clang)
|
||||
|
||||
|
|
|
@ -70,3 +70,4 @@ $(clang_2nd_arch_prefix)TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.p
|
|||
# Address sanitizer clang config
|
||||
$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_RUNTIME_LIBRARY := libclang_rt.asan-arm-android
|
||||
$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_RPATH := /data/vendor/lib:/$(TARGET_COPY_OUT_VENDOR)/lib:/data/lib
|
||||
$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan
|
||||
|
|
|
@ -68,3 +68,4 @@ TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-aarch64-android.a
|
|||
# Address sanitizer clang config
|
||||
ADDRESS_SANITIZER_RUNTIME_LIBRARY := libclang_rt.asan-arm64-android
|
||||
ADDRESS_SANITIZER_RPATH := /data/vendor/lib64:/$(TARGET_COPY_OUT_VENDOR)/lib64:/data/lib64
|
||||
ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan64
|
||||
|
|
|
@ -92,6 +92,7 @@ ifneq ($(filter address,$(my_sanitize)),)
|
|||
$(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
|
||||
my_static_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
|
||||
my_ldflags += -Wl,-rpath,$($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_RPATH)
|
||||
my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -1510,7 +1510,7 @@ endef
|
|||
define transform-o-to-executable-inner
|
||||
$(hide) $(PRIVATE_CXX) -pie \
|
||||
-nostdlib -Bdynamic \
|
||||
-Wl,-dynamic-linker,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_LINKER) \
|
||||
-Wl,-dynamic-linker,$(PRIVATE_LINKER) \
|
||||
-Wl,--gc-sections \
|
||||
-Wl,-z,nocopyreloc \
|
||||
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
|
||||
|
|
Loading…
Reference in New Issue