mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-08 23:56:05 +00:00

Summary: Change the way we use ASan and UBSan together. Instead of keeping two separate runtimes (libclang_rt.asan and libclang_rt.ubsan), embed UBSan into ASan and get rid of libclang_rt.ubsan. If UBSan is not supported on a platform, all UBSan sources are just compiled into dummy empty object files. UBSan initialization code (e.g. flag parsing) is directly called from ASan initialization, so we are able to enforce correct initialization order. This mirrors the approach we already use for ASan+LSan. This change doesn't modify the way we use standalone UBSan. Test Plan: regression test suite Reviewers: kubabrecka, zaks.anna, rsmith, kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8646 llvm-svn: 233861
32 lines
978 B
C++
32 lines
978 B
C++
//===-- ubsan_init.h --------------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Initialization function for UBSan runtime.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
#ifndef UBSAN_INIT_H
|
|
#define UBSAN_INIT_H
|
|
|
|
namespace __ubsan {
|
|
|
|
// Initialize UBSan as a standalone tool. Typically should be called early
|
|
// during initialization.
|
|
void InitAsStandalone();
|
|
|
|
// Initialize UBSan as a standalone tool, if it hasn't been initialized before.
|
|
void InitAsStandaloneIfNecessary();
|
|
|
|
// Initializes UBSan as a plugin tool. This function should be called once
|
|
// from "parent tool" (e.g. ASan) initialization.
|
|
void InitAsPlugin();
|
|
|
|
} // namespace __ubsan
|
|
|
|
#endif // UBSAN_INIT_H
|