[lld] [llvm] [LLD][COFF] Add more variety of CET and hotpatch flags (PR #150761)
Alexandre Ganea via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 4 11:48:59 PDT 2025
aganea wrote:
Before merging, the only small issue I am having with this PR is that if we specify `lld-link ... /hotpatchcompatible` (after this commit), and if we built the code with `clang-cl`, there could be cases where the image would crash at runtime, if hotpatching is applied. Currently `clang-cl` is not compliant when targetting x64 in terms of hotpatching, in the same way as MSVC x64 is. MSVC always generates a two-byte instructions prelude, whereas there are cases where `clang-cl` can generate one-byte instructions. That is the reason why the flag `/HOTPATCH` still exists in `clang-cl`, whereas on MSVC x64 it has been removed (because it's always on). I know this problem already exists today if someone builds an .OBJ with `clang-cl` and links with `lld-link ... /hotpatchcompatible`; however we have the tendency for the opposite: if someone builds with `clang-cl` they would most likely link with `lld-link` as well.
I think the road foward -and to be more compliant- would be to remove `/HOTPATCH` in `clang-cl` and always generate patchable two-byte instructions like MSVC does. This is a minor issue, but I wanted to mention it.
https://github.com/llvm/llvm-project/pull/150761
More information about the llvm-commits
mailing list