Merge pull request #1207 from schellap/relfix

Port native fixes
This commit is contained in:
Senthil 2016-02-03 16:33:11 -08:00
commit 8cb1e93d78
8 changed files with 25 additions and 34 deletions

View file

@ -14,6 +14,6 @@ If (Test-Path $appdepBinDir){
mkdir -Force "$appdepBinDir"
ls "$env:NUGET_PACKAGES\toolchain.win7-x64.Microsoft.DotNet.AppDep\1.0.4-prerelease-00001\*" | foreach {
ls "$env:NUGET_PACKAGES\toolchain.win7-x64.Microsoft.DotNet.AppDep\1.0.5-prerelease-00001\*" | foreach {
copy -Rec $_ "$appdepBinDir"
}

View file

@ -34,6 +34,6 @@ OUTPUT_DIR="$(pwd)"
popd
## App Deps ##
APPDEP_SDK=$NUGET_PACKAGES/toolchain.$RID.Microsoft.DotNet.AppDep/1.0.4-prerelease-00001/
APPDEP_SDK=$NUGET_PACKAGES/toolchain.$RID.Microsoft.DotNet.AppDep/1.0.5-prerelease-00001/
mkdir -p $OUTPUT_DIR/appdepsdk
cp -a $APPDEP_SDK/. $OUTPUT_DIR/appdepsdk

View file

@ -87,7 +87,6 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
foreach (var libPath in _ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib)))
{
// Forward the library to linked to the linker
argsList.Add("-Xlinker");
argsList.Add(libPath);
}
@ -95,7 +94,6 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
var baseAppDeplibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10/x64");
foreach (var appDeplibPath in _appdeplibs.Select(lib => Path.Combine(baseAppDeplibPath, lib)))
{
argsList.Add("-Xlinker");
argsList.Add(appDeplibPath);
}

View file

@ -66,15 +66,15 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
// Input File
var inLibFile = DetermineInFile(config);
argsList.Add("-Xlinker "+inLibFile);
argsList.Add(inLibFile);
// ILC SDK Libs
var ilcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk");
argsList.AddRange(_ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib)).Select(libPath => "-Xlinker " + libPath));
argsList.AddRange(_ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib)));
// AppDep Libs
var baseAppDepLibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10", config.Architecture.ToString());
argsList.AddRange(appdeplibs.Select(lib => Path.Combine(baseAppDepLibPath, lib)).Select(appDepLibPath => "-Xlinker " + appDepLibPath));
argsList.AddRange(appdeplibs.Select(lib => Path.Combine(baseAppDepLibPath, lib)));
// Output
var libOut = DetermineOutputFile(config);

View file

@ -20,10 +20,12 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
private readonly string CompilerOutputExtension = ".obj";
private static readonly string[] DefaultCompilerOptions = { "/nologo", "/W3", "/GS", "/DCPPCODEGEN", "/EHs", "/MT", "/Zi" };
private static readonly Dictionary<BuildConfiguration, string[]> ConfigurationCompilerOptionsMap = new Dictionary<BuildConfiguration, string[]>
{
{ BuildConfiguration.debug, new string[] {"/ZI", "/nologo", "/W3", "/WX-", "/sdl", "/Od", "/D", "CPPCODEGEN", "/D", "WIN32", "/D", "_CONSOLE", "/D", "_LIB", "/D", "_UNICODE", "/D", "UNICODE", "/Gm", "/EHsc", "/RTC1", "/MD", "/GS", "/fp:precise", "/Zc:wchar_t", "/Zc:forScope", "/Zc:inline", "/Gd", "/TP", "/wd4477", "/errorReport:prompt"} },
{ BuildConfiguration.release, new string[] {"/Zi", "/nologo", "/W3", "/WX-", "/sdl", "/O2", "/Oi", "/GL", "/D", "CPPCODEGEN", "/D", "WIN32", "/D", "NDEBUG", "/D", "_CONSOLE", "/D", "_LIB", "/D", "_UNICODE", "/D", "UNICODE", "/Gm-", "/EHsc", "/MD", "/GS", "/Gy", "/fp:precise", "/Zc:wchar_t", "/Zc:forScope", "/Zc:inline", "/Gd", "/TP", "/wd4477", "/errorReport:prompt"} }
{ BuildConfiguration.debug, new string[] { "/Od" } },
{ BuildConfiguration.release, new string[] { "/O2" } }
};
private IEnumerable<string> CompilerArgs { get; set; }
@ -72,6 +74,8 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
argsList.Add("/I");
argsList.Add($"{ilcSdkIncPath}");
argsList.AddRange(DefaultCompilerOptions);
// Configuration Based Compiler Options
argsList.AddRange(ConfigurationCompilerOptionsMap[config.BuildType]);

