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: 38044 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); }