Skip to content

Commit 1470516

Browse files
authored
Merge branch 'main' into refactor-cmm-for-more-integer-widths
2 parents e5c7499 + d6971f8 commit 1470516

File tree

116 files changed

+5977
-590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+5977
-590
lines changed

Makefile.common-jst

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ define dune_main_context
4848
(OCAMLLIB ("$(CURDIR)/_build/runtime_stdlib_install/lib/ocaml_runtime_stdlib")))
4949
(env (_
5050
(flags (:standard -warn-error +A -alert -unsafe_multidomain))
51+
; We never want to build the compiler itself with AddressSanitizer enabled.
52+
(ocamlopt_flags (:standard -fno-asan))
5153
(env-vars ("OCAMLPARAM" "$(BUILD_OCAMLPARAM)"))))))
5254
endef
5355

Makefile.config.in

+1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ INSTRUMENTED_RUNTIME_LIBS=@instrumented_runtime_libs@
199199
WITH_DEBUGGER=@with_debugger@
200200
ASM_CFI_SUPPORTED=@asm_cfi_supported@
201201
WITH_FRAME_POINTERS=@frame_pointers@
202+
WITH_ADDRESS_SANITIZER=@address_sanitizer@
202203
WITH_CPP_MANGLING=@cpp_mangling@
203204
WITH_PROFINFO=@profinfo@
204205
PROFINFO_WIDTH=@profinfo_width@

Makefile.upstream

+1-1
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ SAK_CFLAGS ?= $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) $(CPPFLAGS)
13771377
SAK_LINK ?= $(MKEXE_VIA_CC)
13781378

13791379
$(SAK): $(RUNTIME_DIR)/sak.$(O)
1380-
$(V_MKEXE)$(call SAK_LINK,$@,$^)
1380+
$(V_MKEXE)$(call SAK_LINK,$@,$^ $(if $(filter true,$(WITH_ADDRESS_SANITIZER)),-fsanitize=address -fsanitize-recover=address))
13811381

13821382
$(RUNTIME_DIR)/sak.$(O): $(RUNTIME_DIR)/sak.c $(RUNTIME_DIR)/caml/misc.h $(RUNTIME_DIR)/caml/config.h
13831383
$(V_CC)$(SAK_CC) -c $(SAK_CFLAGS) $(OUTPUTOBJ)$@ $<

backend/amd64/arch.ml

+7-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ let trap_notes = ref true
9494
(* Emit extension symbols for CPUID startup check *)
9595
let arch_check_symbols = ref true
9696

97+
let is_asan_enabled = ref Config.with_address_sanitizer
98+
9799
(* Machine-specific command-line options *)
98100

99101
let command_line_options =
@@ -104,7 +106,11 @@ let command_line_options =
104106
"-ftrap-notes", Arg.Set trap_notes,
105107
" Emit .note.ocaml_eh section with trap handling information (default)";
106108
"-fno-trap-notes", Arg.Clear trap_notes,
107-
" Do not emit .note.ocaml_eh section with trap handling information"
109+
" Do not emit .note.ocaml_eh section with trap handling information";
110+
"-fno-asan",
111+
Arg.Clear is_asan_enabled,
112+
" Disable AddressSanitizer. This is only meaningful if the compiler was \
113+
built with AddressSanitizer support enabled."
108114
] @ Extension.args
109115

110116
(* Specific operations for the AMD64 processor *)

backend/amd64/arch.mli

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ end
3939

4040
val trap_notes : bool ref
4141
val arch_check_symbols : bool ref
42+
val is_asan_enabled : bool ref
4243
val command_line_options : (string * Arg.spec * string) list
4344

4445
(* Specific operations for the AMD64 processor *)

0 commit comments

Comments
 (0)