From patchwork Wed Feb 17 16:03:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1441274 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=RBPNk2pD; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DgjL20ch1z9sRf for ; Thu, 18 Feb 2021 03:03:06 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D5C3B39450E7; Wed, 17 Feb 2021 16:02:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5C3B39450E7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1613577773; bh=cpptT7DjK4UDoAc+VL00xkjpdoHC4dctJnMQ+c+IlCc=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=RBPNk2pDJCi0zFQl+uiKREDmqodvdha0v8qDK6VXKh/2Nn3zPT6E8eqSExekTJrDO qCu6Ugw5FHsXoBJ3TvJl1pfbhSXiMeS6dvrb91RAWhkwBwsWG34gXV9NeZxPCuvQcT SLbRMmYgZtrlmZc98fCXCs8g8PRVmAWkYk94CYPg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 1BE1F39450E5 for ; Wed, 17 Feb 2021 16:02:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1BE1F39450E5 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-149-15gX50BaMVaPpJQawNlZbA-1; Wed, 17 Feb 2021 11:02:48 -0500 X-MC-Unique: 15gX50BaMVaPpJQawNlZbA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 069151005501 for ; Wed, 17 Feb 2021 16:02:48 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-113-131.ams2.redhat.com [10.36.113.131]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5918110013D7 for ; Wed, 17 Feb 2021 16:02:47 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 07/10] __frame_state_for: Use for unwinder access In-Reply-To: References: Message-Id: Date: Wed, 17 Feb 2021 17:03:19 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" --- sysdeps/generic/framestate.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) Reviewed-by: Carlos O'Donell diff --git a/sysdeps/generic/framestate.c b/sysdeps/generic/framestate.c index c1b364dbaa..54c4817f37 100644 --- a/sysdeps/generic/framestate.c +++ b/sysdeps/generic/framestate.c @@ -17,7 +17,6 @@ License along with the GNU C Library; if not, see . */ -#include #include #define STATIC static #define __frame_state_for fallback_frame_state_for @@ -25,6 +24,8 @@ #undef __frame_state_for #include +#include + typedef struct frame_state * (*framesf)(void *pc, struct frame_state *); struct frame_state *__frame_state_for (void *pc, struct frame_state *frame_state); @@ -32,21 +33,15 @@ struct frame_state *__frame_state_for (void *pc, struct frame_state * __frame_state_for (void *pc, struct frame_state *frame_state) { - static framesf frame_state_for; - - if (frame_state_for == NULL) + struct unwind_link *unwind_link = __libc_unwind_link_get (); + if (unwind_link != NULL) + return UNWIND_LINK_PTR (unwind_link, __frame_state_for) (pc, frame_state); + else { - void *handle = __libc_dlopen (LIBGCC_S_SO); - - if (handle == NULL - || (frame_state_for - = (framesf) __libc_dlsym (handle, "__frame_state_for")) == NULL) #ifndef __USING_SJLJ_EXCEPTIONS__ - frame_state_for = fallback_frame_state_for; + return fallback_frame_state_for (pc, frame_state); #else - frame_state_for = abort; + abort (); #endif } - - return frame_state_for (pc, frame_state); }