From patchwork Fri May 23 15:17:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 30810 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EA5942066E for ; Fri, 23 May 2014 15:17:40 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id w7sf16138184qcr.8 for ; Fri, 23 May 2014 08:17:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:subject:date :message-id:x-original-sender:x-original-authentication-results; bh=NQ2kqyBD5iwEndM/wSjM4Ka5WTkFG4wWbGi8Lig8rKc=; b=ifPmcxCeVoTAus6VnQJ/wBNLVCmywZT/7p+j6tSoHWj+ruU75Chk5ia0Vo0spfn+RT 59KmemLMkFyK/TglIhof2AACF5gklgf2/8bYm+bcOPRuzD6M5Zvr+nYTvK9ucHbj10JU daD/FXuOz99v+bTSA5qgWm1VSnXvsnxreJwk55qAPTayIuQaNlErwaneyUHBKm4ZHTij Ty6ZSJuU+zPDl7VKiBesl4/KoFABapmHzhZYGR4j0eOjnSOXZi4J5ScfEjbckKfs9fw4 dtOMAvVT0w/OTBmCwbmSHT6cpF8ni4kY2IBSw2hyCMZmAsXlf7juTAC1xtAib621ih8w oCTg== X-Gm-Message-State: ALoCoQkRw+GFaGz191IE31l9ZKoF/t6+TjwvJsWHH1virRUbHZsbcdnx/4VGX5e9K0MmL36nCx2c X-Received: by 10.52.170.145 with SMTP id am17mr2053351vdc.2.1400858260780; Fri, 23 May 2014 08:17:40 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.32.203 with SMTP id h69ls1713828qgh.56.gmail; Fri, 23 May 2014 08:17:40 -0700 (PDT) X-Received: by 10.58.85.65 with SMTP id f1mr4963429vez.20.1400858260681; Fri, 23 May 2014 08:17:40 -0700 (PDT) Received: from mail-ve0-x229.google.com (mail-ve0-x229.google.com [2607:f8b0:400c:c01::229]) by mx.google.com with ESMTPS id j8si1809002vcr.60.2014.05.23.08.17.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 08:17:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::229 as permitted sender) client-ip=2607:f8b0:400c:c01::229; Received: by mail-ve0-f169.google.com with SMTP id jx11so6521513veb.0 for ; Fri, 23 May 2014 08:17:40 -0700 (PDT) X-Received: by 10.52.181.132 with SMTP id dw4mr874765vdc.86.1400858260604; Fri, 23 May 2014 08:17:40 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp39963vcb; Fri, 23 May 2014 08:17:40 -0700 (PDT) X-Received: by 10.67.22.33 with SMTP id hp1mr6711388pad.134.1400858259849; Fri, 23 May 2014 08:17:39 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id gt9si4379245pac.80.2014.05.23.08.17.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 May 2014 08:17:39 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-50164-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 14712 invoked by alias); 23 May 2014 15:17:30 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 14697 invoked by uid 89); 23 May 2014 15:17:30 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f41.google.com X-Received: by 10.194.80.7 with SMTP id n7mr5018073wjx.8.1400858245167; Fri, 23 May 2014 08:17:25 -0700 (PDT) From: Will Newton To: libc-alpha@sourceware.org Subject: [PATCH] ARM: Fix handling of concurrent TLS descriptor resolution Date: Fri, 23 May 2014 16:17:17 +0100 Message-Id: <1400858237-4516-1-git-send-email-will.newton@linaro.org> X-Original-Sender: will.newton@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::229 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 The current code for handling concurrent resolution says that the ABI for _dl_tlsdesc_resolve_hold is the same as that of _dl_tlsdesc_lazy_resolver. However _dl_tlsdesc_resolve_hold is called from the trampoline directly rather than the lazy resolver stub so, for example, r2 has not been pushed so does not needed to be restored. This fixes an intermittent failure in nptl/tst-tls3 when building glibc for arm-linux-gnueabihf with -mtls-dialect=gnu2. ChangeLog: 2014-05-23 Will Newton * sysdeps/arm/dl-tlsdesc.S (_dl_tlsdesc_resolve_hold): Save and restore r2 rather than just restoring. --- sysdeps/arm/dl-tlsdesc.S | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/sysdeps/arm/dl-tlsdesc.S b/sysdeps/arm/dl-tlsdesc.S index 1644a32..e87e7fb 100644 --- a/sysdeps/arm/dl-tlsdesc.S +++ b/sysdeps/arm/dl-tlsdesc.S @@ -186,7 +186,9 @@ _dl_tlsdesc_lazy_resolver: .size _dl_tlsdesc_lazy_resolver, .-_dl_tlsdesc_lazy_resolver /* Holder for lazy tls descriptors being resolve in another thread. - Same ABI as the lazy resolver itself. */ + + Our calling convention is to clobber r0, r1 and the processor + flags. All others that are modified must be saved */ .hidden _dl_tlsdesc_resolve_hold .global _dl_tlsdesc_resolve_hold .type _dl_tlsdesc_resolve_hold,#function @@ -194,29 +196,20 @@ _dl_tlsdesc_lazy_resolver: eabi_fnstart .align 2 _dl_tlsdesc_resolve_hold: - /* Tell the unwinder that r2 has already been pushed. */ - eabi_save ({r2}) - cfi_adjust_cfa_offset (4) + eabi_save ({r2,r3,ip,lr}) + push {r2, r3, ip, lr} + cfi_adjust_cfa_offset (16) cfi_rel_offset (r2, 0) - eabi_save ({r0,r1,r3,ip,lr}) - push {r0, r1, r3, ip, lr} - cfi_adjust_cfa_offset (20) - cfi_rel_offset (r0, 0) - cfi_rel_offset (r1, 4) - cfi_rel_offset (r3, 8) - cfi_rel_offset (ip, 12) - cfi_rel_offset (lr, 16) - adr r2, _dl_tlsdesc_resolve_hold + cfi_rel_offset (r3, 4) + cfi_rel_offset (ip, 8) + cfi_rel_offset (lr, 12) + adr r1, _dl_tlsdesc_resolve_hold bl _dl_tlsdesc_resolve_hold_fixup - pop {r0, r1, r3, ip, lr} - cfi_adjust_cfa_offset (-20) + pop {r2, r3, ip, lr} + cfi_adjust_cfa_offset (-16) cfi_restore (lr) cfi_restore (ip) cfi_restore (r3) - cfi_restore (r1) - cfi_restore (r0) - pop {r2} - cfi_adjust_cfa_offset (-4) cfi_restore (r2) sfi_breg r0, \ ldr r1, [\B, #4]