llvm-bolt/0002-Add-test-for-emitting-trap-value.patch

45 lines
1.1 KiB
Diff
Raw Permalink Normal View History

From e4ae238a42296a84bc819dd1fb61f3c699952f17 Mon Sep 17 00:00:00 2001
From: Denis Revunov <rnovds@gmail.com>
Date: Thu, 17 Aug 2023 18:30:07 +0300
Subject: [PATCH] Add test for emitting trap value
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D158191
---
bolt/test/runtime/mark-funcs.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 bolt/test/runtime/mark-funcs.c
diff --git a/bolt/test/runtime/mark-funcs.c b/bolt/test/runtime/mark-funcs.c
new file mode 100644
index 000000000..a8586ca8b
--- /dev/null
+++ b/bolt/test/runtime/mark-funcs.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+
+int dummy() {
+ printf("Dummy called\n");
+ return 0;
+}
+
+int main(int argc, char **argv) {
+ if (dummy() != 0)
+ return 1;
+ printf("Main called\n");
+ return 0;
+}
+// Check that emitting trap value works properly and
+// does not break functions
+// REQUIRES: system-linux
+// RUN: %clangxx -Wl,-q %s -o %t.exe
+// RUN: %t.exe | FileCheck %s
+// CHECK: Dummy called
+// CHECK-NEXT: Main called
+// RUN: llvm-bolt %t.exe -o %t.exe.bolt -lite=false --mark-funcs
+// RUN: %t.exe.bolt | FileCheck %s
--
2.33.0