chromium/third_party/lzma_sdk/chromium.patch

diff --git "a/lzma2107\\C/7zCrc.c" "b/third_party\\lzma_sdk/7zCrc.c"
index f186324ddc609..c0cc9bc7812e0 100644
--- "a/lzma2107\\C/7zCrc.c"
+++ "b/third_party\\lzma_sdk/7zCrc.c"
@@ -78,20 +78,20 @@ UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const U
   #if defined(_MSC_VER)
     #if defined(MY_CPU_ARM64)
     #if (_MSC_VER >= 1910)
-        #define USE_ARM64_CRC
+        // #define USE_ARM64_CRC
     #endif
     #endif
   #elif (defined(__clang__) && (__clang_major__ >= 3)) \
      || (defined(__GNUC__) && (__GNUC__ > 4))
       #if !defined(__ARM_FEATURE_CRC32)
-        #define __ARM_FEATURE_CRC32 1
+        // #define __ARM_FEATURE_CRC32 1
           #if (!defined(__clang__) || (__clang_major__ > 3)) // fix these numbers
-            #define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc")))
+            // #define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc")))
           #endif
       #endif
       #if defined(__ARM_FEATURE_CRC32)
-        #define USE_ARM64_CRC
-        #include <arm_acle.h>
+        // #define USE_ARM64_CRC
+        // #include <arm_acle.h>
       #endif
   #endif
 
diff --git "a/lzma2107\\C/CpuArch.c" "b/third_party\\lzma_sdk/CpuArch.c"
index fa9afe3970b3f..30451fba9b97b 100644
--- "a/lzma2107\\C/CpuArch.c"
+++ "b/third_party\\lzma_sdk/CpuArch.c"
@@ -417,7 +417,9 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYPTO_SUPPORT_VAL; }
 
 #include <sys/auxv.h>
 
+#if !defined(ARMV8_OS_FUCHSIA)
 #define USE_HWCAP
+#endif // !defined(ARMV8_OS_FUCHSIA)
 
 #ifdef USE_HWCAP
 
diff --git "a/lzma2107\\C/LzFind.c" "b/third_party\\lzma_sdk/LzFind.c"
index 1b73c28484ccf..36f7330911435 100644
--- "a/lzma2107\\C/LzFind.c"
+++ "b/third_party\\lzma_sdk/LzFind.c"
@@ -505,7 +505,7 @@ void MatchFinder_Init(CMatchFinder *p)
 }
 
 
-
+#if 0
 #ifdef MY_CPU_X86_OR_AMD64
   #if defined(__clang__) && (__clang_major__ >= 8) \
     || defined(__GNUC__) && (__GNUC__ >= 8) \
@@ -549,6 +549,7 @@ void MatchFinder_Init(CMatchFinder *p)
   #endif
 
 #endif
+#endif
 
 /*
 #ifndef ATTRIB_SSE41
diff --git "a/lzma2107\\C/Sha256.c" "b/third_party\\lzma_sdk/Sha256.c"
index 8b3983ea7323d..21996848c9156 100644
--- "a/lzma2107\\C/Sha256.c"
+++ "b/third_party\\lzma_sdk/Sha256.c"
@@ -32,7 +32,8 @@ This code is based on public domain code from Wei Dai's Crypto++ library. */
       #define _SHA_SUPPORTED
     #endif
   #endif
-#elif defined(MY_CPU_ARM_OR_ARM64)
+// TODO(crbug.com/1338627): Enable ARM optimizations
+#elif 0 // defined(MY_CPU_ARM_OR_ARM64)
   #ifdef _MSC_VER
     #if _MSC_VER >= 1910
       #define _SHA_SUPPORTED

diff --git a/lzma2107/Asm/arm64/7zAsm.S b/third_party/lzma_sdk/Asm/arm64/7zAsm.S
index 67d650d9a7c22..aa30a9ef8bf34 100644
--- a/lzma2107/Asm/arm64/7zAsm.S
+++ b/third_party/lzma_sdk/Asm/arm64/7zAsm.S
@@ -37,6 +37,19 @@
 #define  REG_ABI_PARAM_1 r1
 #define  REG_ABI_PARAM_2 r2
 
+// The .note.gnu.property section is required because Chromium Android builds
+// utilize the linker flag force-bti.
+.pushsection .note.gnu.property, "a"
+.balign 8
+.long 4
+.long 0x10
+.long 0x5
+.asciz "GNU"
+.long 0xc0000000
+.long 4
+.long ((1 << 0 ) | (1 << 1))
+.long 0
+.popsection
 
 .macro p2_add reg:req, param:req
         add     \reg, \reg, \param
diff --git a/lzma2107/Asm/x86/7zAsm.asm b/third_party/lzma_sdk/Asm/x86/7zAsm.asm
index 9ca25bccd28cf..df2d4cf5820da 100644
--- a/lzma2107/Asm/x86/7zAsm.asm
+++ b/third_party/lzma_sdk/Asm/x86/7zAsm.asm
@@ -47,7 +47,7 @@ MY_ASM_START macro
   else
     .386
     .model flat
-    _TEXT$00 SEGMENT PARA PUBLIC 'CODE'
+    SEVENZ SEGMENT PARA PUBLIC 'CODE'
   endif
 endm
 
diff --git a/lzma2107/Asm/x86/LzmaDecOpt.asm b/third_party/lzma_sdk/Asm/x86/LzmaDecOpt.asm
index 7e08acc639743..ddbd88ffc2e95 100644
--- a/lzma2107/Asm/x86/LzmaDecOpt.asm
+++ b/third_party/lzma_sdk/Asm/x86/LzmaDecOpt.asm
@@ -17,7 +17,7 @@ include 7zAsm.asm
 
 MY_ASM_START
 
-_TEXT$LZMADECOPT SEGMENT ALIGN(64) 'CODE'
+LZMADEC SEGMENT ALIGN(64) 'CODE'
 
 MY_ALIGN macro num:req
         align  num
@@ -1298,6 +1298,6 @@ fin:
 MY_POP_PRESERVED_ABI_REGS
 MY_ENDP
 
-_TEXT$LZMADECOPT ENDS
+LZMADEC ENDS
 
 end