Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dependency on lld optional during runtime build #84934

Closed
sbomer opened this issue Apr 17, 2023 · 4 comments · Fixed by #85667
Closed

Make dependency on lld optional during runtime build #84934

sbomer opened this issue Apr 17, 2023 · 4 comments · Fixed by #85667

Comments

@sbomer
Copy link
Member

sbomer commented Apr 17, 2023

From @am11 in #84794 (comment):

  • we can no longer build runtime repo with binutils alone.

i.e. LinkerFlavor=lld if target==linux constructs added are missing and Compiler!=gcc condition; we set Compiler at the start of build:

arguments="$arguments /p:Compiler=$compiler /p:CppCompilerAndLinker=$compiler"
(maps to ./build.sh -gcc)

The ability to compile with gcc+binutils is tested by the gcc product build leg, but this doesn't cover test builds. Conditions similar to

<UseLLVMLinker Condition="'$(CppCompilerAndLinker)' == 'clang' and '$(TargetOS)' == 'linux'">true</UseLLVMLinker>
need to be added to nativeaot test builds. I believe this would cover building with gcc+binutils.

That still leaves the scenario of building with clang+bfd (where clang and binutils are installed, but lld isn't). From #84794 (comment):

changes in #84148 will "force" fuse-ld=lld unconditionally, disregarding #2's introspection based linker selection, and fail the build because we didn't install lld-16

When using clang as the linker driver, the NativeAot targets either explicitly use bfd (the default), or can be made to use lld via LinkerFlavor. So the fix for this would be to perform detection of lld when using the clang compiler, and set LinkerFlavor based on the result.

@ghost
Copy link

ghost commented Apr 20, 2023

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

Issue Details

From @am11 in #84794 (comment):

  • we can no longer build runtime repo with binutils alone.

i.e. LinkerFlavor=lld if target==linux constructs added are missing and Compiler!=gcc condition; we set Compiler at the start of build:

arguments="$arguments /p:Compiler=$compiler /p:CppCompilerAndLinker=$compiler"
(maps to ./build.sh -gcc)

The ability to compile with gcc+binutils is tested by the gcc product build leg, but this doesn't cover test builds. Conditions similar to

<UseLLVMLinker Condition="'$(CppCompilerAndLinker)' == 'clang' and '$(TargetOS)' == 'linux'">true</UseLLVMLinker>
need to be added to nativeaot test builds. I believe this would cover building with gcc+binutils.

That still leaves the scenario of building with clang+bfd (where clang and binutils are installed, but lld isn't). From #84794 (comment):

changes in #84148 will "force" fuse-ld=lld unconditionally, disregarding #2's introspection based linker selection, and fail the build because we didn't install lld-16

When using clang as the linker driver, the NativeAot targets either explicitly use bfd (the default), or can be made to use lld via LinkerFlavor. So the fix for this would be to perform detection of lld when using the clang compiler, and set LinkerFlavor based on the result.

Author: sbomer
Assignees: sbomer
Labels:

area-Infrastructure-coreclr, untriaged

Milestone: -

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Apr 27, 2023
@agocke
Copy link
Member

agocke commented May 2, 2023

This should also be checked by runtime-dev-innerloop. Do we run in a container that has lld in that case?

@sbomer
Copy link
Member Author

sbomer commented May 2, 2023

It currently runs in the mariner images, but I think we should move it to something more representative - maybe Ubuntu 20.04 without lld.

@agocke
Copy link
Member

agocke commented May 2, 2023

I would suggest 22.04 (latest LTS), but yeah, agreed.

@ghost ghost removed in-pr There is an active PR which will close this issue when it is merged untriaged New issue has not been triaged by the area owner labels May 4, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants