Skip to content

Commit

Permalink
Add support for Retargetable assembly flag.
Browse files Browse the repository at this point in the history
In mono/metadata:

	* tabledefs.h (ASSEMBLYREF_RETARGETABLE_FLAG):
	(ASSEMBLYREF_ENABLEJITCOMPILE_TRACKING_FLAG):
	(ASSEMBLYREF_DISABLEJITCOMPILE_OPTIMIZER_FLAG): Add AssemblyRef flags.

In mono/dis:

	* dump.c (dump_table_assemblyref): Dump Flags also.
	* main.c (assembly_ref_flags): New. Stringify AssemblyRef flags.
	(dis_directive_assemblyref): Emit flags also.
	(dis_directive_assembly): Likewise.


svn path=/trunk/mono/; revision=67583


Commit migrated from mono/mono@b7dd19a
  • Loading branch information
radical committed Nov 9, 2006
1 parent d33fdcc commit 7be92a4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/mono/mono/dis/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ dump_table_assemblyref (MonoImage *m)
cols [MONO_ASSEMBLYREF_BUILD_NUMBER],
cols [MONO_ASSEMBLYREF_REV_NUMBER],
mono_metadata_string_heap (m, cols [MONO_ASSEMBLYREF_NAME]));
fprintf (output, "\tFlags=0x%08x\n", cols [MONO_ASSEMBLYREF_FLAGS]);
ptr = mono_metadata_blob_heap (m, cols [MONO_ASSEMBLYREF_PUBLIC_KEY]);
len = mono_metadata_decode_value (ptr, &ptr);
if (len > 0){
Expand Down
23 changes: 19 additions & 4 deletions src/mono/mono/dis/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,29 @@ dump_declarative_security (MonoImage *m, guint32 objectType, guint32 token, cons
}
}

static char *
assembly_flags (guint32 f)
{
if (f & ASSEMBLYREF_RETARGETABLE_FLAG)
return g_strdup ("retargetable ");
return g_strdup ("");
}

static void
dis_directive_assembly (MonoImage *m)
{
MonoTableInfo *t = &m->tables [MONO_TABLE_ASSEMBLY];
guint32 cols [MONO_ASSEMBLY_SIZE];
char *flags;

if (t->base == NULL)
return;

mono_metadata_decode_row (t, 0, cols, MONO_ASSEMBLY_SIZE);
flags = assembly_flags (cols [MONO_ASSEMBLY_FLAGS]);

fprintf (output, ".assembly '%s'\n{\n",
mono_metadata_string_heap (m, cols [MONO_ASSEMBLY_NAME]));
fprintf (output, ".assembly %s'%s'\n{\n",
flags, mono_metadata_string_heap (m, cols [MONO_ASSEMBLY_NAME]));
dump_cattrs (m, MONO_TOKEN_ASSEMBLY | 1, " ");
dump_declarative_security (m, OBJECT_TYPE_ASSEMBLYDEF, 1, " ");
fprintf (output,
Expand All @@ -200,6 +210,8 @@ dis_directive_assembly (MonoImage *m)
g_free (dump);
}
fprintf (output, "}\n");

g_free (flags);
}

static void
Expand All @@ -213,16 +225,18 @@ dis_directive_assemblyref (MonoImage *m)
return;

for (i = 0; i < t->rows; i++){
char *esc;
char *esc, *flags;

mono_metadata_decode_row (t, i, cols, MONO_ASSEMBLYREF_SIZE);

esc = get_escaped_name (mono_metadata_string_heap (m, cols [MONO_ASSEMBLYREF_NAME]));
flags = assembly_flags (cols [MONO_ASSEMBLYREF_FLAGS]);

fprintf (output,
".assembly extern %s\n"
".assembly extern %s%s\n"
"{\n"
" .ver %d:%d:%d:%d\n",
flags,
esc,
cols [MONO_ASSEMBLYREF_MAJOR_VERSION], cols [MONO_ASSEMBLYREF_MINOR_VERSION],
cols [MONO_ASSEMBLYREF_BUILD_NUMBER], cols [MONO_ASSEMBLYREF_REV_NUMBER]
Expand All @@ -239,6 +253,7 @@ dis_directive_assemblyref (MonoImage *m)
g_free (dump);
}
fprintf (output, "}\n");
g_free (flags);
g_free (esc);
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/mono/mono/metadata/tabledefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,7 @@ enum {
* 21.5 AssemblyRefs
*/
#define ASSEMBLYREF_FULL_PUBLIC_KEY_FLAG 0x00000001
#define ASSEMBLYREF_RETARGETABLE_FLAG 0x00000100
#define ASSEMBLYREF_ENABLEJITCOMPILE_TRACKING_FLAG 0x00008000
#define ASSEMBLYREF_DISABLEJITCOMPILE_OPTIMIZER_FLAG 0x00004000
#endif

0 comments on commit 7be92a4

Please sign in to comment.