From patchwork Tue Oct 7 21:54:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 38443 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1A4692057C for ; Tue, 7 Oct 2014 21:54:41 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id y10sf4555236wgg.2 for ; Tue, 07 Oct 2014 14:54:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:mime-version:date:message-id:subject:from:to :x-original-sender:x-original-authentication-results:content-type; bh=cD0nr6qBesC/r85uTpWzwd0X3+hZ8MCqap/ZVHCpMgM=; b=Hh+72qqO50ocvyt1IyqAVtSWdnC+5UEj1oS01nvd74JxzxTfesL9hr2TK8Ir1YSYmo k4fMYzGK9mxjhSvqRyERDgKVZ3JDVNXVyOAKMQ/bQAjHNBPFxuXeUcSMzSXbKdx1iymv 7KQLvw/zvFnSStHDVu6luXQjKsRO4GUtV3GCkhJefP/JEbBfSCg++KttrY8cEqtN/nwy DQE0xj0L3n0f6eGRN33cwIDCLG/Ec8mte42g96SNL64uNj+9QsCnoKox+2RdkdYr7F9w FcpsBQXMr/Rd8kV6IJ6oI+NQqQfrCZY2hx19haHCfxCCVAyidoir9JO3tAPZXkfp/Qqu eP/g== X-Gm-Message-State: ALoCoQlw3GogDT2AFwDGeMo9F7b4dNY4iV3Ahi4i097l5wNgh1pXK7r8FcmiXvfmqg6VliDJOZTU X-Received: by 10.112.89.8 with SMTP id bk8mr958964lbb.6.1412718880201; Tue, 07 Oct 2014 14:54:40 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.207 with SMTP id jq15ls238723lab.49.gmail; Tue, 07 Oct 2014 14:54:40 -0700 (PDT) X-Received: by 10.152.28.74 with SMTP id z10mr7172887lag.10.1412718880061; Tue, 07 Oct 2014 14:54:40 -0700 (PDT) Received: from mail-lb0-x22b.google.com (mail-lb0-x22b.google.com [2a00:1450:4010:c04::22b]) by mx.google.com with ESMTPS id e4si30515970lbs.54.2014.10.07.14.54.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 Oct 2014 14:54:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22b as permitted sender) client-ip=2a00:1450:4010:c04::22b; Received: by mail-lb0-f171.google.com with SMTP id z12so7037657lbi.30 for ; Tue, 07 Oct 2014 14:54:39 -0700 (PDT) X-Received: by 10.152.204.231 with SMTP id lb7mr6965100lac.44.1412718879717; Tue, 07 Oct 2014 14:54:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp420505lbb; Tue, 7 Oct 2014 14:54:38 -0700 (PDT) X-Received: by 10.70.45.227 with SMTP id q3mr686900pdm.87.1412718877766; Tue, 07 Oct 2014 14:54:37 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id xv7si16565298pab.225.2014.10.07.14.54.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Oct 2014 14:54:37 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-379821-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 7668 invoked by alias); 7 Oct 2014 21:54:25 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 7657 invoked by uid 89); 7 Oct 2014 21:54:24 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qa0-f54.google.com Received: from mail-qa0-f54.google.com (HELO mail-qa0-f54.google.com) (209.85.216.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 07 Oct 2014 21:54:23 +0000 Received: by mail-qa0-f54.google.com with SMTP id i13so5001120qae.27 for ; Tue, 07 Oct 2014 14:54:21 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.224.80.131 with SMTP id t3mr7789986qak.35.1412718860801; Tue, 07 Oct 2014 14:54:20 -0700 (PDT) Received: by 10.140.86.114 with HTTP; Tue, 7 Oct 2014 14:54:20 -0700 (PDT) Date: Tue, 7 Oct 2014 23:54:20 +0200 Message-ID: Subject: [Patch, testsuite] check if -shared is supported From: Christophe Lyon To: "gcc-patches@gcc.gnu.org" X-IsSubscribed: yes X-Original-Sender: christophe.lyon@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22b as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 Hi, When Jason added the new g++.dg/ipa/devirt-28a.C test along with his fix for PR c++/58678 (https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00838.html), this new test was failing in the ARM and AArch64 configuration I am testing. For the arm*-none-eabi and aarch64*-none-elf configurations, this was simply because -shared is not supported by these targets. The attached patch adds support to test availability of this option, similarly to what is done for -fpic. For the record, for the arm*linux configurations, the test was also failing because testglue.o contained relocations incompatible with -shared. I managed to have them work by adding set_board_info wrap_compile_flags "-mword-relocations" to my .exp dejagnu configuration. In summary, this patch enables to have devirt-28a.C: - PASS on arm*linux* - UNSUPPORTED on arm*-none-eabi and aarch64*-none-elf instead of FAIL. Is it OK for trunk, and 4.9 (since Jason's patch was also committed to 4.9) ? 2014-10-08 Christophe Lyon * lib/target-supports.exp (check_effective_target_shared): New function. * g++.dg/ipa/devirt-28a.C: Check if -shared is supported. Thanks, Christophe. diff --git a/gcc/testsuite/g++.dg/ipa/devirt-28a.C b/gcc/testsuite/g++.dg/ipa/devirt-28a.C index bdd1682..65d5fcd 100644 --- a/gcc/testsuite/g++.dg/ipa/devirt-28a.C +++ b/gcc/testsuite/g++.dg/ipa/devirt-28a.C @@ -1,6 +1,6 @@ // PR c++/58678 // { dg-options "-O3 -flto -shared -fPIC -Wl,--no-undefined" } -// { dg-do link { target { gld && fpic } } } +// { dg-do link { target { { gld && fpic } && shared } } } struct A { virtual ~A(); diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 77e45cb..7ae6161 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -840,6 +840,19 @@ proc check_effective_target_fpic { } { return 0 } +# Return 1 if -shared is supported, as in no warnings or errors +# emitted, 0 otherwise. + +proc check_effective_target_shared { } { + # Note that M68K has a multilib that supports -fpic but not + # -fPIC, so we need to check both. We test with a program that + # requires GOT references. + return [check_no_compiler_messages shared executable { + extern int foo (void); extern int bar; + int baz (void) { return foo () + bar; } + } "-shared -fpic"] +} + # Return 1 if -pie, -fpie and -fPIE are supported, 0 otherwise. proc check_effective_target_pie { } {