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 lld-link not depend on mt.exe on Windows #38314

Open
nico opened this issue Sep 16, 2018 · 6 comments
Open

Make lld-link not depend on mt.exe on Windows #38314

nico opened this issue Sep 16, 2018 · 6 comments
Labels
bugzilla Issues migrated from bugzilla lld:COFF

Comments

@nico
Copy link
Contributor

nico commented Sep 16, 2018

Bugzilla Link 38966
Version unspecified
OS All
Blocks #38315
CC @majnemer

Extended Description

On non-Windows, we use libxml2 and llvm/lib/WindowsManifest/ to merge manifests.

On Windows, libxml2 usually doesn't exist, so we rely on mt.exe being on PATH.

The way forward is probably to use msxml on Windows instead of libxml2, since that's always around. I have prototyped this a bit at https://reviews.llvm.org/D42910 but it's incomplete.

Once this is done, lld-link.exe no longer relies on PATH and the only env var it relies on is LIB, which can be passed via /libpath:. So once this is done, no special env needs to be set to be able to run lld-link -- once we have this, we can stop running lld-link.exe under ninja -t msvc in the chrome/win build on win hosts. (We already don't need it on non-win hosts.)

@majnemer
Copy link
Mannequin

majnemer mannequin commented Sep 16, 2018

Have you considered using XmlLite? It is supposed to be faster than MSXML: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms752838%28v%3dvs.85%29#xmllite-usage-scenarios

@nico
Copy link
Contributor Author

nico commented Sep 17, 2018

IIRC I looked at it and it was a SAX-style parser while MSXML has a DOM mode, which seemed more appropriate for a tool whose purpose is to merge together a bunch of XML trees.

Manifest files are tiny, so programming ergonomics is more important than speed. MSXML's ergonomics are pretty bad, but XmlLite doesn't look much better in that regard.

I'm not married to MSXML, but it seemed like the least bad alternative to me. It's as always very possible that I missed something :-)

@llvmbot
Copy link
Collaborator

llvmbot commented Sep 17, 2018

Couldn't we still just use libxml? It doesn't "usually" exist, but we could statically link against it no? Then, if your build environment detects libxml2, it uses libxml2 (same code that is currently in use for the non-Windows path, so no real changes required), if it doesn't it uses mt.exe (same code that is currently in use for the Windows path).

@nico
Copy link
Contributor Author

nico commented Sep 19, 2018

We could. It makes building LLVM harder though, and we'd have to keep the 'libxml not found' codepath around. Imho MSXML has a larger initial cost but is a better end state.

@nico
Copy link
Contributor Author

nico commented Sep 16, 2021

I changed my mind on this and I now agree with zturner's proposal to use libxml (and its dep libiconv). The main reason is that that way, lld-link will produce the same output on linux and on windows, which seems nice.

@nico
Copy link
Contributor Author

nico commented Nov 27, 2021

mentioned in issue #38315

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla lld:COFF
Projects
None yet
Development

No branches or pull requests

2 participants