[PATCH] D64288: [LLD] [COFF] Share the tail in delayimport symbol thunks

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 13:47:47 PDT 2019


rnk added inline comments.


================
Comment at: COFF/DLL.cpp:195
+    0x48, 0x8D, 0x05, 0, 0, 0, 0,       // lea     rax, [__imp_<FUNCNAME>]
+    0xE9, 0, 0, 0, 0,                   // jmp     __tailMerge_<lib>
+};
----------------
mstorsjo wrote:
> ruiu wrote:
> > Intel recommends jump targets being aligned to 16 bytes. Does this jump target aligned to the boundaries? Last time I tried, I observed a non-negligible difference between unaligned and aligned jump targets.
> I guess that can be done by just marking the tail chunk as 16 byte aligned? Aligning the thunks themselves feels wasteful though.
As far as performance is concerned, each delay load thunk runs once, so I would leave them unaligned to optimize for size.

It might end up mattering for CFI, actually. There's some assumption there that indirect branch targets (which these thunks are) are aligned. I forget the details, though.

I'm also wondering if we shouldn't mark the delay load thunks as hotpatchable so they are affected by `/functionpadmin:`. It seems separable though.


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64288/new/

https://reviews.llvm.org/D64288





More information about the llvm-commits mailing list