summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/function-attributes.c
diff options
context:
space:
mode:
authorCharles Davis <cdavis5x@gmail.com>2016-08-08 21:03:39 +0000
committerCharles Davis <cdavis5x@gmail.com>2016-08-08 21:03:39 +0000
commit3e43970d71fdcea0120f198ee60cadab667dba09 (patch)
tree7cf82716bce0a06e605177ea195bc0059b41f5ec /clang/test/CodeGen/function-attributes.c
parent6b4422e6fe22df3523ac0c9d854eb4d2436d99a3 (diff)
downloadbcm5719-llvm-3e43970d71fdcea0120f198ee60cadab667dba09.tar.gz
bcm5719-llvm-3e43970d71fdcea0120f198ee60cadab667dba09.zip
[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 llvm-svn: 278050
Diffstat (limited to 'clang/test/CodeGen/function-attributes.c')
-rw-r--r--clang/test/CodeGen/function-attributes.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/CodeGen/function-attributes.c b/clang/test/CodeGen/function-attributes.c
index 8f682a715d7..d0374c18660 100644
--- a/clang/test/CodeGen/function-attributes.c
+++ b/clang/test/CodeGen/function-attributes.c
@@ -108,11 +108,18 @@ void f20(void) {
_setjmp(0);
}
+// CHECK-LABEL: define void @f21
+// CHECK: [[HOTPATCH:#[0-9]+]]
+// CHECK: {
+void __attribute__((ms_hook_prologue)) f21(void) {
+}
+
// CHECK: attributes [[NUW]] = { nounwind optsize{{.*}} }
// CHECK: attributes [[AI]] = { alwaysinline nounwind optsize{{.*}} }
// CHECK: attributes [[NUW_OS_RN]] = { nounwind optsize readnone{{.*}} }
// CHECK: attributes [[ALIGN]] = { nounwind optsize alignstack=16{{.*}} }
// CHECK: attributes [[RT]] = { nounwind optsize returns_twice{{.*}} }
+// CHECK: attributes [[HOTPATCH]] = { nounwind optsize{{.*}}"patchable-function"="ms-hotpatch"{{.*}} }
// CHECK: attributes [[NR]] = { noreturn optsize }
// CHECK: attributes [[NUW_RN]] = { nounwind optsize readnone }
// CHECK: attributes [[RT_CALL]] = { optsize returns_twice }
OpenPOWER on IntegriCloud