diff options
author | Charles Davis <cdavis5x@gmail.com> | 2016-08-08 21:03:39 +0000 |
---|---|---|
committer | Charles Davis <cdavis5x@gmail.com> | 2016-08-08 21:03:39 +0000 |
commit | 7d3d1e6b34653fb8be0f350caec788bc31c3bf95 (patch) | |
tree | de4a4882dcac12c8465eedea763eb53e6c57396c /include/clang/Basic/Attr.td | |
parent | 50d23ea322eeef0e6290f5743f014ecdd1c12e8f (diff) |
[Attr] Add support for the `ms_hook_prologue` attribute.
Summary:
Based on a patch by Michael Mueller.
This attribute specifies that a function can be hooked or patched. This
mechanism was originally devised by Microsoft for hotpatching their
binaries (which they're constantly updating to stay ahead of crackers,
script kiddies, and other ne'er-do-wells on the Internet), but it's now
commonly abused by Windows programs that want to hook API functions. It
is for this reason that this attribute was added to GCC--hence the name,
`ms_hook_prologue`.
Depends on D19908.
Reviewers: rnk, aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D19909
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/Attr.td')
-rw-r--r-- | include/clang/Basic/Attr.td | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 7da1efe5ff..49a3273b77 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -257,6 +257,7 @@ def TargetMips : TargetArch<["mips", "mipsel"]>; def TargetMSP430 : TargetArch<["msp430"]>; def TargetX86 : TargetArch<["x86"]>; def TargetAnyX86 : TargetArch<["x86", "x86_64"]>; +def TargetWindowsArches : TargetArch<["x86", "x86_64", "arm", "thumb"]>; def TargetWindows : TargetArch<["x86", "x86_64", "arm", "thumb"]> { let OSes = ["Win32"]; } @@ -2069,6 +2070,12 @@ def TypeTagForDatatype : InheritableAttr { // Microsoft-related attributes +def MSHookPrologue : InheritableAttr, TargetSpecificAttr<TargetWindowsArches> { + let Spellings = [GCC<"ms_hook_prologue">]; + let Subjects = SubjectList<[Function]>; + let Documentation = [MSHookPrologueDocs]; +} + def MSNoVTable : InheritableAttr, TargetSpecificAttr<TargetMicrosoftCXXABI> { let Spellings = [Declspec<"novtable">]; let Subjects = SubjectList<[CXXRecord]>; |