diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-11-28 22:23:53 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-11-28 22:23:53 +0000 |
commit | 28dd54c38fdc99981505665e11b2201304e541bf (patch) | |
tree | 832a01982016ac2e356a0f2f8111cd9a2ddd0a7f /llvm/lib/Support/Error.cpp | |
parent | 9c6cb7642e979ac32af14b7cf1c2c2a41610d43f (diff) | |
download | llvm-28dd54c38fdc99981505665e11b2201304e541bf.zip llvm-28dd54c38fdc99981505665e11b2201304e541bf.tar.gz llvm-28dd54c38fdc99981505665e11b2201304e541bf.tar.bz2 |
Add link-time detection of LLVM_ABI_BREAKING_CHECKS mismatch
The macro LLVM_ENABLE_ABI_BREAKING_CHECKS is moved to a new header
abi-breaking.h, from llvm-config.h. Only headers that are using the
macro are including this new header.
LLVM will define a symbol, either EnableABIBreakingChecks or
DisableABIBreakingChecks depending on the configuration setting for
LLVM_ABI_BREAKING_CHECKS.
The abi-breaking.h header will add weak references to these symbols in
every clients that includes this header. This should ensure that
a mismatch triggers a link failure (or a load time failure for DSO).
On MSVC, the pragma "detect_mismatch" is used instead.
Differential Revision: https://reviews.llvm.org/D26876
llvm-svn: 288082
Diffstat (limited to 'llvm/lib/Support/Error.cpp')
-rw-r--r-- | llvm/lib/Support/Error.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Support/Error.cpp b/llvm/lib/Support/Error.cpp index 7436a1f..60854f1 100644 --- a/llvm/lib/Support/Error.cpp +++ b/llvm/lib/Support/Error.cpp @@ -112,3 +112,18 @@ void report_fatal_error(Error Err, bool GenCrashDiag) { } } + +#ifndef _MSC_VER +namespace llvm { + +// One of these two variables will be referenced by a symbol defined in +// llvm-config.h. We provide a link-time (or load time for DSO) failure when +// there is a mismatch in the build configuration of the API client and LLVM. +#if LLVM_ENABLE_ABI_BREAKING_CHECKS +int EnableABIBreakingChecks; +#else +int DisableABIBreakingChecks; +#endif + +} // end namespace llvm +#endif
\ No newline at end of file |