aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorJacek Caban <jacek@codeweavers.com>2024-08-22 22:03:05 +0200
committerGitHub <noreply@github.com>2024-08-22 22:03:05 +0200
commita2d8743cc86f96f6b1cbd85798328bd3fb2bf4de (patch)
tree2bf72f8ef448e03a250baa6c9a3016c6994b5d9c /clang/lib/CodeGen/CodeGenFunction.cpp
parente454d3103739c19a863a210701cc03528c96dd68 (diff)
downloadllvm-a2d8743cc86f96f6b1cbd85798328bd3fb2bf4de.zip
llvm-a2d8743cc86f96f6b1cbd85798328bd3fb2bf4de.tar.gz
llvm-a2d8743cc86f96f6b1cbd85798328bd3fb2bf4de.tar.bz2
[LLD][COFF] Generate X64 thunks for ARM64EC entry points and patchable functions. (#105499)
This implements Fast-Forward Sequences documented in ARM64EC ABI https://learn.microsoft.com/en-us/windows/arm/arm64ec-abi. There are two conditions when linker should generate such thunks: - For each exported ARM64EC functions. It applies only to ARM64EC functions (we may also have pure x64 functions, for which no thunk is needed). MSVC linker creates `EXP+<mangled export name>` symbol in those cases that points to the thunk and uses that symbol for the export. It's observable from the module: it's possible to reference such symbols as I did in the test. Note that it uses export name, not name of the symbol that's exported (as in `foo` in `/EXPORT:foo=bar`). This implies that if the same function is exported multiple times, it will have multiple thunks. I followed this MSVC behavior. - For hybrid_patchable functions. The linker tries to generate a thunk for each undefined `EXP+*` symbol (and such symbols are created by the compiler as a target of weak alias from the demangled name). MSVC linker tries to find corresponding `*$hp_target` symbol and if fails to do so, it outputs a cryptic error like `LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage`. I just skip generating the thunk in such case (which causes undefined reference error). MSVC linker additionally checks that the symbol complex type is a function (see also #102898). We generally don't do such checks in LLD, so I made it less strict. It should be fine: if it's some data symbol, it will not have `$hp_target` symbol, so we will skip it anyway.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions