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

libnethost is built containing objects with /LTCG enabled #111788

Open
Windows10CE opened this issue Jan 24, 2025 · 2 comments
Open

libnethost is built containing objects with /LTCG enabled #111788

Windows10CE opened this issue Jan 24, 2025 · 2 comments
Labels
area-Host untriaged New issue has not been triaged by the area owner

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Host untriaged New issue has not been triaged by the area owner
Projects
Status: No status
Development

No branches or pull requests

2 participants