aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/X86/ms-secure-hotpatch.c
blob: 9bc8c2cf364bf514b209d22a395ef227684964ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// REQUIRES: x86-registered-target

// This verifies that hotpatch function attributes are correctly propagated when compiling directly to OBJ.
//
// RUN: echo this_gets_hotpatched > %t.patch-functions.txt
// RUN: %clang_cl -c --target=x86_64-windows-msvc -O2 /Z7 -fms-secure-hotpatch-functions-file=%t.patch-functions.txt /Fo%t.obj -- %s
// RUN: llvm-readobj --codeview %t.obj | FileCheck %s

void this_might_have_side_effects();

int __declspec(noinline) this_gets_hotpatched() {
    this_might_have_side_effects();
    return 42;
}

// CHECK: Kind: S_HOTPATCHFUNC (0x1169)
// CHECK-NEXT: Function: this_gets_hotpatched

int __declspec(noinline) this_does_not_get_hotpatched() {
    return this_gets_hotpatched() + 100;
}

// CHECK-NOT: S_HOTPATCHFUNC