Skip to content

Commit

Permalink
Disable strict aliasing
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.

Remove -fpermissive, it's not needed and something to discourage.
  • Loading branch information
bnoordhuis committed Sep 17, 2024
1 parent d77eb91 commit fd8dba1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ext/mini_racer_extension/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
$CXXFLAGS += " -rdynamic" unless $CXXFLAGS.split.include? "-rdynamic"
$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 fd8dba1

Please sign in to comment.