aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2015-07-24 15:24:37 -0700
committerDoug Evans <dje@google.com>2015-07-24 15:24:37 -0700
commit6ebea266fd0a7a56c90db3ab6237ff9f6c919747 (patch)
tree9091b2fa78970015a6eb33966cdce19bf69ba16c
parent4fd4095a5ffe3d4e50e0dac5f8ad37b8478afa9d (diff)
downloadgdb-6ebea266fd0a7a56c90db3ab6237ff9f6c919747.zip
gdb-6ebea266fd0a7a56c90db3ab6237ff9f6c919747.tar.gz
gdb-6ebea266fd0a7a56c90db3ab6237ff9f6c919747.tar.bz2
Workaround debian change to default value of --as-needed.
gdb/testsuite/ChangeLog: * lib/future.exp (gdb_default_target_compile): New option "early_flags". * lib/gdb.exp (gdb_compile): Undo debian's change in default of --as-needed.
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/lib/future.exp17
-rw-r--r--gdb/testsuite/lib/gdb.exp7
3 files changed, 25 insertions, 6 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d066548..591ce4a 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,12 @@
2015-07-24 Doug Evans <dje@google.com>
+ * lib/future.exp (gdb_default_target_compile): New option
+ "early_flags".
+ * lib/gdb.exp (gdb_compile): Undo debian's change in default of
+ --as-needed.
+
+2015-07-24 Doug Evans <dje@google.com>
+
* gdb.perf/lib/perftest/measure.py (MeasurementCpuTime::stop): Print
result.
(MeasurementWallTime::stop): Ditto.
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
index a27e120..994843e 100644
--- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp
@@ -135,14 +135,15 @@ proc gdb_default_target_compile {source destfile type options} {
error "Must supply an output filename for the compile to default_target_compile"
}
+ set early_flags ""
set add_flags ""
set libs ""
set compiler_type "c"
set compiler ""
set linker ""
# linker_opts_order is one of "sources-then-flags", "flags-then-sources".
- # The order shouldn't matter. It's done this way to preserve
- # existing behavior.
+ # The order matters for things like -Wl,--as-needed. The default is to
+ # preserve existing behavior.
set linker_opts_order "sources-then-flags"
set ldflags ""
set dest [target_info name]
@@ -240,6 +241,10 @@ proc gdb_default_target_compile {source destfile type options} {
regsub "^compiler=" $i "" tmp
set compiler $tmp
}
+ if {[regexp "^early_flags=" $i]} {
+ regsub "^early_flags=" $i "" tmp
+ append early_flags " $tmp"
+ }
if {[regexp "^additional_flags=" $i]} {
regsub "^additional_flags=" $i "" tmp
append add_flags " $tmp"
@@ -473,15 +478,15 @@ proc gdb_default_target_compile {source destfile type options} {
# become confused about the name of the actual source file.
switch $type {
"object" {
- set opts "$add_flags $sources"
+ set opts "$early_flags $add_flags $sources"
}
"executable" {
switch $linker_opts_order {
"flags-then-sources" {
- set opts "$add_flags $sources"
+ set opts "$early_flags $add_flags $sources"
}
"sources-then-flags" {
- set opts "$sources $add_flags"
+ set opts "$early_flags $sources $add_flags"
}
default {
error "Invalid value for board_info linker_opts_order"
@@ -489,7 +494,7 @@ proc gdb_default_target_compile {source destfile type options} {
}
}
default {
- set opts "$sources $add_flags"
+ set opts "$early_flags $sources $add_flags"
}
}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 0805de9..ffc63a5 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3026,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