You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
File diff suppressed because it is too large
Load Diff
@@ -2,10 +2,6 @@ thisdir = tools/linker
|
||||
SUBDIRS =
|
||||
include ../../build/rules.make
|
||||
|
||||
PROGRAM_SNK = ../../class/mono.snk
|
||||
|
||||
CECIL = $(topdir)/class/lib/$(PROFILE)/Mono.Cecil.dll
|
||||
|
||||
RESOURCES = \
|
||||
Descriptors/mscorlib.xml \
|
||||
Descriptors/System.xml \
|
||||
@@ -18,7 +14,8 @@ PROGRAM = monolinker.exe
|
||||
|
||||
$(PROGRAM): $(RESOURCES)
|
||||
|
||||
LOCAL_MCS_FLAGS = /r:$(CECIL) /r:System.Xml.dll -keyfile:$(PROGRAM_SNK) $(RESOURCES:%=-resource:%)
|
||||
LIB_REFS = System System.Core System.Xml Mono.Cecil
|
||||
LOCAL_MCS_FLAGS = $(RESOURCES:%=-resource:%)
|
||||
|
||||
EXTRA_DISTFILES = $(RESOURCES)
|
||||
|
||||
|
@@ -141,8 +141,11 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
void ProcessVirtualMethods ()
|
||||
{
|
||||
foreach (MethodDefinition method in _virtual_methods)
|
||||
foreach (MethodDefinition method in _virtual_methods) {
|
||||
Annotations.Push (method);
|
||||
ProcessVirtualMethod (method);
|
||||
Annotations.Pop ();
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessVirtualMethod (MethodDefinition method)
|
||||
@@ -193,17 +196,21 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
protected virtual void MarkCustomAttribute (CustomAttribute ca)
|
||||
{
|
||||
Annotations.Push (ca);
|
||||
MarkMethod (ca.Constructor);
|
||||
|
||||
MarkCustomAttributeArguments (ca);
|
||||
|
||||
TypeReference constructor_type = ca.Constructor.DeclaringType;
|
||||
TypeDefinition type = constructor_type.Resolve ();
|
||||
if (type == null)
|
||||
if (type == null) {
|
||||
Annotations.Pop ();
|
||||
throw new ResolutionException (constructor_type);
|
||||
}
|
||||
|
||||
MarkCustomAttributeProperties (ca, type);
|
||||
MarkCustomAttributeFields (ca, type);
|
||||
Annotations.Pop ();
|
||||
}
|
||||
|
||||
protected void MarkSecurityDeclarations (ISecurityDeclarationProvider provider)
|
||||
@@ -268,10 +275,12 @@ namespace Mono.Linker.Steps {
|
||||
protected void MarkCustomAttributeProperty (CustomAttributeNamedArgument namedArgument, TypeDefinition attribute)
|
||||
{
|
||||
PropertyDefinition property = GetProperty (attribute, namedArgument.Name);
|
||||
Annotations.Push (property);
|
||||
if (property != null)
|
||||
MarkMethod (property.SetMethod);
|
||||
|
||||
MarkIfType (namedArgument.Argument);
|
||||
Annotations.Pop ();
|
||||
}
|
||||
|
||||
PropertyDefinition GetProperty (TypeDefinition type, string propertyname)
|
||||
@@ -518,6 +527,7 @@ namespace Mono.Linker.Steps {
|
||||
if (type.HasMethods) {
|
||||
MarkMethodsIf (type.Methods, IsVirtualAndHasPreservedParent);
|
||||
MarkMethodsIf (type.Methods, IsStaticConstructorPredicate);
|
||||
MarkMethodsIf (type.Methods, HasSerializationAttribute);
|
||||
}
|
||||
|
||||
DoAdditionalTypeProcessing (type);
|
||||
@@ -634,8 +644,10 @@ namespace Mono.Linker.Steps {
|
||||
if (property.Name != property_name)
|
||||
continue;
|
||||
|
||||
Annotations.Push (property);
|
||||
MarkMethod (property.GetMethod);
|
||||
MarkMethod (property.SetMethod);
|
||||
Annotations.Pop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -695,8 +707,11 @@ namespace Mono.Linker.Steps {
|
||||
void MarkMethodsIf (ICollection methods, MethodPredicate predicate)
|
||||
{
|
||||
foreach (MethodDefinition method in methods)
|
||||
if (predicate (method))
|
||||
if (predicate (method)) {
|
||||
Annotations.Push (predicate);
|
||||
MarkMethod (method);
|
||||
Annotations.Pop ();
|
||||
}
|
||||
}
|
||||
|
||||
static MethodPredicate IsDefaultConstructorPredicate = new MethodPredicate (IsDefaultConstructor);
|
||||
@@ -726,6 +741,25 @@ namespace Mono.Linker.Steps {
|
||||
return method.IsConstructor && method.IsStatic;
|
||||
}
|
||||
|
||||
static bool HasSerializationAttribute (MethodDefinition method)
|
||||
{
|
||||
if (!method.HasCustomAttributes)
|
||||
return false;
|
||||
foreach (var ca in method.CustomAttributes) {
|
||||
var cat = ca.AttributeType;
|
||||
if (cat.Namespace != "System.Runtime.Serialization")
|
||||
continue;
|
||||
switch (cat.Name) {
|
||||
case "OnDeserializedAttribute":
|
||||
case "OnDeserializingAttribute":
|
||||
case "OnSerializedAttribute":
|
||||
case "OnSerializingAttribute":
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsSerializable (TypeDefinition td)
|
||||
{
|
||||
return (td.Attributes & TypeAttributes.Serializable) != 0;
|
||||
@@ -906,6 +940,7 @@ namespace Mono.Linker.Steps {
|
||||
EnqueueMethod (method);
|
||||
|
||||
Annotations.Pop ();
|
||||
Annotations.AddDependency (method);
|
||||
|
||||
return method;
|
||||
}
|
||||
@@ -944,6 +979,7 @@ namespace Mono.Linker.Steps {
|
||||
if (CheckProcessed (method))
|
||||
return;
|
||||
|
||||
Annotations.Push (method);
|
||||
MarkType (method.DeclaringType);
|
||||
MarkCustomAttributes (method);
|
||||
MarkSecurityDeclarations (method);
|
||||
@@ -987,6 +1023,7 @@ namespace Mono.Linker.Steps {
|
||||
Annotations.Mark (method);
|
||||
|
||||
ApplyPreserveMethods (method);
|
||||
Annotations.Pop ();
|
||||
}
|
||||
|
||||
// Allow subclassers to mark additional things when marking a method
|
||||
|
Reference in New Issue
Block a user