From patchwork Mon Jan 18 21:11:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Pluzhnikov X-Patchwork-Id: 10435 Received: (qmail 89203 invoked by alias); 18 Jan 2016 21:11:51 -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 89183 invoked by uid 89); 18 Jan 2016 21:11:51 -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, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS, UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 spammy=344, 334, rdi, 33, 4 X-HELO: mail-wm0-f50.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:cc :content-type; bh=JhV6rtA6ZS910LUSuS9E7dfGNF/v8cuxJ/v+FCgGqr8=; b=CQZnDoV8atJ8X+Mahl9kIF66lq//2PnEIfEyp5U2p/Vi8L7+dTkq5O55yRsUCpGs37 wMixqg4likXC/OQ7H0GaUynPJoH41n20Bcucgw/XUDwrHPITIvk1544l3wLWviXKflA3 UxRrAp1QERfYxCeYOV9/KsTV5LhZSii4jfsJ3dhm6yQrDTvaSr9XWzL2k32jN2FJ1Ir3 J7fiY2W8+3JVUtZriMCSMIclDFei/FSi83YsphjJizHk2ukCNlm6m7fRmQY8fYWQrxHP HcoCv3veGgL9AcupMeiQUqNMioOZLog6xeevogjKIVZrYyhvdgonwt4xn/7yy7DSDA0w LK3Q== X-Gm-Message-State: AG10YOT8vJmDvnZ5RGthLxxh+AIoIYH6etrgw0yVwS0EwMO1dk18eBSBbi+AmrOKR1sLh95EhesturbVU36is6SK X-Received: by 10.28.228.87 with SMTP id b84mr16189489wmh.36.1453151506208; Mon, 18 Jan 2016 13:11:46 -0800 (PST) MIME-Version: 1.0 From: Paul Pluzhnikov Date: Mon, 18 Jan 2016 13:11:16 -0800 Message-ID: Subject: [patch] Use ENTRY/END in sysdeps/x86_64/nptl/pthread_spin*.S To: GLIBC Devel Cc: Wei Mi Greetings, Currently, x86_64 pthread_spin_{lock,unlock,trylock} lack unwind descriptors, which causes tools like GDB and libunwind to guess how to unwind from them. Libunwind happens to guess incorrectly, leading to either bad stack trace, or a crash. Attached patch fixes this. Tested on Linux/x86_64. Ok for trunk? P.S. I'd like to excise other instances of functions that lack unwind descriptors in a follow-up patch, if that's ok. 2016-01-18 Paul Pluzhnikov * sysdeps/x86_64/nptl/pthread_spin_lock.S (pthread_spin_lock): Use ENTRY/END * sysdeps/x86_64/nptl/pthread_spin_trylock.S (pthread_spin_trylock): Likewise * sysdeps/x86_64/nptl/pthread_spin_unlock.S (pthread_spin_unlock): Likewise diff --git a/sysdeps/x86_64/nptl/pthread_spin_lock.S b/sysdeps/x86_64/nptl/pthread_spin_lock.S index c9b9424..b871241 100644 --- a/sysdeps/x86_64/nptl/pthread_spin_lock.S +++ b/sysdeps/x86_64/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) 1: LOCK decl 0(%rdi) jne 2f @@ -33,4 +31,4 @@ pthread_spin_lock: cmpl $0, 0(%rdi) jg 1b jmp 2b - .size pthread_spin_lock,.-pthread_spin_lock +END(pthread_spin_lock) diff --git a/sysdeps/x86_64/nptl/pthread_spin_trylock.S b/sysdeps/x86_64/nptl/pthread_spin_trylock.S index fc74d77..c9c5317 100644 --- a/sysdeps/x86_64/nptl/pthread_spin_trylock.S +++ b/sysdeps/x86_64/nptl/pthread_spin_trylock.S @@ -17,6 +17,7 @@ . */ #include +#include #ifdef UP @@ -25,10 +26,7 @@ # define LOCK lock #endif - .globl pthread_spin_trylock - .type pthread_spin_trylock,@function - .align 16 -pthread_spin_trylock: +ENTRY(pthread_spin_trylock) movl $1, %eax xorl %ecx, %ecx LOCK @@ -36,4 +34,4 @@ pthread_spin_trylock: movl $EBUSY, %eax cmovel %ecx, %eax retq - .size pthread_spin_trylock,.-pthread_spin_trylock +END(pthread_spin_trylock) diff --git a/sysdeps/x86_64/nptl/pthread_spin_unlock.S b/sysdeps/x86_64/nptl/pthread_spin_unlock.S index e341018..188de2e 100644 --- a/sysdeps/x86_64/nptl/pthread_spin_unlock.S +++ b/sysdeps/x86_64/nptl/pthread_spin_unlock.S @@ -16,14 +16,13 @@ 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 $1, (%rdi) xorl %eax, %eax retq - .size pthread_spin_unlock,.-pthread_spin_unlock +END(pthread_spin_unlock) /* The implementation of pthread_spin_init is identical. */ .globl pthread_spin_init