]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
liblzma: Enable Intel CET in x86 CRC assembly codes
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 23 Dec 2020 14:49:04 +0000 (06:49 -0800)
committerLasse Collin <lasse.collin@tukaani.org>
Wed, 23 Dec 2020 15:13:33 +0000 (17:13 +0200)
When Intel CET is enabled, we need to include <cet.h> in assembly codes
to mark Intel CET support and add _CET_ENDBR to indirect jump targets.

Tested on Intel Tiger Lake under CET enabled Linux.

src/liblzma/check/crc32_x86.S
src/liblzma/check/crc64_x86.S

index 632c7b379d08ead299d73afea0360016343f64d1..7814beca90f9be6398e7c12350925743ab46bc06 100644 (file)
@@ -51,6 +51,14 @@ init_table(void)
  * extern uint32_t lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc);
  */
 
+/* When Intel CET is enabled, include <cet.h> in assembly code to mark
+   Intel CET support.  */
+#ifdef __CET__
+# include <cet.h>
+#else
+# define _CET_ENDBR
+#endif
+
 /*
  * On some systems, the functions need to be prefixed. The prefix is
  * usually an underscore.
@@ -83,6 +91,7 @@ init_table(void)
 
        ALIGN(4, 16)
 LZMA_CRC32:
+       _CET_ENDBR
        /*
         * Register usage:
         * %eax crc
index f5bb84b97e0a2b2af75ea7ce0b7ab78cf83ddd94..7ee08f64f3b5d712f1d11de7d86b4e9cb2b245c8 100644 (file)
@@ -41,6 +41,14 @@ init_table(void)
  * extern uint64_t lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc);
  */
 
+/* When Intel CET is enabled, include <cet.h> in assembly code to mark
+   Intel CET support.  */
+#ifdef __CET__
+# include <cet.h>
+#else
+# define _CET_ENDBR
+#endif
+
 /*
  * On some systems, the functions need to be prefixed. The prefix is
  * usually an underscore.
@@ -73,6 +81,7 @@ init_table(void)
 
        ALIGN(4, 16)
 LZMA_CRC64:
+       _CET_ENDBR
        /*
         * Register usage:
         * %eax crc LSB