From patchwork Mon Oct 4 00:01:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Howarth X-Patchwork-Id: 66607 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 1CB15B70B8 for ; Mon, 4 Oct 2010 11:02:01 +1100 (EST) Received: (qmail 29221 invoked by alias); 4 Oct 2010 00:01:59 -0000 Received: (qmail 29202 invoked by uid 22791); 4 Oct 2010 00:01:58 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, TW_FN, TW_GD, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from bromo.med.uc.edu (HELO bromo.med.uc.edu) (129.137.3.146) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Mon, 04 Oct 2010 00:01:53 +0000 Received: from bromo.med.uc.edu (localhost.localdomain [127.0.0.1]) by bromo.med.uc.edu (Postfix) with ESMTP id 6E87E400007; Sun, 3 Oct 2010 20:01:51 -0400 (EDT) Received: (from howarth@localhost) by bromo.med.uc.edu (8.14.3/8.14.3/Submit) id o9401ps5013690; Sun, 3 Oct 2010 20:01:51 -0400 Date: Sun, 3 Oct 2010 20:01:50 -0400 From: Jack Howarth To: gcc-patches@gcc.gnu.org Cc: mikestump@comcast.net, iains@gcc.gnu.org Subject: [PATCH] Backport fix for PR debug/42487 Message-ID: <20101004000150.GA13688@bromo.med.uc.edu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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 The attached patch backports the addition of the proc check_effective_target_function_sections to lib/target-supports.exp and its use in gcc.dg/debug/dwarf2/aranges-fnsec-1.c to eliminate bogus failures on targets like darwin which don't support function sections. Tested on x86_64-apple-darwin10. Okay for gcc 4.5.2? Jack 2010-10-03 Jack Howarth Backport from mainline 2010-08-18 Iain Sandoe PR debug/42487 * lib/target-supports.exp (check_effective_target_function_sections): New. * gcc.dg/debug/dwarf2/aranges-fnsec-1.c: Check that the target supports function sections before proceding. Index: gcc/testsuite/gcc.dg/debug/dwarf2/aranges-fnsec-1.c =================================================================== --- gcc/testsuite/gcc.dg/debug/dwarf2/aranges-fnsec-1.c (revision 164915) +++ gcc/testsuite/gcc.dg/debug/dwarf2/aranges-fnsec-1.c (working copy) @@ -2,6 +2,7 @@ text section if nothing went in there. */ /* Origin: Joseph Myers */ /* { dg-do compile } */ +/* { dg-require-effective-target function_sections } */ /* { dg-options "-gdwarf-2 -ffunction-sections -w -dA" } */ /* { dg-final { scan-assembler-not "\\.Letext0-\\.Ltext0" } } */ /* { dg-final { scan-assembler-not "\\.Ltext0\[^\n\r\]*Offset 0x0" } } */ Index: gcc/testsuite/lib/target-supports.exp =================================================================== --- gcc/testsuite/lib/target-supports.exp (revision 164915) +++ gcc/testsuite/lib/target-supports.exp (working copy) @@ -605,6 +605,20 @@ }] } +# Return 1 if -ffunction-sections is supported, 0 otherwise. + +proc check_effective_target_function_sections {} { + # Darwin has its own scheme and silently accepts -ffunction-sections. + global target_triplet + if { [regexp ".*-.*-darwin.*" $target_triplet] } { + return 0 + } + + return [check_no_compiler_messages functionsections assembly { + void foo (void) { } + } "-ffunction-sections"] +} + # Return 1 if compilation with -fgraphite is error-free for trivial # code, 0 otherwise.