View file

@ -18,10 +18,12 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
private readonly string InputExtension = ".obj";
private static readonly Dictionary<BuildConfiguration, string> ConfigurationLinkerOptionsMap = new Dictionary<BuildConfiguration, string>
private static readonly string[] DefaultLinkerOptions = new string[] { "/NOLOGO", "/DEBUG", "/MANIFEST:NO" };
private static readonly Dictionary<BuildConfiguration, string[]> ConfigurationLinkerOptionsMap = new Dictionary<BuildConfiguration, string[]>
{
{ BuildConfiguration.debug, "/NOLOGO /ERRORREPORT:PROMPT /MANIFEST /MANIFESTUAC:\"level='asInvoker' uiAccess='false'\" /manifest:embed /Debug /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT" },
{ BuildConfiguration.release, "/NOLOGO /ERRORREPORT:PROMPT /INCREMENTAL:NO /OPT:REF /OPT:ICF /LTCG:incremental /MANIFEST /MANIFESTUAC:\"level='asInvoker' uiAccess='false'\" /manifest:embed /Debug /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT" }
{ BuildConfiguration.debug, new string[] { } },
{ BuildConfiguration.release, new string[] { "/INCREMENTAL:NO", "/OPT:REF", "/OPT:ICF" } }
};
private static readonly Dictionary<NativeIntermediateMode, string[]> IlcSdkLibMap = new Dictionary<NativeIntermediateMode, string[]>
@ -46,14 +48,6 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
"odbccp32.lib"
};
// We will always link against msvcrt.lib since the runtime libraries are also built against msvcrt.lib as we are not interested in assertions
// from CRT code.
private static readonly Dictionary<BuildConfiguration, string[]> ConfigurationLinkLibMap = new Dictionary<BuildConfiguration, string[]>()
{
{ BuildConfiguration.debug , new string[] { "msvcrt.lib" } },
{ BuildConfiguration.release , new string[] { "msvcrt.lib" } }
};
private IEnumerable<string> Args { get; set; }
private NativeCompileSettings config;
@ -90,8 +84,10 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
{
var argsList = new List<string>();
argsList.AddRange(DefaultLinkerOptions);
// Configuration Based Linker Options
argsList.Add(ConfigurationLinkerOptionsMap[config.BuildType]);
argsList.AddRange(ConfigurationLinkerOptionsMap[config.BuildType]);
//Output
var outFile = DetermineOutputFile(config);
@ -112,13 +108,6 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
argsList.Add($"{sdkLibPath}");
}
// Configuration Based Libs
var configLibs = ConfigurationLinkLibMap[config.BuildType];
foreach (var lib in configLibs)
{
argsList.Add($"{lib}");
}
// Link Libs
foreach(var path in config.LinkLibPaths){
argsList.Add($"{path}");

View file

@ -5,7 +5,7 @@
},
"dependencies": {
"NETStandard.Library": "1.0.0-rc2-23728",
"Microsoft.DotNet.AppDep":"1.0.4-prerelease-00001"
"Microsoft.DotNet.AppDep":"1.0.5-prerelease-00001"
},
"frameworks": {
"dnxcore50": { }

View file

@ -28,7 +28,7 @@
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Compiler.Common": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"Microsoft.DotNet.ILCompiler.SDK": "1.0.4-prerelease-00006",
"Microsoft.DotNet.ILCompiler.SDK": "1.0.5-prerelease-00002",
"Microsoft.Extensions.Logging": "1.0.0-rc2-16040",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-16040",