From patchwork Thu Jun 30 17:26:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 102789 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]) by ozlabs.org (Postfix) with SMTP id D1676B6F57 for ; Fri, 1 Jul 2011 03:27:07 +1000 (EST) Received: (qmail 31853 invoked by alias); 30 Jun 2011 17:27:05 -0000 Received: (qmail 31844 invoked by uid 22791); 30 Jun 2011 17:27:04 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Jun 2011 17:26:47 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 0887C70E; Thu, 30 Jun 2011 19:26:46 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id W4QMRoBEno0n; Thu, 30 Jun 2011 19:26:42 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id E80E270D; Thu, 30 Jun 2011 19:26:42 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id p5UHQgJM025639; Thu, 30 Jun 2011 19:26:42 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Mike Stump , "Frank Ch. Eigler" Subject: [testsuite, libmudflap] Only use --noinhibit-exec with GNU ld (PR libmudflap/49549) Date: Thu, 30 Jun 2011 19:26:41 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes 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 As reported in the PR, libmudflap.cth/cthfrags.exp unconditionally uses -Wl,--noinhibit-exec, which is a GNU ld option unknown to Sun ld, even though the Solaris 11 ld has implemented many of the GNU ld options. This patch addresses this by providing an effective-target check for gld, similar to the existing gas check, and using it. I don't distinguish between GNU ld and gold here, which is probably unnecessary for the most cases. With this patch, libmudflap make check on sparc-sun-solaris2.11 (both multilibs) produced the almost perfect results already reported in the previous message. Though I don't nominally need approval for this patch, I'll wait a day if Mike or Frank have comments. Rainer 2011-06-29 Rainer Orth PR libmudflap/49549 * testsuite/lib/libmudflap.exp (load_gcc_lib): Load target-supports.exp. * testsuite/libmudflap.cth/cthfrags.exp: Only pass --noinhibit-exec to GNU ld. gcc: PR libmudflap/49549 * doc/sourcebuild.texi (Effective-Target Keywords): Document gld. gcc/testsuite: PR libmudflap/49549 * lib/target-supports.exp (check_effective_target_gld): New proc. diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1760,6 +1760,9 @@ Target uses GNU @command{as}. @item gc_sections Target supports @option{--gc-sections}. +@item gld +Target uses GNU @command{ld}. + @item keeps_null_pointer_checks Target keeps null pointer checks, either due to the use of @option{-fno-delete-null-pointer-checks} or hardwired into the target. diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3843,6 +3843,26 @@ proc check_effective_target_gas { } { return $use_gas_saved } +# Return 1 if GNU ld is used. + +proc check_effective_target_gld { } { + global use_gld_saved + global tool + + if {![info exists use_gld_saved]} { + # Check if the ld used by gcc is GNU ld. + set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=ld" "" "none" ""] 0] + set status [remote_exec host "$gcc_ld" "--version"] + set ld_output [lindex $status 1] + if { [ string first "GNU" $ld_output ] >= 0 } { + set use_gld_saved 1 + } else { + set use_gld_saved 0 + } + } + return $use_gld_saved +} + # Return 1 if the compiler has been configure with link-time optimization # (LTO) support. diff --git a/libmudflap/testsuite/lib/libmudflap.exp b/libmudflap/testsuite/lib/libmudflap.exp --- a/libmudflap/testsuite/lib/libmudflap.exp +++ b/libmudflap/testsuite/lib/libmudflap.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2001, 2002, 2003, 2004, 2009, 2010 +# Copyright (C) 2001, 2002, 2003, 2004, 2009, 2010, 2011 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -30,6 +30,7 @@ proc load_gcc_lib { filename } { load_lib mfdg.exp load_lib libgloss.exp load_gcc_lib target-libpath.exp +load_gcc_lib target-supports.exp load_gcc_lib timeout.exp load_gcc_lib timeout-dg.exp diff --git a/libmudflap/testsuite/libmudflap.cth/cthfrags.exp b/libmudflap/testsuite/libmudflap.cth/cthfrags.exp --- a/libmudflap/testsuite/libmudflap.cth/cthfrags.exp +++ b/libmudflap/testsuite/libmudflap.cth/cthfrags.exp @@ -11,10 +11,15 @@ foreach flags $MUDFLAP_FLAGS { set bsrc [file tail $srcfile] setenv MUDFLAP_OPTIONS "-viol-segv" if {$libmudflapth} then { - # --noinhibit-exec works around a ld problem that causes - # "Dwarf Error: Invalid or unhandled FORM value: 14" - # to fail builds unnecessarily. - dg-runtest $srcfile $flags "-fmudflapth -lmudflapth -lpthread -Wl,--noinhibit-exec" + if [check_effective_target_gld] { + # --noinhibit-exec works around a ld problem that causes + # "Dwarf Error: Invalid or unhandled FORM value: 14" + # to fail builds unnecessarily. + set noie_option " -Wl,--noinhibit-exec" + } else { + set noie_option "" + } + dg-runtest $srcfile $flags "-fmudflapth -lmudflapth -lpthread $noie_option" } else { if {$flags != ""} {set f " ($flags)"} {set f ""} untested "libmudflap.cth/$bsrc$f"