Skip to content

libnethost is built containing objects with /LTCG enabled #111788

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

Closed
Windows10CE opened this issue Jan 24, 2025 · 4 comments · Fixed by #111805
Closed

libnethost is built containing objects with /LTCG enabled #111788

Windows10CE opened this issue Jan 24, 2025 · 4 comments · Fixed by #111805
Assignees
Labels
area-Host in-pr There is an active PR which will close this issue when it is merged

Comments

@Windows10CE
Copy link
Contributor

Windows10CE commented Jan 24, 2025

Description

nethost has this inside its build configuration:
https://github.com./dotnet/runtime/blob/main/src/native/corehost/nethost/CMakeLists.txt#L54-L60

fxr_resolver, which nethost depends on, also contains this:
https://github.com./dotnet/runtime/blob/main/src/native/corehost/fxr/staticlib/CMakeLists.txt#L39-L45

However, hostmisc, also bundled into nethost, does not strip /LTCG from its arguments, and builds with it enabled. This is then brought in as a dependency of nethost, causing nethost to not be able to be linked with any other linker than link.exe.

Reproduction Steps

Attempting to use lld-link to link nethost with anything should reproduce this, but I do not know if this is actually the case on Windows.

Expected behavior

nethost can be linked against using any linker, as seems to be the original intention.

Actual behavior

nethost fails to be linked against with other linkers, as they do not recognize the whole program opts information:

    lld-link : error : hostmisc\CMakeFiles\hostmisc.dir\trace.cpp.obj: is not a native COFF file. Recompile without /GL?
    lld-link : error : hostmisc\CMakeFiles\hostmisc.dir\utils.cpp.obj: is not a native COFF file. Recompile without /GL?
    lld-link : error : hostmisc\CMakeFiles\hostmisc.dir\pal.windows.cpp.obj: is not a native COFF file. Recompile without /GL?
    lld-link : error : hostmisc\CMakeFiles\hostmisc.dir\__\fxr\fx_ver.cpp.obj: is not a native COFF file. Recompile without /GL?

Regression?

Unsure.

Known Workarounds

Manually building nethost with the same /LTCG opt out in hostmisc/CMakeLists.txt causes things to work as intended again.

Configuration

  • .NET 9
  • Linking on Arch Linux, with lld-link

Other information

No response

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jan 24, 2025
Copy link
Contributor

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

@ikkentim
Copy link

You mean /LTSC. I ran into this issue as well recently. Would love to see this fixed.

Related issue #71056

@Windows10CE Windows10CE changed the title libnethost is built containing objects with /LTSC enabled libnethost is built containing objects with /LTCG enabled Jan 24, 2025
@agocke
Copy link
Member

agocke commented Jan 28, 2025

@jkoritzinsky can you look at the cmake config here?

@jkoritzinsky
Copy link
Member

Yep I’ll take a look.

@jkoritzinsky jkoritzinsky self-assigned this Jan 28, 2025
jkoritzinsky added a commit to jkoritzinsky/runtime that referenced this issue Jan 28, 2025
@jkoritzinsky jkoritzinsky linked a pull request Jan 28, 2025 that will close this issue
@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Jan 29, 2025
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Jan 31, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Mar 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Host in-pr There is an active PR which will close this issue when it is merged
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants