summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Error.cpp
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-11-18 17:28:10 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-11-18 17:28:10 +0000
commitc3115285164b7c3762be12c2925d7ec76106e6f6 (patch)
tree155b4afc9bb3a4b1055745c6b474cd98b689c113 /llvm/lib/Support/Error.cpp
parent395be572f00fcc21538a30dc3d4a75bbbba78ee9 (diff)
downloadbcm5719-llvm-c3115285164b7c3762be12c2925d7ec76106e6f6.tar.gz
bcm5719-llvm-c3115285164b7c3762be12c2925d7ec76106e6f6.zip
Add link-time detection of LLVM_ABI_BREAKING_CHECKS mismatch
Summary: LLVM will define a symbol, either EnableABIBreakingChecks or DisableABIBreakingChecks depending on the configuration setting for LLVM_ABI_BREAKING_CHECKS. The llvm-config.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. Reviewers: rnk, jroelofs Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D26841 llvm-svn: 287352
Diffstat (limited to 'llvm/lib/Support/Error.cpp')
-rw-r--r--llvm/lib/Support/Error.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Support/Error.cpp b/llvm/lib/Support/Error.cpp
index 7436a1fd38e..f818868b641 100644
--- a/llvm/lib/Support/Error.cpp
+++ b/llvm/lib/Support/Error.cpp
@@ -112,3 +112,19 @@ 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
OpenPOWER on IntegriCloud