Skip to content

Commit

Permalink
Merge pull request #10797 from dra27/fix-volatile
Browse files Browse the repository at this point in the history
Fix compilation of systhreads on Visual Studio 2019 and 2022
  • Loading branch information
dra27 committed Jan 4, 2022
2 parents 7ca339b + 0ac7358 commit 42f0c8a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@ OCaml 4.14.0
(Sébastien Hinderer, review by David Allsopp, Daniel Bünzli, Xavier Leroy
and Gabriel Scherer)

- #10797: Compile with -d2VolatileMetadata- on supporting versions of Visual
Studio. This suppresses the addition of .voltbl sections and eliminates
linking errors in systhreads.
(David Allsopp, review by Jonah Beckford and Sébastien Hinderer)

### Bug fixes:

- #9214, #10709: Wrong unmarshaling of function pointers in debugger mode.
Expand Down
13 changes: 13 additions & 0 deletions aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ AC_DEFUN([OCAML_CC_HAS_DEBUG_PREFIX_MAP], [
CFLAGS="$saved_CFLAGS"
])

AC_DEFUN([OCAML_CL_HAS_VOLATILE_METADATA], [
AC_MSG_CHECKING([whether the C compiler supports -d2VolatileMetadata-])
saved_CFLAGS="$CFLAGS"
CFLAGS="-d2VolatileMetadata- $CFLAGS"
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([int main() { return 0; }])],
[cl_has_volatile_metadata=true
AC_MSG_RESULT([yes])],
[cl_has_volatile_metadata=false
AC_MSG_RESULT([no])])
CFLAGS="$saved_CFLAGS"
])

# Save C compiler related variables
AC_DEFUN([OCAML_CC_SAVE_VARIABLES], [
saved_CC="$CC"
Expand Down
24 changes: 24 additions & 0 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,9 @@ AS_CASE([$host],
[common_cflags="-nologo -O2 -Gy- -MD $cc_warnings"
common_cppflags="-D_CRT_SECURE_NO_DEPRECATE"
internal_cppflags='-DUNICODE -D_UNICODE'
OCAML_CL_HAS_VOLATILE_METADATA
AS_IF([test "x$cl_has_volatile_metadata" = "xtrue"],
[internal_cflags='-d2VolatileMetadata-'])
internal_cppflags="$internal_cppflags -DWINDOWS_UNICODE="
internal_cppflags="${internal_cppflags}\$(WINDOWS_UNICODE)"],
[xlc-*],
Expand Down

0 comments on commit 42f0c8a

Please sign in to comment.