Skip to content

Commit

Permalink
bugfix: Stop ocaml-option-flambda (etc.) auto-used in switch
Browse files Browse the repository at this point in the history
ocaml-option-flambda conflicts dkml-base-compiler so can't be auto-used.

Also remove auto-use of ocaml-option-fp and ocaml-option-afl since not recognized by dkml-base-compiler.

Only comes into play when `dk Ml.Switch init --non-system-compiler`
  • Loading branch information
jonahbeckford committed Sep 23, 2024
1 parent 74458f4 commit 307f68d
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions src/unix/create-opam-switch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -487,22 +487,27 @@ if [ "$BUILD_OCAML_BASE" = ON ]; then
if [ $BUILD_DEBUG = ON ]; then
OCAML_OPTIONS="$OCAML_OPTIONS",dkml-option-debuginfo
fi
if [ $BUILD_DEBUG = ON ] && [ $TARGET_CANENABLEFRAMEPOINTER = ON ]; then
# Frame pointer should be on in Debug mode.
OCAML_OPTIONS="$OCAML_OPTIONS",ocaml-option-fp
fi
if [ "$BUILDTYPE" = ReleaseCompatPerf ] && [ $TARGET_CANENABLEFRAMEPOINTER = ON ]; then
# If we need Linux `perf` we need frame pointers enabled
OCAML_OPTIONS="$OCAML_OPTIONS",ocaml-option-fp
fi
if [ $BUILD_RELEASE = ON ]; then
# All release builds should get flambda optimization
OCAML_OPTIONS="$OCAML_OPTIONS",ocaml-option-flambda
fi
if cmake_flag_on "${DKML_COMPILE_CM_HAVE_AFL:-OFF}" || [ "$BUILDTYPE" = ReleaseCompatFuzz ]; then
# If we need fuzzing we must add AFL. If we have a fuzzing compiler, use AFL in OCaml.
OCAML_OPTIONS="$OCAML_OPTIONS",ocaml-option-afl
fi

# TODO: These ocaml-option-* have not been integrated into dkml-base-compiler.
# We should always enable frame pointers.
# Flambda optimization should get an option, and select with dk Ml.Switch --flambda
#
# if [ $BUILD_DEBUG = ON ] && [ $TARGET_CANENABLEFRAMEPOINTER = ON ]; then
# # Frame pointer should be on in Debug mode.
# OCAML_OPTIONS="$OCAML_OPTIONS",ocaml-option-fp
# fi
# if [ "$BUILDTYPE" = ReleaseCompatPerf ] && [ $TARGET_CANENABLEFRAMEPOINTER = ON ]; then
# # If we need Linux `perf` we need frame pointers enabled
# OCAML_OPTIONS="$OCAML_OPTIONS",ocaml-option-fp
# fi
# if [ $BUILD_RELEASE = ON ]; then
# # All release builds should get flambda optimization
# OCAML_OPTIONS="$OCAML_OPTIONS",ocaml-option-flambda
# fi
# if cmake_flag_on "${DKML_COMPILE_CM_HAVE_AFL:-OFF}" || [ "$BUILDTYPE" = ReleaseCompatFuzz ]; then
# # If we need fuzzing we must add AFL. If we have a fuzzing compiler, use AFL in OCaml.
# OCAML_OPTIONS="$OCAML_OPTIONS",ocaml-option-afl
# fi
fi

# Set DKMLBASECOMPILERVERSION. Ex: 4.12.1~v1.0.2~prerel27
Expand Down

0 comments on commit 307f68d

Please sign in to comment.