rui314 / mold

Mold: A Modern Linker 🦠
MIT License
13.69k stars 448 forks source link

Fix `get_self_path` on windows #1283

Closed yujincheng08 closed 2 weeks ago

yujincheng08 commented 2 weeks ago

On windows, calling read_symlink will throw an exception.

rui314 commented 2 weeks ago

We use this fiction for mold -run, but the first of not supported on Windows, so we don't need the code for it.

yujincheng08 commented 2 weeks ago

well, i am trying to make mold support lto on msys: https://github.com/yujincheng08/MINGW-packages/commit/8ff0e682a1596db1fbb3df638dbcc49fdfaf7450 and this is one of the patch so I wonder if it can be somehow merged by upstream.

it compiles at least (but there's an error of mutex when trying to use).

rui314 commented 2 weeks ago

Then can you send me PR once the feature is ready?

rui314 commented 2 weeks ago

So, are you trying to cross build Linux binaries on msys on Windows?

yujincheng08 commented 2 weeks ago

@rui314 sure I am more than happy to PR this. And yes I am cross-compiling Linux binaries on msys on windows.

yujincheng08 commented 2 weeks ago

You are right. This is because the is_llvm check has failed so lto tries to restart_process which involves this. So this PR is not needed.