From patchwork Mon Mar 6 14:17:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Toma Tabacu X-Patchwork-Id: 735731 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3vcMMF0BgLz9sNj for ; Tue, 7 Mar 2017 01:18:00 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="D92Rr5Xx"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=R3B FYjNxEvkUwv6Jndmj09TRQGzMTiQwgRWxL4VoB27M5hcjp7yhdNAuloW5T466VeX +i4pNO62BR8ZyQSfjZxjFNnmGSvAiC2GBbGbijKfDpMk68j/trt0reApeQgJIWD8 rzX1JGDvBiOspcbaHNTd8stIz53+omw90O4l4I4M= 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:from :to:cc:subject:date:message-id:content-type :content-transfer-encoding:mime-version; s=default; bh=wQuMalklx 49BOIMglPw8dPvOKXo=; b=D92Rr5XxlFpoUOzOU+Kckf4UNhanNE9xNraWZvGhm mmIKM/g3u+0J5QoPCLRK+1UvAKMCF9cNYRPJ7949qR8SQg6U371jtcZ0iEa+6/+t pMj95fqo1V1BCTUiWhxvFi7h6Nw6fe2cpVguYNeqHcd5E9b0+C001G8z1nQpd3De jw= Received: (qmail 82634 invoked by alias); 6 Mar 2017 14:17:52 -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 82620 invoked by uid 89); 6 Mar 2017 14:17:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2897, H*Ad:U*ro X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 Mar 2017 14:17:50 +0000 Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 0665C51A860D5; Mon, 6 Mar 2017 14:17:45 +0000 (GMT) Received: from HHMAIL-X.hh.imgtec.org (10.100.10.113) by hhmail02.hh.imgtec.org (10.100.10.20) with Microsoft SMTP Server (TLS) id 14.3.294.0; Mon, 6 Mar 2017 14:17:48 +0000 Received: from hhmail02.hh.imgtec.org ([fe80::5400:d33e:81a4:f775]) by HHMAIL-X.hh.imgtec.org ([fe80::3509:b0ce:371:2b%18]) with mapi id 14.03.0294.000; Mon, 6 Mar 2017 14:17:48 +0000 From: Toma Tabacu To: "gcc-patches@gcc.gnu.org" CC: Matthew Fortune , "catherine_moore@mentor.com" , "Rainer Orth (ro@CeBiTec.Uni-Bielefeld.DE)" Subject: [PATCH, testsuite] Add check_effective_target_rdynamic and use it in g++.dg/lto/pr69589_0.C. Date: Mon, 6 Mar 2017 14:17:47 +0000 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi, g++.dg/lto/pr69589_0.C is currently failing for mips-mti-elf with the following error: xg++: error: unrecognized command line option '-rdynamic' However, it passes just fine for mips-mti-linux-gnu. I think that we should skip this test for mips-mti-elf. This patch achieves this by adding support for check_effective_target_rdynamic and then using it in g++.dg/lto/pr69589_0.C. This patch also removes the existing dg-skip-if, as it is made redundant by the effective target check. The latter is also more convenient, as we won't have to keep tweaking the dg-skip-if for failing targets anymore. This is similar to my recent check_effective_target_gettimeofday patch, which was greatly improved by Rainer Orth's review. Tested with mips-mti-elf and mips-mti-linux-gnu. Does this look good ? Regards, Toma gcc/ * doc/sourcebuild.texi (Effective-Target Keywords, Other attributes): Document rdynamic. gcc/testsuite/ * g++.dg/lto/pr69589_0.C: Add dg-require-effective-target for rdynamic. Remove dg-skip-if for targets which don't support -rdynamic. * lib/target-supports.exp (check_effective_target_rdynamic): New proc. diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 0dc4348..d75e078 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2065,6 +2065,9 @@ Target supports @option{-mpe-aligned-commons}. @item pie Target supports @option{-pie}, @option{-fpie} and @option{-fPIE}. +@item rdynamic +Target supports @option{-rdynamic}. + @item section_anchors Target supports section anchors. diff --git a/gcc/testsuite/g++.dg/lto/pr69589_0.C b/gcc/testsuite/g++.dg/lto/pr69589_0.C index 11766f1..599d5d4 100644 --- a/gcc/testsuite/g++.dg/lto/pr69589_0.C +++ b/gcc/testsuite/g++.dg/lto/pr69589_0.C @@ -1,7 +1,7 @@ // { dg-lto-do link } // { dg-lto-options "-O2 -rdynamic" } // { dg-extra-ld-options "-r -nostdlib" } -// { dg-skip-if "Skip targets without -rdynamic support" { arm*-none-eabi aarch64*-*-elf nios2-*-elf } { "*" } { "" } } +// { dg-require-effective-target rdynamic } #pragma GCC visibility push(hidden) struct A { int &operator[] (long); }; diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 2766af4..f46f0ba 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1484,6 +1484,16 @@ proc check_effective_target_static_libgfortran { } { } "-static"] } +# Return 1 if we can use the -rdynamic option, 0 otherwise. +# +# When the target name changes, replace the cached result. + +proc check_effective_target_rdynamic { } { + return [check_no_compiler_messages rdynamic executable { + int main() { return 0; } + } "-rdynamic"] +} + # Return 1 if cilk-plus is supported by the target, 0 otherwise. proc check_effective_target_cilkplus { } {