Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation of systhreads on Visual Studio 2019 and 2022 #10797

Merged
merged 1 commit into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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