<LinkerArg Include="-arch $(CrossCompileArch)" Condition="'$(TargetOS)' == 'osx' and '$(CrossCompileArch)' != ''" />
<LinkerArg Include="-g" Condition="$(NativeDebugSymbols) == 'true'" />
<LinkerArg Include="-Wl,--strip-debug" Condition="$(NativeDebugSymbols) != 'true' and '$(TargetOS)' != 'osx'" />
- <LinkerArg Include="-Wl,-rpath,'$(IlcRPath)'" />
+ <LinkerArg Include="-Wl,-rpath,'$(IlcRPath)'" Condition="'$(StaticExecutable)' != 'true'" />
<LinkerArg Include="-Wl,--build-id=sha1" Condition="'$(TargetOS)' != 'osx'" />
<LinkerArg Include="-Wl,--as-needed" Condition="'$(TargetOS)' != 'osx'" />
<LinkerArg Include="-Wl,-e0x0" Condition="'$(NativeLib)' == 'Shared' and '$(TargetOS)' != 'osx'" />
<LinkerArg Include="@(StaticICULibs)" Condition="'$(StaticICULinking)' == 'true'" />
<LinkerArg Include="@(StaticSslLibs)" Condition="'$(StaticOpenSslLinking)' == 'true'" />
<LinkerArg Include="-lm" />
- <LinkerArg Include="-static" Condition="'$(StaticExecutable)' == 'true'" />
+ <LinkerArg Include="-static" Condition="'$(StaticExecutable)' == 'true' and '$(PositionIndependentExecutable)' == 'false'" />
+ <LinkerArg Include="-static-pie" Condition="'$(StaticExecutable)' == 'true' and '$(PositionIndependentExecutable)' != 'false'" />
<LinkerArg Include="-dynamiclib" Condition="'$(TargetOS)' == 'osx' and '$(NativeLib)' == 'Shared'" />
<LinkerArg Include="-shared" Condition="'$(TargetOS)' != 'osx' and '$(NativeLib)' == 'Shared'" />
<!-- binskim warning BA3001 PIE disabled on executable -->
<LinkerArg Include="-pie" Condition="'$(TargetOS)' != 'osx' and '$(NativeLib)' == '' and '$(StaticExecutable)' != 'true' and '$(PositionIndependentExecutable)' != 'false'" />
- <LinkerArg Include="-static-pie" Condition="'$(StaticExecutable)' == 'true' and '$(PositionIndependentExecutable)' != 'false'" />
<!-- binskim warning BA3010 The GNU_RELRO segment is missing -->
<LinkerArg Include="-Wl,-z,relro" Condition="'$(TargetOS)' != 'osx'" />
<!-- binskim warning BA3011 The BIND_NOW flag is missing -->