diff options
author | Tom de Vries <tdevries@suse.de> | 2020-12-13 16:25:19 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2020-12-13 16:25:19 +0100 |
commit | a406a98e6e061ac865747ac2d2ba73a2ecaab081 (patch) | |
tree | 338e7c51987343dd43adb3a6ec9ca352ceca3747 /gdb/testsuite/lib | |
parent | 5d7e6ed0bd0ec0d4663e55b28e6fbdca2cb798e1 (diff) | |
download | gdb-a406a98e6e061ac865747ac2d2ba73a2ecaab081.zip gdb-a406a98e6e061ac865747ac2d2ba73a2ecaab081.tar.gz gdb-a406a98e6e061ac865747ac2d2ba73a2ecaab081.tar.bz2 |
[gdb/testsuite] Handle ada in gdb_compile_shlib
The single test-case in the testsuite that creates an ada shared library is
gdb.ada/catch_ex_std.exp.
The test-case does use gdb_compile_shlib, but with a few tweaks that make sure
things are properly handled for ada.
Move the ada-specific code to gdb_compile_shlib, such that gdb_compile_sh can
be used for ada shared libs without tweaks.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-12-13 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (gdb_compile_shlib): Handle ada.
* gdb.ada/catch_ex_std.exp: Use gdb_compile_shlib to compile from
source to shared lib. Add ada to options.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index f2954fd..e413bab 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -4286,6 +4286,11 @@ proc gdb_compile_pthreads {source dest type options} { proc gdb_compile_shlib {sources dest options} { set obj_options $options + set ada 0 + if { [lsearch -exact $options "ada"] >= 0 } { + set ada 1 + } + set info_options "" if { [lsearch -exact $options "c++"] >= 0 } { set info_options "c++" @@ -4324,19 +4329,45 @@ proc gdb_compile_shlib {sources dest options} { set outdir [file dirname $dest] set objects "" foreach source $sources { - set sourcebase [file tail $source] if {[file extension $source] == ".o"} { # Already a .o file. lappend objects $source - } elseif {[gdb_compile $source "${outdir}/${sourcebase}.o" object \ - $obj_options] != ""} { - return -1 + continue + } + + set sourcebase [file tail $source] + + if { $ada } { + # Gnatmake doesn't like object name foo.adb.o, use foo.o. + set sourcebase [file rootname $sourcebase] + } + set object ${outdir}/${sourcebase}.o + + if { $ada } { + # Use gdb_compile_ada_1 instead of gdb_compile_ada to avoid the + # PASS message. + if {[gdb_compile_ada_1 $source $object object \ + $obj_options] != ""} { + return -1 + } } else { - lappend objects ${outdir}/${sourcebase}.o + if {[gdb_compile $source $object object \ + $obj_options] != ""} { + return -1 + } } + + lappend objects $object } set link_options $options + if { $ada } { + # If we try to use gnatmake for the link, it will interpret the + # object file as an .adb file. Remove ada from the options to + # avoid it. + set idx [lsearch $link_options "ada"] + set link_options [lreplace $link_options $idx $idx] + } if [test_compiler_info "xlc-*"] { lappend link_options "additional_flags=-qmkshrobj" } else { |