LLVM: Always compile MCDisassembler.cpp to fix release link errors

MCDisassembler.cpp was incorrectly marked as debug-only in the LLVM 16
build files generation script. However, target disassemblers (like
X86Disassembler) are unconditionally compiled and depend on MCDisassembler,
leading to undefined symbol link errors in release builds.
https://ci.chromium.org/ui/p/chromium/builders/build/win-build-perf-siso/19852/overview

This change moves MCDisassembler.cpp to the common LLVM files list so it
is always compiled.

Change-Id: Iaaf942426973db6fd648169b852d3aa5f16b4e2a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/77369
Reviewed-by: Shahbaz Youssefi <syoussefi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Commit-Queue: Geoff Lang <geofflang@google.com>
Reviewed-by: Geoff Lang <geofflang@google.com>
Tested-by: Geoff Lang <geofflang@google.com>
Presubmit-Ready: Geoff Lang <geofflang@google.com>
diff --git a/third_party/llvm-16.0/Android.bp b/third_party/llvm-16.0/Android.bp
index e9bfb37..92065a0 100644
--- a/third_party/llvm-16.0/Android.bp
+++ b/third_party/llvm-16.0/Android.bp
@@ -1,4 +1,4 @@
-// File generated by ./generate_build_files.py
+// File generated by generate_build_files.py
 
 package {
     // http://go/android-license-faq
@@ -608,9 +608,8 @@
         "llvm/lib/MC/MCContext.cpp",
         "llvm/lib/MC/MCDXContainerStreamer.cpp",
         "llvm/lib/MC/MCDXContainerWriter.cpp",
-        "llvm/lib/MC/MCDisassembler/MCExternalSymbolizer.cpp",
+        "llvm/lib/MC/MCDisassembler/MCDisassembler.cpp",
         "llvm/lib/MC/MCDisassembler/MCRelocationInfo.cpp",
-        "llvm/lib/MC/MCDisassembler/MCSymbolizer.cpp",
         "llvm/lib/MC/MCDwarf.cpp",
         "llvm/lib/MC/MCELFObjectTargetWriter.cpp",
         "llvm/lib/MC/MCELFStreamer.cpp",
@@ -1498,14 +1497,10 @@
     ],
 
     cflags: [
-        "-Wno-ignored-qualifiers",
         "-Wno-implicit-fallthrough",
-        "-Wno-nontrivial-memcall",
         "-Wno-unreachable-code-loop-increment",
         "-Wno-unused-parameter",
         "-Wno-unused-variable",
-        // This warning can be re-enabled after updating to newer llvm version.
-        "-Wno-unnecessary-virtual-specifier",
         "-DBLAKE3_NO_AVX512",
         "-DBLAKE3_NO_AVX2",
         "-DBLAKE3_NO_SSE41",
@@ -1520,10 +1515,6 @@
         // b/193198227
         hwaddress: false,
     },
-
-    // Pinning the repo to C++20 because LLVM 16 has many forward declarations
-    // without full type being defined which causes issues with C++23
-    cpp_std: "c++20",
 }
 
 cc_library_static {
@@ -1543,6 +1534,5 @@
 
     srcs: [
         "llvm/lib/Analysis/RegionPrinter.cpp",
-        "llvm/lib/MC/MCDisassembler/MCDisassembler.cpp",
     ],
 }
diff --git a/third_party/llvm-16.0/BUILD.gn b/third_party/llvm-16.0/BUILD.gn
index 1458655..c7f62d9 100644
--- a/third_party/llvm-16.0/BUILD.gn
+++ b/third_party/llvm-16.0/BUILD.gn
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# File generated by ./generate_build_files.py
+# File generated by generate_build_files.py
 
 import("../../src/swiftshader.gni")
 
@@ -778,9 +778,8 @@
     "llvm/lib/MC/MCContext.cpp",
     "llvm/lib/MC/MCDXContainerStreamer.cpp",
     "llvm/lib/MC/MCDXContainerWriter.cpp",
