mstorsjo / llvm-mingw

An LLVM/Clang/LLD based mingw-w64 toolchain
Other
1.75k stars 176 forks source link

MinGW lld does not support --thinlto-cache-policy #386

Closed Andarwinux closed 5 months ago

Andarwinux commented 6 months ago
./bin/ld.lld -m i386pep --thinlto-cache-policy=cache_size_bytes=1g
lld: error: unknown argument: --thinlto-cache-policy=cache_size_bytes=1g

MinGW mode lld doesn't seem to support --thinlto-cache-policy, I've also tried to pass it directly to COFF Linker via -Xlink=-lldltocachepolicy=cache_size_bytes=1g, but it doesn't seem to work.

mstorsjo commented 6 months ago

Right, we should hook up this option on the mingw linker level. We hooked up a bunch of them a while ago (on the main branch, past 17.x), but this one is still missing. FWIW, it is possible to pass with -Xlink, but note that it takes a : for the option value, not an =. So for me, this seems to work with e.g. -Wl,-Xlink=-lldltocachepolicy:cache_size_bytes=1g. (I didn’t test that it actually has the desired effect, but it doesn’t seem to warn at least.)

Andarwinux commented 6 months ago

Confirmed -Xlink=-lldltocachepolicy:cache_size_bytes=1g is working

mstorsjo commented 5 months ago

I made a PR implementing this now at https://github.com/llvm/llvm-project/pull/77387.