[lld] [LLD][COFF] Replace ARM64EC TLS directory chunks with native chunks when available (PR #212845)

Jacek Caban via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 06:48:15 PDT 2026


cjacek wrote:

Thanks. Here, I meant specifically about the same set of TLS callbacks being pulled by the linker. See the attached test as an example. It uses TLS callbacks from Classic, but not from EC. If I build it like:
```
cl -c test.cpp -Fo:test.arm64.obj
cl -c test.cpp -Fo:test.arm64ec.obj -arm64EC
link -out:test.exe test.arm64.obj test.arm64ec.obj -machine:arm64x
```
test.exe will crash when ran in EC mode. I think that, since EC doesn't use TLS callbacks, `-arm64xsameaddress` directive never has a chance to mark the function as such, but it's still present in TLS directory as seen by EC loader.

If I remove entirely TLS usage from EC (remove tl variable from the test), then no TLS directory is emitted, even through it's required by Classic, so then it crashes when ran in native mode.

https://github.com/llvm/llvm-project/pull/212845


More information about the llvm-commits mailing list