From 03b9ee485291c54e252c7f62530301ae5b6f79d8 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Fri, 20 Mar 2020 12:04:57 -0400 Subject: [PATCH 1/2] [mono] Add headers for unstable APIs We have functions that are de-facto part of the Mono embedding API that are used by Xamarin.iOS or Xamarin.Android that are not in a state where we want to commit to supporting them forever in their current form. Nonetheless, we would like to make sure that the symbols for these functions are visible even if we otherwise compile the runtime with `-fvisisibility=hidden`, and we would like to discourage declaring the functions in the embedder's own headers. The functions that go into the `mono/{utils,metadata,jit}/mono-private-unstable.h` headers will all be marked with `MONO_API MONO_RT_EXTERNAL_ONLY` but we will not guarantee that the functions will be there from one release to the next or that they will not change their signatures or their behaviors. --- src/mono/mono/metadata/Makefile.am | 1 + .../mono/metadata/mono-private-unstable.h | 19 +++++++++++++++++++ src/mono/mono/mini/Makefile.am.in | 4 +++- src/mono/mono/mini/mono-private-unstable.h | 19 +++++++++++++++++++ src/mono/mono/utils/Makefile.am | 1 + src/mono/mono/utils/mono-private-unstable.h | 19 +++++++++++++++++++ 6 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/mono/mono/metadata/mono-private-unstable.h create mode 100644 src/mono/mono/mini/mono-private-unstable.h create mode 100644 src/mono/mono/utils/mono-private-unstable.h diff --git a/src/mono/mono/metadata/Makefile.am b/src/mono/mono/metadata/Makefile.am index f8bb45da5d0a1..0415d87bee410 100644 --- a/src/mono/mono/metadata/Makefile.am +++ b/src/mono/mono/metadata/Makefile.am @@ -455,6 +455,7 @@ libmonoruntimeinclude_HEADERS = \ mono-config.h \ mono-debug.h \ mono-gc.h \ + mono-private-unstable.h \ object.h \ object-forward.h \ opcodes.h \ diff --git a/src/mono/mono/metadata/mono-private-unstable.h b/src/mono/mono/metadata/mono-private-unstable.h new file mode 100644 index 0000000000000..7fd11db4d7828 --- /dev/null +++ b/src/mono/mono/metadata/mono-private-unstable.h @@ -0,0 +1,19 @@ +/** + * \file + * + * Private unstable APIs. + * + * WARNING: The declarations and behavior of functions in this header are NOT STABLE and can be modified or removed at + * any time. + * + */ + + +#ifndef __MONO_METADATA_MONO_PRIVATE_UNSTABLE_H__ +#define __MONO_METADATA_MONO_PRIVATE_UNSTABLE_H__ + +#include + + + +#endif /*__MONO_METADATA_MONO_PRIVATE_UNSTABLE_H__*/ diff --git a/src/mono/mono/mini/Makefile.am.in b/src/mono/mono/mini/Makefile.am.in index 567313b6c7f4a..4fa894984cc16 100755 --- a/src/mono/mono/mini/Makefile.am.in +++ b/src/mono/mono/mini/Makefile.am.in @@ -783,7 +783,9 @@ libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit # These are public headers. # They should not use glib.h, G_BEGIN_DECLS, guint, etc. # They should be wrapped in MONO_BEGIN_DECLS / MONO_END_DECLS. -libmonoinclude_HEADERS = jit.h +libmonoinclude_HEADERS = \ + jit.h \ + mono-private-unstable.h CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649,0618 diff --git a/src/mono/mono/mini/mono-private-unstable.h b/src/mono/mono/mini/mono-private-unstable.h new file mode 100644 index 0000000000000..805edd25c4759 --- /dev/null +++ b/src/mono/mono/mini/mono-private-unstable.h @@ -0,0 +1,19 @@ +/** + * \file + * + * Private unstable APIs. + * + * WARNING: The declarations and behavior of functions in this header are NOT STABLE and can be modified or removed at + * any time. + * + */ + + +#ifndef __MONO_JIT_MONO_PRIVATE_UNSTABLE_H__ +#define __MONO_JIT_MONO_PRIVATE_UNSTABLE_H__ + +#include + + + +#endif /*__MONO_JIT_MONO_PRIVATE_UNSTABLE_H__*/ diff --git a/src/mono/mono/utils/Makefile.am b/src/mono/mono/utils/Makefile.am index 79856efb6c6d8..f4565f380dbe1 100644 --- a/src/mono/mono/utils/Makefile.am +++ b/src/mono/mono/utils/Makefile.am @@ -343,6 +343,7 @@ libmonoutilsinclude_HEADERS = \ mono-publib.h \ mono-jemalloc.h \ mono-dl-fallback.h \ + mono-private-unstable.h \ mono-counters.h EXTRA_DIST = mono-errno.h mono-embed.h mono-embed.c ../../support/libm/complex.c mono-experiments.def diff --git a/src/mono/mono/utils/mono-private-unstable.h b/src/mono/mono/utils/mono-private-unstable.h new file mode 100644 index 0000000000000..241a723447957 --- /dev/null +++ b/src/mono/mono/utils/mono-private-unstable.h @@ -0,0 +1,19 @@ +/** + * \file + * + * Private unstable APIs. + * + * WARNING: The declarations and behavior of functions in this header are NOT STABLE and can be modified or removed at + * any time. + * + */ + + +#ifndef __MONO_UTILS_MONO_PRIVATE_UNSTABLE_H__ +#define __MONO_UTILS_MONO_PRIVATE_UNSTABLE_H__ + +#include + + + +#endif /*__MONO_UTILS_MONO_PRIVATE_UNSTABLE_H__*/ From 34c3ceb04343583822b847fe861fdd0e4816c054 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Fri, 20 Mar 2020 17:01:06 -0400 Subject: [PATCH 2/2] [msvc] Add the three mono-private-unstable.h files --- src/mono/msvc/libmono.bat | 12 ++++++++++-- src/mono/msvc/libmonoruntime-common.targets | 1 + src/mono/msvc/libmonoruntime-common.targets.filters | 3 +++ src/mono/msvc/libmonoutils-common.targets | 1 + src/mono/msvc/libmonoutils-common.targets.filters | 3 +++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/mono/msvc/libmono.bat b/src/mono/msvc/libmono.bat index b06d3721f3872..fc52ac1fb0475 100755 --- a/src/mono/msvc/libmono.bat +++ b/src/mono/msvc/libmono.bat @@ -69,6 +69,7 @@ metadata.h ^ mono-config.h ^ mono-debug.h ^ mono-gc.h ^ +mono-private-unstable.h ^ object.h ^ object-forward.h ^ opcodes.h ^ @@ -88,15 +89,22 @@ mono-error.h ^ mono-forward.h ^ mono-jemalloc.h ^ mono-logger.h ^ +mono-private-unstable.h ^ mono-publib.h +SET JIT_FILES=^ +jit.h ^ +mono-private-unstable.h + ECHO Copying mono include files from %SOURCE_ROOT% to %TARGET_ROOT% ... SET RUN=%XCOPY_COMMAND% "%SOURCE_ROOT%\cil\opcode.def" "%TARGET_ROOT%\cil\" %OPTIONS% call :runCommand "%RUN%" %ARGUMENTS% -SET RUN=%XCOPY_COMMAND% "%SOURCE_ROOT%\mini\jit.h" "%TARGET_ROOT%\jit\" %OPTIONS% -call :runCommand "%RUN%" %ARGUMENTS% +FOR %%a IN (%JIT_FILES%) DO ( + SET RUN=%XCOPY_COMMAND% "%SOURCE_ROOT%\mini\%%a" "%TARGET_ROOT%\jit\" %OPTIONS% + call :runCommand "!RUN!" %ARGUMENTS% +) FOR %%a IN (%META_DATA_FILES%) DO ( SET RUN=%XCOPY_COMMAND% "%SOURCE_ROOT%\metadata\%%a" "%TARGET_ROOT%\metadata\" %OPTIONS% diff --git a/src/mono/msvc/libmonoruntime-common.targets b/src/mono/msvc/libmonoruntime-common.targets index a1d02521cf8ff..3e6f62e64d155 100644 --- a/src/mono/msvc/libmonoruntime-common.targets +++ b/src/mono/msvc/libmonoruntime-common.targets @@ -244,6 +244,7 @@ + diff --git a/src/mono/msvc/libmonoruntime-common.targets.filters b/src/mono/msvc/libmonoruntime-common.targets.filters index 7bb69e615e823..d614b6bcc49f7 100644 --- a/src/mono/msvc/libmonoruntime-common.targets.filters +++ b/src/mono/msvc/libmonoruntime-common.targets.filters @@ -675,6 +675,9 @@ Header Files$(MonoRuntimeFilterSubFolder)\common\public + + Header Files$(MonoRuntimeFilterSubFolder)\common\public + Header Files$(MonoRuntimeFilterSubFolder)\common\public diff --git a/src/mono/msvc/libmonoutils-common.targets b/src/mono/msvc/libmonoutils-common.targets index 19dca2758646a..88cc2c34979a9 100644 --- a/src/mono/msvc/libmonoutils-common.targets +++ b/src/mono/msvc/libmonoutils-common.targets @@ -207,6 +207,7 @@ + diff --git a/src/mono/msvc/libmonoutils-common.targets.filters b/src/mono/msvc/libmonoutils-common.targets.filters index 33813fd98c31b..88f842fa5cee0 100644 --- a/src/mono/msvc/libmonoutils-common.targets.filters +++ b/src/mono/msvc/libmonoutils-common.targets.filters @@ -492,6 +492,9 @@ Header Files$(MonoUtilsFilterSubFolder)\common\public + + Header Files$(MonoUtilsFilterSubFolder)\common\public + Header Files$(MonoUtilsFilterSubFolder)\common\public