Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions eng/toolAot.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@

<PropertyGroup Condition="'$(AotOrSingleFile)' == 'true' and '$(UseNativeAotForComponents)' == 'true'">
<PublishAot>true</PublishAot>
<!--
_IsApplePlatform is defined in the NativeAOT NuGet package targets which are imported after
Directory.Build.targets, so it is not available here. Use PortableOS to detect Apple platforms.
-->
<_IsApplePlatformToolAot Condition="'$(PortableOS)' == 'osx' or '$(PortableOS)' == 'ios' or '$(PortableOS)' == 'iossimulator' or '$(PortableOS)' == 'tvos' or '$(PortableOS)' == 'tvossimulator' or '$(PortableOS)' == 'maccatalyst'">true</_IsApplePlatformToolAot>
<!-- Use .dwarf files instead of .dsym files since our symbol exporting may not safely handle folders. -->
<NativeSymbolExt Condition="'$(_IsApplePlatform)' == 'true'">.dwarf</NativeSymbolExt>
<DsymUtilOptions Condition="'$(_IsApplePlatform)' == 'true'">--flat</DsymUtilOptions>
<NativeSymbolExt Condition="'$(_IsApplePlatformToolAot)' == 'true'">.dwarf</NativeSymbolExt>
<DsymUtilOptions Condition="'$(_IsApplePlatformToolAot)' == 'true'">--flat 2>/dev/null</DsymUtilOptions>
</PropertyGroup>

<PropertyGroup Condition="'$(AotOrSingleFile)' == 'true' and '$(UseNativeAotForComponents)' != 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ The .NET Foundation licenses this file to you under the MIT license.
Command="&quot;$(ObjCopyName)&quot; --add-gnu-debuglink=&quot;$(NativeBinary)$(NativeSymbolExt)&quot; &quot;$(NativeBinary)&quot;" />

<Exec Condition="'$(StripSymbols)' == 'true' and '$(_IsApplePlatform)' == 'true' and '$(NativeLib)' != 'Static'"
IgnoreStandardErrorWarningFormat="true"
Command="
dsymutil $(DsymUtilOptions) &quot;$(NativeBinary)&quot; &amp;&amp;
strip -no_code_signature_warning -x &quot;$(NativeBinary)&quot;" />
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/tools/aot/ILCompiler/ILCompiler_publish.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
<TrimmerSingleWarn>false</TrimmerSingleWarn>
<AotOrSingleFile>true</AotOrSingleFile>
<UseBootstrapLayout Condition="'$(UseBootstrap)' == 'true'">true</UseBootstrapLayout>
<!-- Workaround for dsymutil module cache errors on Apple platforms until https://github.com/dotnet/runtime/pull/123386 -->
<!-- See https://github.com/dotnet/runtime/issues/123687 -->
<StripSymbols Condition="'$(PortableOS)' == 'osx' or '$(PortableOS)' == 'ios' or '$(PortableOS)' == 'tvos' or '$(PortableOS)' == 'maccatalyst'">false</StripSymbols>
</PropertyGroup>

<Import Project="ILCompiler.props" />
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
<TrimmerSingleWarn>false</TrimmerSingleWarn>
<AotOrSingleFile>true</AotOrSingleFile>
<UseBootstrapLayout Condition="'$(UseBootstrap)' == 'true'">true</UseBootstrapLayout>
<!-- Workaround for dsymutil module cache errors on Apple platforms until https://github.com/dotnet/runtime/pull/123386 -->
<!-- See https://github.com/dotnet/runtime/issues/123687 -->
<StripSymbols Condition="'$(PortableOS)' == 'osx' or '$(PortableOS)' == 'ios' or '$(PortableOS)' == 'tvos' or '$(PortableOS)' == 'maccatalyst'">false</StripSymbols>
</PropertyGroup>

<Import Project="crossgen2.props" />
Expand Down
1 change: 1 addition & 0 deletions src/native/libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)

if (CLR_CMAKE_TARGET_APPLE)
add_definitions(-D__APPLE_USE_RFC_3542)
add_compile_options(-gline-tables-only)
endif ()

if (CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_HAIKU)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ endif()

add_custom_command(
OUTPUT pal_swiftbindings.o
COMMAND xcrun swiftc -emit-object -static -parse-as-library -enable-library-evolution ${SWIFT_COMPILER_ERRORS_FLAG} -gline-tables-only ${SWIFT_OPTIMIZATION_FLAG} -runtime-compatibility-version none ${SWIFT_SDK_FLAG} -target ${SWIFT_COMPILER_TARGET} ${CMAKE_CURRENT_SOURCE_DIR}/pal_swiftbindings.swift -o pal_swiftbindings.o
COMMAND xcrun swiftc -emit-object -static -parse-as-library -enable-library-evolution ${SWIFT_COMPILER_ERRORS_FLAG} -gnone ${SWIFT_OPTIMIZATION_FLAG} -runtime-compatibility-version none ${SWIFT_SDK_FLAG} -target ${SWIFT_COMPILER_TARGET} ${CMAKE_CURRENT_SOURCE_DIR}/pal_swiftbindings.swift -o pal_swiftbindings.o
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/pal_swiftbindings.swift
COMMENT "Compiling Swift file pal_swiftbindings.swift"
)
Expand Down
2 changes: 1 addition & 1 deletion src/native/managed/native-library.targets
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<_StripLike Condition="'$(_StripLike)' == ''">gnu</_StripLike>
</PropertyGroup>

