From 5b69c06f1f8ba3743cc447bed9521eb4ef186dec Mon Sep 17 00:00:00 2001 From: Vishwath Mohan Date: Tue, 14 Feb 2017 07:55:37 -0800 Subject: [PATCH] Blacklist code for CFI. Adds the -fsanitize-blacklist option for CFI, using the built in blacklist at external/compiler-rt/lib/cfi/cfi_blacklist.txt. Also refactors the CFI cflags and ldflags into ../soong/cc/makevars.go to ensure they're consistent across Soong and make projects. Bug: 30227045 Test: ENABLE_CFI=true m -j40 builds and boots. Test: The blacklist prevents runtime errors that otherwise occur. Change-Id: I0c2801ed459a3b9adeb37daff3ca212564801259 --- core/config_sanitizers.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk index 57a7993bd9..729ef48d37 100644 --- a/core/config_sanitizers.mk +++ b/core/config_sanitizers.mk @@ -159,8 +159,8 @@ ifneq ($(filter cfi,$(my_sanitize)),) # LLVM is not set up to do this on a function basis, so force Thumb on the # entire module. LOCAL_ARM_MODE := thumb - my_cflags += -flto -fsanitize-cfi-cross-dso -fvisibility=default - my_ldflags += -flto -fsanitize-cfi-cross-dso -fsanitize=cfi -Wl,-plugin-opt,O1 -Wl,-export-dynamic-symbol=__cfi_check + my_cflags += $(CFI_EXTRA_CFLAGS) + my_ldflags += $(CFI_EXTRA_LDFLAGS) my_arflags += --plugin $(LLVM_PREBUILTS_PATH)/../lib64/LLVMgold.so # Workaround for b/33678192. CFI jumptables need Thumb2 codegen. Revert when # Clang is updated past r290384.