mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-19 03:54:01 +00:00
Makefile: add ASAN=1 flag to build with AddressSanitizer enabled
This sanitizer is useful to detect use-after-free, double free, buffer overflows, and more such errors. I've found it useful lately to detect some bugs in TinyGo, and having a single flag to enable it makes it much easier to enable AddressSanitizer.
This commit is contained in:
committed by
Ron Evans
parent
8f33721b88
commit
5548b5999b
@@ -56,6 +56,12 @@ else
|
|||||||
LLVM_OPTION += '-DLLVM_ENABLE_ASSERTIONS=OFF'
|
LLVM_OPTION += '-DLLVM_ENABLE_ASSERTIONS=OFF'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Enable AddressSanitizer
|
||||||
|
ifeq (1, $(ASAN))
|
||||||
|
LLVM_OPTION += -DLLVM_USE_SANITIZER=Address
|
||||||
|
CGO_LDFLAGS += -fsanitize=address
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq (1, $(STATIC))
|
ifeq (1, $(STATIC))
|
||||||
# Build TinyGo as a fully statically linked binary (no dynamically loaded
|
# Build TinyGo as a fully statically linked binary (no dynamically loaded
|
||||||
# libraries such as a libc). This is not supported with glibc which is used
|
# libraries such as a libc). This is not supported with glibc which is used
|
||||||
|
|||||||
Reference in New Issue
Block a user