diff options
author | hjl-tools <hjl.tools@gmail.com> | 2022-05-15 18:43:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-15 21:43:56 -0400 |
commit | 3ac265d5c0e038e324bae29131dbc4bacb4935ea (patch) | |
tree | 7e707a85cc3edcde36a3c592914d4da50803bf1f /src | |
parent | e67697c370e8875f28b2bf62fac25edad7558eca (diff) | |
download | libffi-3ac265d5c0e038e324bae29131dbc4bacb4935ea.tar.gz |
x86-64: Always double jump table slot size for CET (#710) (#711)
When CET is enabled, double jump table slot size to add 4 bytes of ENDBR64
for CET. Since CET enabled clang doesn't have the LLVM assembler bug:
https://bugs.llvm.org/show_bug.cgi?id=21501
fixed by
commit 04d39260d64e08b8bfb3844109ad43d4055b2e8d
Author: Rafael Espindola <rafael.espindola@gmail.com>
Date: Wed Nov 4 23:50:29 2015 +0000
Simplify .org processing and make it a bit more powerful.
we can use .org to allocate jump table slot size to 16 bytes.
Diffstat (limited to 'src')
-rw-r--r-- | src/x86/unix64.S | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/x86/unix64.S b/src/x86/unix64.S index 8cf3a23..d9c5bd4 100644 --- a/src/x86/unix64.S +++ b/src/x86/unix64.S @@ -39,14 +39,13 @@ actual table. The entry points into the table are all 8 bytes. The use of ORG asserts that we're at the correct location. */ /* ??? The clang assembler doesn't handle .org with symbolic expressions. */ -#if defined(__clang__) || defined(__APPLE__) || (defined (__sun__) && defined(__svr4__)) +#ifdef __CET__ +/* Double slot size to 16 byte to add 4 bytes of ENDBR64. */ +# define E(BASE, X) .balign 8; .org BASE + X * 16 +#elif defined(__clang__) || defined(__APPLE__) || (defined (__sun__) && defined(__svr4__)) # define E(BASE, X) .balign 8 #else -# ifdef __CET__ -# define E(BASE, X) .balign 8; .org BASE + X * 16 -# else -# define E(BASE, X) .balign 8; .org BASE + X * 8 -# endif +# define E(BASE, X) .balign 8; .org BASE + X * 8 #endif /* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, |