From 5a6de523839c55c944afc611654219690ed2bf5d Mon Sep 17 00:00:00 2001 From: nattress Date: Mon, 28 Mar 2016 17:28:44 -0700 Subject: [PATCH] Add dotnet-compile-native linker script for Linux / OSX Add CoreRT SDK linkerscript to linker options if the file is present. It is used for controlling section merging for multi-file compilation. --- .../Linux/LinuxRyuJitCompileStep.cs | 7 +++++++ .../IntermediateCompilation/Mac/MacRyuJitCompileStep.cs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Linux/LinuxRyuJitCompileStep.cs b/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Linux/LinuxRyuJitCompileStep.cs index 65602dd04..bf54a1d0b 100644 --- a/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Linux/LinuxRyuJitCompileStep.cs +++ b/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Linux/LinuxRyuJitCompileStep.cs @@ -70,6 +70,13 @@ namespace Microsoft.DotNet.Tools.Compiler.Native var ilcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk"); argsList.AddRange(_ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib))); + // Optional linker script + var linkerScriptFile = Path.Combine(ilcSdkLibPath, "linkerscript"); + if (File.Exists(linkerScriptFile)) + { + argsList.Add(linkerScriptFile); + } + // AppDep Libs var baseAppDepLibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/ubuntu.14.04", config.Architecture.ToString()); argsList.AddRange(_appdeplibs.Select(lib => Path.Combine(baseAppDepLibPath, lib))); diff --git a/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Mac/MacRyuJitCompileStep.cs b/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Mac/MacRyuJitCompileStep.cs index 4a44bd459..0076ddb27 100644 --- a/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Mac/MacRyuJitCompileStep.cs +++ b/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Mac/MacRyuJitCompileStep.cs @@ -72,6 +72,13 @@ namespace Microsoft.DotNet.Tools.Compiler.Native var ilcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk"); argsList.AddRange(_ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib))); + // Optional linker script + var linkerScriptFile = Path.Combine(ilcSdkLibPath, "linkerscript"); + if (File.Exists(linkerScriptFile)) + { + argsList.Add(linkerScriptFile); + } + // AppDep Libs var baseAppDepLibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10", config.Architecture.ToString()); argsList.AddRange(appdeplibs.Select(lib => Path.Combine(baseAppDepLibPath, lib)));