From patchwork Thu Jul 21 22:29:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 106181 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 2E9A1B6F71 for ; Fri, 22 Jul 2011 08:30:11 +1000 (EST) Received: (qmail 5477 invoked by alias); 21 Jul 2011 22:30:10 -0000 Received: (qmail 5467 invoked by uid 22791); 21 Jul 2011 22:30:09 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_ZJ, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gy0-f175.google.com (HELO mail-gy0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Jul 2011 22:29:55 +0000 Received: by gyd12 with SMTP id 12so1004553gyd.20 for ; Thu, 21 Jul 2011 15:29:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.144.6 with SMTP id r6mr412102wfd.306.1311287394431; Thu, 21 Jul 2011 15:29:54 -0700 (PDT) Received: by 10.142.89.19 with HTTP; Thu, 21 Jul 2011 15:29:54 -0700 (PDT) In-Reply-To: References: Date: Fri, 22 Jul 2011 00:29:54 +0200 Message-ID: Subject: Re: [PATCH, testsuite]: Fix detection of ifunc support From: Uros Bizjak To: gcc-patches@gcc.gnu.org Cc: Nathan Sidwell 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 On Thu, Jul 21, 2011 at 11:56 PM, Uros Bizjak wrote: > Revision 164725 [1] broke detection of ifunc support in the testsuite > [2] due to extra "#endif" without if in the test function. Attached > patch fixes this up. Actually, we can use existing testsuite infrastructure to simplify the function substantially. 2011-07-21  Uros Bizjak          * lib/target-supports.exp (check_ifunc_available): Rewrite. The patch is tested on x86_64-pc-linux-gnu, but my toolchain does not support ifunc attribute. Can somebody please test it with ifunc support? OK for mainline and 4.6 ? Uros. Index: lib/target-supports.exp =================================================================== --- lib/target-supports.exp (revision 176584) +++ lib/target-supports.exp (working copy) @@ -361,45 +361,16 @@ return $alias_available_saved } -############################### -# proc check_ifunc_available { } -############################### +# Returns 1 if the target supports ifunc, 0 otherwise. -# Determine if the target toolchain supports the ifunc attribute. - -# Returns 1 if the target supports ifunc. Returns 0 if the target -# does not support ifunc. - proc check_ifunc_available { } { - global ifunc_available_saved - global tool - - if [info exists ifunc_available_saved] { - verbose "check_ifunc_available returning saved $ifunc_available_saved" 2 - } else { - set src ifunc[pid].c - set obj ifunc[pid].o - verbose "check_ifunc_available compiling testfile $src" 2 - set f [open $src "w"] - puts $f "#endif" - puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif" - puts $f "void g() {}" - puts $f "void f() __attribute__((ifunc(\"g\")));" - close $f - set lines [${tool}_target_compile $src $obj object ""] - file delete $src - remote_file build delete $obj - - if [string match "" $lines] then { - set ifunc_available_saved 1 - } else { - set ifunc_available_saved 0 - } - - verbose "check_ifunc_available returning $ifunc_available_saved" 2 - } - - return $ifunc_available_saved + return [check_no_compiler_messages ifunc_available object { + #ifdef __cplusplus + extern "C" + #endif + void g() {} + f() __attribute__((ifunc("g"))); + }] } # Returns true if --gc-sections is supported on the target.