Tighten regexp in gdb.base/setshow.exp
[deliverable/binutils-gdb.git] / ld / testsuite / lib / ld-lib.exp
index 5f49e74f9dae69e3e06351facf1f3b2500157bfa..67c429ffec581ecab5826e670520556a0c588227 100644 (file)
@@ -1,7 +1,5 @@
 # Support routines for LD testsuite.
-#   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-#    2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-#    Free Software Foundation, Inc.
+#   Copyright 1994-2013 Free Software Foundation, Inc.
 #
 # This file is part of the GNU Binutils.
 #
@@ -179,13 +177,18 @@ proc big_or_little_endian {} {
 proc default_ld_link { ld target objects } {
     global HOSTING_EMU
     global HOSTING_CRT0
+    global HOSTING_SCRT0
     global HOSTING_LIBS
     global LIBS
     global host_triplet
     global link_output
     global exec_output
 
-    set objs "$HOSTING_CRT0 $objects"
+    if { [ string match "* -pie *" $objects ] } {
+       set objs "$HOSTING_SCRT0 $objects"
+    } else {
+       set objs "$HOSTING_CRT0 $objects"
+    }
     set libs "$LIBS $HOSTING_LIBS"
 
     if [is_endian_output_format $objects] then {
@@ -328,10 +331,12 @@ proc default_ld_compile { cc source object } {
 proc default_ld_assemble { as in_flags source object } {
     global ASFLAGS
     global host_triplet
+    global srcdir
+    global subdir
 
     if ![info exists ASFLAGS] { set ASFLAGS "" }
 
-    set flags [big_or_little_endian]
+    set flags "[big_or_little_endian] -I$srcdir/$subdir"
     set exec_output [run_host_cmd "$as" "$flags $in_flags $ASFLAGS -o $object $source"]
     set exec_output [prune_warnings $exec_output]
     if [string match "" $exec_output] then {
@@ -995,12 +1000,13 @@ proc ar_simple_create { ar aropts target objects } {
 # List contains test-items with 3 items followed by 2 lists, one item and
 # one optional item:
 #  0:name
-#  1:ld/ar options
-#  2:assembler options
-#  3:filenames of assembler files
-#  4:list of actions, options and expected outputs.
-#  5:name of output file
-#  6:compiler flags (optional)
+#  1:ld/ar leading options, placed before object files
+#  2:ld/ar trailing options, placed after object files
+#  3:assembler options
+#  4:filenames of assembler files
+#  5:list of actions, options and expected outputs.
+#  6:name of output file
+#  7:compiler flags (optional)
 #
 # Actions: { command command-line-options file-containg-expected-output-regexps }
 # Commands:
@@ -1036,11 +1042,12 @@ proc run_ld_link_tests { ldtests } {
        }
 
        set ld_options [lindex $testitem 1]
-       set as_options [lindex $testitem 2]
-       set src_files  [lindex $testitem 3]
-       set actions [lindex $testitem 4]
-       set binfile tmpdir/[lindex $testitem 5]
-       set cflags [lindex $testitem 6]
+       set ld_after [lindex $testitem 2]
+       set as_options [lindex $testitem 3]
+       set src_files  [lindex $testitem 4]
+       set actions [lindex $testitem 5]
+       set binfile tmpdir/[lindex $testitem 6]
+       set cflags [lindex $testitem 7]
        set objfiles {}
        set is_unresolved 0
        set failed 0
@@ -1049,6 +1056,7 @@ proc run_ld_link_tests { ldtests } {
 
 #      verbose -log "Testname is $testname"
 #      verbose -log "ld_options is $ld_options"
+#      verbose -log "ld_after is $ld_after"
 #      verbose -log "as_options is $as_options"
 #      verbose -log "src_files is $src_files"
 #      verbose -log "actions is $actions"
@@ -1082,10 +1090,10 @@ proc run_ld_link_tests { ldtests } {
        }
 
        if { [regexp ".*\\.a$" $binfile] } {
-           if { ![ar_simple_create $ar $ld_options $binfile "$objfiles"] } {
+           if { ![ar_simple_create $ar $ld_options $binfile "$objfiles $ld_after"] } {
                set failed 1
            }
-       } elseif { ![ld_simple_link $ld $binfile "-L$srcdir/$subdir $ld_options $objfiles"] } {
+       } elseif { ![ld_simple_link $ld $binfile "-L$srcdir/$subdir $ld_options $objfiles $ld_after"] } {
            set maybe_failed 1
            set ld_output "$exec_output"
        }
@@ -1418,7 +1426,7 @@ proc run_cc_link_tests { ldtests } {
            if { $warnings != "" } then {
                verbose -log "returned with: <$exec_output>, expected: <$warnings>"
                if { [regexp $warnings $exec_output] } then {
-                   set failed 2
+                   set failed 0
                } else {
                    set failed 1
                }
@@ -1510,22 +1518,21 @@ proc check_gc_sections_available { } {
     if {![info exists gc_sections_available_saved]} {
        # Some targets don't support gc-sections despite whatever's
        # advertised by ld's options.
-       if {[istarget aarch64*-*-*]
-            || [istarget arc-*-*]
-            || [istarget d30v-*-*]
-            || [istarget dlx-*-*]
-            || [istarget i960-*-*]
-            || [istarget or32-*-*]
-            || [istarget pj*-*-*]
-            || [istarget alpha-*-*]
-            || [istarget hppa*64-*-*]
-            || [istarget i370-*-*]
-            || [istarget i860-*-*]
-            || [istarget ia64-*-*]
-            || [istarget mep-*-*]
-            || [istarget mn10200-*-*]
-            || [istarget *-*-cygwin]
-            || [istarget *-*-mingw*] } {
+       if {   [istarget arc-*-*]
+           || [istarget d30v-*-*]
+           || [istarget dlx-*-*]
+           || [istarget i960-*-*]
+           || [istarget or32-*-*]
+           || [istarget pj*-*-*]
+           || [istarget alpha-*-*]
+           || [istarget hppa*64-*-*]
+           || [istarget i370-*-*]
+           || [istarget i860-*-*]
+           || [istarget ia64-*-*]
+           || [istarget mep-*-*]
+           || [istarget mn10200-*-*]
+           || [istarget *-*-cygwin]
+           || [istarget *-*-mingw*] } {
            set gc_sections_available_saved 0
            return 0
        }
@@ -1555,10 +1562,12 @@ proc check_gc_sections_available { } {
 # Only used and accurate for ELF targets at the moment
 
 proc check_shared_lib_support { } {
-    if {![istarget arc-*-*]
+    if {![istarget aarch64*-*-elf]
+        && ![istarget arc-*-*]
+        && ![istarget arm*-*-elf]
         && ![istarget avr-*-*]
         && ![istarget cr16-*-*]
-        && ![istarget cris*-*-*]
+        && ![istarget cris*-*-elf]
         && ![istarget crx-*-*]
         && ![istarget d10v-*-*]
         && ![istarget d30v-*-*]
@@ -1580,6 +1589,7 @@ proc check_shared_lib_support { } {
         && ![istarget mcore*-*-*]
         && ![istarget mep-*-*]
         && ![istarget microblaze-*-*]
+        && ![istarget mips*-*-elf]
         && ![istarget mn10200-*-*]
         && ![istarget moxie-*-*]
         && ![istarget msp430-*-*]
@@ -1587,6 +1597,7 @@ proc check_shared_lib_support { } {
         && ![istarget openrisc-*-*]
         && ![istarget or32-*-*]
         && ![istarget pj-*-*]
+        && ![istarget rl78-*-*]
         && ![istarget rx-*-*]
         && ![istarget spu-*-*]
         && ![istarget v850*-*-*]
This page took 0.025502 seconds and 4 git commands to generate.