Files
clang-p2996/compiler-rt/test/msan/preinit_array.cpp
Evgeniy Stepanov 72131161a4 [msan] Intercept __getrlimit.
Summary:
This interceptor is useful on its own, but the main purpose of this
change is to intercept libpthread initialization on linux/glibc in
order to run __msan_init before any .preinit_array constructors.

We used to trigger on pthread_initialize_minimal -> getrlimit(), but
that call has changed to __getrlimit at some point.

Reviewers: vitalybuka, pcc

Subscribers: jfb, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D68168

llvm-svn: 373239
2019-09-30 17:49:48 +00:00

17 lines
309 B
C++

// RUN: %clangxx_msan -O0 %s -o %t && %run %t
#include <sanitizer/msan_interface.h>
volatile int global;
static void pre_ctor() {
volatile int local;
global = 42;
local = 42;
}
__attribute__((section(".preinit_array"), used)) void(*__local_pre_ctor)(void) = pre_ctor;
int main(void) {
return 0;
}