From patchwork Mon Nov 12 11:43:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 996360 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-489723-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="cRVl0WUj"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hjX07Xl5"; 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 42tpnB46dNz9s1x for ; Mon, 12 Nov 2018 22:43:58 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=D4H7Xoy6N02mBiGUGtZ/xrELckVIc7HLw/AwUjxQ2BYe+WGQ6P BH5bFS3VdP3F/kbQsmAQJgVFUlQAv8765FHfZgc0nsvgruLTrNHXGwJAsK5LG+QI H/JxvcYyACP4yY/M3wRSMvJ8QCtd2NNAhWvzgIh1LLOVGLWWl+yYjkoRU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=dil6/m8xGPsuFfMrUsdIr5QWwQ8=; b=cRVl0WUjAGY5/F9MHCb+ lJjEkMF3MoOt38xpz9R6hGmt1ykUiIsmm0ud03BLfB67nZ4QMpHnbLtabjJkY0xD n0i6YfvRNRWTjErW7gHwLLijTxFtJY1xzFjPm5WQLqWDGnajBl5dwBih4tJ8SFtT 1J4BYTEKyXRqx11AH5Cufww= Received: (qmail 47799 invoked by alias); 12 Nov 2018 11:43:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 47790 invoked by uid 89); 12 Nov 2018 11:43:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=addis, SIZE, 1847, HX-HELO:sk:mail-pg X-HELO: mail-pg1-f178.google.com Received: from mail-pg1-f178.google.com (HELO mail-pg1-f178.google.com) (209.85.215.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Nov 2018 11:43:49 +0000 Received: by mail-pg1-f178.google.com with SMTP id 17so3714208pgg.1 for ; Mon, 12 Nov 2018 03:43:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=Imuvt3RMGV2uqbybh6C6jCx1V/ymTo3GUY2UdK+R4bA=; b=hjX07Xl5YysTtHnWUz5kymccWOc+z5o5b+sk6o2QTc6uImfITtPVnUrGrz1ozO+NxF vcpokM0RrRh8uHOLPsduR0imE/E3dhC8mkE1sAZ8goP3RfABwNTIzt3X27jQ/9YNMKN4 pSTuFYuyujBfdfqNa9DFw/V8jPDs9pxI09fP+BifnzXJ2lWPEEdDvXIwvLqhDtpj5Bk5 41WN7vj47gDTxMKU26LHsKhL1ukJ+aZ8Pk6CH7UJ3JFFpZyPnqpj9EZ5yQe4zpB3U26F c/NtsXvMfFsu79IZto8ZWnQ70dptinPvBDTrWxDPA9DCa0IAI0F3T6vNZhSSFCB002Oz sMAQ== Received: from bubble.grove.modra.org ([58.175.241.133]) by smtp.gmail.com with ESMTPSA id x63-v6sm21130420pfk.14.2018.11.12.03.43.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Nov 2018 03:43:47 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 0021880388; Mon, 12 Nov 2018 22:13:43 +1030 (ACDT) Date: Mon, 12 Nov 2018 22:13:43 +1030 From: Alan Modra To: gcc-patches@gcc.gnu.org Cc: Segher Boessenkool Subject: [PowerPC] libgcc cfi Message-ID: <20181112114343.GG22752@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-IsSubscribed: yes There are a few places in libgcc assembly where we don't emit call frame information for functions, potentially breaking unwinding from asynchronous signal handlers. This patch fixes most. Although I patch tramp.S there is no attempt made to provide CFI for the actual trampoline on the stack. Doing that would require generating CFI at run time and both registering and deregistering it, which is probably not worth doing since it would significantly slow down the call. Note that the out-of-line register save/restore functions do not need CFI in the assembly. CFI is added for them by the rs6000.c prologue and epilogue code. Bootstrapped etc. powerpc64le-linux. * config/rs6000/morestack.S (__stack_split_initialize), (__morestack_get_guard, __morestack_set_guard), (__morestack_make_guard): Provide CFI covering these functions. * config/rs6000/tramp.S (__trampoline_setup): Likewise. diff --git a/libgcc/config/rs6000/morestack.S b/libgcc/config/rs6000/morestack.S index a0fee4037e4..936051eab33 100644 --- a/libgcc/config/rs6000/morestack.S +++ b/libgcc/config/rs6000/morestack.S @@ -304,12 +304,15 @@ DW.ref.__gcc_personality_v0: # new thread starts. This is called from a constructor. # void __stack_split_initialize (void) ENTRY(__stack_split_initialize) + .cfi_startproc addi %r3,%r1,-0x4000 # We should have at least 16K. std %r3,-0x7000-64(%r13) # tcbhead_t.__private_ss # void __generic_morestack_set_initial_sp (void *sp, size_t len) mr %r3,%r1 li %r4, 0x4000 b __generic_morestack_set_initial_sp +# The lack of .cfi_endproc here is deliberate. This function and the +# following ones can all use the default FDE. SIZE (__stack_split_initialize) @@ -335,6 +338,7 @@ ENTRY0(__morestack_make_guard) sub %r3,%r3,%r4 addi %r3,%r3,BACKOFF blr + .cfi_endproc SIZE (__morestack_make_guard) diff --git a/libgcc/config/rs6000/tramp.S b/libgcc/config/rs6000/tramp.S index 19ea57838fc..637f4510146 100644 --- a/libgcc/config/rs6000/tramp.S +++ b/libgcc/config/rs6000/tramp.S @@ -56,8 +56,10 @@ trampoline_size = .-trampoline_initial /* R6 = static chain */ FUNC_START(__trampoline_setup) + .cfi_startproc mflr r0 /* save return address */ bcl 20,31,.LCF0 /* load up __trampoline_initial into r7 */ + .cfi_register lr,r0 .LCF0: mflr r11 addi r7,r11,trampoline_initial-4-.LCF0 /* trampoline address -4 */ @@ -112,6 +114,7 @@ FUNC_START(__trampoline_setup) addi r30,r30,_GLOBAL_OFFSET_TABLE_-1b@l #endif bl JUMP_TARGET(abort) + .cfi_endproc FUNC_END(__trampoline_setup) #endif @@ -144,6 +147,7 @@ trampoline_size = .-trampoline_initial .popsection FUNC_START(__trampoline_setup) + .cfi_startproc addis 7,2,.LC0@toc@ha ld 7,.LC0@toc@l(7) /* trampoline address -8 */ @@ -180,6 +184,7 @@ FUNC_START(__trampoline_setup) .Labort: bl JUMP_TARGET(abort) nop + .cfi_endproc FUNC_END(__trampoline_setup) #endif