Loading core/config_sanitizers.mk +25 −6 Original line number Original line Diff line number Diff line Loading @@ -235,6 +235,11 @@ ifneq ($(filter cfi,$(my_sanitize)),) # entire module. # entire module. LOCAL_ARM_MODE := thumb LOCAL_ARM_MODE := thumb my_cflags += $(CFI_EXTRA_CFLAGS) my_cflags += $(CFI_EXTRA_CFLAGS) # Only append the default visibility flag if -fvisibility has not already been # set to hidden. ifeq ($(filter -fvisibility=hidden,$(LOCAL_CFLAGS)),) my_cflags += -fvisibility=default endif my_ldflags += $(CFI_EXTRA_LDFLAGS) my_ldflags += $(CFI_EXTRA_LDFLAGS) my_arflags += --plugin $(LLVM_PREBUILTS_PATH)/../lib64/LLVMgold.so my_arflags += --plugin $(LLVM_PREBUILTS_PATH)/../lib64/LLVMgold.so # Workaround for b/33678192. CFI jumptables need Thumb2 codegen. Revert when # Workaround for b/33678192. CFI jumptables need Thumb2 codegen. Revert when Loading @@ -242,6 +247,15 @@ ifneq ($(filter cfi,$(my_sanitize)),) ifneq ($(filter arm,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),) ifneq ($(filter arm,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),) my_ldflags += -march=armv7-a my_ldflags += -march=armv7-a endif endif ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true) my_ldflags := $(filter-out -fsanitize-cfi-cross-dso,$(my_ldflags)) my_cflags := $(filter-out -fsanitize-cfi-cross-dso,$(my_cflags)) else # Apply the version script to non-static executables my_ldflags += -Wl,--version-script,build/soong/cc/config/cfi_exports.map LOCAL_ADDITIONAL_DEPENDENCIES += build/soong/cc/config/cfi_exports.map endif endif endif # If local or global modules need ASAN, add linker flags. # If local or global modules need ASAN, add linker flags. Loading Loading @@ -293,6 +307,10 @@ ifneq ($(strip $(LOCAL_SANITIZE_RECOVER)),) endif endif ifneq ($(my_sanitize_diag),) ifneq ($(my_sanitize_diag),) # TODO(vishwath): Add diagnostic support for static executables once # we switch to clang-4393122 (which adds the static ubsan runtime # that this depends on) ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true) notrap_arg := $(subst $(space),$(comma),$(my_sanitize_diag)), notrap_arg := $(subst $(space),$(comma),$(my_sanitize_diag)), my_cflags += -fno-sanitize-trap=$(notrap_arg) my_cflags += -fno-sanitize-trap=$(notrap_arg) # Diagnostic requires a runtime library, unless ASan or TSan are also enabled. # Diagnostic requires a runtime library, unless ASan or TSan are also enabled. Loading @@ -301,3 +319,4 @@ ifneq ($(my_sanitize_diag),) my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY) my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY) endif endif endif endif endif core/definitions.mk +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1556,7 +1556,7 @@ $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs; filelist="$$filelist $$ldir/$$ext$$f"; \ filelist="$$filelist $$ldir/$$ext$$f"; \ done ; \ done ; \ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \ $(2) $$filelist $(PRIVATE_ARFLAGS) $(2) $$filelist endef endef Loading Loading
core/config_sanitizers.mk +25 −6 Original line number Original line Diff line number Diff line Loading @@ -235,6 +235,11 @@ ifneq ($(filter cfi,$(my_sanitize)),) # entire module. # entire module. LOCAL_ARM_MODE := thumb LOCAL_ARM_MODE := thumb my_cflags += $(CFI_EXTRA_CFLAGS) my_cflags += $(CFI_EXTRA_CFLAGS) # Only append the default visibility flag if -fvisibility has not already been # set to hidden. ifeq ($(filter -fvisibility=hidden,$(LOCAL_CFLAGS)),) my_cflags += -fvisibility=default endif my_ldflags += $(CFI_EXTRA_LDFLAGS) my_ldflags += $(CFI_EXTRA_LDFLAGS) my_arflags += --plugin $(LLVM_PREBUILTS_PATH)/../lib64/LLVMgold.so my_arflags += --plugin $(LLVM_PREBUILTS_PATH)/../lib64/LLVMgold.so # Workaround for b/33678192. CFI jumptables need Thumb2 codegen. Revert when # Workaround for b/33678192. CFI jumptables need Thumb2 codegen. Revert when Loading @@ -242,6 +247,15 @@ ifneq ($(filter cfi,$(my_sanitize)),) ifneq ($(filter arm,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),) ifneq ($(filter arm,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),) my_ldflags += -march=armv7-a my_ldflags += -march=armv7-a endif endif ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true) my_ldflags := $(filter-out -fsanitize-cfi-cross-dso,$(my_ldflags)) my_cflags := $(filter-out -fsanitize-cfi-cross-dso,$(my_cflags)) else # Apply the version script to non-static executables my_ldflags += -Wl,--version-script,build/soong/cc/config/cfi_exports.map LOCAL_ADDITIONAL_DEPENDENCIES += build/soong/cc/config/cfi_exports.map endif endif endif # If local or global modules need ASAN, add linker flags. # If local or global modules need ASAN, add linker flags. Loading Loading @@ -293,6 +307,10 @@ ifneq ($(strip $(LOCAL_SANITIZE_RECOVER)),) endif endif ifneq ($(my_sanitize_diag),) ifneq ($(my_sanitize_diag),) # TODO(vishwath): Add diagnostic support for static executables once # we switch to clang-4393122 (which adds the static ubsan runtime # that this depends on) ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true) notrap_arg := $(subst $(space),$(comma),$(my_sanitize_diag)), notrap_arg := $(subst $(space),$(comma),$(my_sanitize_diag)), my_cflags += -fno-sanitize-trap=$(notrap_arg) my_cflags += -fno-sanitize-trap=$(notrap_arg) # Diagnostic requires a runtime library, unless ASan or TSan are also enabled. # Diagnostic requires a runtime library, unless ASan or TSan are also enabled. Loading @@ -301,3 +319,4 @@ ifneq ($(my_sanitize_diag),) my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY) my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY) endif endif endif endif endif
core/definitions.mk +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1556,7 +1556,7 @@ $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs; filelist="$$filelist $$ldir/$$ext$$f"; \ filelist="$$filelist $$ldir/$$ext$$f"; \ done ; \ done ; \ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \ $(2) $$filelist $(PRIVATE_ARFLAGS) $(2) $$filelist endef endef Loading