Skip to content

Fall back to ld for private libunwind partial link#129352

Open
sbomer wants to merge 1 commit into
dotnet:mainfrom
sbomer:ld-libunwind
Open

Fall back to ld for private libunwind partial link#129352
sbomer wants to merge 1 commit into
dotnet:mainfrom
sbomer:ld-libunwind

Conversation

@sbomer

@sbomer sbomer commented Jun 12, 2026

Copy link
Copy Markdown
Member

When CMAKE_LINKER resolves to llvm-link, continue preferring the matching ld.lld for the NativeAOT private libunwind partial link, but fall back to binutils ld when ld.lld is unavailable.

Fixes #129313

When CMAKE_LINKER resolves to llvm-link, continue preferring the matching ld.lld for the NativeAOT private libunwind partial link, but fall back to binutils ld when ld.lld is unavailable.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the NativeAOT private libunwind “partial link” tool selection logic so that when CMAKE_LINKER resolves to llvm-link, the build prefers a matching ld.lld but can fall back to ld if ld.lld isn’t available.

Changes:

  • If ld.lld matching the detected llvm-link version is found, use it for the -r partial link step.
  • Otherwise, attempt to locate ld and use it as a fallback linker; if neither is found, fail configuration with a fatal error.
Show a summary per file
File Description
src/coreclr/nativeaot/Runtime/Full/CMakeLists.txt Updates linker selection for the libunwind relocatable/partial link step to prefer ld.lld but allow fallback to ld.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

if(NATIVEAOT_PRIVATE_LIBUNWIND_LD_LLD)
set(NATIVEAOT_PRIVATE_LIBUNWIND_LINKER "${NATIVEAOT_PRIVATE_LIBUNWIND_LD_LLD}")
else()
find_program(NATIVEAOT_PRIVATE_LIBUNWIND_LD NAMES ld)
if(NATIVEAOT_PRIVATE_LIBUNWIND_LD)
set(NATIVEAOT_PRIVATE_LIBUNWIND_LINKER "${NATIVEAOT_PRIVATE_LIBUNWIND_LD}")
else()
message(FATAL_ERROR "A linker supporting relocatable linking is required to privatize NativeAOT libunwind symbols")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

ld.lld is required to privatize NativeAOT libunwind symbols

3 participants