Skip to content

Add UsePureLLVMToolchain for compiler-rt+lld combo - #129382

Merged
jkotas merged 2 commits into
dotnet:mainfrom
am11:patch-53
Jun 17, 2026
Merged

jkotas merged 2 commits into
dotnet:mainfrom
am11:patch-53

Conversation

@am11

@am11 am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member
# on Alpine, install llvm toolchain without GNU-ness
$ apk add clang llvm lld compiler-rt
$ dotnet new webapiaot -n wapi1
$ cd $_
$ dotnet publish -p UsePureLLVMToolchain=true

Saves 22592 bytes in webapiaot.

@am11
am11 requested a review from MichalStrehovsky as a code owner June 14, 2026 13:29
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jun 14, 2026
@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.

@jkotas

jkotas commented Jun 14, 2026 •

Copy link
Copy Markdown
Member

on Alpine, install llvm toolchain without GNU-ness
$ apk add clang llvm lld compiler-rt

Is the mixing a matching of static libraries built against GNU rt (what's in the package) with compiler-rt guaranteed to work?

@am11

am11 commented Jun 14, 2026

Copy link
Copy Markdown
Member Author

Is the mixing a matching of static libraries built against GNU rt (what's in the package) with compiler-rt guaranteed to work?

The static libraries only contain undefined references to the builtins. These are resolved at final link-time by the selected runtime. Since the linker isn't throwing any 'unresolved symbol' errors during my test on Ubuntu/Alpine, the required interface is being satisfied by compiler-rt. Compatibility is quite high which makes compiler-rt usable on distros which default to llvm these days.

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@MichalStrehovsky Does this look reasonable to you?

@MichalStrehovsky MichalStrehovsky left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@MichalStrehovsky Does this look reasonable to you?

I kind of wish we could default enable it with LinkerFlavor=lld, but we'd need to extend our list of prerequisites, so it's probably a no-go.

We don't currently document LinkerFlavor on learn.microsoft.com, so this will probably stay in the same category as that or static libssl linking.

At that point it's similarly discoverable as someone finding out they can set LinkerFlavor and pass the LinkerArg (LinkerArg is documented).

I don't expect many people to find out about this new property, but it's in a leafy location where it doesn't hurt to have the property.

@jkotas

jkotas commented Jun 17, 2026

Copy link
Copy Markdown
Member

/ba-g infrastructure timeouts

@jkotas
jkotas merged commit 5656cc9 into dotnet:main Jun 17, 2026
105 of 112 checks passed
@am11
am11 deleted the patch-53 branch June 17, 2026 13:09
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 18, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
```sh
# on Alpine, install llvm toolchain without GNU-ness
$ apk add clang llvm lld compiler-rt
$ dotnet new webapiaot -n wapi1
$ cd $_
$ dotnet publish -p UsePureLLVMToolchain=true
```

Saves `22592` bytes in `webapiaot`.
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants