i386: Use ENTRY/END in assembly codes

Use ENTRY and END in assembly codes so that ENDBR32 will be added at
function entries when CET is enabled.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
H.J. Lu 2020-02-01 05:44:55 -08:00
parent 825b58f3fb
commit 0455f251f4
3 changed files with 10 additions and 15 deletions

View File

@ -15,12 +15,10 @@
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
#include <sysdep.h>
#include <lowlevellock.h> #include <lowlevellock.h>
.globl pthread_spin_lock ENTRY (pthread_spin_lock)
.type pthread_spin_lock,@function
.align 16
pthread_spin_lock:
mov 4(%esp), %eax mov 4(%esp), %eax
1: LOCK 1: LOCK
decl 0(%eax) decl 0(%eax)
@ -34,4 +32,4 @@ pthread_spin_lock:
cmpl $0, 0(%eax) cmpl $0, 0(%eax)
jg 1b jg 1b
jmp 2b jmp 2b
.size pthread_spin_lock,.-pthread_spin_lock END (pthread_spin_lock)

View File

@ -16,15 +16,14 @@
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
.globl pthread_spin_unlock #include <sysdep.h>
.type pthread_spin_unlock,@function
.align 16 ENTRY (pthread_spin_unlock)
pthread_spin_unlock:
movl 4(%esp), %eax movl 4(%esp), %eax
movl $1, (%eax) movl $1, (%eax)
xorl %eax, %eax xorl %eax, %eax
ret ret
.size pthread_spin_unlock,.-pthread_spin_unlock END (pthread_spin_unlock)
/* The implementation of pthread_spin_init is identical. */ /* The implementation of pthread_spin_init is identical. */
.globl pthread_spin_init .globl pthread_spin_init

View File

@ -16,6 +16,7 @@
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
#include <sysdep.h>
#include <pthread-errnos.h> #include <pthread-errnos.h>
@ -25,10 +26,7 @@
# define LOCK lock # define LOCK lock
#endif #endif
.globl pthread_spin_trylock ENTRY (pthread_spin_trylock)
.type pthread_spin_trylock,@function
.align 16
pthread_spin_trylock:
movl 4(%esp), %edx movl 4(%esp), %edx
movl $1, %eax movl $1, %eax
xorl %ecx, %ecx xorl %ecx, %ecx
@ -43,4 +41,4 @@ pthread_spin_trylock:
0: 0:
#endif #endif
ret ret
.size pthread_spin_trylock,.-pthread_spin_trylock END (pthread_spin_trylock)