brintos

brintos / llvm-project-archived public Read only

0
0
Text · 737 B · 0b848ec Raw
30 lines · cpp
1// RUN: %clangxx -fsanitize=undefined -shared-libsan %s -o %t && %run %t 2>&1 | FileCheck %s2 3// Ensure ubsan runtime/interceptors are lazily initialized if called early.4 5// The test seems to segfault on aarch64 with tsan:6// https://lab.llvm.org/buildbot/#/builders/179/builds/66627// Reason unknown, needs debugging.8// UNSUPPORTED: target=aarch64{{.*}} && ubsan-tsan9 10// TySan doesn't build a shared library11// UNSUPPORTED: ubsan-tysan12 13#include <assert.h>14#include <signal.h>15#include <stdio.h>16 17__attribute__((constructor(1))) void ctor() {18  fprintf(stderr, "INIT\n");19  struct sigaction old;20  assert(!sigaction(SIGSEGV, nullptr, &old));21};22 23int main() {24  fprintf(stderr, "DONE\n");25  return 0;26}27 28// CHECK: INIT29// CHECK: DONE30