mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-10 03:13:46 +00:00
configure.ac:
Add configure option --enable-sanitizers.
Mmake.common.in:
scripts/Mercury.config.in:
Add variables to be set when --enable-sanitizers is used.
scripts/mgnuc.in:
scripts/ml.in:
Pass sanitizer options to the C compiler and the linker.
compiler/options.m:
Add options --cflags-for-sanitizers and --linker-sanitizer-flags
for receiving the configuration.
Set --linker-trace-flags and --shlib-linker-trace-flags default
values to empty instead of "-g" (likely copy error).
compiler/compile_target_code.m:
Pass sanitizer options to the C compiler, and the linker when
building an executable or shared library.
runtime/Mmakefile:
trace/Mmakefile:
Pass sanitizer options to linker when building shared libraries.
README.sanitizers:
Add instructions.
18 lines
748 B
Plaintext
18 lines
748 B
Plaintext
The configure option `--enable-sanitizers' will enable AddressSanitizer
|
|
and UndefinedBehaviorSanitizer when building with gcc. The built Mercury
|
|
compiler will also enable the same sanitizers when building user programs.
|
|
|
|
AddressSanitizer and UndefinedBehaviorSanitizer are included in gcc 4.9
|
|
and above. We have tested with gcc 5.3.0.
|
|
|
|
Only high-level C grades work with the sanitizers enabled.
|
|
|
|
For best results, use a `.ll_debug' grade or otherwise enable C debugging.
|
|
|
|
clang does not work yet (tested version 3.8.0). It seemingly does not
|
|
terminate when compiling certain files with UndefinedBehaviorSanitizer,
|
|
e.g. runtime/mercury_deconstruct.c. There are also linking issues to be
|
|
sorted out.
|
|
|
|
See also: <https://github.com/google/sanitizers>
|