[runtime] Add Dedup Support to MkBundle (#5484)

* [runtime] Fix mkbundle compilation on OSX

* [runtime] Add aot arguments to mkbundle

* [runtime] Enable compiling aot with mkbundle

* [runtime] Add new dedup interface to mkbundle

* [runtime] Fix path resolving for mkbundle

* [runtime] Use mkbundle in BCL tests

* [runtime] Skip building System.Security, System.IdentityModel tests on testing_aot_full

* [runtime] Fix in-tree building for mkbundle

* [runtime] Move testing dll into profile

* [runtime] Add target to mkbundle all tests before CI

* [runtime] Build stripper and use with mkbundle

Preliminary linker support ran into dependency-finding bug
with the monolinker.exe binary. Fix postponed until later.

* [runtime] Skip not supported tests with mkbundle

* [runtime] Don't re-aot when running BCL tests

* [runtime] Provide config to mkbundle

* [runtime] Fix mkbundle internationalization test results, build all

* [runtime] Clean up temp mkbundle aot directory

* [runtime] Add mkbundle support for dedup

* [runtime] Fix tracking of dedup module in mkbundle

* [runtime] Document mkbundle AOT options in man pages

* [runtime] Fix CADMessage generic method argument marshalling
This commit is contained in:
Alexander Kyte authored and Ludovic Henry committed 2017-11-15 09:56:26 -05:00
1 parent 50fa04c136
commit ca8b8bd346
25 files changed
+534 -46

No files matched your search

+11 -1
View File
@@ -958,6 +958,8 @@ with_cooperative_gc_default=no
INVARIANT_AOT_OPTIONS=nimt-trampolines=2000,ntrampolines=8000,nrgctx-fetch-trampolines=256,ngsharedvt-trampolines=4000
AOT_BUILD_ATTRS=$INVARIANT_AOT_OPTIONS
if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
DISABLE_MCS_DOCS_default=yes
elif test x$with_runtime_preset = xnet_4_x; then
@@ -985,8 +987,8 @@ elif test x$with_runtime_preset = xfullaot; then
mono_feature_disable_appdomains='yes'
AOT_BUILD_FLAGS="--runtime=mobile -O=gsharedvt --aot=full,$INVARIANT_AOT_OPTIONS"
AOT_RUN_FLAGS="--runtime=mobile --full-aot"
AOT_MODE="full"
elif test x$with_runtime_preset = xbitcode; then
DISABLE_MCS_DOCS_default=yes
with_testing_aot_full_default=yes
@@ -1003,6 +1005,7 @@ elif test x$with_runtime_preset = xbitcode; then
AOT_BUILD_FLAGS="--runtime=mobile --aot=llvmonly,$INVARIANT_AOT_OPTIONS"
AOT_RUN_FLAGS="--runtime=mobile --llvmonly"
AOT_MODE="llvmonly"
elif test x$with_runtime_preset = xhybridaot; then
DISABLE_MCS_DOCS_default=yes
with_testing_aot_hybrid_default=yes
@@ -1030,6 +1033,7 @@ elif test x$with_runtime_preset = xwinaot; then
AOT_BUILD_FLAGS="--runtime=mobile --aot=full,$INVARIANT_AOT_OPTIONS"
AOT_RUN_FLAGS="--runtime=mobile --full-aot"
AOT_MODE="llvmonly"
elif test x$with_runtime_preset = xorbis; then
DISABLE_MCS_DOCS_default=yes
with_orbis_default=yes
@@ -1043,6 +1047,7 @@ elif test x$with_runtime_preset = xorbis; then
AOT_BUILD_FLAGS="--runtime=mobile --aot=full,$INVARIANT_AOT_OPTIONS"
AOT_RUN_FLAGS="--runtime=mobile --full-aot"
AOT_MODE="full"
elif test x$with_runtime_preset = xunreal; then
DISABLE_MCS_DOCS_default=yes
with_unreal_default=yes
@@ -4871,6 +4876,11 @@ fi
if test "x$AOT_BUILD_FLAGS" != "x" ; then
echo "AOT_RUN_FLAGS=$AOT_RUN_FLAGS" >> $srcdir/$mcsdir/build/config.make
echo "AOT_BUILD_FLAGS=$AOT_BUILD_FLAGS" >> $srcdir/$mcsdir/build/config.make
echo "AOT_BUILD_ATTRS=$AOT_BUILD_ATTRS" >> $srcdir/$mcsdir/build/config.make
fi
if test "x$AOT_MODE" != "x" ; then
echo "AOT_MODE=$AOT_MODE" >> $srcdir/$mcsdir/build/config.make
fi
if test "x$enable_btls" = "xyes"; then
+31
View File
@@ -188,6 +188,18 @@ as precompiled binaries on the Mono distribution server.
.I "--local-targets"
Lists all of the available local cross compilation targets.
.TP
.I "--cil-strip PATH"
Provides a CIL stripper that mkbundle will use if able to.
The intended use is to help reduce file size on AOT.
.TP
.I "--in-tree path/to/mono/source/root"
Provides mkbundle with a mono source repository from which to pull the necessary headers for compilation.
This allows mkbundle to run out of the project's source tree, useful for working with multiple runtimes and for
testing without installing.
.TP
.I "--managed-linker PATH"
Provides mkbundle access to a managed linker to preprocess the assemblies.
.TP
.I "--machine-config FILE"
Uses the given FILE as the machine.config file for the generated
application.
@@ -308,6 +320,25 @@ causes it to statically link instead.
Compresses the assemblies before embedding. This results in smaller
executable files, but increases startup time and requires zlib to be
installed on the target system.
.SH AOT Options
These options support an mkbundle using AOT compilation with static linking. A native compiler
toolchain is required.
.TP
.I "--aot-runtime PATH"
Provide the path to the mono runtime to use for AOTing assemblies.
.TP
.I "--aot-dedup"
(Experimental) Deduplicate AOT'ed methods based on a unique mangling of method names.
.TP
.I "--aot-mode MODE"
MODE can be either "full" or "llvmonly" at this time.
Currently, mkbundle supports three AOT modes. The default mode (this option unset)
will AOT methods but will fall back on runtime codegen where it is much faster or offers
a more full compatibility profile. The "full" setting will generate the necessary stubs to
not require runtime code generation. The "llvmonly" setting does the same, but forces all codegen
to go through the llvm backend.
.SH WINDOWS
If you are using the old embedding on Windows systems, it it necessary
to have Unix-like toolchain to be installed for \fImkbundle\fP to
+3 -1
View File
@@ -32,7 +32,9 @@ mono_libdir = $(exec_prefix)/lib
sysconfdir = $(prefix)/etc
#RUNTIME = mono
RUNTIME = false
TEST_RUNTIME = MONO_PATH="./$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/$(PROFILE_DIRECTORY)$(PLATFORM_PATH_SEPARATOR)$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug
MONO_PATH_TOP = $(topdir)/class/lib/$(PROFILE_DIRECTORY)/
MONO_PATH_TESTS = $(MONO_PATH_TOP)/tests
TEST_RUNTIME = MONO_PATH="$(MONO_PATH_TOP)$(PLATFORM_PATH_SEPARATOR)$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$(MONO_PATH_TESTS)$(PLATFORM_PATH_SEPARATOR).$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug
# In case you want to add MCS_FLAGS, this lets you not have to
# keep track of the default value
+6 -3
View File
@@ -177,11 +177,14 @@ do-all-aot:
ifneq ("$(wildcard $(topdir)/class/lib/$(PROFILE))","")
AOT_PROFILE_ASSEMBLIES := $(sort $(patsubst .//%,%,$(filter-out %.dll.dll %.exe.dll %bare% %plaincore% %secxml% %Facades% %ilasm%,$(filter %.dll %.exe,$(wildcard $(topdir)/class/lib/$(PROFILE)/*)))))
AOT_PROFILE_TESTS := $(sort $(patsubst .//%,%,$(filter-out %.dll.dll %.exe.dll %bare% %plaincore% %secxml% %Facades% %ilasm%,$(filter %.dll %.exe,$(wildcard $(topdir)/class/lib/$(PROFILE)/tests/*)))))
AOT_PROFILE_ASSEMBLIES_OUT := $(patsubst %,%$(PLATFORM_AOT_SUFFIX),$(AOT_PROFILE_ASSEMBLIES))
AOT_PROFILE_TESTS_OUT := $(patsubst %,%$(PLATFORM_AOT_SUFFIX),$(AOT_PROFILE_TESTS))
# This can run in parallel
.PHONY: aot-all-profile
ifdef AOT_BUILD_FLAGS
aot-all-profile: $(patsubst %,%$(PLATFORM_AOT_SUFFIX),$(AOT_PROFILE_ASSEMBLIES))
aot-all-profile: $(AOT_PROFILE_ASSEMBLIES_OUT) $(AOT_PROFILE_TESTS_OUT)
else
aot-all-profile:
echo AOT_BUILD_FLAGS not set, skipping AOT.
@@ -189,12 +192,12 @@ endif
%.dll$(PLATFORM_AOT_SUFFIX): %.dll
@ mkdir -p $<_bitcode_tmp
$(Q_AOT) MONO_PATH="$(dir $<)" $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS),temp-path=$<_bitcode_tmp --verbose $< > [email protected]
$(Q_AOT) MONO_PATH="$(topdir)/class/lib/$(PROFILE)" $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS),temp-path=$<_bitcode_tmp --verbose $< > [email protected]
@ rm -rf $<_bitcode_tmp
%.exe$(PLATFORM_AOT_SUFFIX): %.exe
@ mkdir -p $<_bitcode_tmp
$(Q_AOT) MONO_PATH="$(dir $<)" $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS),temp-path=$<_bitcode_tmp --verbose $< > [email protected]
$(Q_AOT) MONO_PATH="$(topdir)/class/lib/$(PROFILE)" $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS),temp-path=$<_bitcode_tmp --verbose $< > [email protected]
@ rm -rf $<_bitcode_tmp
endif #ifneq ("$(wildcard $(topdir)/class/lib/$(PROFILE))","")
+58 -6
View File
@@ -90,8 +90,14 @@ tests_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
endif
test_assemblies :=
test_lib_dir = $(topdir)/class/lib/$(PROFILE)/tests
test_lib_output = $(topdir)/class/lib/$(PROFILE)/tests/$(test_lib)
ifdef HAVE_CS_TESTS
test_assemblies = $(test_lib)
test_assemblies += $(test_lib_output)
check: run-test
test-local: $(test_assemblies)
@@ -121,11 +127,11 @@ LABELS_ARG = -labels
endif
ifdef ALWAYS_AOT
test-local-aot-compile: $(topdir)/build/deps/nunit-$(PROFILE).stamp
test-local-aot-compile: $(topdir)/build/deps/nunit-$(PROFILE).stamp $(test_assemblies)
PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(AOT_BUILD_FLAGS) $(test_assemblies)
else
test-local-aot-compile: $(topdir)/build/deps/nunit-$(PROFILE).stamp
test-local-aot-compile: $(topdir)/build/deps/nunit-$(PROFILE).stamp $(test_assemblies)
endif # ALWAYS_AOT
@@ -144,10 +150,53 @@ ifdef TEST_NUNITLITE_APP_CONFIG_RUNTIME
sed -i -e "/__INSERT_CUSTOM_APP_CONFIG_RUNTIME__/r $(TEST_NUNITLITE_APP_CONFIG_RUNTIME)" $(NUNITLITE_CONFIG_FILE)
endif
ifdef PLATFORM_AOT_SUFFIX
DEDUP_DUMMY_CS=$(topdir)/class/lib/$(PROFILE)/DedupInflatedMethods.cs
DEDUP_DUMMY=$(topdir)/class/lib/$(PROFILE)/DedupInflatedMethods.dll
$(DEDUP_DUMMY):
echo " // Empty Assembly \n\n" > $(DEDUP_DUMMY_CS)
$(CSCOMPILE) -t:library -out:$(DEDUP_DUMMY) $(DEDUP_DUMMY_CS)
rm $(DEDUP_DUMMY_CS)
MKBUNDLE_TEST_BIN = $(TEST_HARNESS).static
MKBUNDLE_EXE = $(topdir)/class/lib/$(PROFILE)/mkbundle.exe
# Pattern based on the one in AOT_PROFILE_ASSEMBLIES
# It's easier if you read it backwards.
# What we do here is get the files in the profile directory that end in "test.dll" or are prefixed with nunit (filter)
# and then strip out everything that we expect to live outside the top level (filter-out)
TEST_ASSEMBLIES:=$(sort $(patsubst .//%,%,$(filter-out %.exe.static %.dll.dll %.exe.dll %bare% %plaincore% %secxml% %Facades% %ilasm%,$(filter %.dll,$(wildcard $(topdir)/class/lib/$(PROFILE)/tests/*)))))
$(MKBUNDLE_EXE): $(topdir)/tools/mkbundle/mkbundle.cs
make -C $(topdir)/tools/mkbundle
mkbundle-all-tests:
$(Q_AOT) $(MAKE) -C $(topdir)/class do-test
$(Q_AOT) $(MAKE) -C $(topdir)/tools/mkbundle
$(Q_AOT) $(MAKE) $(MKBUNDLE_TEST_BIN) # recursive make re-computes variables for TEST_ASSEMBLIES
ifdef MKBUNDLE_DEDUP
MKBUNDLE_DEDUP_COND := $(DEDUP_DUMMY)
DEDUP_ARGS=--aot-dedup $(DEDUP_DUMMY)
endif
$(MKBUNDLE_TEST_BIN): $(TEST_ASSEMBLIES) $(TEST_HARNESS) $(MKBUNDLE_EXE) $(MKBUNDLE_DEDUP_COND)
$(Q_AOT) MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)" PKG_CONFIG_PATH="$(topdir)/../data" $(RUNTIME) $(RUNTIME_FLAGS) $(MKBUNDLE_EXE) -L $(topdir)/class/lib/$(PROFILE) -v --deps $(TEST_HARNESS) $(TEST_ASSEMBLIES) -o $(MKBUNDLE_TEST_BIN) --aot-mode $(AOT_MODE) --aot-runtime $(RUNTIME) --aot-args $(AOT_BUILD_ATTRS) --in-tree $(topdir)/.. --managed-linker $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/monolinker.exe --config $(topdir)/../data/config --i18n all $(DEDUP_ARGS) --keeptemp
endif # PLATFORM_AOT_SUFFIX
ifneq ($(wildcard $(MKBUNDLE_TEST_BIN)),)
TEST_HARNESS_EXEC=$(MKBUNDLE_TEST_BIN)
TEST_HARNESS_EXCLUDES:=$(TEST_HARNESS_EXCLUDES),StaticLinkedAotNotWorking
else
TEST_HARNESS_EXEC=$(TEST_RUNTIME) $(RUNTIME_FLAGS) $(TEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(TEST_HARNESS)
endif
## FIXME: i18n problem in the 'sed' command below
run-test-lib: test-local test-local-aot-compile patch-nunitlite-appconfig
ok=:; \
PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(TEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(TEST_HARNESS) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(LABELS_ARG) -format:nunit2 -result:TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \
PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_HARNESS_EXEC) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(LABELS_ARG) -format:nunit2 -result:TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \
if [ ! -f "TestResult-$(PROFILE).xml" ]; then echo "<?xml version='1.0' encoding='utf-8'?><test-results failures='1' total='1' not-run='0' name='bcl-tests' date='$$(date +%F)' time='$$(date +%T)'><test-suite name='$(strip $(test_assemblies))' success='False' time='0'><results><test-case name='crash' executed='True' success='False' time='0'><failure><message>The test runner didn't produce a test result XML, probably due to a crash of the runtime. Check the log for more details.</message><stack-trace></stack-trace></failure></test-case></results></test-suite></test-results>" > TestResult-$(PROFILE).xml; fi; \
$$ok
@@ -169,7 +218,10 @@ endif
ifdef HAVE_CS_TESTS
$(test_lib): $(the_assembly) $(test_response) $(test_nunit_dep)
$(test_lib_dir):
mkdir -p $@
$(test_lib_output): $(the_assembly) $(test_response) $(test_nunit_dep) $(test_lib_dir)
$(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response)
test_response_preprocessed = $(test_response)_preprocessed
@@ -189,7 +241,7 @@ $(test_makefrag): $(test_response)
-include $(test_makefrag)
build-test-lib: $(test_lib)
build-test-lib: $(test_lib_output)
@echo Building testing lib
endif
+1 -1
View File
@@ -30,4 +30,4 @@ CLEAN_FILES += $(TEST_RESX_RESOURCES)
$(TEST_RESX_RESOURCES): %.resources: %.resx
$(RESGEN) $< || cp $@.prebuilt $@
$(test_lib): $(TEST_RESX_RESOURCES)
$(test_lib_output): $(TEST_RESX_RESOURCES) $(test_lib_dir)
@@ -30,8 +30,13 @@ namespace MonoTests.Microsoft.Build.Construction
var xml = XmlReader.Create (new StringReader (empty_project_xml), null, "file:///foo.xml");
// This creator does not fill FullPath...
var root = ProjectRootElement.Create (xml);
// Expected to run from mcs/class/lib/profile/tests
var dir_name = Path.GetDirectoryName (new Uri (GetType ().Assembly.CodeBase).LocalPath);
var namespace_path = Path.Combine (Directory.GetParent (dir_name).Parent.Parent.FullName, "Microsoft.Build");
Assert.IsNull (root.FullPath, "#2");
Assert.AreEqual (Path.GetDirectoryName (new Uri (GetType ().Assembly.CodeBase).LocalPath), root.DirectoryPath, "#3");
Assert.AreEqual (namespace_path, root.DirectoryPath, "#3");
}
[Test]
@@ -39,7 +44,11 @@ namespace MonoTests.Microsoft.Build.Construction
{
var root = ProjectRootElement.Create ();
root.FullPath = "test" + Path.DirectorySeparatorChar + "foo.xml";
var full = Path.Combine (Path.GetDirectoryName (new Uri (GetType ().Assembly.CodeBase).LocalPath), "test", "foo.xml");
// Expected to run from mcs/class/lib/profile/tests
var dir_name = Path.GetDirectoryName (new Uri (GetType ().Assembly.CodeBase).LocalPath);
var namespace_path = Path.Combine (Directory.GetParent (dir_name).Parent.Parent.FullName, "Microsoft.Build");
var full = Path.Combine (namespace_path, "test", "foo.xml");
Assert.AreEqual (full, root.FullPath, "#1");
Assert.AreEqual (Path.GetDirectoryName (full), root.DirectoryPath, "#1");
}
+4
View File
@@ -31,6 +31,10 @@ endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
ifdef MOBILE_PROFILE
NO_TEST = yes
endif
EXTRA_DISTFILES = \
Test/Resources/test.cer \
Test/Resources/test_neg_serial.cer \
+4
View File
@@ -28,6 +28,10 @@ EXTRA_DISTFILES = \
RESX_RESOURCE_STRING = ../../../external/corefx/src/System.Security.Cryptography.Xml/src/Resources/Strings.resx
ifdef MOBILE_PROFILE
NO_TEST = yes
endif
include ../../build/library.make
$(build_lib): $(secxml_libdir)/System.dll $(MONO_SECURITY_DLL)
@@ -138,7 +138,10 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
if (!name.EndsWith (".xml"))
name = name + ".xml";
var uri = new Uri (asm.CodeBase);
// Run from mcs/class/lib/<profile>
var path = Path.GetDirectoryName (uri.AbsolutePath);
path = Directory.GetParent (path).Parent.Parent.FullName;
path = Path.Combine (path, "System.ServiceModel");
path = Path.Combine (path, "Test");
path = Path.Combine (path, "MetadataTests");
path = Path.Combine (path, "Resources");
@@ -172,6 +175,8 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
name = name + ".config";
var uri = new Uri (asm.CodeBase);
var path = Path.GetDirectoryName (uri.AbsolutePath);
path = Directory.GetParent (path).Parent.Parent.FullName;
path = Path.Combine (path, "System.ServiceModel");
path = Path.Combine (path, "Test");
path = Path.Combine (path, "MetadataTests");
path = Path.Combine (path, "Resources");
@@ -91,12 +91,10 @@ namespace MonoTests.System.Web.Caching
static CacheItemPriorityQueueTest ()
{
dataDir =
Path.Combine (
Path.Combine (
Path.Combine (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location), "Test"),
"System.Web.Caching"),
DATA_DIR);
// Assumes this is compiled into mcs/class/lib/<profile>/test
string class_dir = Directory.GetParent (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location)).Parent.Parent.FullName;
string system_web_dir = Path.Combine (class_dir, "System.Web", "Test", "System.Web.Caching");
dataDir = Path.Combine (system_web_dir, DATA_DIR);
}
void RunTest (string testsFileName, string listFileName)
@@ -97,6 +97,7 @@ namespace MonoTests.System.Xml
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Can't find .dll files when bundled in .exe
public void TestAsync ()
{
var loc = Assembly.GetExecutingAssembly ().Location;
+1 -1
View File
@@ -177,7 +177,7 @@ $(the_libdir_base)System.Configuration.dll:
$(build_lib): $(CYCLIC_DEP_FILES)
$(test_lib): $(TEST_RESOURCES)
$(test_lib_output): $(TEST_RESOURCES) $(test_lib_dir)
CLEAN_FILES = $(test_lib).config $(bare_libdir)/System.dll $(secxml_libdir)/System.dll $(bare_libdir)/System.dll.mdb $(secxml_libdir)/System.dll.mdb
@@ -46,6 +46,7 @@ namespace MonoTests.System.IO.Compression
[Test]
[ExpectedException (typeof (ArgumentNullException))]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Constructor_Null ()
{
DeflateStream ds = new DeflateStream (null, CompressionMode.Compress);
@@ -53,12 +54,14 @@ namespace MonoTests.System.IO.Compression
[Test]
[ExpectedException (typeof (ArgumentException))]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Constructor_InvalidCompressionMode ()
{
DeflateStream ds = new DeflateStream (new MemoryStream (), (CompressionMode)Int32.MinValue);
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckCompressDecompress ()
{
byte [] data = new byte[100000];
@@ -81,6 +84,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckDecompress ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -92,6 +96,7 @@ namespace MonoTests.System.IO.Compression
// https://bugzilla.xamarin.com/show_bug.cgi?id=22346
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckEmptyRead ()
{
byte [] dummy = new byte[1];
@@ -102,6 +107,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentNullException))]
public void CheckNullRead ()
{
@@ -111,6 +117,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (InvalidOperationException))]
public void CheckCompressingRead ()
{
@@ -121,6 +128,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentException))]
public void CheckRangeRead ()
{
@@ -132,6 +140,7 @@ namespace MonoTests.System.IO.Compression
#if !MOBILE
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[Category("NotWorking")]
[ExpectedException (typeof (InvalidDataException))]
public void CheckInvalidDataRead ()
@@ -145,6 +154,7 @@ namespace MonoTests.System.IO.Compression
#endif
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ObjectDisposedException))]
public void CheckClosedRead ()
{
@@ -156,6 +166,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ObjectDisposedException))]
public void CheckClosedFlush ()
{
@@ -166,6 +177,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckSeek ()
{
@@ -175,6 +187,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckSetLength ()
{
@@ -184,6 +197,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckGetCanSeekProp ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -204,6 +218,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckGetCanReadProp ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -224,6 +239,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckGetCanWriteProp ()
{
MemoryStream backing = new MemoryStream ();
@@ -244,6 +260,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckSetLengthProp ()
{
@@ -253,6 +270,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckGetLengthProp ()
{
@@ -262,6 +280,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckGetPositionProp ()
{
@@ -271,6 +290,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void DisposeTest ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -284,6 +304,7 @@ namespace MonoTests.System.IO.Compression
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void JunkAtTheEnd ()
{
// Write a deflated stream, then some additional data...
@@ -330,6 +351,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Bug19313 ()
{
byte [] buffer = new byte [512];
@@ -344,6 +366,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckNet45Overloads () // Xambug #21982
{
MemoryStream dataStream = GenerateStreamFromString("Hello");
@@ -362,6 +385,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentException))]
public void CheckBufferOverrun ()
{
@@ -374,6 +398,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Bug28777_EmptyFlush ()
{
MemoryStream backing = new MemoryStream ();
@@ -384,6 +409,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Bug28777_DoubleFlush ()
{
byte[] buffer = new byte [4096];
@@ -397,6 +423,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Bug34916_Inflate ()
{
var base64String = @"H4sIAAAAAAAAA6yVu27bQBBF/4VtZGHeD3ZJmhTp5C5IIUiEIcCWDEUugiD/nmEQwYRNURFAsuFwd2exZ++d+farud89davT+um5aRsC1DuEO+R7lJayRV9m5gegFqBZNB83m5fjevOzadGWUPHjaXd62XYVEy3Z04wiMTKIX0dfV0G/6FO3Pu72D/+iL916W9GbOV/X58SaS6zEKKyoGUA1eNg/nLfF2jUEBBNMtT4Wzeq567Z9HkZkE1Osf93msN/+WO32m+7zsavsh30/BUU8fy+uUCC+QIHpPQW1RAXkEGWUmSnUy2iUYSMYOGpARYViiIHcqY5kExS8rg2vY8gLGEjeYsClBVE4ORQHz3kxsEF4iS01xzBIZkgYQcYQQ7C54LQaIrxWn5+4ioT1BiRQN8Fh6MrOPjOS9Eh3M8YRJJQMZioJkUODFA8RNJ9AYuYBNyGJW5D0oi3/EpZ3dWYk5X5PN81RJGJgDATMQ5X02nFS1imVlMGvu0XwBg5/K1hY1U8tecxcNDy1/FAnG+OAQSi9PliHRaNUiuoxQYFB6T8oyAUKEu9LJ6oipbr1spyZArhWX6qbi7EOUrs7SCAoDNVgzKagMlUz+q6DQ4N8/yM=";
@@ -415,6 +442,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Bug44994_Inflate()
{
var base64String = @"7cWxCQAgDACwpeBjgqsgXiHU0fd9QzBLErX1EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADepcxcuU/atm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm37zy8=";
@@ -434,6 +462,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[Category ("MobileNotWorking")]
public void Bug44994_InflateByteByByte()
{
@@ -44,6 +44,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor_Null ()
{
@@ -51,6 +52,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentException))]
public void Constructor_InvalidCompressionMode ()
{
@@ -58,6 +60,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckCompressDecompress ()
{
byte [] data = new byte[100000];
@@ -80,6 +83,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckDecompress ()
{
byte [] data = {0x1f, 0x8b, 0x08, 0x08, 0x70, 0xbb, 0x5d, 0x41, 0x00, 0x03, 0x74, 0x65, 0x73, 0x74, 0x00, 0xf3, 0x48, 0xcd, 0xc9, 0xc9, 0xe7, 0x02, 0x00, 0x16, 0x35, 0x96, 0x31, 0x06, 0x00, 0x00, 0x00 };
@@ -91,6 +95,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentNullException))]
public void CheckNullRead ()
{
@@ -101,6 +106,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (InvalidOperationException))]
public void CheckCompressingRead ()
{
@@ -111,6 +117,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentException))]
public void CheckRangeRead ()
{
@@ -123,6 +130,7 @@ namespace MonoTests.System.IO.Compression
#if !MOBILE
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[Category("NotWorking")]
public void CheckInvalidDataRead ()
{
@@ -139,6 +147,7 @@ namespace MonoTests.System.IO.Compression
#endif
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckClosedRead ()
{
byte [] dummy = new byte[20];
@@ -153,6 +162,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ObjectDisposedException))]
public void CheckClosedFlush ()
{
@@ -163,6 +173,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckSeek ()
{
@@ -172,6 +183,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckSetLength ()
{
@@ -181,6 +193,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckGetCanSeekProp ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -201,6 +214,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckGetCanReadProp ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -221,6 +235,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckGetCanWriteProp ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -241,6 +256,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckSetLengthProp ()
{
@@ -250,6 +266,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckGetLengthProp ()
{
@@ -259,6 +276,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckGetPositionProp ()
{
@@ -268,6 +286,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void DisposeTest ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -277,6 +296,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void DisposeOrderTest ()
{
var fs = new MemoryStream();
@@ -304,6 +324,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckNet45Overloads () // Xambug #21982
{
MemoryStream dataStream = GenerateStreamFromString("Hello");
@@ -1220,6 +1220,7 @@ namespace MonoTests.System.Net
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
+1 -1
View File
@@ -166,7 +166,7 @@ TEST_RESOURCES = $(TEST_RESX_RESOURCES) $(TEST_RESX_RESOURCES_SATELITE)
satellite_assembly1 = es-ES/$(patsubst %.dll,%.resources.dll,$(test_lib))
satellite_assembly2 = nn-NO/$(patsubst %.dll,%.resources.dll,$(test_lib))
$(test_lib): $(TEST_RESOURCES) $(satellite_assembly1) $(satellite_assembly2)
$(test_lib_output): $(TEST_RESOURCES) $(satellite_assembly1) $(satellite_assembly2) $(test_lib_dir)
$(satellite_assembly1): Test/resources/culture-es-ES.cs Test/resources/Resources.es-ES.resources
@mkdir -p es-ES
@@ -97,9 +97,39 @@ namespace System.Runtime.Remoting.Messaging {
else
sig_cand = type.GetMethod (methodName, BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance, null, param_types, null);
if (sig_cand != null && generic_arg_names != null && !sig_cand.IsGenericMethodDefinition)
sig_cand = null;
if (sig_cand != null && generic_arg_names != null)
sig_cand = ((MethodInfo)sig_cand).MakeGenericMethod (GetTypes (generic_arg_names));
// We have a generic method with parameters that contain generic arguments
if (sig_cand == null && generic_arg_names != null) {
foreach (var method in type.GetMethods ()) {
if (method.Name != methodName)
continue;
if (!method.IsGenericMethodDefinition || method.GetGenericArguments().Length != generic_arg_names.Length)
continue;
sig_cand = ((MethodInfo)method).MakeGenericMethod (GetTypes (generic_arg_names));
var parameters = sig_cand.GetParameters ();
if (param_names.Length != parameters.Length)
continue;
for (int i=0; i < parameters.Length; i++) {
if (parameters [i].ParameterType.AssemblyQualifiedName != param_names [i]) {
sig_cand = null;
break;
}
}
if (sig_cand != null)
break;
}
}
if (sig_cand == null)
throw new RemotingException ($"Method '{methodName}' not found in type '{typeName}'");
@@ -113,19 +143,17 @@ namespace System.Runtime.Remoting.Messaging {
ctor = method.IsConstructor;
methodName = method.Name;
var param_types = method.GetParameters ();
param_names = new string [param_types.Length];
for (int i = 0; i < param_types.Length; ++i)
param_names [i] = param_types [i].ParameterType.AssemblyQualifiedName;
if (!ctor && method.IsGenericMethod) {
var ga = method.GetGenericArguments ();
generic_arg_names = new string [ga.Length];
for (int i = 0; i < ga.Length; ++i)
generic_arg_names [i] = ga [i].AssemblyQualifiedName;
method = ((MethodInfo)method).GetGenericMethodDefinition ();
}
var param_types = method.GetParameters ();
param_names = new string [param_types.Length];
for (int i = 0; i < param_types.Length; ++i)
param_names [i] = param_types [i].ParameterType.AssemblyQualifiedName;
}
}
@@ -1111,6 +1111,7 @@ public class AssemblyNameTest {
[Test]
[Category ("AndroidNotWorking")] // Accessing assemblies by asm.Location is not supported
[Category ("StaticLinkedAotNotWorking")] // Can't find .dll files when bundled in .exe
public void GetAssemblyName_CodeBase ()
{
Assembly execAssembly = Assembly.GetExecutingAssembly ();
@@ -322,6 +322,7 @@ namespace MonoTests.System.Reflection
[Test]
[Category ("AndroidNotWorking")] // Assemblies in Xamarin.Android cannot be accessed as FileStream
[Category ("StaticLinkedAotNotWorking")] // Can't find .dll files when bundled in .exe
public void GetFiles_False ()
{
Assembly corlib = typeof (int).Assembly;
@@ -335,6 +336,7 @@ namespace MonoTests.System.Reflection
[Test]
[Category ("AndroidNotWorking")] // Assemblies in Xamarin.Android cannot be accessed as FileStream
[Category ("StaticLinkedAotNotWorking")] // Can't find .dll files when bundled in .exe
public void GetFiles_True ()
{
Assembly corlib = typeof (int).Assembly;
@@ -1043,7 +1043,9 @@ namespace MonoTests.System.Text
[Category ("MobileNotWorking")]
public void Bug415628 ()
{
using (var f = File.Open (Path.Combine (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location), "Test/resources/415628.bin"), FileMode.Open)) {
DirectoryInfo bcl_output_dir = Directory.GetParent (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location)).Parent;
string namespace_dir = Path.Combine (bcl_output_dir.Parent.FullName, "corlib");
using (var f = File.Open (Path.Combine (namespace_dir, "Test/resources/415628.bin"), FileMode.Open)) {
BinaryReader br = new BinaryReader (f);
byte [] buf = br.ReadBytes (8000);
Encoding.UTF8.GetString(buf);
+1 -1
View File
@@ -49,7 +49,7 @@ net_4_5_dirs := \
mono-symbolicate \
linker-analyzer
build_SUBDIRS = resgen gacutil security culevel cil-stringreplacer commoncryptogenerator resx2sr linker
build_SUBDIRS = resgen gacutil security culevel cil-stringreplacer commoncryptogenerator resx2sr linker cil-strip
monodroid_tools_SUBDIRS = cil-strip mkbundle mdoc mono-symbolicate
monodroid_SUBDIRS = nunit-lite
monotouch_SUBDIRS = nunit-lite
+293 -15
View File
@@ -40,8 +40,11 @@ class MakeBundle {
static string output = "a.out";
static string object_out = null;
static List<string> link_paths = new List<string> ();
static List<string> aot_paths = new List<string> ();
static List<string> aot_names = new List<string> ();
static Dictionary<string,string> libraries = new Dictionary<string,string> ();
static bool autodeps = false;
static string in_tree = null;
static bool keeptemp = false;
static bool compile_only = false;
static bool static_link = false;
@@ -62,7 +65,27 @@ class MakeBundle {
static string fetch_target = null;
static bool custom_mode = true;
static string embedded_options = null;
static string runtime = null;
static string runtime_bin = null;
static string runtime {
get {
if (runtime_bin == null && IsUnix)
runtime_bin = Process.GetCurrentProcess().MainModule.FileName;
return runtime_bin;
}
set { runtime_bin = value; }
}
static bool aot_compile = false;
static string aot_args = "static";
static DirectoryInfo aot_temp_dir = null;
static string aot_mode = "";
static string aot_runtime = null;
static string aot_dedup_assembly = null;
static string cil_strip_path = null;
static string managed_linker_path = null;
static string sdk_path = null;
static string lib_path = null;
static Dictionary<string,string> environment = new Dictionary<string,string>();
@@ -351,6 +374,78 @@ class MakeBundle {
case "--bundled-header":
bundled_header = true;
break;
case "--in-tree":
if (i+1 == top) {
Console.WriteLine ("Usage: --in-tree <path/to/headers> ");
return 1;
}
in_tree = args [++i];
break;
case "--managed-linker":
if (i+1 == top) {
Console.WriteLine ("Usage: --managed-linker <path/to/exe> ");
return 1;
}
managed_linker_path = args [++i];
break;
case "--cil-strip":
if (i+1 == top) {
Console.WriteLine ("Usage: --cil-strip <path/to/exe> ");
return 1;
}
cil_strip_path = args [++i];
break;
case "--aot-runtime":
if (i+1 == top) {
Console.WriteLine ("Usage: --aot-runtime <path/to/runtime> ");
return 1;
}
aot_runtime = args [++i];
aot_compile = true;
static_link = true;
break;
case "--aot-dedup":
if (i+1 == top) {
Console.WriteLine ("Usage: --aot-dedup <container_dll> ");
return 1;
}
var rel_path = args [++i];
var asm = LoadAssembly (rel_path);
if (asm != null)
aot_dedup_assembly = new Uri(asm.CodeBase).LocalPath;
sources.Add (rel_path);
aot_compile = true;
static_link = true;
break;
case "--aot-mode":
if (i+1 == top) {
Console.WriteLine ("Need string of aot mode (full, llvmonly). Omit for normal AOT.");
return 1;
}
aot_mode = args [++i];
if (aot_mode != "full" && aot_mode != "llvmonly") {
Console.WriteLine ("Need string of aot mode (full, llvmonly). Omit for normal AOT.");
return 1;
}
aot_compile = true;
static_link = true;
break;
case "--aot-args":
if (i+1 == top) {
Console.WriteLine ("AOT arguments are passed as a comma-delimited list");
return 1;
}
if (args [i + 1].Contains ("outfile")) {
Console.WriteLine ("Per-aot-output arguments (ex: outfile, llvm-outfile) cannot be given");
return 1;
}
aot_args = String.Format("static,{0}", args [++i]);
aot_compile = true;
static_link = true;
break;
default:
sources.Add (args [i]);
break;
@@ -411,6 +506,12 @@ class MakeBundle {
foreach (string file in assemblies)
if (!QueueAssembly (files, file))
return 1;
PreprocessAssemblies (assemblies, files);
if (aot_compile)
AotCompile (files);
if (custom_mode)
GenerateBundles (files);
else
@@ -543,7 +644,6 @@ class MakeBundle {
Console.WriteLine ("At {0:x} with input {1}", package.Position, fileStream.Length);
fileStream.CopyTo (package);
package.Position = package.Position + (align - (package.Position % align));
return (int) ret;
}
}
@@ -552,7 +652,6 @@ class MakeBundle {
{
var p = package.Position;
var size = AddFile (fname);
locations [entry] = Tuple.Create(p, size);
}
@@ -638,12 +737,8 @@ class MakeBundle {
static bool GeneratePackage (List<string> files)
{
if (runtime == null){
if (IsUnix)
runtime = Process.GetCurrentProcess().MainModule.FileName;
else {
Error ("You must specify at least one runtime with --runtime or --cross");
Environment.Exit (1);
}
Error ("You must specify at least one runtime with --runtime or --cross");
Environment.Exit (1);
}
if (!File.Exists (runtime)){
Error ($"The specified runtime at {runtime} does not exist");
@@ -729,6 +824,11 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
} else {
tc.WriteLine ("#include <mono/metadata/mono-config.h>");
tc.WriteLine ("#include <mono/metadata/assembly.h>\n");
if (in_tree != null)
tc.WriteLine ("#include <mono/mini/jit.h>\n");
else
tc.WriteLine ("#include <mono/jit/jit.h>\n");
}
if (compress) {
@@ -869,6 +969,7 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
}
ts.Close ();
// Managed assemblies baked in
if (compress)
tc.WriteLine ("\nstatic const CompressedAssembly *compressed [] = {");
else
@@ -878,6 +979,37 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
tc.WriteLine ("\t&{0},", c);
}
tc.WriteLine ("\tNULL\n};\n");
// AOT baked in plus loader
foreach (string asm in aot_names){
tc.WriteLine ("\textern const void *mono_aot_module_{0}_info;", asm);
}
tc.WriteLine ("\nstatic void install_aot_modules (void) {\n");
foreach (string asm in aot_names){
tc.WriteLine ("\tmono_aot_register_module (mono_aot_module_{0}_info);\n", asm);
}
string enum_aot_mode;
switch (aot_mode) {
case "full":
enum_aot_mode = "MONO_AOT_MODE_FULL";
break;
case "llvmonly":
enum_aot_mode = "MONO_AOT_MODE_LLVMONLY";
break;
case "":
enum_aot_mode = "MONO_AOT_MODE_NORMAL";
break;
default:
throw new Exception ("Unsupported AOT mode");
}
tc.WriteLine ("\tmono_jit_set_aot_mode ({0});", enum_aot_mode);
tc.WriteLine ("\n}\n");
tc.WriteLine ("static char *image_name = \"{0}\";", prog);
if (ctor_func != null) {
@@ -963,15 +1095,28 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
debugging = "-ggdb";
if (static_link)
{
string platform_libs;
string smonolib;
if (style == "osx")
if (style == "osx") {
smonolib = "`pkg-config --variable=libdir mono-2`/libmono-2.0.a ";
else
platform_libs = "-liconv -framework Foundation ";
} else {
smonolib = "-Wl,-Bstatic -lmono-2.0 -Wl,-Bdynamic ";
cmd = String.Format("{4} -o '{2}' -Wall {5} `pkg-config --cflags mono-2` {0} {3} " +
"`pkg-config --libs-only-L mono-2` " + smonolib +
"`pkg-config --libs-only-l mono-2 | sed -e \"s/\\-lmono-2.0 //\"` {1}",
temp_c, temp_o, output, zlib, cc, objc);
platform_libs = "";
}
string in_tree_include = "";
if (in_tree != null) {
smonolib = String.Format ("{0}/mono/mini/.libs/libmonosgen-2.0.a", in_tree);
in_tree_include = String.Format (" -I{0} ", in_tree);
}
cmd = String.Format("{4} -o '{2}' -Wall {7} `pkg-config --cflags mono-2` {9} {0} {3} " +
"`pkg-config --libs-only-L mono-2` {5} {6} {8} " +
"`pkg-config --libs-only-l mono-2 | sed -e \"s/\\-lmono-2.0 //\"` {1} -g ",
temp_c, temp_o, output, zlib, cc, smonolib, String.Join (" ", aot_paths), objc, platform_libs, in_tree_include);
}
else
{
@@ -994,6 +1139,8 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
if (!compile_only){
File.Delete (temp_c);
}
if (aot_temp_dir != null)
aot_temp_dir.Delete (true);
File.Delete (temp_s);
}
}
@@ -1281,6 +1428,137 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
}
}
static string EncodeAotSymbol (string symbol)
{
var sb = new StringBuilder ();
/* This mimics what the aot-compiler does */
foreach (var b in System.Text.Encoding.UTF8.GetBytes (symbol)) {
char c = (char) b;
if ((c >= '0' && c <= '9') ||
(c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z')) {
sb.Append (c);
continue;
}
sb.Append ('_');
}
return sb.ToString ();
}
static void AotCompile (List<string> files)
{
if (aot_runtime == null)
aot_runtime = runtime;
if (aot_runtime == null) {
Error ("You must specify at least one aot runtime with --runtime or --cross or --aot_runtime when AOT compiling");
Environment.Exit (1);
}
var aot_mode_string = "";
if (aot_mode != null)
aot_mode_string = "," + aot_mode;
var dedup_mode_string = "";
StringBuilder all_assemblies = null;
if (aot_dedup_assembly != null) {
dedup_mode_string = ",dedup-skip";
all_assemblies = new StringBuilder("");
}
Console.WriteLine ("Aoting files:");
for (int i=0; i < files.Count; i++) {
var file_name = files [i];
string path = LocateFile (new Uri (file_name).LocalPath);
string outPath = String.Format ("{0}.aot_out", path);
aot_paths.Add (outPath);
var name = System.Reflection.Assembly.LoadFrom(path).GetName().Name;
aot_names.Add (EncodeAotSymbol (name));
if (aot_dedup_assembly != null) {
all_assemblies.Append (path);
all_assemblies.Append (" ");
Execute (String.Format ("MONO_PATH={0} {1} --aot={2},outfile={3}{4}{5} {6}",
Path.GetDirectoryName (path), aot_runtime, aot_args, outPath, aot_mode_string, dedup_mode_string, path));
} else {
Execute (String.Format ("MONO_PATH={0} {1} --aot={2},outfile={3}{4} {5}",
Path.GetDirectoryName (path), aot_runtime, aot_args, outPath, aot_mode_string, path));
}
}
if (aot_dedup_assembly != null) {
var filePath = new Uri (aot_dedup_assembly).LocalPath;
string path = LocateFile (filePath);
dedup_mode_string = String.Format (",dedup-include={0}", Path.GetFileName(filePath));
string outPath = String.Format ("{0}.aot_out", path);
Execute (String.Format ("MONO_PATH={7} {0} --aot={1},outfile={2}{3}{4} {5} {6}",
aot_runtime, aot_args, outPath, aot_mode_string, dedup_mode_string, path, all_assemblies.ToString (), Path.GetDirectoryName (path)));
}
if ((aot_mode == "full" || aot_mode == "llvmonly") && cil_strip_path != null) {
for (int i=0; i < files.Count; i++) {
var in_name = new Uri (files [i]).LocalPath;
var cmd = String.Format ("{0} {1} {2}", aot_runtime, cil_strip_path, in_name);
Execute (cmd);
}
}
}
static void LinkManaged (List <string> files, string outDir)
{
if (managed_linker_path == null)
return;
var paths = new StringBuilder ("");
foreach (var file in files) {
paths.Append (" -a ");
paths.Append (new Uri (file).LocalPath);
}
var cmd = String.Format ("{0} {1} -b true -out {2} {3} -c link -p copy ", runtime, managed_linker_path, outDir, paths.ToString ());
Execute (cmd);
}
static void PreprocessAssemblies (List <string> chosenFiles, List <string> files)
{
if (aot_mode == "" || (cil_strip_path == null && managed_linker_path == null))
return;
var temp_dir_name = Path.Combine(Directory.GetCurrentDirectory(), "temp_assemblies");
aot_temp_dir = new DirectoryInfo (temp_dir_name);
if (aot_temp_dir.Exists) {
Console.WriteLine ("Removing previous build cache at {0}", temp_dir_name);
aot_temp_dir.Delete (true);
}
aot_temp_dir.Create ();
//if (managed_linker_path != null) {
//LinkManaged (chosenFiles, temp_dir);
//// Replace list with new list of files
//files.Clear ();
//Console.WriteLine ("Iterating {0}", temp_dir);
//aot_temp_dir = new DirectoryInfo (temp_dir);
//foreach (var file in aot_temp_dir.GetFiles ()) {
//files.Append (String.Format ("file:///{0}", file));
//Console.WriteLine (String.Format ("file:///{0}", file));
//}
//return;
//}
// Fix file references
for (int i=0; i < files.Count; i++) {
var in_name = new Uri (files [i]).LocalPath;
var out_name = Path.Combine (temp_dir_name, Path.GetFileName (in_name));
File.Copy (in_name, out_name);
files [i] = out_name;
if (in_name == aot_dedup_assembly)
aot_dedup_assembly = out_name;
}
}
static void Execute (string cmdLine)
{
if (IsUnix) {
+2
View File
@@ -2,4 +2,6 @@ void mono_mkbundle_init ()
{
install_dll_config_files ();
mono_register_bundled_assemblies(bundled);
install_aot_modules ();
}
+5
View File
@@ -1,5 +1,10 @@
#!/bin/bash -e
if test -n "${MONO_STATIC_AOT}";
then
${TESTCMD} --label=mkbundle --timeout=25m make -j 4 -w -C mcs/class/corlib -k mkbundle-all-tests
fi
if test -n "${MONO_LLVMONLY}";
then
${TESTCMD} --label=mini --timeout=25m make -j 4 -w -C mono/mini -k llvmonlycheck