aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp4
-rw-r--r--gdb/testsuite/lib/gdb.exp9
2 files changed, 11 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
index 9bffb33..b57b320 100644
--- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
+++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
@@ -32,12 +32,12 @@ if { [catch {file copy -force ${srcdir}/${subdir}/${srcfile} \
return -1
}
-if { [gdb_compile "$sourcetmp" "$binfile" executable {debug}] != "" } {
+if { [gdb_compile "$sourcetmp" "$binfile" executable {debug build-id}] != "" } {
untested "failed to compile"
return -1
}
-if { [gdb_compile "$sourcetmp" "${binfile}2" executable {debug}] != "" } {
+if { [gdb_compile "$sourcetmp" "${binfile}2" executable {debug build-id}] != "" } {
fail "compile"
return -1
}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 042d7ad..a05b14b 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4685,6 +4685,7 @@ set gdb_saved_set_unbuffered_mode_obj ""
# - macros: Add the required compiler flag to include macro information in
# debug information
# - text_segment=addr: Tell the linker to place the text segment at ADDR.
+# - build-id: Ensure the final binary includes a build-id.
#
# And here are some of the not too obscure options understood by DejaGnu that
# influence the compilation:
@@ -4747,6 +4748,14 @@ proc gdb_compile {source dest type options} {
}
}
+ # If the 'build-id' option is used, then ensure that we generate a
+ # build-id. GCC does this by default, but Clang does not, so
+ # enable it now.
+ if {[lsearch -exact $options build-id] > 0
+ && [test_compiler_info "clang-*"]} {
+ lappend new_options "additional_flags=-Wl,--build-id"
+ }
+
# Treating .c input files as C++ is deprecated in Clang, so
# explicitly force C++ language.
if { !$getting_compiler_info