From patchwork Sun Jan 24 00:18:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Pluzhnikov X-Patchwork-Id: 10536 Received: (qmail 62915 invoked by alias); 24 Jan 2016 00:18:40 -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 62905 invoked by uid 89); 24 Jan 2016 00:18:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS, UNWANTED_LANGUAGE_BODY autolearn=no version=3.3.2 spammy=404, 5216, lifting, 3010 X-HELO: mail-wm0-f51.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=TsWVo67FLvYppH1SxtEzp/WpH7yhCQA8gDjZTCRdDqY=; b=DLUX2397B4eq4Zu9dBQ6aiGRQoX4r30x7Y033VMj7xMKeTp07xoHTUQLaXsWeEVddn tb1IrHpxy3QUhtSDoSg1dFyvNsKPGCL3jb0FH+XEXNHVXydWeNVyT3wR5PPHcv/UuY77 l0cQLrqGgczYW3W5jIM3s3ZOZTExYsXWCZliUUSeqSnfCNOFN0nITdF9YhNnz4CvxWK5 U2kCDomjcu3jUv2LaXan/XJ/7CyPO+l11Fcdqr3XDR6R+GNSEytWnIMDUmGAirpQeNpz 0GbX74sJlqexqn+uM4HKAAYEeZRT2/ygVn5PLBY+xUk0kHNiS2gLX2zqm1NqjCXnI9zs Yw5w== X-Gm-Message-State: AG10YOSbjdu5ZGz/tkwuIf7F/kKQcErIhe1AX91ACArAI+n96yXwfBS/2EmznFDlPLY3BWgTMrV0vgdX4UzDRBHp X-Received: by 10.28.54.159 with SMTP id y31mr11192889wmh.87.1453594715375; Sat, 23 Jan 2016 16:18:35 -0800 (PST) MIME-Version: 1.0 From: Paul Pluzhnikov Date: Sat, 23 Jan 2016 16:18:05 -0800 Message-ID: Subject: [PATCH][BZ #19490] Add unwind descriptors to pthread_spin_init, etc. on i386 To: GLIBC Devel Greetings, This is similar to https://www.sourceware.org/ml/libc-alpha/2016-01/msg00605.html https://www.sourceware.org/ml/libc-alpha/2016-01/msg00456.html but for i386. Tested on Linux/i686. Assuming this is OK, should I wait for lifting of the freeze? 2016-01-23 Paul Pluzhnikov [BZ #19490] * sysdeps/i386/i386-mcount.S (_mcount): Add unwind descriptor (__fentry__): Likewise * sysdeps/unix/sysv/linux/i386/_exit.S (_exit): Use ENTRY/END * sysdeps/i386/nptl/pthread_spin_lock.S (pthread_spin_lock): Likewise * sysdeps/i386/pthread_spin_trylock.S (pthread_spin_trylock): Likewise * sysdeps/i386/nptl/pthread_spin_unlock.S (pthread_spin_unlock): Likewise diff --git a/sysdeps/i386/i386-mcount.S b/sysdeps/i386/i386-mcount.S index 94fb95e..f92f3ff 100644 --- a/sysdeps/i386/i386-mcount.S +++ b/sysdeps/i386/i386-mcount.S @@ -30,10 +30,17 @@ .type C_SYMBOL_NAME(_mcount), @function .align ALIGNARG(4) C_LABEL(_mcount) + cfi_startproc /* Save the caller-clobbered registers. */ pushl %eax + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %edx + cfi_adjust_cfa_offset (4) + cfi_rel_offset (eax, 8) + cfi_rel_offset (ecx, 4) + cfi_rel_offset (edx, 0) movl 12(%esp), %edx movl 4(%ebp), %eax @@ -45,9 +52,16 @@ C_LABEL(_mcount) /* Pop the saved registers. Please note that `mcount' has no return value. */ popl %edx + cfi_adjust_cfa_offset (-4) + cfi_restore (edx) popl %ecx + cfi_adjust_cfa_offset (-4) + cfi_restore (ecx) popl %eax + cfi_adjust_cfa_offset (-4) + cfi_restore (eax) ret + cfi_endproc ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount)) #undef mcount @@ -58,10 +72,17 @@ weak_alias (_mcount, mcount) .type C_SYMBOL_NAME(__fentry__), @function .align ALIGNARG(4) C_LABEL(__fentry__) + cfi_startproc /* Save the caller-clobbered registers. */ pushl %eax + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %edx + cfi_adjust_cfa_offset (4) + cfi_rel_offset (eax, 8) + cfi_rel_offset (ecx, 4) + cfi_rel_offset (edx, 0) movl 12(%esp), %edx movl 16(%esp), %eax @@ -73,7 +94,14 @@ C_LABEL(__fentry__) /* Pop the saved registers. Please note that `__fentry__' has no return value. */ popl %edx + cfi_adjust_cfa_offset (-4) + cfi_restore (edx) popl %ecx + cfi_adjust_cfa_offset (-4) + cfi_restore (ecx) popl %eax + cfi_adjust_cfa_offset (-4) + cfi_restore (eax) ret + cfi_endproc ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(__fentry__)) diff --git a/sysdeps/i386/nptl/pthread_spin_lock.S b/sysdeps/i386/nptl/pthread_spin_lock.S index e311d95..ea552da 100644 --- a/sysdeps/i386/nptl/pthread_spin_lock.S +++ b/sysdeps/i386/nptl/pthread_spin_lock.S @@ -16,11 +16,9 @@ . */ #include +#include - .globl pthread_spin_lock - .type pthread_spin_lock,@function - .align 16 -pthread_spin_lock: +ENTRY(pthread_spin_lock) mov 4(%esp), %eax 1: LOCK decl 0(%eax) @@ -34,4 +32,4 @@ pthread_spin_lock: cmpl $0, 0(%eax) jg 1b jmp 2b - .size pthread_spin_lock,.-pthread_spin_lock +END(pthread_spin_lock) diff --git a/sysdeps/i386/nptl/pthread_spin_unlock.S b/sysdeps/i386/nptl/pthread_spin_unlock.S index a552cf9..ef75a50 100644 --- a/sysdeps/i386/nptl/pthread_spin_unlock.S +++ b/sysdeps/i386/nptl/pthread_spin_unlock.S @@ -16,15 +16,14 @@ License along with the GNU C Library; if not, see . */ - .globl pthread_spin_unlock - .type pthread_spin_unlock,@function - .align 16 -pthread_spin_unlock: +#include + +ENTRY(pthread_spin_unlock) movl 4(%esp), %eax movl $1, (%eax) xorl %eax, %eax ret - .size pthread_spin_unlock,.-pthread_spin_unlock +END(pthread_spin_unlock) /* The implementation of pthread_spin_init is identical. */ .globl pthread_spin_init diff --git a/sysdeps/i386/pthread_spin_trylock.S b/sysdeps/i386/pthread_spin_trylock.S index 36979bd..7d3dabb 100644 --- a/sysdeps/i386/pthread_spin_trylock.S +++ b/sysdeps/i386/pthread_spin_trylock.S @@ -17,7 +17,7 @@ . */ #include - +#include #ifdef UP # define LOCK @@ -25,10 +25,7 @@ # define LOCK lock #endif - .globl pthread_spin_trylock - .type pthread_spin_trylock,@function - .align 16 -pthread_spin_trylock: +ENTRY(pthread_spin_trylock) movl 4(%esp), %edx movl $1, %eax xorl %ecx, %ecx @@ -43,4 +40,4 @@ pthread_spin_trylock: 0: #endif ret - .size pthread_spin_trylock,.-pthread_spin_trylock +END(pthread_spin_trylock) diff --git a/sysdeps/unix/sysv/linux/i386/_exit.S b/sysdeps/unix/sysv/linux/i386/_exit.S index e1550e6..6193ff2 100644 --- a/sysdeps/unix/sysv/linux/i386/_exit.S +++ b/sysdeps/unix/sysv/linux/i386/_exit.S @@ -17,10 +17,7 @@ #include - .text - .type _exit,@function - .global _exit -_exit: +ENTRY(_exit) movl 4(%esp), %ebx /* Try the new syscall first. */ @@ -37,7 +34,7 @@ _exit: /* This must not fail. Be sure we don't return. */ hlt - .size _exit,.-_exit +END(_exit) libc_hidden_def (_exit) rtld_hidden_def (_exit)