Files
clang-p2996/compiler-rt/test/metadata/uar.cpp
Dmitry Vyukov dbe8c2c316 Use-after-return sanitizer binary metadata
Currently per-function metadata consists of:
(start-pc, size, features)

This adds a new UAR feature and if it's set an additional element:
(start-pc, size, features, stack-args-size)

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D136078
2022-12-05 14:40:31 +01:00

60 lines
1.8 KiB
C++

// RUN: %clangxx %s -o %t -fexperimental-sanitize-metadata=covered,uar && %t | FileCheck %s
// CHECK: metadata add version 1
// CHECK: empty: features=0 stack_args=0
void empty() {}
// CHECK: ellipsis: features=0 stack_args=0
void ellipsis(const char *fmt, ...) {
volatile int x;
x = 1;
}
// CHECK: non_empty_function: features=2 stack_args=0
void non_empty_function() {
// Completely empty functions don't get uar metadata.
volatile int x;
x = 1;
}
// CHECK: no_stack_args: features=2 stack_args=0
void no_stack_args(long a0, long a1, long a2, long a3, long a4, long a5) {
volatile int x;
x = 1;
}
// CHECK: stack_args: features=2 stack_args=16
void stack_args(long a0, long a1, long a2, long a3, long a4, long a5, long a6) {
volatile int x;
x = 1;
}
// CHECK: more_stack_args: features=2 stack_args=32
void more_stack_args(long a0, long a1, long a2, long a3, long a4, long a5,
long a6, long a7, long a8) {
volatile int x;
x = 1;
}
// CHECK: struct_stack_args: features=2 stack_args=144
struct large {
char x[131];
};
void struct_stack_args(large a) {
volatile int x;
x = 1;
}
#define FUNCTIONS \
FN(empty); \
FN(ellipsis); \
FN(non_empty_function); \
FN(no_stack_args); \
FN(stack_args); \
FN(more_stack_args); \
FN(struct_stack_args); \
/**/
#include "common.h"