From patchwork Wed Oct 21 17:20:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 9298 Received: (qmail 83073 invoked by alias); 21 Oct 2015 17:20:05 -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 83055 invoked by uid 89); 21 Oct 2015 17:20:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f178.google.com MIME-Version: 1.0 X-Received: by 10.182.22.229 with SMTP id h5mr7474658obf.26.1445448001123; Wed, 21 Oct 2015 10:20:01 -0700 (PDT) In-Reply-To: References: <20151012232028.GC8797@intel.com> Date: Wed, 21 Oct 2015 10:20:01 -0700 Message-ID: Subject: Re: [PATCH 5/6] Optimize i386 syscall inlining From: "H.J. Lu" To: Joseph Myers Cc: Andreas Schwab , GNU C Library On Wed, Oct 21, 2015 at 9:39 AM, Joseph Myers wrote: > On Wed, 21 Oct 2015, H.J. Lu wrote: > >> On Wed, Oct 21, 2015 at 8:01 AM, Andreas Schwab wrote: >> > "H.J. Lu" writes: >> > >> >> Which GCC are you using? >> > >> > https://build.opensuse.org/package/show/openSUSE:Factory/gcc5 >> > >> > Andreas. >> >> I am testing this patch and will check it in if it passes check. > > Do you also need to change libc-do-syscall.S to build __libc_do_syscall > for the profiling libc? > Yes. I checked in this patch to provide __libc_do_syscall for profiling libc. From 95b097779a670dca5f06fbceede31de60046ed76 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 21 Oct 2015 09:54:36 -0700 Subject: [PATCH] Build i386 __libc_do_syscall when PROF is defined Need to provide i386 __libc_do_syscall when PROF is defined. Define OPTIMIZE_FOR_GCC_5 for .S files so that it can be used in libc-do-syscall.S. * sysdeps/unix/sysv/linux/i386/libc-do-syscall.S: Replace __GNUC_PREREQ (5,0) with OPTIMIZE_FOR_GCC_5. * sysdeps/unix/sysv/linux/i386/sysdep.h (OPTIMIZE_FOR_GCC_5): Moved before "#ifdef __ASSEMBLER__". --- ChangeLog | 7 +++++++ sysdeps/unix/sysv/linux/i386/libc-do-syscall.S | 2 +- sysdeps/unix/sysv/linux/i386/sysdep.h | 19 +++++++++---------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc95bda..1300047 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-10-21 H.J. Lu + + * sysdeps/unix/sysv/linux/i386/libc-do-syscall.S: Replace + __GNUC_PREREQ (5,0) with OPTIMIZE_FOR_GCC_5. + * sysdeps/unix/sysv/linux/i386/sysdep.h (OPTIMIZE_FOR_GCC_5): + Moved before "#ifdef __ASSEMBLER__". + 2015-10-21 Joseph Myers [BZ #19156] diff --git a/sysdeps/unix/sysv/linux/i386/libc-do-syscall.S b/sysdeps/unix/sysv/linux/i386/libc-do-syscall.S index cdef3d5..f748cf2 100644 --- a/sysdeps/unix/sysv/linux/i386/libc-do-syscall.S +++ b/sysdeps/unix/sysv/linux/i386/libc-do-syscall.S @@ -18,7 +18,7 @@ #include -#if !__GNUC_PREREQ (5,0) +#ifndef OPTIMIZE_FOR_GCC_5 /* %eax, %ecx, %edx and %esi contain the values expected by the kernel. %edi points to a structure with the values of %ebx, %edi and %ebp. */ diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 5830544..dbe5654 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -41,6 +41,15 @@ # undef I386_USE_SYSENTER #endif +/* Since GCC 5 and above can properly spill %ebx with PIC when needed, + we can inline syscalls with 6 arguments if GCC 5 or above is used + to compile glibc. Disable GCC 5 optimization when compiling for + profiling since asm ("ebp") can't be used to put the 6th argument + in %ebp for syscall. */ +#if __GNUC_PREREQ (5,0) && !defined PROF +# define OPTIMIZE_FOR_GCC_5 +#endif + #ifdef __ASSEMBLER__ /* Linux uses a negative return value to indicate syscall errors, @@ -227,16 +236,6 @@ extern int __syscall_error (int) attribute_hidden __attribute__ ((__regparm__ (1))); -/* Since GCC 5 and above can properly spill %ebx with PIC when needed, - we can inline syscalls with 6 arguments if GCC 5 or above is used - to compile glibc. Disable GCC 5 optimization when compiling for - profiling since asm ("ebp") can't be used to put the 6th argument - in %ebp for syscall. */ - -#if __GNUC_PREREQ (5,0) && !defined PROF -# define OPTIMIZE_FOR_GCC_5 -#endif - #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. */ -- 2.4.3