From patchwork Fri Aug 3 09:45:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 953150 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-483094-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="MIm8CaXI"; 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 41hhxq2Cv1z9s2g for ; Fri, 3 Aug 2018 19:46:04 +1000 (AEST) 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:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=dirZH5LYoWltKqMv0 iKL4wrLato1TuKqe+MAOzzNi0xZ6cAWPE52SWNZ8HpPjfLdupriuQHomIVkrGKAS 2l8ipK83bcEhbeJLhKXbvxN5H2qdH/1ZdOElRNUPw4IbmBt+zKG5MGRgFTBQti8x jUoJ+UK+pkBHQixas8v1JHzZqk= 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:references:mime-version :content-type:in-reply-to; s=default; bh=RsXlVLCzJvYNUJ/0hWYsSTG DExY=; b=MIm8CaXIqZpZuACLKNqacHiUP+IlNmWpLnUQKgHwdyYfBZzxiyitw9u +d3meFitR45G5w+LP/mHlw4h5Vl8muaRls87IS37uNjXzeTSyJMsOahxw3RxI6+H 4ELcLJchgP6kyt21TzlAv5/SEwpsoNl46r01lNQrp+tOh29rIO8o= Received: (qmail 114804 invoked by alias); 3 Aug 2018 09:45:57 -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 114365 invoked by uid 89); 3 Aug 2018 09:45:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS, TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy=boilerplate, HTo:D*acm.org X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 03 Aug 2018 09:45:13 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 09529AD99; Fri, 3 Aug 2018 09:45:08 +0000 (UTC) Date: Fri, 3 Aug 2018 11:45:31 +0200 From: Tom de Vries To: Jakub Jelinek , Jason Merrill , Nathan Sidwell Cc: gcc-patches@gcc.gnu.org Subject: [c++] Don't emit exception tables for UI_NONE Message-ID: <20180803094531.4ea4ao6mriam5nv2@delia> References: <20180802153052.ycw3rxjj3kwy5pqa@delia> <20180802153927.GE17988@tucnak> <336e2629-c34f-530f-2885-a8e629616c7d@suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <336e2629-c34f-530f-2885-a8e629616c7d@suse.de> User-Agent: NeoMutt/20170912 (1.9.0) X-IsSubscribed: yes [ was: Re: [PATCH][nvptx] Ignore c++ exceptions ] On Thu, Aug 02, 2018 at 06:10:50PM +0200, Tom de Vries wrote: > On 08/02/2018 05:39 PM, Jakub Jelinek wrote: > > On Thu, Aug 02, 2018 at 05:30:53PM +0200, Tom de Vries wrote: > >> The nvptx port can't support exceptions using sjlj, because ptx does not > >> support sjlj. However, default_except_unwind_info still returns UI_SJLJ, even > >> even if we configure with --disable-sjlj-exceptions, because UI_SJLJ is the > >> fallback option. > >> > >> The reason default_except_unwind_info doesn't return UI_DWARF2 is because > >> DWARF2_UNWIND_INFO is not defined in defaults.h, because > >> INCOMING_RETURN_ADDR_RTX is not defined, because there's no ptx equivalent. > >> > >> Testcase libgomp.c++/for-15.C currently doesn't compile unless fno-exceptions > >> is added because: > >> - it tries to generate sjlj exception handling code, and > >> - it tries to generate exception tables using label-addressed .byte sequence. > >> Ptx doesn't support generating random data at a label, nor being able to > >> load/write data relative to a label. > >> > >> This patch fixes the first problem by using UI_TARGET for nvptx. > >> > >> The second problem is worked around by generating all .byte sequences commented > >> out. It would be better to have a narrower workaround, and define > >> TARGET_ASM_BYTE_OP to "error: .byte unsupported " or some such. > > > > Hopefully this part is temporary and there is some way to figure this out > > later. > > > > I except that for UI_NONE we don't want to write out exception tables, > so that's something we can fix, and then we can return UI_NONE in > nvptx_except_unwind_info. > Hi, If a target does not support exceptions, it can indicate this by returning UI_NONE in TARGET_EXCEPT_UNWIND_INFO. Currently the compiler still emits exception tables for such a target. This patch makes sure that no exception tables are emitted if the target does not support exceptions. This allows us to remove a workaround in TARGET_ASM_BYTE_OP in the nvptx port. Build on x86_64 with nvptx accelerator, and tested libgomp. OK for trunk if currently running bootstrap and reg-test on x86_64 succeeds? Thanks, - Tom [c++] Don't emit exception tables for UI_NONE 2018-08-03 Tom de Vries * common/config/nvptx/nvptx-common.c (nvptx_except_unwind_info): Return UI_NONE. * config/nvptx/nvptx.c (TARGET_ASM_BYTE_OP): Remove define. * except.c (output_function_exception_table): Do early exit if targetm_common.except_unwind_info (&global_options) == UI_NONE. --- gcc/common/config/nvptx/nvptx-common.c | 2 +- gcc/config/nvptx/nvptx.c | 3 --- gcc/except.c | 3 ++- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/gcc/common/config/nvptx/nvptx-common.c b/gcc/common/config/nvptx/nvptx-common.c index f31e0696281..3a124e8844d 100644 --- a/gcc/common/config/nvptx/nvptx-common.c +++ b/gcc/common/config/nvptx/nvptx-common.c @@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see enum unwind_info_type nvptx_except_unwind_info (struct gcc_options *opts ATTRIBUTE_UNUSED) { - return UI_TARGET; + return UI_NONE; } #undef TARGET_HAVE_NAMED_SECTIONS diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 62fefda8612..c0b0a2ec3ab 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -6051,9 +6051,6 @@ nvptx_can_change_mode_class (machine_mode, machine_mode, reg_class_t) #undef TARGET_HAVE_SPECULATION_SAFE_VALUE #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed -#undef TARGET_ASM_BYTE_OP -#define TARGET_ASM_BYTE_OP "// .byte " - struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-nvptx.h" diff --git a/gcc/except.c b/gcc/except.c index 84666d9041e..728b1e1d349 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -3189,7 +3189,8 @@ output_function_exception_table (int section) rtx personality = get_personality_function (current_function_decl); /* Not all functions need anything. */ - if (!crtl->uses_eh_lsda) + if (!crtl->uses_eh_lsda + || targetm_common.except_unwind_info (&global_options) == UI_NONE) return; /* No need to emit any boilerplate stuff for the cold part. */