summaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorTrilok Soni <tsoni@codeaurora.org>2017-04-26 17:32:05 -0700
committerRhythm Patel <rhythmp@codeaurora.org>2017-08-15 15:34:56 -0700
commitc1a2d145164238b7a79c1c38c7ce52db1f9ed670 (patch)
treeffed1b3085fca33ccb471850cf82607150384dce /makefile
parentf76d72079e80961d69dd67f6ecddd3d93f0f4e74 (diff)
edk2: UbsanLib: Undefined Behavior Sanitizer Lib
UBSAN helps in catching Undefined behavior of the code at the runtime. This patch adds support for UBSAN's compile time instrumentation hooks. Please note that enabling UBSAN will increase the size of overall edk2 Change-Id: I380bb4cc51c2e58a820e9f9b7b1e7e1024f60b55
Diffstat (limited to 'makefile')
-rw-r--r--makefile13
1 files changed, 12 insertions, 1 deletions
diff --git a/makefile b/makefile
index ad7baac52b..979bbe7aea 100644
--- a/makefile
+++ b/makefile
@@ -37,6 +37,17 @@ ABL_FV_IMG := $(BUILD_ROOT)/FV/abl.fv
ABL_FV_ELF := $(BOOTLOADER_OUT)/../../abl.elf
SHELL:=/bin/bash
+# UEFI UBSAN Configuration
+# ENABLE_UEFI_UBSAN := true
+
+ifeq "$(ENABLE_UEFI_UBSAN)" "true"
+ UBSAN_GCC_FLAG_UNDEFINED := -fsanitize=undefined
+ UBSAN_GCC_FLAG_ALIGNMENT := -fno-sanitize=alignment
+else
+ UBSAN_GCC_FLAG_UNDEFINED :=
+ UBSAN_GCC_FLAG_ALIGNMENT :=
+endif
+
.PHONY: all cleanall
all: ABL_FV_ELF
@@ -52,7 +63,7 @@ EDK_TOOLS_BIN:
ABL_FV_IMG: EDK_TOOLS_BIN
@. ./edksetup.sh BaseTools && \
- build -p $(WORKSPACE)/QcomModulePkg/QcomModulePkg.dsc -a $(ARCHITECTURE) -t $(TARGET_TOOLS) -b $(TARGET) -D ABL_OUT_DIR=$(ANDROID_PRODUCT_OUT) -D VERIFIED_BOOT=$(VERIFIED_BOOT) -D VERIFIED_BOOT_2=$(VERIFIED_BOOT_2) -D USER_BUILD_VARIANT=$(USER_BUILD_VARIANT) -j build_modulepkg.log $*
+ build -p $(WORKSPACE)/QcomModulePkg/QcomModulePkg.dsc -a $(ARCHITECTURE) -t $(TARGET_TOOLS) -b $(TARGET) -D ABL_OUT_DIR=$(ANDROID_PRODUCT_OUT) -D VERIFIED_BOOT=$(VERIFIED_BOOT) -D VERIFIED_BOOT_2=$(VERIFIED_BOOT_2) -D USER_BUILD_VARIANT=$(USER_BUILD_VARIANT) -D UBSAN_UEFI_GCC_FLAG_UNDEFINED=$(UBSAN_GCC_FLAG_UNDEFINED) -D UBSAN_UEFI_GCC_FLAG_ALIGNMENT=$(UBSAN_GCC_FLAG_ALIGNMENT) -j build_modulepkg.log $*
cp $(BUILD_ROOT)/FV/FVMAIN_COMPACT.Fv $(ABL_FV_IMG)
ABL_FV_ELF: ABL_FV_IMG