Skip to content

Commit

Permalink
Makefile: enable ASAN for GCC
Browse files Browse the repository at this point in the history
Previously the `Makefile` conditionally enabled address sanitizer (ASAN)
based on whether the compiler was `clang`. Since GCC has supported
address sanitizer since GCC 4.8[0] we can remove this check and always
use ASAN for both supported compilers.

The only snag is that I observed linker errors about undefined
references to `__ubsan_handle_type_mismatch` unless I fix the `LDFLAGS`
to also include `-fsanitize=undefined`. This was already included in the
`CFLAGS`.

[0]: https://github.com/google/sanitizers/wiki/AddressSanitizer#getting-addresssanitizer
  • Loading branch information
cpu committed Apr 25, 2024
1 parent 7ccc6de commit c5199c2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions rustls-libssl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ CFLAGS := -Werror -Wall -Wextra -Wpedantic -g $(shell pkg-config --cflags openss
PROFILE := debug

ifeq ($(PROFILE), debug)
ifeq ($(CC), clang)
CFLAGS += -fsanitize=address -fsanitize=undefined
LDFLAGS += -fsanitize=address
endif
LDFLAGS += -fsanitize=address -fsanitize=undefined
endif

ifeq ($(PROFILE), release)
Expand Down

0 comments on commit c5199c2

Please sign in to comment.