diff mbox

Backport fix for PR debug/42487

Message ID 20101004000150.GA13688@bromo.med.uc.edu
State New
Headers show

Commit Message

Jack Howarth Oct. 4, 2010, 12:01 a.m. UTC
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 <howarth@bromo.med.uc.edu>

	Backport from mainline
	2010-08-18  Iain Sandoe  <iains@gcc.gnu.org>

	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.

Comments

Mike Stump Oct. 4, 2010, 2:55 a.m. UTC | #1
On Oct 3, 2010, at 5:01 PM, Jack Howarth wrote:
> Okay for gcc 4.5.2?

Ok.
diff mbox

Patch

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 <joseph@codesourcery.com> */
 /* { 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.