Skip to content

Commit

Permalink
Disable strict aliasing (#315)
Browse files Browse the repository at this point in the history
Harmonize C++ compiler flags with Node.js (-fno-rtti, -fno-exceptions)
and, critically, disable strict aliasing, because V8 is not the least
bit strict-aliasing safe.

Upstream turned it off in nodejs/node#54339,
like it always should have been, and I suspect the mismatch may be the
cause of segfaults that show up in production.
  • Loading branch information
bnoordhuis authored Sep 17, 2024
1 parent d77eb91 commit 5b9d19e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ext/mini_racer_extension/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
$CXXFLAGS += " -fPIC" unless $CXXFLAGS.split.include? "-rdynamic" or IS_DARWIN
$CXXFLAGS += " -std=c++17"
$CXXFLAGS += " -fpermissive"
$CXXFLAGS += " -fno-rtti"
$CXXFLAGS += " -fno-exceptions"
$CXXFLAGS += " -fno-strict-aliasing"
#$CXXFLAGS += " -DV8_COMPRESS_POINTERS"
$CXXFLAGS += " -fvisibility=hidden "

Expand Down

0 comments on commit 5b9d19e

Please sign in to comment.