===================================================================
@@ -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" } } */
===================================================================
@@ -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.