PATCH: Pass -fcommon for elfcomm.exp

Mark Mitchell mitchell@codesourcery.com
Fri Mar 6 21:30:00 GMT 2009


If "-fno-common" is in CFLAGS, then the tests for correct handling of
common data fail because the compiler doesn't actually generate common
data.  This patch explicitly passes -fcommon, making the testsuite
more robust.  

Tested on arm-none-eabi.  OK to apply?

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

2009-03-05  Mark Mitchell  <mark@codesourcery.com>

	* ld-elfcomm/elfcomm.exp: Compile with -fcommon.

Index: ld/testsuite/ld-elfcomm/elfcomm.exp
===================================================================
--- ld/testsuite/ld-elfcomm/elfcomm.exp	(revision 238952)
+++ ld/testsuite/ld-elfcomm/elfcomm.exp	(working copy)
@@ -175,9 +175,10 @@ proc assembler_generates_commons {} {
     return 1
 }
 
-
-if {   ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/common1a.c tmpdir/common1a.o]
-    || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/common1b.c tmpdir/common1b.o] } {
+# Explicitly use "-fcommon" so that even if $CFLAGS includes
+# "-fno-common", these tests are compiled as expected.
+if {   ![ld_compile "$CC $CFLAGS -fcommon" $srcdir/$subdir/common1a.c tmpdir/common1a.o]
+    || ![ld_compile "$CC $CFLAGS -fcommon" $srcdir/$subdir/common1b.c tmpdir/common1b.o] } {
     unresolved $test1
     return
 }



More information about the Binutils mailing list