diff -Nru llvm-toolchain-19-19.1.0~++rc4/debian/patches/mips-mlir-xgot.diff llvm-toolchain-19-19.1.0~++rc4/debian/patches/mips-mlir-xgot.diff --- llvm-toolchain-19-19.1.0~++rc4/debian/patches/mips-mlir-xgot.diff 1970-01-01 08:00:00.000000000 +0800 +++ llvm-toolchain-19-19.1.0~++rc4/debian/patches/mips-mlir-xgot.diff 2024-09-04 03:48:12.000000000 +0800 @@ -0,0 +1,15 @@ +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. diff -Nru llvm-toolchain-19-19.1.0~++rc4/debian/patches/series llvm-toolchain-19-19.1.0~++rc4/debian/patches/series --- llvm-toolchain-19-19.1.0~++rc4/debian/patches/series 2024-08-19 23:25:47.000000000 +0800 +++ llvm-toolchain-19-19.1.0~++rc4/debian/patches/series 2024-09-04 03:48:12.000000000 +0800 @@ -152,3 +152,4 @@ offload-disable-static-assert.diff link-with-package-metadata.diff env-lld-package-metadata.diff +mips-mlir-xgot.diff diff -Nru llvm-toolchain-19-19.1.0~++rc4/debian/rules llvm-toolchain-19-19.1.0~++rc4/debian/rules --- llvm-toolchain-19-19.1.0~++rc4/debian/rules 2024-09-03 21:04:57.000000000 +0800 +++ llvm-toolchain-19-19.1.0~++rc4/debian/rules 2024-09-04 03:48:12.000000000 +0800 @@ -188,6 +188,9 @@ # everywhere and in all stages LDFLAGS_EXTRA += -latomic endif +ifneq (,$(filter $(DEB_HOST_ARCH),mipsel mips64el)) +LDFLAGS_EXTRA += -mxgot +endif Z3_FLAG = -DLLVM_ENABLE_Z3_SOLVER=OFF ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' libz3-dev) gt 4.7.0; echo $$?),0)