@@ -111,7 +111,7 @@ The .NET Foundation licenses this file to you under the MIT license.
111111 <LinkerArg Include =" -arch $(CrossCompileArch)" Condition =" '$(TargetOS)' == 'osx' and '$(CrossCompileArch)' != ''" />
112112 <LinkerArg Include =" -g" Condition =" $(NativeDebugSymbols) == 'true'" />
113113 <LinkerArg Include =" -Wl,--strip-debug" Condition =" $(NativeDebugSymbols) != 'true' and '$(TargetOS)' != 'osx'" />
114- <LinkerArg Include =" -Wl,-rpath,'$(IlcRPath)'" />
114+ <LinkerArg Include =" -Wl,-rpath,'$(IlcRPath)'" Condition = " '$(StaticExecutable)' != 'true' " />
115115 <LinkerArg Include =" -Wl,--build-id=sha1" Condition =" '$(TargetOS)' != 'osx'" />
116116 <LinkerArg Include =" -Wl,--as-needed" Condition =" '$(TargetOS)' != 'osx'" />
117117 <LinkerArg Include =" -Wl,-e0x0" Condition =" '$(NativeLib)' == 'Shared' and '$(TargetOS)' != 'osx'" />
@@ -129,12 +129,12 @@ The .NET Foundation licenses this file to you under the MIT license.
129129 <LinkerArg Include =" @(StaticICULibs)" Condition =" '$(StaticICULinking)' == 'true'" />
130130 <LinkerArg Include =" @(StaticSslLibs)" Condition =" '$(StaticOpenSslLinking)' == 'true'" />
131131 <LinkerArg Include =" -lm" />
132- <LinkerArg Include =" -static" Condition =" '$(StaticExecutable)' == 'true'" />
132+ <LinkerArg Include =" -static" Condition =" '$(StaticExecutable)' == 'true' and '$(PositionIndependentExecutable)' == 'false'" />
133+ <LinkerArg Include =" -static-pie" Condition =" '$(StaticExecutable)' == 'true' and '$(PositionIndependentExecutable)' != 'false'" />
133134 <LinkerArg Include =" -dynamiclib" Condition =" '$(TargetOS)' == 'osx' and '$(NativeLib)' == 'Shared'" />
134135 <LinkerArg Include =" -shared" Condition =" '$(TargetOS)' != 'osx' and '$(NativeLib)' == 'Shared'" />
135136 <!-- binskim warning BA3001 PIE disabled on executable -->
136137 <LinkerArg Include =" -pie" Condition =" '$(TargetOS)' != 'osx' and '$(NativeLib)' == '' and '$(StaticExecutable)' != 'true' and '$(PositionIndependentExecutable)' != 'false'" />
137- <LinkerArg Include =" -static-pie" Condition =" '$(StaticExecutable)' == 'true' and '$(PositionIndependentExecutable)' != 'false'" />
138138 <!-- binskim warning BA3010 The GNU_RELRO segment is missing -->
139139 <LinkerArg Include =" -Wl,-z,relro" Condition =" '$(TargetOS)' != 'osx'" />
140140 <!-- binskim warning BA3011 The BIND_NOW flag is missing -->
0 commit comments