Merge "QcomModulePkg: Enable the sdllvm analyze under a flag"
diff --git a/AndroidBoot.mk b/AndroidBoot.mk
index 75a539b..2b7416f 100644
--- a/AndroidBoot.mk
+++ b/AndroidBoot.mk
@@ -1,8 +1,15 @@
#Android makefile to build bootloader as a part of Android Build
-ifeq ($(shell echo $(SDCLANG_PATH) | head -c 1),/)
- CLANG_BIN := $(SDCLANG_PATH)/
-else
- CLANG_BIN := $(ANDROID_BUILD_TOP)/$(SDCLANG_PATH)/
+CLANG_BIN := $(ANDROID_BUILD_TOP)/$(LLVM_PREBUILTS_PATH)/
+ABL_USE_SDLLVM := false
+
+ifneq ($(wildcard $(SDCLANG_PATH)),)
+ ifeq ($(shell echo $(SDCLANG_PATH) | head -c 1),/)
+ CLANG_BIN := $(SDCLANG_PATH)/
+ else
+ CLANG_BIN := $(ANDROID_BUILD_TOP)/$(SDCLANG_PATH)/
+ endif
+
+ ABL_USE_SDLLVM := true
endif
ifneq ($(wildcard $(SDCLANG_PATH_2)),)
@@ -11,6 +18,8 @@
else
CLANG_BIN := $(ANDROID_BUILD_TOP)/$(SDCLANG_PATH_2)/
endif
+
+ ABL_USE_SDLLVM := true
endif
ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
@@ -77,6 +86,7 @@
$(USER_BUILD_VARIANT) \
CLANG_BIN=$(CLANG_BIN) \
CLANG_PREFIX=$(CLANG35_PREFIX)\
+ ABL_USE_SDLLVM=$(ABL_USE_SDLLVM) \
CLANG_GCC_TOOLCHAIN=$(CLANG35_GCC_TOOLCHAIN)\
TARGET_ARCHITECTURE=$(TARGET_ARCHITECTURE)
diff --git a/QcomModulePkg/Application/LinuxLoader/LinuxLoader.inf b/QcomModulePkg/Application/LinuxLoader/LinuxLoader.inf
index f3d261c..3de6230 100644
--- a/QcomModulePkg/Application/LinuxLoader/LinuxLoader.inf
+++ b/QcomModulePkg/Application/LinuxLoader/LinuxLoader.inf
@@ -1,5 +1,5 @@
#/* @file
-# Copyright (c) 2017, The Linux Foundation. All rights reserved.
+# Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
# Portions Copyright (c) 2011-2013, ARM Limited. All rights reserved.
#
# This program and the accompanying materials
@@ -24,7 +24,7 @@
LinuxLoader.c
[BuildOptions.AARCH64]
- GCC:*_*_*_CC_FLAGS = --compile-and-analyze $(BUILD_REPORT_DIR)
+ GCC:*_*_*_CC_FLAGS = $(SDLLVM_COMPILE_ANALYZE) $(SDLLVM_ANALYZE_REPORT)
GCC:*_*_*_CC_FLAGS = $(UBSAN_UEFI_GCC_FLAG_UNDEFINED)
GCC:*_*_*_CC_FLAGS = $(UBSAN_UEFI_GCC_FLAG_ALIGNMENT)
diff --git a/QcomModulePkg/Library/BootLib/BootLib.inf b/QcomModulePkg/Library/BootLib/BootLib.inf
index 4910db2..8e6202e 100644
--- a/QcomModulePkg/Library/BootLib/BootLib.inf
+++ b/QcomModulePkg/Library/BootLib/BootLib.inf
@@ -37,7 +37,7 @@
LIBRARY_CLASS = BootLib
[BuildOptions.AARCH64]
- GCC:*_*_*_CC_FLAGS = -O2 --compile-and-analyze $(BUILD_REPORT_DIR)
+ GCC:*_*_*_CC_FLAGS = -O2 $(SDLLVM_COMPILE_ANALYZE) $(SDLLVM_ANALYZE_REPORT)
GCC:*_*_*_CC_FLAGS = $(UBSAN_UEFI_GCC_FLAG_UNDEFINED)
GCC:*_*_*_CC_FLAGS = $(UBSAN_UEFI_GCC_FLAG_ALIGNMENT)
diff --git a/QcomModulePkg/Library/FastbootLib/FastbootLib.inf b/QcomModulePkg/Library/FastbootLib/FastbootLib.inf
index 1dda004..b4968b4 100644
--- a/QcomModulePkg/Library/FastbootLib/FastbootLib.inf
+++ b/QcomModulePkg/Library/FastbootLib/FastbootLib.inf
@@ -42,7 +42,7 @@
#
[BuildOptions.AARCH64]
- GCC:*_*_*_CC_FLAGS = --compile-and-analyze $(BUILD_REPORT_DIR)
+ GCC:*_*_*_CC_FLAGS = $(SDLLVM_COMPILE_ANALYZE) $(SDLLVM_ANALYZE_REPORT)
[Sources]
FastbootMain.c
diff --git a/QcomModulePkg/Library/StackCanary/StackCanary.inf b/QcomModulePkg/Library/StackCanary/StackCanary.inf
index 1013996..6de63d2 100644
--- a/QcomModulePkg/Library/StackCanary/StackCanary.inf
+++ b/QcomModulePkg/Library/StackCanary/StackCanary.inf
@@ -40,8 +40,8 @@
StackCanary.c
[BuildOptions.AARCH64]
- GCC:*_*_*_CC_FLAGS = -fno-stack-protector --compile-and-analyze $(BUILD_REPORT_DIR)
-
+ GCC:*_*_*_CC_FLAGS = -fno-stack-protector
+ GCC:*_*_*_CC_FLAGS = $(SDLLVM_COMPILE_ANALYZE) $(SDLLVM_ANALYZE_REPORT)
[BuildOptions.ARM]
GCC:*_*_*_CC_FLAGS = -fno-stack-protector
diff --git a/QcomModulePkg/Library/avb/AvbLib.inf b/QcomModulePkg/Library/avb/AvbLib.inf
index ce0ba4f..bfb3a75 100644
--- a/QcomModulePkg/Library/avb/AvbLib.inf
+++ b/QcomModulePkg/Library/avb/AvbLib.inf
@@ -40,7 +40,7 @@
GCC:*_*_*_CC_FLAGS = -DAVB_COMPILATION -DAVB_ENABLE_DEBUG
[BuildOptions.AARCH64]
- GCC:*_*_*_CC_FLAGS = --compile-and-analyze $(BUILD_REPORT_DIR)
+ GCC:*_*_*_CC_FLAGS = $(SDLLVM_COMPILE_ANALYZE) $(SDLLVM_ANALYZE_REPORT)
[Sources]
libavb/avb_chain_partition_descriptor.c
diff --git a/QcomModulePkg/Library/zlib/zlib.inf b/QcomModulePkg/Library/zlib/zlib.inf
index 4ca0117..b25af58 100644
--- a/QcomModulePkg/Library/zlib/zlib.inf
+++ b/QcomModulePkg/Library/zlib/zlib.inf
@@ -8,7 +8,8 @@
[BuildOptions.AARCH64]
- GCC:*_*_*_CC_FLAGS = -O2 -DZ_SOLO --compile-and-analyze $(BUILD_REPORT_DIR)
+ GCC:*_*_*_CC_FLAGS = -O2 -DZ_SOLO
+ GCC:*_*_*_CC_FLAGS = $(SDLLVM_COMPILE_ANALYZE) $(SDLLVM_ANALYZE_REPORT)
[Sources]
zutil.c
diff --git a/makefile b/makefile
index e46e6f6..f468805 100644
--- a/makefile
+++ b/makefile
@@ -55,6 +55,16 @@
ENABLE_LE_VARIANT := 0
endif
+ifeq "$(ABL_USE_SDLLVM)" "true"
+ SDLLVM_COMPILE_ANALYZE := --compile-and-analyze
+ SDLLVM_ANALYZE_REPORT := $(BUILD_REPORT_DIR)
+else
+ SDLLVM_COMPILE_ANALYZE :=
+ SDLLVM_ANALYZE_REPORT :=
+endif
+export SDLLVM_COMPILE_ANALYZE := $(SDLLVM_COMPILE_ANALYZE)
+export SDLLVM_ANALYZE_REPORT := $(SDLLVM_ANALYZE_REPORT)
+
.PHONY: all cleanall
all: ABL_FV_ELF