Disable LLVM ABI-breaking checks mismatch check.

Subzero doesn't actually use any ABI breaking LLVM functionality, so
we compile a minimized version of LLVMSupport which does not include
the symbol used to detect a mismatch in the ABI-breaking check at link-
time. Hence we need to disable this check.

Change-Id: I04c37deb359b81c21954ad92a6665d44fe2312a5
Reviewed-on: https://swiftshader-review.googlesource.com/8929
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/third_party/llvm-subzero/build/Android/include/llvm/Config/abi-breaking.h b/third_party/llvm-subzero/build/Android/include/llvm/Config/abi-breaking.h
index d9839ab..627d55d 100644
--- a/third_party/llvm-subzero/build/Android/include/llvm/Config/abi-breaking.h
+++ b/third_party/llvm-subzero/build/Android/include/llvm/Config/abi-breaking.h
@@ -17,7 +17,7 @@
 
 /* Define to disable the link-time checking of mismatch for
    LLVM_ENABLE_ABI_BREAKING_CHECKS */
-#define LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 0
+#define LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 1
 #if !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
 
 // ABI_BREAKING_CHECKS protection: provides link-time failure when clients build
diff --git a/third_party/llvm-subzero/build/Linux/include/llvm/Config/abi-breaking.h b/third_party/llvm-subzero/build/Linux/include/llvm/Config/abi-breaking.h
index d9839ab..627d55d 100644
--- a/third_party/llvm-subzero/build/Linux/include/llvm/Config/abi-breaking.h
+++ b/third_party/llvm-subzero/build/Linux/include/llvm/Config/abi-breaking.h
@@ -17,7 +17,7 @@
 
 /* Define to disable the link-time checking of mismatch for
    LLVM_ENABLE_ABI_BREAKING_CHECKS */
-#define LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 0
+#define LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 1
 #if !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
 
 // ABI_BREAKING_CHECKS protection: provides link-time failure when clients build
diff --git a/third_party/llvm-subzero/build/MacOS/include/llvm/Config/abi-breaking.h b/third_party/llvm-subzero/build/MacOS/include/llvm/Config/abi-breaking.h
index 62f685c..627d55d 100644
--- a/third_party/llvm-subzero/build/MacOS/include/llvm/Config/abi-breaking.h
+++ b/third_party/llvm-subzero/build/MacOS/include/llvm/Config/abi-breaking.h
@@ -13,11 +13,11 @@
 #define LLVM_ABI_BREAKING_CHECKS_H
 
 /* Define to enable checks that alter the LLVM C++ ABI */
-#define LLVM_ENABLE_ABI_BREAKING_CHECKS 0
+#define LLVM_ENABLE_ABI_BREAKING_CHECKS 1
 
 /* Define to disable the link-time checking of mismatch for
    LLVM_ENABLE_ABI_BREAKING_CHECKS */
-#define LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 0
+#define LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 1
 #if !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
 
 // ABI_BREAKING_CHECKS protection: provides link-time failure when clients build
diff --git a/third_party/llvm-subzero/build/Windows/include/llvm/Config/abi-breaking.h b/third_party/llvm-subzero/build/Windows/include/llvm/Config/abi-breaking.h
index d78ffa1..7e003c0 100644
--- a/third_party/llvm-subzero/build/Windows/include/llvm/Config/abi-breaking.h
+++ b/third_party/llvm-subzero/build/Windows/include/llvm/Config/abi-breaking.h
@@ -13,11 +13,11 @@
 #define LLVM_ABI_BREAKING_CHECKS_H

 

 /* Define to enable checks that alter the LLVM C++ ABI */

-#define LLVM_ENABLE_ABI_BREAKING_CHECKS 0

+#define LLVM_ENABLE_ABI_BREAKING_CHECKS 1

 

 /* Define to disable the link-time checking of mismatch for

    LLVM_ENABLE_ABI_BREAKING_CHECKS */

-#define LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 0

+#define LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 1

 #if !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING

 

 // ABI_BREAKING_CHECKS protection: provides link-time failure when clients build

diff --git a/third_party/llvm-subzero/lib/Support/Error.cpp b/third_party/llvm-subzero/lib/Support/Error.cpp
deleted file mode 100644
index 4730c0b..0000000
--- a/third_party/llvm-subzero/lib/Support/Error.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-//===----- lib/Support/Error.cpp - Error and associated utilities ---------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Support/Error.h"
-#include "llvm/ADT/Twine.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/ManagedStatic.h"
-#include <system_error>
-
-
-using namespace llvm;
-
-namespace {
-
-  enum class ErrorErrorCode : int {
-    MultipleErrors = 1,
-    InconvertibleError
-  };
-
-  // FIXME: This class is only here to support the transition to llvm::Error. It
-  // will be removed once this transition is complete. Clients should prefer to
-  // deal with the Error value directly, rather than converting to error_code.
-  class ErrorErrorCategory : public std::error_category {
-  public:
-    const char *name() const noexcept override { return "Error"; }
-
-    std::string message(int condition) const override {
-      switch (static_cast<ErrorErrorCode>(condition)) {
-      case ErrorErrorCode::MultipleErrors:
-        return "Multiple errors";
-      case ErrorErrorCode::InconvertibleError:
-        return "Inconvertible error value. An error has occurred that could "
-               "not be converted to a known std::error_code. Please file a "
-               "bug.";
-      }
-      llvm_unreachable("Unhandled error code");
-    }
-  };
-
-}
-
-static ManagedStatic<ErrorErrorCategory> ErrorErrorCat;
-
-namespace llvm {
-
-void ErrorInfoBase::anchor() {}
-char ErrorInfoBase::ID = 0;
-char ErrorList::ID = 0;
-char ECError::ID = 0;
-char StringError::ID = 0;
-
-void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner) {
-  if (!E)
-    return;
-  OS << ErrorBanner;
-  handleAllErrors(std::move(E), [&](const ErrorInfoBase &EI) {
-    EI.log(OS);
-    OS << "\n";
-  });
-}
-
-
-std::error_code ErrorList::convertToErrorCode() const {
-  return std::error_code(static_cast<int>(ErrorErrorCode::MultipleErrors),
-                         *ErrorErrorCat);
-}
-
-std::error_code inconvertibleErrorCode() {
-  return std::error_code(static_cast<int>(ErrorErrorCode::InconvertibleError),
-                         *ErrorErrorCat);
-}
-
-Error errorCodeToError(std::error_code EC) {
-  if (!EC)
-    return Error::success();
-  return Error(llvm::make_unique<ECError>(ECError(EC)));
-}
-
-std::error_code errorToErrorCode(Error Err) {
-  std::error_code EC;
-  handleAllErrors(std::move(Err), [&](const ErrorInfoBase &EI) {
-    EC = EI.convertToErrorCode();
-  });
-  if (EC == inconvertibleErrorCode())
-    report_fatal_error(EC.message());
-  return EC;
-}
-
-StringError::StringError(const Twine &S, std::error_code EC)
-    : Msg(S.str()), EC(EC) {}
-
-void StringError::log(raw_ostream &OS) const { OS << Msg; }
-
-std::error_code StringError::convertToErrorCode() const {
-  return EC;
-}
-
-void report_fatal_error(Error Err, bool GenCrashDiag) {
-  assert(Err && "report_fatal_error called with success value");
-  std::string ErrMsg;
-  {
-    raw_string_ostream ErrStream(ErrMsg);
-    logAllUnhandledErrors(std::move(Err), ErrStream, "");
-  }
-  report_fatal_error(ErrMsg);
-}
-
-}
-
-#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