[PATCH] D132331: [llvm] Mark CFGuard fn ptr symbol as DSO local and add tests for mingw

Alvin Wong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 21 09:43:45 PDT 2022


alvinhochun created this revision.
alvinhochun added reviewers: ajpaverd, rnk.
Herald added subscribers: pengfei, mstorsjo, hiraditya.
Herald added a project: All.
alvinhochun requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

For mingw target, if a symbol is not marked DSO local, a `.refptr` is
generated for it. This makes CFG check calls use an extra pointer
dereference, which adds extra overhead compared to the MSVC version,
so mark the CFG guard check funciton pointer DSO local to stop it.
This should have no effect on MSVC target.

Also adapt the existing cfguard tests to run for mingw targets, so that
this change is checked.

Depends on D132302 <https://reviews.llvm.org/D132302>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132331

Files:
  llvm/lib/Transforms/CFGuard/CFGuard.cpp
  llvm/test/CodeGen/AArch64/cfguard-checks.ll
  llvm/test/CodeGen/AArch64/cfguard-module-flag.ll
  llvm/test/CodeGen/ARM/cfguard-checks.ll
  llvm/test/CodeGen/ARM/cfguard-module-flag.ll
  llvm/test/CodeGen/WinCFGuard/cfguard-cast.ll
  llvm/test/CodeGen/WinCFGuard/cfguard-giats.ll
  llvm/test/CodeGen/WinCFGuard/cfguard-mingw.ll
  llvm/test/CodeGen/X86/cfguard-checks.ll
  llvm/test/CodeGen/X86/cfguard-module-flag.ll
  llvm/test/CodeGen/X86/cfguard-x86-64-vectorcall.ll
  llvm/test/CodeGen/X86/cfguard-x86-vectorcall.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132331.454322.patch
Type: text/x-patch
Size: 17614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220821/bd094c54/attachment.bin>


More information about the llvm-commits mailing list