aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/check/crc32_x86.S
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-12-23 06:49:04 -0800
committerLasse Collin <lasse.collin@tukaani.org>2022-07-12 18:30:56 +0300
commitc01e29a933baba737217a3549eaaced7e499edf5 (patch)
treee878a5fd449ae72bd12447c5f0741607a5187936 /src/liblzma/check/crc32_x86.S
parentUpdate THANKS. (diff)
downloadxz-c01e29a933baba737217a3549eaaced7e499edf5.tar.xz
liblzma: Enable Intel CET in x86 CRC assembly codes
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.
Diffstat (limited to 'src/liblzma/check/crc32_x86.S')
-rw-r--r--src/liblzma/check/crc32_x86.S9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/liblzma/check/crc32_x86.S b/src/liblzma/check/crc32_x86.S
index 632c7b37..7814beca 100644
--- a/src/liblzma/check/crc32_x86.S
+++ b/src/liblzma/check/crc32_x86.S
@@ -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