diff options
author | Jan Kotas <jkotas@microsoft.com> | 2018-08-09 12:06:07 +0300 |
---|---|---|
committer | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2018-08-09 12:06:07 +0300 |
commit | 5bed31924abf08f5c62b63b7edab57983ab96e7a (patch) | |
tree | 3a5e6d413d8b42a0fdc54dad8df2cb3e7b60ce0e /src | |
parent | 677a6ed3cde826486dc21e3929794c851176f4b2 (diff) |
Use --as-needed command line switch with the Unix linker (#6192)
Removes unused native symbol references from the native binary
Fixes #6191
Diffstat (limited to 'src')
-rw-r--r-- | src/BuildIntegration/Microsoft.NETCore.Native.Unix.props | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/BuildIntegration/Microsoft.NETCore.Native.Unix.props b/src/BuildIntegration/Microsoft.NETCore.Native.Unix.props index c5b397b3f..a8c8bafdb 100644 --- a/src/BuildIntegration/Microsoft.NETCore.Native.Unix.props +++ b/src/BuildIntegration/Microsoft.NETCore.Native.Unix.props @@ -81,6 +81,7 @@ See the LICENSE file in the project root for more information. <LinkerArg Include="@(NativeLibrary)" /> <LinkerArg Include="-g" /> <LinkerArg Include="-Wl,-rpath,'$ORIGIN'" /> + <LinkerArg Include="-Wl,--as-needed" Condition="'$(TargetOS)' != 'OSX'" /> <LinkerArg Include="-pthread" /> <LinkerArg Include="-lstdc++" /> <LinkerArg Include="-ldl" /> @@ -94,7 +95,7 @@ See the LICENSE file in the project root for more information. <LinkerArg Include="-shared" Condition="'$(TargetOS)' != 'OSX' and '$(NativeLib)' == 'Shared'" /> <LinkerArg Include="@(NativeFramework->'-framework %(Identity)')" Condition="'$(TargetOS)' == 'OSX'" /> </ItemGroup> - + <Exec Command="command -v $(CppLinker)" IgnoreExitCode="true"> <Output TaskParameter="ExitCode" PropertyName="_WhereLinker"/> </Exec> |