Port the error functions from ELF to COFF.

This has a few advantages

* Less C++ code (about 300 lines less).
* Less machine code (about 14 KB of text on a linux x86_64 build).
* It is more debugger friendly. Just set a breakpoint on the exit function and
  you get the complete lld stack trace of when the error was found.
* It is a more robust API. The errors are handled early and we don't get a
  std::error_code hot potato being passed around.
* In most cases the error function in a better position to print diagnostics
  (it has more context).

llvm-svn: 244215
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp
index fe8b990..8533fa7 100644
--- a/lld/COFF/Chunks.cpp
+++ b/lld/COFF/Chunks.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "Chunks.h"
+#include "Error.h"
 #include "InputFiles.h"
 #include "Symbols.h"
 #include "llvm/Object/COFF.h"
@@ -60,7 +61,7 @@
   case IMAGE_REL_AMD64_SECTION:  add16(Off, Sym->getSectionIndex()); break;
   case IMAGE_REL_AMD64_SECREL:   add32(Off, Sym->getSecrel()); break;
   default:
-    llvm::report_fatal_error("Unsupported relocation type");
+    error("Unsupported relocation type");
   }
 }
 
@@ -75,7 +76,7 @@
   case IMAGE_REL_I386_SECTION:  add16(Off, Sym->getSectionIndex()); break;
   case IMAGE_REL_I386_SECREL:   add32(Off, Sym->getSecrel()); break;
   default:
-    llvm::report_fatal_error("Unsupported relocation type");
+    error("Unsupported relocation type");
   }
 }
 
@@ -119,7 +120,7 @@
   case IMAGE_REL_ARM_BRANCH24T: applyBranch24T(Off, S - P - 4); break;
   case IMAGE_REL_ARM_BLX23T:    applyBranch24T(Off, S - P - 4); break;
   default:
-    llvm::report_fatal_error("Unsupported relocation type");
+    error("Unsupported relocation type");
   }
 }