From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 dcvr.yhbt.net (Postfix) with ESMTPS id 24EE51F453 for ; Mon, 4 Feb 2019 22:37:02 +0000 (UTC) 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:cc:subject:in-reply-to:date:message-id :mime-version:content-type; q=dns; s=default; b=L+1mVoxhh75Uf0dH J2nIJtEKCfHsFpV2spT+IsE6iK8fs7rjBiCiQ1v1oXiaPIbG37nGjteXUojEgCch DeXbB5qbvRS3HFw4t6jdaosGgUCLVwwyBEjp0DfzSZn23Dde0O8ZuobwRUghj2nh 5Rp3eC5bV2nv3kPao1pFaLvGF9A= 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:cc:subject:in-reply-to:date:message-id :mime-version:content-type; s=default; bh=11YTGodRskWt2TwljMITZg DfE9E=; b=TxNP6Ift43oewK1DyjFPbp6PccCzTEpsBKZ32hcvWy+olyZtT4fFXc 1Nt+Gm18rNL2gpVZPKnrUl9VYzsuaFIMO4IMoPhp2S2wd9lah1rIKynTaQPn7VH5 cGjM7r5d5XZeW4KA3SppwoT7nTFJJSZDUSjvTCDsORJsCaakp0u0k= Received: (qmail 65087 invoked by alias); 4 Feb 2019 22:36:59 -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 Received: (qmail 65078 invoked by uid 89); 4 Feb 2019 22:36:59 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mx1.redhat.com From: DJ Delorie To: Jim Wilson Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] RISC-V: Fix elfutils testsuite unwind failures. In-Reply-To: <20190113234809.4818-1-jimw@sifive.com> (message from Jim Wilson on Sun, 13 Jan 2019 15:48:09 -0800) Date: Mon, 04 Feb 2019 17:37:16 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain I'm OK with this patch plus or minus the return from main comment I added below. If someone "in the know" can comment on that comment, I can commit the patch once we have consensus on it. Jim Wilson writes: > -CFLAGS-tst-unwind-main.c += -funwind-tables > +CFLAGS-tst-unwind-main.c += -funwind-tables -DUSE_PTHREADS=0 This allows for the test to run the "old" way, ok. > static _Unwind_Reason_Code > callback (struct _Unwind_Context *ctx, void *arg) > { > return _URC_NO_REASON; > } > > -int > -main (void) > +static void * > +func (void *a) > { > /* Arrange for this test to be killed if _Unwind_Backtrace runs into an > endless loop. We cannot use the test driver because the complete > call chain needs to be compiled with -funwind-tables so that > - _Unwind_Backtrace is able to reach _start. */ > + _Unwind_Backtrace is able to reach the start routine. */ > alarm (DEFAULT_TIMEOUT); > _Unwind_Backtrace (callback, 0); > + return a; > +} > + > +int > +main (void) > +{ > +#if USE_PTHREADS > + pthread_t thr; > + int rc = pthread_create (&thr, NULL, &func, NULL); > + if (rc) > + error (1, rc, "pthread_create"); > + rc = pthread_join (thr, NULL); > + if (rc) > + error (1, rc, "pthread_join"); > +#else > + func (NULL); > +#endif > } main() should return something in the fall-through case, be it zero (main should exit) or 1 (code shouldn't be reached), now that main() doesn't end with _Unwind_Backtrace() itself, if for no reason than to avoid future warnings. > - tst-rwlock-pwn > + tst-rwlock-pwn tst-unwind-thread ok > +CFLAGS-tst-unwind-thread.c += -funwind-tables ok, same as original test. > +#define USE_PTHREADS 1 > +#include "../elf/tst-unwind-main.c" Ok. > ENTRY (__thread_start) > L (thread_start): > + /* Terminate call stack by noting ra is undefined. Use a dummy > + .cfi_label to force starting the FDE. */ > + .cfi_label .Ldummy > + cfi_undefined (ra) > + As noted, this matches start.S, so ok.