diff options
author | Gary Benson <gbenson@redhat.com> | 2020-11-02 14:19:29 +0000 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2020-11-02 14:19:29 +0000 |
commit | 1c2bec1918cee91221bccc30db4f0253dc31d1b7 (patch) | |
tree | 162fcbf282fcb4d5b6b08cac316b0c32583d8490 /gdb | |
parent | 6539a36d0e1a949f66ee2d58bb16c8db133c96a5 (diff) | |
download | fsf-binutils-gdb-1c2bec1918cee91221bccc30db4f0253dc31d1b7.zip fsf-binutils-gdb-1c2bec1918cee91221bccc30db4f0253dc31d1b7.tar.gz fsf-binutils-gdb-1c2bec1918cee91221bccc30db4f0253dc31d1b7.tar.bz2 |
Fix gdb.base/print-file-var.exp with Clang
The C++ parts of gdb.base/print-file-var.exp failed to build with
Clang because the "-x c++" option added by gdb_compile caused the
compiler to attempt to parse .so files as C++. This commit splits
the compiler and linker options into separate lists, and switches
to building via build_executable_from_specs which can accommodate
this separation.
gdb/testsuite/ChangeLog:
* gdb.base/print-file-var.exp (test): Separate compiler and
linker options, and build using build_executable_from_specs
to accommodate this.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/print-file-var.exp | 18 |
2 files changed, 16 insertions, 8 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 330a5eb..6948378 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2020-11-02 Gary Benson <gbenson@redhat.com> + * gdb.base/print-file-var.exp (test): Separate compiler and + linker options, and build using build_executable_from_specs + to accommodate this. + +2020-11-02 Gary Benson <gbenson@redhat.com> + * lib/gdb.exp (gdb_compile): Inhibit passing "-x c++" for .c files compiled as C++ with Clang if any shared libraries are specified. diff --git a/gdb/testsuite/gdb.base/print-file-var.exp b/gdb/testsuite/gdb.base/print-file-var.exp index 22df9f1..62e5f23 100644 --- a/gdb/testsuite/gdb.base/print-file-var.exp +++ b/gdb/testsuite/gdb.base/print-file-var.exp @@ -56,22 +56,24 @@ proc test {hidden dlopen version_id_main lang} { return -1 } - set main_opts [list debug shlib=${libobj1} $lang] + set main_opts [list debug $lang] + set link_opts [list debug shlib=${libobj1}] if {$dlopen} { - lappend main_opts "shlib_load" \ - "additional_flags=-DSHLIB_NAME=\"$libobj2\"" + lappend main_opts "additional_flags=-DSHLIB_NAME=\"$libobj2\"" + lappend link_opts "shlib_load" } else { - lappend main_opts "shlib=${libobj2}" + lappend link_opts "shlib=${libobj2}" } lappend main_opts "additional_flags=-DVERSION_ID_MAIN=$version_id_main" - if { [gdb_compile "${srcdir}/${subdir}/${main}.c" \ - [standard_output_file ${executable}] \ - executable \ + if { [build_executable_from_specs ${main} \ + $executable \ + $link_opts \ + ${main}.c \ $main_opts] - != ""} { + != 0 } { return -1 } |