diff options
-rw-r--r-- | doc/manual/rl-next/new-assertions.md | 23 | ||||
-rw-r--r-- | local.mk | 2 | ||||
-rw-r--r-- | meson.build | 9 |
3 files changed, 31 insertions, 3 deletions
diff --git a/doc/manual/rl-next/new-assertions.md b/doc/manual/rl-next/new-assertions.md new file mode 100644 index 000000000..efaaeb306 --- /dev/null +++ b/doc/manual/rl-next/new-assertions.md @@ -0,0 +1,23 @@ +--- +synopsis: Lix turns more internal bugs into crashes +cls: [797, 626] +--- + +Lix now enables build options such as trapping on signed overflow and enabling +libstdc++ assertions by default. These may find new bugs in Lix, which will +present themselves as Lix processes aborting, potentially without an error +message. + +If Lix processes abort on your machine, this is a bug. Please file a bug, +ideally with the core dump (or information from it). + +On Linux, run `coredumpctl list`, find the crashed process's PID at +the bottom of the list, then run `coredumpctl info THE-PID`. You can then paste +the output into a bug report. + +On macOS, open the Console app from Applications/Utilities, select Crash +Reports, select the crash report in question. Right click on it, select Open In +Finder, then include that file in your bug report. [See the Apple +documentation][apple-crashreport] for more details. + +[apple-crashreport]: https://developer.apple.com/documentation/xcode/acquiring-crash-reports-and-diagnostic-logs#Locate-crash-reports-and-memory-logs-on-the-device @@ -4,7 +4,7 @@ # This has an overhead of 0-4% on gcc and unmeasurably little on clang, in # Nix evaluation benchmarks. DEFAULT_SANITIZE_FLAGS = -fsanitize=signed-integer-overflow -fsanitize-undefined-trap-on-error -GLOBAL_CXXFLAGS += -Wno-deprecated-declarations -Werror=switch $(DEFAULT_SANITIZE_FLAGS) +GLOBAL_CXXFLAGS += -Wno-deprecated-declarations -Werror=switch $(DEFAULT_SANITIZE_FLAGS) -D_GLIBCXX_ASSERTIONS=1 GLOBAL_LDFLAGS += $(DEFAULT_SANITIZE_FLAGS) # Allow switch-enum to be overridden for files that do not support it, usually because of dependency headers. ERROR_SWITCH_ENUM = -Werror=switch-enum diff --git a/meson.build b/meson.build index 2cedabad5..456be5aa2 100644 --- a/meson.build +++ b/meson.build @@ -344,6 +344,12 @@ add_project_arguments( '-Wimplicit-fallthrough', '-Werror=switch', '-Werror=switch-enum', + # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked + # at ~1% overhead in `nix search`. + # + # FIXME: remove when we get meson 1.4.0 which will default this to on for us: + # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions + '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) @@ -351,8 +357,7 @@ if cxx.get_id() in ['gcc', 'clang'] # 2024-03-24: jade benchmarked the default sanitize reporting in clang and got # a regression of about 10% on hackage-packages.nix with clang. So we are trapping instead. # - # This has an overhead of 0-4% on gcc and unmeasurably little on clang, in - # Nix evaluation benchmarks. + # This has an unmeasurably low overhead in Nix evaluation benchmarks. # # N.B. Meson generates a completely nonsense warning here: # https://github.com/mesonbuild/meson/issues/9822 |