Skip to content

Commit

Permalink
Better support for asan/ubsan.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Oct 3, 2024
1 parent bef8e91 commit 59a4129
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ext/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
$CFLAGS << " -Wall -Wno-unknown-pragmas -std=c99"

if ENV.key?("RUBY_DEBUG")
$CFLAGS << " -DRUBY_DEBUG -O0"
$stderr.puts "Enabling debug mode..."

# Add address and undefined behaviour sanitizers:
$CFLAGS << " -fsanitize=undefined -fno-omit-frame-pointer"
$LDFLAGS << " -fsanitize=undefined"
$CFLAGS << " -DRUBY_DEBUG -O0"
end

$srcs = ["io/event/event.c", "io/event/selector/selector.c"]
Expand Down Expand Up @@ -56,6 +54,14 @@

have_header("ruby/io/buffer.h")

if ENV.key?("RUBY_SANITIZE")
$stderr.puts "Enabling sanitizers..."

# Add address and undefined behaviour sanitizers:
$CFLAGS << " -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
$LDFLAGS << " -fsanitize=address -fsanitize=undefined"
end

create_header

# Generate the makefile to compile the native binary into `lib`:
Expand Down

0 comments on commit 59a4129

Please sign in to comment.