Skip to content

Commit

Permalink
[runtime] Fix the computation of AssemblyName.ProcessorArchitecture (…
Browse files Browse the repository at this point in the history
…) to be compatible with MS.NET. Fixes #17632.
  • Loading branch information
vargaz committed Feb 6, 2014
1 parent 0522c8b commit f344386
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mono/metadata/assembly.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ mono_assembly_fill_assembly_name (MonoImage *image, MonoAssemblyName *aname)
{
MonoTableInfo *t = &image->tables [MONO_TABLE_ASSEMBLY];
guint32 cols [MONO_ASSEMBLY_SIZE];
gint32 machine;
gint32 machine, flags;

if (!t->rows)
return FALSE;
Expand Down Expand Up @@ -804,9 +804,16 @@ mono_assembly_fill_assembly_name (MonoImage *image, MonoAssemblyName *aname)
aname->public_key = 0;

machine = ((MonoCLIImageInfo*)(image->image_info))->cli_header.coff.coff_machine;
flags = ((MonoCLIImageInfo*)(image->image_info))->cli_cli_header.ch_flags;
switch (machine) {
case COFF_MACHINE_I386:
aname->arch = MONO_PROCESSOR_ARCHITECTURE_X86;
/* https://bugzilla.xamarin.com/show_bug.cgi?id=17632 */
if (flags & (CLI_FLAGS_32BITREQUIRED|CLI_FLAGS_PREFERRED32BIT))
aname->arch = MONO_PROCESSOR_ARCHITECTURE_X86;
else if ((flags & 0x70) == 0x70)
aname->arch = MONO_PROCESSOR_ARCHITECTURE_NONE;
else
aname->arch = MONO_PROCESSOR_ARCHITECTURE_MSIL;
break;
case COFF_MACHINE_IA64:
aname->arch = MONO_PROCESSOR_ARCHITECTURE_IA64;
Expand Down
1 change: 1 addition & 0 deletions mono/metadata/cil-coff.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ typedef struct {
#define CLI_FLAGS_ILONLY 0x01
#define CLI_FLAGS_32BITREQUIRED 0x02
#define CLI_FLAGS_STRONGNAMESIGNED 0x8
#define CLI_FLAGS_PREFERRED32BIT 0x10
#define CLI_FLAGS_TRACKDEBUGDATA 0x00010000
guint32 ch_flags;

Expand Down

0 comments on commit f344386

Please sign in to comment.