Index: llvm-toolchain-19-19.1.0~++rc4/mlir/CMakeLists.txt
===================================================================
--- llvm-toolchain-19-19.1.0~++rc4.orig/mlir/CMakeLists.txt
+++ llvm-toolchain-19-19.1.0~++rc4/mlir/CMakeLists.txt
@@ -93,6 +93,10 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" A
   append_if(CXX_SUPPORTS_WNO_UNUSED_BUT_SET_PARAMETER "-Wno-unused-but-set-parameter" CMAKE_CXX_FLAGS)
 endif()
 
+check_symbol_exists(__mips "" __MIPS)
+append_if(__MIPS "-mxgot" CMAKE_C_FLAGS)
+append_if(__MIPS "-mxgot" CMAKE_CXX_FLAGS)
+
 # Installing the headers and docs needs to depend on generating any public
 # tablegen'd targets.
 # mlir-generic-headers are dialect-independent.
