Scan ABIv2 tables pointer-by-pointer to skip intra-section padding#89
Scan ABIv2 tables pointer-by-pointer to skip intra-section padding#89DHowett-MSFT wants to merge 1 commit intognustep:masterfrom
Conversation
On Windows with incremental linking enabled, structures laid out in the .objcrt sections may be padded on either side with alignment-sized sets of null bytes. Since Clang sets the alignment for each ABI section to a pointer's width, we can skip over those padding bytes by moving uintptr_twise.
|
I've created this as a draft so that we can discuss it. I agree that this is best solved with a linker directive or by using another linker. My main contention, which is primary centered around WinObjC (and therefore, we are willing to carry this patch on our own) is twofold:
This patch is fragile, but it tries to only rely on known invariants: that the first field of every runtime structure will never intentionally be |
|
I think I'd rather keep this in the WinObjC version, where the ABI guarantees are weaker. I'm not sure that using lld-link.exe instead of link.exe is that much of a problem (the LLVM toolchain files for Visual Studio will use lld-link and clang), but if it is then having this in WinObjC for a release or two and then removing it seems like a better option than upstreaming it. I presume the directive will be silently ignored by linkers that don't support it, so we should be able to make clang emit it soon and then turn this into dead code as soon as the new linker is released. |
On Windows with incremental linking enabled, structures laid out in the
.objcrt sections may be padded on either side with alignment-sized sets
of null bytes. Since Clang sets the alignment for each ABI section to a
pointer's width, we can skip over those padding bytes by moving
uintptr_twise.