-    "llvm/lib/MC/MCDisassembler/MCExternalSymbolizer.cpp",
+    "llvm/lib/MC/MCDisassembler/MCDisassembler.cpp",
     "llvm/lib/MC/MCDisassembler/MCRelocationInfo.cpp",
-    "llvm/lib/MC/MCDisassembler/MCSymbolizer.cpp",
     "llvm/lib/MC/MCDwarf.cpp",
     "llvm/lib/MC/MCELFObjectTargetWriter.cpp",
     "llvm/lib/MC/MCELFStreamer.cpp",
@@ -1283,7 +1282,6 @@
 swiftshader_llvm_source_set("swiftshader_llvm_debug") {
   sources = [
     "llvm/lib/Analysis/RegionPrinter.cpp",
-    "llvm/lib/MC/MCDisassembler/MCDisassembler.cpp",
   ]
 }
 
diff --git a/third_party/llvm-16.0/CMakeLists.txt b/third_party/llvm-16.0/CMakeLists.txt
index 68cb73a..e8d49ab 100644
--- a/third_party/llvm-16.0/CMakeLists.txt
+++ b/third_party/llvm-16.0/CMakeLists.txt
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# File generated by ./generate_build_files.py
+# File generated by generate_build_files.py
 
 set(LLVM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/llvm)
 set(LLVM_CONFIG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/configs)
@@ -104,7 +104,6 @@
     ${LLVM_DIR}/lib/Analysis/PtrUseVisitor.cpp
     ${LLVM_DIR}/lib/Analysis/RegionInfo.cpp
     ${LLVM_DIR}/lib/Analysis/RegionPass.cpp
-    ${LLVM_DIR}/lib/Analysis/RegionPrinter.cpp
     ${LLVM_DIR}/lib/Analysis/ReplayInlineAdvisor.cpp
     ${LLVM_DIR}/lib/Analysis/ScalarEvolution.cpp
     ${LLVM_DIR}/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
@@ -608,9 +607,7 @@
     ${LLVM_DIR}/lib/MC/MCDXContainerStreamer.cpp
     ${LLVM_DIR}/lib/MC/MCDXContainerWriter.cpp
     ${LLVM_DIR}/lib/MC/MCDisassembler/MCDisassembler.cpp
-    ${LLVM_DIR}/lib/MC/MCDisassembler/MCExternalSymbolizer.cpp
     ${LLVM_DIR}/lib/MC/MCDisassembler/MCRelocationInfo.cpp
-    ${LLVM_DIR}/lib/MC/MCDisassembler/MCSymbolizer.cpp
     ${LLVM_DIR}/lib/MC/MCDwarf.cpp
     ${LLVM_DIR}/lib/MC/MCELFObjectTargetWriter.cpp
     ${LLVM_DIR}/lib/MC/MCELFStreamer.cpp
diff --git a/third_party/llvm-16.0/scripts/generate_build_files.py b/third_party/llvm-16.0/scripts/generate_build_files.py
index 4d182e6..4b2ae8a 100755
--- a/third_party/llvm-16.0/scripts/generate_build_files.py
+++ b/third_party/llvm-16.0/scripts/generate_build_files.py
@@ -247,7 +247,6 @@
     "/lib/MC/MCAsmInfoWasm.cpp",
     "/lib/MC/MCAsmInfoXCOFF.cpp",
     "/lib/MC/MCDisassembler/Disassembler.cpp",
-    "/lib/MC/MCDisassembler/MCDisassembler.cpp",
     "/lib/MC/MCDisassembler/MCExternalSymbolizer.cpp",
     "/lib/MC/MCDisassembler/MCSymbolizer.cpp",
     "/lib/MC/MCInstrInfo.cpp",
@@ -361,7 +360,6 @@
 
 files_llvm_debug = [
     "/lib/Analysis/RegionPrinter.cpp",
-    "/lib/MC/MCDisassembler/MCDisassembler.cpp",
 ]
 
 files_to_add_back_for_llvm_arm = [