-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from marktwtn/sanitizer-check
Build: Extend build option for Sanitizer checking
- Loading branch information
Showing
4 changed files
with
36 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
SHELL = /bin/bash | ||
|
||
# Check whether the GCC version is higher than the minimum required version including Sanitizers | ||
# TODO: The ARM platform should be handled as well | ||
SANITIZER_MIN_GCC_VER = 4.9 | ||
GCC_VER := $(shell $(CC) -dumpfullversion) | ||
# Get the lower version of the current GCC version and the minimum required version | ||
LOWER_VER := $(firstword $(shell echo -e "$(SANITIZER_MIN_GCC_VER)\n$(GCC_VER)" | sort -V)) | ||
|
||
# Check whether the specified Sanitizer is existed or not | ||
SANITIZER_LIST = address undefined thread | ||
# If it is existed, return the name of the Sanitizer | ||
# Otherwise, return empty string | ||
SANITIZER := $(filter $(SANITIZER_LIST),$(BUILD_DEBUG)) | ||
|
||
ifeq ("$(LOWER_VER)","$(SANITIZER_MIN_GCC_VER)") | ||
ifneq ("$(SANITIZER)","") | ||
CFLAGS += -fsanitize=$(SANITIZER) | ||
LDFLAGS += -fsanitize=$(SANITIZER) | ||
endif | ||
endif |