[mono/mono] 6934f160: Fill out AssemblyName.ProcessorArchitecture for assemblies. Fixes #15347.

"Zoltan Varga ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141c5d68848-8b29078e-d8ab-4c15-b745-e4bc6b1fb010-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/4387da152422...6934f160db0e

   Commit: 6934f160db0edae2258b570ce7a959c217ed0b44
   Author: Zoltan Varga <[email protected]> (vargaz)
     Date: 2013-10-17 09:53:17 GMT
      URL: https://github.com/mono/mono/commit/6934f160db0edae2258b570ce7a959c217ed0b44

Fill out AssemblyName.ProcessorArchitecture for assemblies. Fixes #15347.

Changed paths:
  M mono/metadata/assembly.c
  M mono/metadata/cil-coff.h
  M mono/metadata/metadata-internals.h

Modified: mono/metadata/assembly.c
===================================================================
@@ -33,6 +33,7 @@
 #include <mono/utils/mono-path.h>
 #include <mono/metadata/reflection.h>
 #include <mono/metadata/coree.h>
+#include <mono/metadata/cil-coff.h>
 #include <mono/utils/mono-io-portability.h>
 #include <mono/utils/atomic.h>
 
@@ -741,6 +742,7 @@
 {
 	MonoTableInfo *t = &image->tables [MONO_TABLE_ASSEMBLY];
 	guint32 cols [MONO_ASSEMBLY_SIZE];
+	gint32 machine;
 
 	if (!t->rows)
 		return FALSE;
@@ -785,6 +787,24 @@
 	else
 		aname->public_key = 0;
 
+	machine = ((MonoCLIImageInfo*)(image->image_info))->cli_header.coff.coff_machine;
+	switch (machine) {
+	case COFF_MACHINE_I386:
+		aname->arch = MONO_PROCESSOR_ARCHITECTURE_X86;
+		break;
+	case COFF_MACHINE_IA64:
+		aname->arch = MONO_PROCESSOR_ARCHITECTURE_IA64;
+		break;
+	case COFF_MACHINE_AMD64:
+		aname->arch = MONO_PROCESSOR_ARCHITECTURE_AMD64;
+		break;
+	case COFF_MACHINE_ARM:
+		aname->arch = MONO_PROCESSOR_ARCHITECTURE_ARM;
+		break;
+	default:
+		break;
+	}
+
 	return TRUE;
 }
 

Modified: mono/metadata/cil-coff.h
===================================================================
@@ -37,6 +37,12 @@
 	char    msdos_header2 [64];
 } MonoMSDOSHeader;
 
+/* Possible values for coff_machine */
+#define COFF_MACHINE_I386 332
+#define COFF_MACHINE_IA64 512
+#define COFF_MACHINE_AMD64 34404
+#define COFF_MACHINE_ARM 452
+
 /* 20 bytes */
 typedef struct {
 	guint16  coff_machine;

Modified: mono/metadata/metadata-internals.h
===================================================================
@@ -44,6 +44,7 @@ struct _MonoType {
 #define MONO_PROCESSOR_ARCHITECTURE_X86 2
 #define MONO_PROCESSOR_ARCHITECTURE_IA64 3
 #define MONO_PROCESSOR_ARCHITECTURE_AMD64 4
+#define MONO_PROCESSOR_ARCHITECTURE_ARM 5
 
 struct _MonoAssemblyName {
 	const char *name;


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.