daily update
[external/binutils.git] / ld / testsuite / ld-elfcomm / elfcomm.exp
index 18aff55..572931b 100644 (file)
@@ -1,5 +1,6 @@
 # Expect script for common symbol tests
-#   Copyright 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+#   Copyright 2003, 2005, 2006, 2007, 2008, 2009
+#   Free Software Foundation, Inc.
 #
 # This file is part of the GNU Binutils.
 #
@@ -28,6 +29,11 @@ if ![is_elf_format] {
     return
 }
 
+# hpux assembly is weird
+if [istarget "hppa*-*-hpux*"] {
+    return
+}
+
 proc test_sort_common {} {
     global exec_output
     global objdump
@@ -175,9 +181,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
 }
@@ -185,14 +192,25 @@ if {   ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/common1a.c tmpdir/common1a.o]
 global ld
 global link_output
 
-if { [ld_simple_link $ld tmpdir/common1.o "-r tmpdir/common1a.o tmpdir/common1b.o"] } {
+set options "-r tmpdir/common1a.o tmpdir/common1b.o"
+
+# SH64 targets needs an extra ld option for this test.
+if [istarget sh64*-*-*] {
+    if [istarget sh64*l*-*-*] {
+       set options "-mshlelf32 $options"
+    } else {
+       set options "-mshelf32 $options"
+    }
+}
+
+if { [ld_simple_link $ld tmpdir/common1.o $options] } {
     unresolved $test1w1
     return
 }
 
 # This test fails on MIPS because the backend sets type_change_ok.
-# The size change warning is suppressed.
-if {[istarget mips*-*-*]} {
+# The size change warning is suppressed.  Same on hppa64.
+if {[istarget mips*-*-*] || [istarget hppa*64*-*-*]} {
     if { ![regexp "Warning: alignment (\[0-9\]+) of symbol \`_?foo1\' in tmpdir/common1b.o is smaller than 64 in tmpdir/common1a.o" $link_output] } {
         fail $test1w1
     } else {
@@ -211,7 +229,18 @@ if { [dump_common1 $test1c1] } {
     pass $test1c1
 }
 
-if { [ld_simple_link $ld tmpdir/common1.o "-r tmpdir/common1b.o tmpdir/common1a.o"] } {
+set options "-r tmpdir/common1b.o tmpdir/common1a.o"
+
+# SH64 targets needs an extra ld option for this test.
+if [istarget sh64*-*-*] {
+    if [istarget sh64*l*-*-*] {
+       set options "-mshlelf32 $options"
+    } else {
+       set options "-mshelf32 $options"
+    }
+}
+
+if { [ld_simple_link $ld tmpdir/common1.o $options] } {
     unresolved $test1w2
     return
 }