From patchwork Thu Feb 13 17:07:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1237616 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-109688-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=X2awRd1J; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gs+qhkJG; 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 48JNJT00wtz9s29 for ; Fri, 14 Feb 2020 04:08:40 +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:message-id:date:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=wj9 zmrrkw0qjWWpn03qjfJ59lD/GDrnNaBYacdjYc72E8466NUdTkdCQI0OdLEH/luD FazCxBMB5+k7/oRfhY7KuaFIHttAn13SGZjTJi7xhmdD784pFegpGGSRIVRnR4Uw FhzBKQ88Mr/XO6apB7YwjIPPsZucmZFsCHnvpf9U= 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:message-id:date:mime-version :content-type:content-transfer-encoding; s=default; bh=fy7I8X5aW 70jfi/+hlQ87Z+T188=; b=X2awRd1Jfr8fP9WY6jgPxycANYcFOsXok5anLz94X o0d7tAp0GwC7xNnfXG9AdLnJesqORni8X3K5MeKBbwPtFvDRyDzdmG9ljlIp3gDF UEruMbzDOltE8ALGnMpPW+wB6TatjUmq4baBO9QYDnsoz/715PX04dfOVymGTiEW Ck= Received: (qmail 49896 invoked by alias); 13 Feb 2020 17:08:20 -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 49810 invoked by uid 89); 13 Feb 2020 17:08:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=ported, preserves X-HELO: us-smtp-delivery-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581613696; 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; bh=l8QpEu1yvWcWAH383hA9REiV59NfV9w4z6IijbhbHnI=; b=gs+qhkJG5RuaDdAovf1aeLBg0fsfrBvy7d3EBi1G7kGiiMjgkNi4iKQPUJ3dDqQzq2a7US nvZctl6orQipLCaBDPD07VGioYdPWH7Kc5GgRmfkJx0uXyqFw5oNqtb7br/uq0+TaYvzAj 8i5vHqTKDkjxANtMzid2k0dFJQIVaqs= From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 00/11] Unify dynamic loading of the libgcc_s unwinder X-From-Line: f76766bb3e960981c0e2ccadafaea916174cf86c Mon Sep 17 00:00:00 2001 Message-Id: Date: Thu, 13 Feb 2020 18:07:44 +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 This series unifies the way glibc loads the libgcc_s unwinder via internal dlopen. There are presently four uses: * The backtrace function. * Legacy support for unwinder frame registration, which needs __frame_state_for. * GCC unwind personality support (__gcc_personality_v0 _Unwind_Resume) for C sources with -fexceptions. This is needed in libc and libpthread. * The libpthread unwinder, which also needs the canonical frame address to properly de-interleave longjump frames. Only the backtrace function could be ported separately in a per-architecture fashion. The last two commits in the series correspond to the libc part of the personality support, and the libpthread personality support and the unwinder there. The S/390 version preserves the backchain fallback for now. Tested on aarch64-linux-gnu, arm-linux-gnueabi, s390-linux-gnu, s390x-linux-gnu, i686-linux-gnu, powerpc-linux-gnu, powerpc64-linux-gnu, powerpc64le-linux-gnu, x86_64-linux-gnu. Built successfully with build-many-glibcs.py. Thanks, Florian Florian Weimer (11): Implement for dynamically loading the libgcc_s unwinder backtrace: Implement on top of arm: Implement backtrace on top of i386: Implement backtrace on top of m68k: Implement backtrace on top of sparc: Implement backtrace on top s390: Implement backtrace on top of __frame_state_for: Use for unwinder access Move sysdeps/gnu/unwind-resume.c to sysdeps/generic/unwind-resume.c Implement _Unwind_Resume in libc on top of nptl: Use for accessing the libgcc_s unwinder debug/backtrace.c | 86 +++------- malloc/set-freeres.c | 5 + misc/Makefile | 2 +- misc/Versions | 1 + misc/unwind-link.c | 149 ++++++++++++++++++ nptl/nptlfreeres.c | 1 - nptl/pthreadP.h | 6 +- nptl/pthread_cancel.c | 3 +- sysdeps/alpha/arch-unwind-link.h | 27 ++++ sysdeps/arm/arch-unwind-link.h | 38 +++++ sysdeps/arm/arm-unwind-resume.S | 26 +-- sysdeps/arm/backtrace.c | 77 +++------ sysdeps/arm/nptl/unwind-forcedunwind.c | 25 +++ sysdeps/arm/pt-arm-unwind-resume.S | 22 ++- sysdeps/arm/unwind-resume.c | 25 +++ sysdeps/generic/arch-unwind-link.h | 32 ++++ sysdeps/generic/framestate.c | 21 +-- sysdeps/generic/unwind-link.h | 99 ++++++++++++ sysdeps/generic/unwind-resume.c | 46 ++++++ sysdeps/gnu/unwind-resume.c | 83 ---------- sysdeps/i386/arch-unwind-link.h | 38 +++++ sysdeps/i386/backtrace.c | 82 +++------- sysdeps/ia64/arch-unwind-link.h | 31 ++++ sysdeps/m68k/arch-unwind-link.h | 34 ++++ sysdeps/m68k/backtrace.c | 82 +++------- sysdeps/m68k/m680x0/arch-unwind-link.h | 26 +++ sysdeps/mach/hurd/fork.c | 3 + sysdeps/mips/arch-unwind-link.h | 27 ++++ sysdeps/nptl/fork.c | 3 + sysdeps/nptl/unwind-forcedunwind.c | 115 ++------------ sysdeps/powerpc/powerpc32/arch-unwind-link.h | 27 ++++ sysdeps/s390/arch-unwind-link.h | 27 ++++ sysdeps/s390/s390-32/backtrace.c | 45 ++---- sysdeps/s390/s390-64/backtrace.c | 46 ++---- sysdeps/sh/arch-unwind-link.h | 27 ++++ sysdeps/sparc/arch-unwind-link.h | 27 ++++ sysdeps/sparc/backtrace.c | 66 ++------ .../sysv/linux/ia64/unwind-forcedunwind.c | 16 +- 38 files changed, 899 insertions(+), 597 deletions(-) create mode 100644 misc/unwind-link.c create mode 100644 sysdeps/alpha/arch-unwind-link.h create mode 100644 sysdeps/arm/arch-unwind-link.h create mode 100644 sysdeps/arm/nptl/unwind-forcedunwind.c create mode 100644 sysdeps/arm/unwind-resume.c create mode 100644 sysdeps/generic/arch-unwind-link.h create mode 100644 sysdeps/generic/unwind-link.h create mode 100644 sysdeps/generic/unwind-resume.c delete mode 100644 sysdeps/gnu/unwind-resume.c create mode 100644 sysdeps/i386/arch-unwind-link.h create mode 100644 sysdeps/ia64/arch-unwind-link.h create mode 100644 sysdeps/m68k/arch-unwind-link.h create mode 100644 sysdeps/m68k/m680x0/arch-unwind-link.h create mode 100644 sysdeps/mips/arch-unwind-link.h create mode 100644 sysdeps/powerpc/powerpc32/arch-unwind-link.h create mode 100644 sysdeps/s390/arch-unwind-link.h create mode 100644 sysdeps/sh/arch-unwind-link.h create mode 100644 sysdeps/sparc/arch-unwind-link.h