Workaround debian change to default value of --as-needed.
[deliverable/binutils-gdb.git] / gdb / testsuite / lib / gdb.exp
index c0e0cb1b09b3773b2aab2ac76f938ce924d3e7fa..ffc63a594422207721b75649d2dc069d6027a383 100644 (file)
@@ -2271,6 +2271,53 @@ proc is_x86_like_target {} {
     return [expr [is_ilp32_target] && ![is_amd64_regs_target]]
 }
 
+# Return 1 if this target is an arm or aarch32 on aarch64.
+
+gdb_caching_proc is_aarch32_target {
+    if { [istarget "arm*-*-*"] } {
+       return 1
+    }
+
+    if { ![istarget "aarch64*-*-*"] } {
+       return 0
+    }
+
+    set me "is_aarch32_target"
+
+    set src [standard_temp_file aarch32[pid].s]
+    set obj [standard_temp_file aarch32[pid].o]
+
+    set list {}
+    foreach reg \
+       {r0 r1 r2 r3} {
+           lappend list "\tmov $reg, $reg"
+       }
+    gdb_produce_source $src [join $list \n]
+
+    verbose "$me:  compiling testfile $src" 2
+    set lines [gdb_compile $src $obj object {quiet}]
+    file delete $src
+    file delete $obj
+
+    if ![string match "" $lines] then {
+       verbose "$me:  testfile compilation failed, returning 0" 2
+       return 0
+    }
+
+    verbose "$me:  returning 1" 2
+    return 1
+}
+
+# Return 1 if this target is an aarch64, either lp64 or ilp32.
+
+proc is_aarch64_target {} {
+    if { ![istarget "aarch64*-*-*"] } {
+       return 0
+    }
+
+    return [expr ![is_aarch32_target]]
+}
+
 # Return 1 if displaced stepping is supported on target, otherwise, return 0.
 proc support_displaced_stepping {} {
 
@@ -2979,6 +3026,13 @@ proc gdb_compile {source dest type options} {
                      || [istarget *-*-cygwin*]) } {
                    lappend new_options "additional_flags=-Wl,--enable-auto-import"
                }
+               if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } {
+                   # Undo debian's change in the default.
+                   # Put it at the front to not override any user-provided
+                   # value, and to make sure it appears in front of all the
+                   # shlibs!
+                   lappend new_options "early_flags=-Wl,--no-as-needed"
+               }
             }
        } elseif { $opt == "shlib_load" } {
            set shlib_load 1
@@ -4694,11 +4748,13 @@ proc help_test_raw { gdb_command expected_lines args } {
 # are regular expressions that should match the beginning of output,
 # before the list of commands in that class.  The presence of 
 # command list and standard epilogue will be tested automatically.
+# Notice that the '[' and ']' characters don't need to be escaped for strings
+# wrapped in {} braces.
 proc test_class_help { command_class expected_initial_lines args } {
     set l_stock_body {
-        "List of commands\:.*\[\r\n\]+"
-        "Type \"help\" followed by command name for full documentation\.\[\r\n\]+"
-        "Type \"apropos word\" to search for commands related to \"word\"\.[\r\n\]+"
+        "List of commands\:.*[\r\n]+"
+        "Type \"help\" followed by command name for full documentation\.[\r\n]+"
+        "Type \"apropos word\" to search for commands related to \"word\"\.[\r\n]+"
         "Command name abbreviations are allowed if unambiguous\." 
     }
     set l_entire_body [concat $expected_initial_lines $l_stock_body]
This page took 0.025422 seconds and 4 git commands to generate.