From patchwork Thu Feb 13 17:08:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1237622 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=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-109693-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha1 header.s=default header.b=SUfieA9A; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZfXSplYG; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 48JNKN5TTrz9s3x for ; Fri, 14 Feb 2020 04:09:28 +1100 (AEDT) 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:subject:in-reply-to:references :message-id:date:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=O0zH9lCGx5AQ3kFF LTMw/vUP2YWep4RFgJj+xv9M/5/9P9g6knvpXzOebR81bN9aj+Y2kFriGBkPf767 r5fuy4WHfwfEF/RLmLT/UOZcuwOoAkY/Hnc0Abu/2uoTVd9Flbi7+A97NKSQY0YV KX1ien3h9XfvAN4YUXMDY6aS230= 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:subject:in-reply-to:references :message-id:date:mime-version:content-type :content-transfer-encoding; s=default; bh=ZKhvFBSxW0HBhqCxmysW/U EqCBk=; b=SUfieA9AjPc+HZZ8wegqSA4jkijILcNA8AnL4VXrj5l6qCDghohIUy ijyqI5LI5Ng+uQ3I0bHoNbMpNF0USlp0B2WEcl384hC0fio6W9lpbiQ65ksX1DqX Vt7DTdsSABqNFhfrnN0EzGsif1SBKDxDsysq+ipOFYWF+pbOIiLF4= Received: (qmail 51085 invoked by alias); 13 Feb 2020 17:08:30 -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 51030 invoked by uid 89); 13 Feb 2020 17:08:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581613706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9oUS+rIMSSvQu+W570foookGxfUsfxZn+iMf8Ujvgy0=; b=ZfXSplYGiD10ivU843xXF1WhrrhRJf9DzsRkWngLftvJliHl0Ead1IoIhEtxSS5L/AWQG6 rL/pq62/gHp8DM4JxjUtgZjLTKV61/xqJT/OX1MBEPHGERpVfg5EKGVKZqm7ZnKYN0qhgz nQUqT3KIQMoAqFPDqh1UUHNbcv3H3js= From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 08/11] __frame_state_for: Use for unwinder access In-Reply-To: References: X-From-Line: 2517bf664b69611181ac85d1ce810c9012afb497 Mon Sep 17 00:00:00 2001 Message-Id: <2517bf664b69611181ac85d1ce810c9012afb497.1581613260.git.fweimer@redhat.com> Date: Thu, 13 Feb 2020 18:08:20 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com --- sysdeps/generic/framestate.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/sysdeps/generic/framestate.c b/sysdeps/generic/framestate.c index e342ce8e54..83cfcd20fd 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); }