[PATCH 1/2] Use -fno-asynchronous-unwind-tables if C program is compiled without debug info on x86

Yao Qi
2016-04-19T07:50:52Z

.eh_frame is added in default on x86 and x86_64 so that DWARF unwinder
is always used, but prologue unwinders won't be used at all. IOW,
prologue unwinders are not tested by regression tests. If the test is
intended to compiled *without* debug info, we shouldn't generate any
debug info (.eh_frame for example) at all.

This patch is to disable async-unwind-tables generation if the C program
is intended to compile without debug info on x86-like target.

gdb/testsuite:

2016-04-18 Pierre Langlois <pierre.langlois@arm.com>
Yao Qi <yao.qi@linaro.org>

PR gdb/19947
* lib/gdb.exp (gdb_compile): Append
"additional_flags=-fno-asynchronous-unwind-tables" if C program
is compiled without debug info on x86.
---
gdb/testsuite/lib/gdb.exp | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 0d8a3b0..5b789af 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3419,6 +3419,15 @@ proc gdb_compile {source dest type options} {
set options [lreplace $options $nowarnings $nowarnings $flag]
}

+ if {([lsearch -exact $options debug] == -1
+ || [lsearch -exact $options nodebug] != -1)
+ && ([istarget "i?86-*-*"] || [istarget "x86_64-*-*"])
+ && ([lsearch -regexp $options {(c\+\+|ada|f77|f90)}] == -1) } {
+ # C program is intended to compile without debug information
+ # on x86 target.
+ lappend options "additional_flags=-fno-asynchronous-unwind-tables"
+ }
+
if { $type == "executable" } {
if { ([istarget "*-*-mingw*"]
|| [istarget "*-*-*djgpp"]
--
1.9.1