[PATCH] D28141: [COFF] Use 32-bit jump table entries in .rdata for Win64

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 28 13:42:22 PST 2016


rnk created this revision.
rnk added reviewers: majnemer, compnerd.
rnk added a subscriber: llvm-commits.

We were already using 32-bit jump table entries, but this was a
consequence of the default PIC model on Win64, and not an intentional
design decision. This patch ensures that we always use 32-bit label
difference jump table entries on Win64 regardless of the PIC model. This
is a good idea because it saves executable size and object file size.

Moving the jump tables to .rdata cleans up the disassembled object code
and reduces the available ROP targets, but it requires adding one more
RIP-relative lea to the code.  COFF doesn't have relocations to express
the difference between two arbitrary symbols, so we can't use the jump
table label in the label difference like we do elsewhere.

Fixes PR31488


https://reviews.llvm.org/D28141

Files:
  include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
  lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ISelLowering.h
  test/CodeGen/X86/win64-jumptable.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28141.82616.patch
Type: text/x-patch
Size: 5527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161228/8d52eb2c/attachment.bin>


More information about the llvm-commits mailing list