<Exec Command="dsymutil --flat $(LikeCoreCLRDSymUtilMinimizeOpt) $(StripSourceFile)" Condition="'$(_StripLike)' == 'apple'"/> <!-- produces the .dylib.dwarf file -->
<Exec Command="dsymutil --flat $(LikeCoreCLRDSymUtilMinimizeOpt) $(StripSourceFile)" Condition="'$(_StripLike)' == 'apple'" IgnoreStandardErrorWarningFormat="true" /> <!-- produces the .dylib.dwarf file -->
<Exec Command="strip -no_code_signature_warning -S $(StripSourceFile)" Condition="'$(_StripLike)' == 'apple'"/>
<!-- runtime build runs "codesign -f -s - libWhatever.dylib" in release configurations -->
<Exec Command="codesign -f -s - $(StripSourceFile)" Condition="'$(RuntimeConfiguration)' == 'Release' and '$(_StripLike)' == 'apple'" />
Expand Down
1 change: 1 addition & 0 deletions src/tasks/Crossgen2Tasks/Microsoft.NET.CrossGen.targets
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<Exec Command="chmod 644 &quot;%(_ReadyToRunNativeObjectOutputs.Identity)&quot;" />

<Exec Condition="'$(StripSymbols)' == 'true'"
IgnoreStandardErrorWarningFormat="true"
Command="
dsymutil $(DsymUtilOptions) &quot;%(_ReadyToRunNativeObjectOutputs.Identity)&quot; &amp;&amp;
strip -no_code_signature_warning -x &quot;%(_ReadyToRunNativeObjectOutputs.Identity)&quot;" />
Expand Down
6 changes: 6 additions & 0 deletions src/tests/Common/CLRTest.CrossGen.targets
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
echo clang -dynamiclib -o "$__OutputFileFinal" "$__OutputFile" -install_name "@rpath/`basename "$__OutputFileFinal"`" -Wl,-dead_strip
clang -dynamiclib -o "$__OutputFileFinal" "$__OutputFile" -install_name "@rpath/`basename "$__OutputFileFinal"`" -Wl,-dead_strip
__linkExitCode=$?

if [ $__linkExitCode -eq 0 ] && [ "$(StripSymbols)" == "true" ]; then
echo "Stripping symbols from: $(basename "$__OutputFileFinal")"
dsymutil "$__OutputFileFinal" && strip -no_code_signature_warning -x "$__OutputFileFinal"
Comment on lines +160 to +162
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this bash script embedded in an MSBuild property, $(basename "$__OutputFileFinal") will be interpreted by MSBuild as a property expansion and will end up empty in the emitted script, so the log line won’t show the file name. Use bash-safe basename expansion (e.g., backticks/parameter expansion) or escape $ so the command substitution runs at execution time.

Copilot uses AI. Check for mistakes.
__linkExitCode=$?
Comment on lines +162 to +163
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new Mach-O stripping step calls dsymutil/strip directly but (unlike the MSBuild stripping logic in NativeAOT/CrossGen targets) doesn’t probe for tool availability or use the shared DsymUtilOptions (e.g., adding --minimize when supported). Consider adding a quick command -v dsymutil && command -v strip check with a clearer failure message, and passing $(DsymUtilOptions) through to keep behavior consistent with the rest of the repo’s stripping implementation.

Suggested change
dsymutil "$__OutputFileFinal" && strip -no_code_signature_warning -x "$__OutputFileFinal"
__linkExitCode=$?
if command -v dsymutil >/dev/null 2>&1 && command -v strip >/dev/null 2>&1; then
dsymutil $(DsymUtilOptions) "$__OutputFileFinal" && strip -no_code_signature_warning -x "$__OutputFileFinal"
__linkExitCode=$?
else
echo "error: dsymutil and/or strip not found on PATH; cannot strip symbols for $(basename "$__OutputFileFinal")"
__linkExitCode=1
fi

Copilot uses AI. Check for mistakes.
fi
fi

echo "Running R2RDump: $__R2RDumpCommand"
Expand Down
3 changes: 0 additions & 3 deletions src/tests/Common/XUnitLogChecker/XUnitLogChecker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
<PublishAot Condition="'$(UseNativeAotForComponents)' == 'true'">true</PublishAot>
<PublishSingleFile Condition="'$(UseNativeAotForComponents)' != 'true'">true</PublishSingleFile>
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
<!-- Workaround for dsymutil module cache errors on Apple platforms until https://github.com/dotnet/runtime/pull/123386 -->
<!-- See https://github.com/dotnet/runtime/issues/123687 -->
<StripSymbols Condition="'$(PortableOS)' == 'osx' or '$(PortableOS)' == 'ios' or '$(PortableOS)' == 'tvos' or '$(PortableOS)' == 'maccatalyst'">false</StripSymbols>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 0 additions & 3 deletions src/tools/ilasm/src/ilasm/ilasm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
<PublishTrimmed>true</PublishTrimmed>
<AotOrSingleFile>true</AotOrSingleFile>
<UseBootstrapLayout Condition="'$(UseBootstrap)' == 'true'">true</UseBootstrapLayout>
<!-- Workaround for dsymutil module cache errors on Apple platforms until https://github.com/dotnet/runtime/pull/123386 -->
<!-- See https://github.com/dotnet/runtime/issues/123687 -->
<StripSymbols Condition="'$(PortableOS)' == 'osx' or '$(PortableOS)' == 'ios' or '$(PortableOS)' == 'tvos' or '$(PortableOS)' == 'maccatalyst'">false</StripSymbols>
<Nullable>enable</Nullable>
Comment on lines 12 to 15
</PropertyGroup>

Expand Down
Loading