i386: Update I386_USE_SYSENTER for early PIC syscall
Define I386_USE_SYSENTER to 0 or 1 so that special versions of syscalls with "int $0x80" can be provided for static PIE during self relocation. Also check PIC instead SHARED for PIC version of syscall macros. * sysdeps/unix/sysv/linux/i386/sysdep.h (I386_USE_SYSENTER): Define to I386_USE_SYSENTER to 0 or 1 if not defined. (ENTER_KERNEL): Check if I386_USE_SYSENTER is 1 and check PIC. (INTERNAL_SYSCALL_MAIN_INLINE): Likewise. (INTERNAL_SYSCALL_NCS): Likewise. (LOADARGS_1): Likewise. (LOADARGS_5): Likewise. (RESTOREARGS_1): Likewise. (RESTOREARGS_5): Likewise.
This commit is contained in:
parent
fc11ff8d0a
commit
627c69c838
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2017-08-04 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/i386/sysdep.h (I386_USE_SYSENTER):
|
||||||
|
Define to I386_USE_SYSENTER to 0 or 1 if not defined.
|
||||||
|
(ENTER_KERNEL): Check if I386_USE_SYSENTER is 1 and check PIC.
|
||||||
|
(INTERNAL_SYSCALL_MAIN_INLINE): Likewise.
|
||||||
|
(INTERNAL_SYSCALL_NCS): Likewise.
|
||||||
|
(LOADARGS_1): Likewise.
|
||||||
|
(LOADARGS_5): Likewise.
|
||||||
|
(RESTOREARGS_1): Likewise.
|
||||||
|
(RESTOREARGS_5): Likewise.
|
||||||
|
|
||||||
2017-08-04 H.J. Lu <hongjiu.lu@intel.com>
|
2017-08-04 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* sysdeps/x86_64/memmove.S (MEMCPY_SYMBOL): Don't check SHARED.
|
* sysdeps/x86_64/memmove.S (MEMCPY_SYMBOL): Don't check SHARED.
|
||||||
|
@ -34,11 +34,13 @@
|
|||||||
#undef SYS_ify
|
#undef SYS_ify
|
||||||
#define SYS_ify(syscall_name) __NR_##syscall_name
|
#define SYS_ify(syscall_name) __NR_##syscall_name
|
||||||
|
|
||||||
#if defined USE_DL_SYSINFO \
|
#ifndef I386_USE_SYSENTER
|
||||||
&& (IS_IN (libc) || IS_IN (libpthread))
|
# if defined USE_DL_SYSINFO \
|
||||||
# define I386_USE_SYSENTER 1
|
&& (IS_IN (libc) || IS_IN (libpthread))
|
||||||
#else
|
# define I386_USE_SYSENTER 1
|
||||||
# undef I386_USE_SYSENTER
|
# else
|
||||||
|
# define I386_USE_SYSENTER 0
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Since GCC 5 and above can properly spill %ebx with PIC when needed,
|
/* Since GCC 5 and above can properly spill %ebx with PIC when needed,
|
||||||
@ -110,8 +112,8 @@
|
|||||||
|
|
||||||
/* The original calling convention for system calls on Linux/i386 is
|
/* The original calling convention for system calls on Linux/i386 is
|
||||||
to use int $0x80. */
|
to use int $0x80. */
|
||||||
#ifdef I386_USE_SYSENTER
|
#if I386_USE_SYSENTER
|
||||||
# ifdef SHARED
|
# ifdef PIC
|
||||||
# define ENTER_KERNEL call *%gs:SYSINFO_OFFSET
|
# define ENTER_KERNEL call *%gs:SYSINFO_OFFSET
|
||||||
# else
|
# else
|
||||||
# define ENTER_KERNEL call *_dl_sysinfo
|
# define ENTER_KERNEL call *_dl_sysinfo
|
||||||
@ -357,9 +359,9 @@ struct libc_do_syscall_args
|
|||||||
register unsigned int resultvar; \
|
register unsigned int resultvar; \
|
||||||
INTERNAL_SYSCALL_MAIN_##nr (name, err, args); \
|
INTERNAL_SYSCALL_MAIN_##nr (name, err, args); \
|
||||||
(int) resultvar; })
|
(int) resultvar; })
|
||||||
#ifdef I386_USE_SYSENTER
|
#if I386_USE_SYSENTER
|
||||||
# ifdef OPTIMIZE_FOR_GCC_5
|
# ifdef OPTIMIZE_FOR_GCC_5
|
||||||
# ifdef SHARED
|
# ifdef PIC
|
||||||
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
|
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
|
||||||
LOADREGS_##nr(args) \
|
LOADREGS_##nr(args) \
|
||||||
asm volatile ( \
|
asm volatile ( \
|
||||||
@ -395,7 +397,7 @@ struct libc_do_syscall_args
|
|||||||
(int) resultvar; })
|
(int) resultvar; })
|
||||||
# endif
|
# endif
|
||||||
# else /* GCC 5 */
|
# else /* GCC 5 */
|
||||||
# ifdef SHARED
|
# ifdef PIC
|
||||||
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
|
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
|
||||||
EXTRAVAR_##nr \
|
EXTRAVAR_##nr \
|
||||||
asm volatile ( \
|
asm volatile ( \
|
||||||
@ -494,7 +496,7 @@ struct libc_do_syscall_args
|
|||||||
|
|
||||||
#define LOADARGS_0
|
#define LOADARGS_0
|
||||||
#ifdef __PIC__
|
#ifdef __PIC__
|
||||||
# if defined I386_USE_SYSENTER && defined SHARED
|
# if I386_USE_SYSENTER && defined PIC
|
||||||
# define LOADARGS_1 \
|
# define LOADARGS_1 \
|
||||||
"bpushl .L__X'%k3, %k3\n\t"
|
"bpushl .L__X'%k3, %k3\n\t"
|
||||||
# define LOADARGS_5 \
|
# define LOADARGS_5 \
|
||||||
@ -521,7 +523,7 @@ struct libc_do_syscall_args
|
|||||||
|
|
||||||
#define RESTOREARGS_0
|
#define RESTOREARGS_0
|
||||||
#ifdef __PIC__
|
#ifdef __PIC__
|
||||||
# if defined I386_USE_SYSENTER && defined SHARED
|
# if I386_USE_SYSENTER && defined PIC
|
||||||
# define RESTOREARGS_1 \
|
# define RESTOREARGS_1 \
|
||||||
"bpopl .L__X'%k3, %k3\n\t"
|
"bpopl .L__X'%k3, %k3\n\t"
|
||||||
# define RESTOREARGS_5 \
|
# define RESTOREARGS_5 \
|
||||||
|
Loading…
Reference in New Issue
Block a user