Skip to content

Commit

Permalink
Revert "Do not allow naked pointers (remove configure option)"
Browse files Browse the repository at this point in the history
This reverts commit 4984208.
  • Loading branch information
gretay-js committed Jan 10, 2025
1 parent 35e2c04 commit 37a38eb
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 7 deletions.
33 changes: 29 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ AC_SUBST([mkexe_ldflags_exp])
AC_SUBST([PACKLD])
AC_SUBST([build_libraries_manpages])
AC_SUBST([compute_deps])
AC_SUBST([naked_pointers])
AC_SUBST([naked_pointers_checker])
AC_SUBST([intel_jcc_bug_cflags])
AC_SUBST([stack_allocation])
AC_SUBST([poll_insertion])
Expand Down Expand Up @@ -583,10 +585,9 @@ AC_ARG_ENABLE([cpp-mangling],
[AS_HELP_STRING([--enable-cpp-mangling],
[use cpp mangling for exported symbols])])

AC_ARG_ENABLE([naked-pointers], [],
[AS_IF([test "x$enableval" != 'xno'],
[AC_MSG_ERROR([Naked pointers were prohibited in OCaml 5.0.])])],
[])
AC_ARG_ENABLE([naked-pointers],
[AS_HELP_STRING([--disable-naked-pointers],
[do not allow naked pointers])])

AC_ARG_ENABLE([naked-pointers-checker], [],
[AS_IF([test "x$enableval" != 'xno'],
Expand Down Expand Up @@ -2639,6 +2640,30 @@ AS_IF([test x"$enable_cpp_mangling" = "xyes"],
AC_DEFINE([WITH_CPP_MANGLING])],
[cpp_mangling=false])

## No naked pointers

AS_IF([test x"$enable_naked_pointers" = "xno" ],
[naked_pointers=false
AC_DEFINE([NO_NAKED_POINTERS])],
[naked_pointers=true])

AS_IF([test x"$enable_naked_pointers_checker" = "xyes" ],
[AS_IF([test x"$enable_naked_pointers" = "xno" ],
[AC_MSG_ERROR(m4_normalize([
--enable-naked-pointers-checker and --disable-naked-pointers
are incompatible]))])
AS_CASE(["$arch","$system"],
[amd64,linux|amd64,macosx \
|amd64,openbsd|amd64,win64 \
|amd64,freebsd|amd64,solaris \
|arm64,linux|arm64,macosx],
[naked_pointers_checker=true
AC_DEFINE([NAKED_POINTERS_CHECKER])],
[*],
[AC_MSG_ERROR([naked pointers checker not supported on this platform])]
)],
[naked_pointers_checker=false])

## Check for mmap support for huge pages and contiguous heap
OCAML_MMAP_SUPPORTS_HUGE_PAGES

Expand Down
2 changes: 1 addition & 1 deletion ocamltest/ocamltest_config.ml.in
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ let stack_allocation = @stack_allocation@

let poll_insertion = @poll_insertion@

let naked_pointers = false
let naked_pointers = @naked_pointers@

let tsan = @tsan@
2 changes: 1 addition & 1 deletion runtime4/caml/m.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

#undef WITH_FRAME_POINTERS

#define NO_NAKED_POINTERS 1
#undef NO_NAKED_POINTERS

#undef NAKED_POINTERS_CHECKER

Expand Down
1 change: 0 additions & 1 deletion utils/config.common.ml.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ and cfg_magic_number = {magic|@CFG_MAGIC_NUMBER@|magic}

let safe_string = true
let default_safe_string = true
let naked_pointers = false
let flambda_backend = true

let interface_suffix = ref ".mli"
Expand Down
1 change: 1 addition & 0 deletions utils/config.generated.ml.in
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ let flexdll_dirs = [@flexdll_dir@]

let ar_supports_response_files = @ar_supports_response_files@

let naked_pointers = "@naked_pointers@" = "true"
let runtime5 = "@enable_runtime5@" = "yes"

let reserved_header_bits =
Expand Down

0 comments on commit 37a38eb

Please sign in to comment.