From patchwork Thu Jan 31 22:27:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1034494 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-99656-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="fmtZHadq"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43rFGl2m6fz9sDX for ; Fri, 1 Feb 2019 09:27:26 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=hpppdMmly+r0MP6x/Pr0CwVB3ioYu 9ggTAGkVbET9uCiVwUcN66ttx5omHMDZcBqUDHlM/f6IxqqgyawCf370c1xfZF7S foX8s76JcityQaCa8NAjcHI3kgkYCWKBDYo11ppGj6UKOEm0YnUL/3Tj1gr5wc5c JV2IpZ+W8hIA4k= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; s=default; bh=uiziNwSwXWAtdGjZcv4qEerna1M=; b=fmt ZHadqrfztGZ8KslQTyobGBO5mMXhdCO8LHJhMjnzcdPBxUchoBm7ZKCE8OLHhDsO uGe1px4SoxD3lNS+aDq9JrLUt5tvdlk/zzUa3UUAqmIWfEwh437jaNJaKOo3BDhQ 78sxLVUxuqIkLrvpyv78UEuUIhIcMcC73ENNqT30= Received: (qmail 105281 invoked by alias); 31 Jan 2019 22:27:20 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 105272 invoked by uid 89); 31 Jan 2019 22:27:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] i386: Remove support for GCC versions before 5 from Date: Thu, 31 Jan 2019 23:27:14 +0100 Message-ID: <87ftt8bgzh.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Tested on i386. 2019-01-31 Florian Weimer i386: Remove support for GCC versions before 5 from . * sysdeps/unix/sysv/linux/i386/sysdep.h [!OPTIMIZE_FOR_GCC_5] (bpushl, bpopl, struct libc_do_syscall_args, INTERNAL_SYSCALL_MAIN_6) (INTERNAL_SYSCALL_MAIN_INLINE, INTERNAL_SYSCALL_NCS) (check_consistency): Remove. * elf/dl-load.c (_dl_map_object_from_fd): Remove call to check_consistency. * sysdeps/unix/sysv/linux/dl-execstack.c (_dl_make_stack_executable): Likewise. diff --git a/elf/dl-load.c b/elf/dl-load.c index f972524421..80c23446ba 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1281,10 +1281,6 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, #endif __stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC; -#ifdef check_consistency - check_consistency (); -#endif - errval = (*GL(dl_make_stack_executable_hook)) (stack_endp); if (errval) { diff --git a/sysdeps/unix/sysv/linux/dl-execstack.c b/sysdeps/unix/sysv/linux/dl-execstack.c index ac1aa72f3b..28f3bd90e0 100644 --- a/sysdeps/unix/sysv/linux/dl-execstack.c +++ b/sysdeps/unix/sysv/linux/dl-execstack.c @@ -50,10 +50,6 @@ _dl_make_stack_executable (void **stack_endp) GL(dl_stack_flags) |= PF_X; out: -#ifdef check_consistency - check_consistency (); -#endif - return result; } rtld_hidden_def (_dl_make_stack_executable) diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 0be10744ff..7bfb42dbbb 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -241,48 +241,6 @@ extern int __syscall_error (int) attribute_hidden __attribute__ ((__regparm__ (1))); -#ifndef OPTIMIZE_FOR_GCC_5 -/* We need some help from the assembler to generate optimal code. We - define some macros here which later will be used. */ -asm (".L__X'%ebx = 1\n\t" - ".L__X'%ecx = 2\n\t" - ".L__X'%edx = 2\n\t" - ".L__X'%eax = 3\n\t" - ".L__X'%esi = 3\n\t" - ".L__X'%edi = 3\n\t" - ".L__X'%ebp = 3\n\t" - ".L__X'%esp = 3\n\t" - ".macro bpushl name reg\n\t" - ".if 1 - \\name\n\t" - ".if 2 - \\name\n\t" - "error\n\t" - ".else\n\t" - "xchgl \\reg, %ebx\n\t" - ".endif\n\t" - ".endif\n\t" - ".endm\n\t" - ".macro bpopl name reg\n\t" - ".if 1 - \\name\n\t" - ".if 2 - \\name\n\t" - "error\n\t" - ".else\n\t" - "xchgl \\reg, %ebx\n\t" - ".endif\n\t" - ".endif\n\t" - ".endm\n\t"); - -/* Six-argument syscalls use an out-of-line helper, because an inline - asm using all registers apart from %esp cannot work reliably and - the assembler does not support describing an asm that saves and - restores %ebp itself as a separate stack frame. This structure - stores the arguments not passed in registers; %edi is passed with a - pointer to this structure. */ -struct libc_do_syscall_args -{ - int ebx, edi, ebp; -}; -#endif - /* Define a macro which expands inline into the wrapper code for a system call. */ #undef INLINE_SYSCALL @@ -336,43 +294,23 @@ struct libc_do_syscall_args INTERNAL_SYSCALL_MAIN_INLINE(name, err, 4, args) #define INTERNAL_SYSCALL_MAIN_5(name, err, args...) \ INTERNAL_SYSCALL_MAIN_INLINE(name, err, 5, args) -/* Each object using 6-argument inline syscalls must include a - definition of __libc_do_syscall. */ -#ifdef OPTIMIZE_FOR_GCC_5 -# define INTERNAL_SYSCALL_MAIN_6(name, err, args...) \ +#define INTERNAL_SYSCALL_MAIN_6(name, err, args...) \ INTERNAL_SYSCALL_MAIN_INLINE(name, err, 6, args) -#else /* GCC 5 */ -# define INTERNAL_SYSCALL_MAIN_6(name, err, arg1, arg2, arg3, \ - arg4, arg5, arg6) \ - struct libc_do_syscall_args _xv = \ - { \ - (int) (arg1), \ - (int) (arg5), \ - (int) (arg6) \ - }; \ - asm volatile ( \ - "movl %1, %%eax\n\t" \ - "call __libc_do_syscall" \ - : "=a" (resultvar) \ - : "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \ - : "memory", "cc") -#endif /* GCC 5 */ #define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ \ register unsigned int resultvar; \ INTERNAL_SYSCALL_MAIN_##nr (name, err, args); \ (int) resultvar; }) #if I386_USE_SYSENTER -# ifdef OPTIMIZE_FOR_GCC_5 -# ifdef PIC -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# ifdef PIC +# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ LOADREGS_##nr(args) \ asm volatile ( \ "call *%%gs:%P2" \ : "=a" (resultvar) \ : "a" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \ ASMARGS_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({ \ register unsigned int resultvar; \ LOADREGS_##nr(args) \ @@ -382,14 +320,14 @@ struct libc_do_syscall_args : "a" (name), "i" (offsetof (tcbhead_t, sysinfo)) \ ASMARGS_##nr(args) : "memory", "cc"); \ (int) resultvar; }) -# else -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# else +# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ LOADREGS_##nr(args) \ asm volatile ( \ "call *_dl_sysinfo" \ : "=a" (resultvar) \ : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({ \ register unsigned int resultvar; \ LOADREGS_##nr(args) \ @@ -398,63 +336,15 @@ struct libc_do_syscall_args : "=a" (resultvar) \ : "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \ (int) resultvar; }) -# endif -# else /* GCC 5 */ -# ifdef PIC -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ - EXTRAVAR_##nr \ - asm volatile ( \ - LOADARGS_##nr \ - "movl %1, %%eax\n\t" \ - "call *%%gs:%P2\n\t" \ - RESTOREARGS_##nr \ - : "=a" (resultvar) \ - : "i" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \ - ASMFMT_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register unsigned int resultvar; \ - EXTRAVAR_##nr \ - asm volatile ( \ - LOADARGS_##nr \ - "call *%%gs:%P2\n\t" \ - RESTOREARGS_##nr \ - : "=a" (resultvar) \ - : "0" (name), "i" (offsetof (tcbhead_t, sysinfo)) \ - ASMFMT_##nr(args) : "memory", "cc"); \ - (int) resultvar; }) -# else -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ - EXTRAVAR_##nr \ - asm volatile ( \ - LOADARGS_##nr \ - "movl %1, %%eax\n\t" \ - "call *_dl_sysinfo\n\t" \ - RESTOREARGS_##nr \ - : "=a" (resultvar) \ - : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register unsigned int resultvar; \ - EXTRAVAR_##nr \ - asm volatile ( \ - LOADARGS_##nr \ - "call *_dl_sysinfo\n\t" \ - RESTOREARGS_##nr \ - : "=a" (resultvar) \ - : "0" (name) ASMFMT_##nr(args) : "memory", "cc"); \ - (int) resultvar; }) -# endif -# endif /* GCC 5 */ +# endif #else -# ifdef OPTIMIZE_FOR_GCC_5 -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ LOADREGS_##nr(args) \ asm volatile ( \ "int $0x80" \ : "=a" (resultvar) \ : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({ \ register unsigned int resultvar; \ LOADREGS_##nr(args) \ @@ -463,28 +353,6 @@ struct libc_do_syscall_args : "=a" (resultvar) \ : "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \ (int) resultvar; }) -# else /* GCC 5 */ -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ - EXTRAVAR_##nr \ - asm volatile ( \ - LOADARGS_##nr \ - "movl %1, %%eax\n\t" \ - "int $0x80\n\t" \ - RESTOREARGS_##nr \ - : "=a" (resultvar) \ - : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register unsigned int resultvar; \ - EXTRAVAR_##nr \ - asm volatile ( \ - LOADARGS_##nr \ - "int $0x80\n\t" \ - RESTOREARGS_##nr \ - : "=a" (resultvar) \ - : "0" (name) ASMFMT_##nr(args) : "memory", "cc"); \ - (int) resultvar; }) -# endif /* GCC 5 */ #endif #undef INTERNAL_SYSCALL_DECL @@ -549,35 +417,33 @@ struct libc_do_syscall_args # define RESTOREARGS_5 #endif -#ifdef OPTIMIZE_FOR_GCC_5 -# define LOADREGS_0() -# define ASMARGS_0() -# define LOADREGS_1(arg1) \ +#define LOADREGS_0() +#define ASMARGS_0() +#define LOADREGS_1(arg1) \ LOADREGS_0 () -# define ASMARGS_1(arg1) \ +#define ASMARGS_1(arg1) \ ASMARGS_0 (), "b" ((unsigned int) (arg1)) -# define LOADREGS_2(arg1, arg2) \ +#define LOADREGS_2(arg1, arg2) \ LOADREGS_1 (arg1) -# define ASMARGS_2(arg1, arg2) \ +#define ASMARGS_2(arg1, arg2) \ ASMARGS_1 (arg1), "c" ((unsigned int) (arg2)) -# define LOADREGS_3(arg1, arg2, arg3) \ +#define LOADREGS_3(arg1, arg2, arg3) \ LOADREGS_2 (arg1, arg2) -# define ASMARGS_3(arg1, arg2, arg3) \ +#define ASMARGS_3(arg1, arg2, arg3) \ ASMARGS_2 (arg1, arg2), "d" ((unsigned int) (arg3)) -# define LOADREGS_4(arg1, arg2, arg3, arg4) \ +#define LOADREGS_4(arg1, arg2, arg3, arg4) \ LOADREGS_3 (arg1, arg2, arg3) -# define ASMARGS_4(arg1, arg2, arg3, arg4) \ +#define ASMARGS_4(arg1, arg2, arg3, arg4) \ ASMARGS_3 (arg1, arg2, arg3), "S" ((unsigned int) (arg4)) -# define LOADREGS_5(arg1, arg2, arg3, arg4, arg5) \ +#define LOADREGS_5(arg1, arg2, arg3, arg4, arg5) \ LOADREGS_4 (arg1, arg2, arg3, arg4) -# define ASMARGS_5(arg1, arg2, arg3, arg4, arg5) \ +#define ASMARGS_5(arg1, arg2, arg3, arg4, arg5) \ ASMARGS_4 (arg1, arg2, arg3, arg4), "D" ((unsigned int) (arg5)) -# define LOADREGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ +#define LOADREGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ register unsigned int _a6 asm ("ebp") = (unsigned int) (arg6); \ LOADREGS_5 (arg1, arg2, arg3, arg4, arg5) -# define ASMARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ +#define ASMARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ ASMARGS_5 (arg1, arg2, arg3, arg4, arg5), "r" (_a6) -#endif /* GCC 5 */ #define ASMFMT_0() #ifdef __PIC__ @@ -615,20 +481,6 @@ struct libc_do_syscall_args # define EXTRAVAR_5 #endif -/* Consistency check for position-independent code. */ -#if defined __PIC__ && !defined OPTIMIZE_FOR_GCC_5 -# define check_consistency() \ - ({ int __res; \ - __asm__ __volatile__ \ - (LOAD_PIC_REG_STR (cx) ";" \ - "subl %%ebx, %%ecx;" \ - "je 1f;" \ - "ud2;" \ - "1:\n" \ - : "=c" (__res)); \ - __res; }) -#endif - #endif /* __ASSEMBLER__ */