Patchwork PR debug/42487, xfail scan-assembler on DW_AT_ranges in gcc.dg/debug/dwarf2/aranges-fnsec-1.c for darwin

login
register
mail settings
Submitter IainS
Date Aug. 18, 2010, 8:25 a.m.
Message ID <B5F7F0DB-EE94-4374-B051-4074B9711D5C@sandoe-acoustics.co.uk>
Download mbox | patch
Permalink /patch/62011/
State New
Headers show

Comments

IainS - Aug. 18, 2010, 8:25 a.m.
On 17 Aug 2010, at 19:08, Mark Mitchell wrote:

> IainS wrote:
>
>>> Iain explained this one -- .subsections_via_symbols allows many
>>> of the -function-sections type tests to succeed.  So, I'm really
>>> not sure how to proceed.  Mark?
>
> Iain's version is fine by me.

well I took three "fine by me"s to be approval, so ...
(after checking that the test correctly unsupports on darwin and that  
it still runs OK on x86_64-unk-linux-gnu)
I applied the following as r163326,
cheers,
Iain

testsuite:

	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.

  # code, 0 otherwise.

Index: gcc/testsuite/gcc.dg/debug/dwarf2/aranges-fnsec-1.c
===================================================================
--- gcc/testsuite/gcc.dg/debug/dwarf2/aranges-fnsec-1.c (revision  
163325)
+++ 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" } } */

Patch

Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp       (revision 163325)
+++ gcc/testsuite/lib/target-supports.exp       (working copy)
@@ -623,6 +623,20 @@  proc check_effective_target_tls_runtime {} {
      }]
  }

+# 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