.TP
.I \-platform:ARCH
Used to specify the target platform. The possible values are: anycpu,
-x86, x64 or itanium. As of June 2009, the Mono runtime only have support
-to emit anycpu and x86 assemblies.
+anycpu32bitpreferred, arm, x86, x64 or itanium. The default option is
+anycpu.
.TP
.I -resource:RESOURCE[,ID]
Embeds to the given resource file. The optional ID can be used to
--- /dev/null
+// CS1672: Invalid -platform option `any'. Valid options are `anycpu', `anycpu32bitpreferred', `arm', `x86', `x64' or `itanium'
+// Line: 0
+// Compiler options: -platform:any
\ No newline at end of file
--- /dev/null
+// CS4023: Platform option `anycpu32bitpreferred' is valid only for executables
+// Line: 0
+// Compiler options: -platform:anycpu32bitpreferred -target:library
public void Save ()
{
- PortableExecutableKinds pekind;
+ PortableExecutableKinds pekind = PortableExecutableKinds.ILOnly;
ImageFileMachine machine;
switch (Compiler.Settings.Platform) {
case Platform.X86:
- pekind = PortableExecutableKinds.Required32Bit | PortableExecutableKinds.ILOnly;
+ pekind |= PortableExecutableKinds.Required32Bit;
machine = ImageFileMachine.I386;
break;
case Platform.X64:
- pekind = PortableExecutableKinds.ILOnly;
+ pekind |= PortableExecutableKinds.PE32Plus;
machine = ImageFileMachine.AMD64;
break;
case Platform.IA64:
- pekind = PortableExecutableKinds.ILOnly;
machine = ImageFileMachine.IA64;
break;
+ case Platform.AnyCPU32Preferred:
+#if STATIC
+ pekind |= PortableExecutableKinds.Preferred32Bit;
+ machine = ImageFileMachine.I386;
+ break;
+#else
+ throw new NotSupportedException ();
+#endif
+ case Platform.Arm:
+#if STATIC
+ machine = ImageFileMachine.ARM;
+#else
+ throw new NotSupportedException ();
+#endif
+ break;
case Platform.AnyCPU:
default:
- pekind = PortableExecutableKinds.ILOnly;
machine = ImageFileMachine.I386;
break;
}
return false;
}
+ if (settings.Platform == Platform.AnyCPU32Preferred && (settings.Target == Target.Library || settings.Target == Target.Module)) {
+ Report.Error (4023, "Platform option `anycpu32bitpreferred' is valid only for executables");
+ return false;
+ }
+
TimeReporter tr = new TimeReporter (settings.Timestamps);
ctx.TimeReporter = tr;
tr.StartTotal ();
public enum Platform
{
- AnyCPU, X86, X64, IA64
+ AnyCPU,
+ AnyCPU32Preferred,
+ Arm,
+ X86,
+ X64,
+ IA64
}
public class CompilerSettings
return ParseResult.Error;
}
- switch (value.ToLower (CultureInfo.InvariantCulture)) {
+ switch (value.ToLowerInvariant ()) {
+ case "arm":
+ settings.Platform = Platform.Arm;
+ break;
case "anycpu":
settings.Platform = Platform.AnyCPU;
break;
case "itanium":
settings.Platform = Platform.IA64;
break;
+ case "anycpu32bitpreferred":
+ settings.Platform = Platform.AnyCPU32Preferred;
+ break;
default:
- report.Error (1672, "Invalid platform type for -platform. Valid options are `anycpu', `x86', `x64' or `itanium'");
+ report.Error (1672, "Invalid -platform option `{0}'. Valid options are `anycpu', `anycpu32bitpreferred', `arm', `x86', `x64' or `itanium'",
+ value);
return ParseResult.Error;
}
void Usage ()
{
output.WriteLine (
- "Mono C# compiler, Copyright 2001 - 2011 Novell, Inc.\n" +
+ "Mono C# compiler, Copyright 2001-2011 Novell, Inc., Copyright 2011-2012 Xamarin, Inc\n" +
"mcs [options] source-files\n" +
" --about About the Mono C# compiler\n" +
" -addmodule:M1[,Mn] Adds the module to the generated assembly\n" +
" -out:FILE Specifies output assembly name\n" +
" -pkg:P1[,Pn] References packages P1..Pn\n" +
" -platform:ARCH Specifies the target platform of the output assembly\n" +
- " ARCH can be one of: anycpu, x86, x64 or itanium\n" +
+ " ARCH can be one of: anycpu, anycpu32bitpreferred, arm,\n" +
+ " x86, x64 or itanium. The default is anycpu.\n" +
" -recurse:SPEC Recursively compiles files according to SPEC pattern\n" +
" -reference:A1[,An] Imports metadata from the specified assembly (short: -r)\n" +
" -reference:ALIAS=A Imports metadata using specified extern alias (short: -r)\n" +