summaryrefslogtreecommitdiffstats
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2005-04-14 19:06:19 +0000
committerDaniel Jacobowitz <drow@false.org>2005-04-14 19:06:19 +0000
commit57bf0e56f8f2f0fad9ab6c562cb2f7fbc8fea257 (patch)
tree0b8a96713f182ac35d2ac88d2c95366cb93d2ffd /gdb/testsuite
parent64efe6255e659a2aee0d19d631c0142b09e85463 (diff)
downloadppe42-binutils-57bf0e56f8f2f0fad9ab6c562cb2f7fbc8fea257.tar.gz
ppe42-binutils-57bf0e56f8f2f0fad9ab6c562cb2f7fbc8fea257.zip
* lib/gdb.exp (gdb_compile): Handle shlib=.
(gdb_compile_shlib): New function.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/lib/gdb.exp86
2 files changed, 92 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 3962865266..aa01056bed 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-14 Paul Gilliam <pgilliam@us.ibm.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+
+ * lib/gdb.exp (gdb_compile): Handle shlib=.
+ (gdb_compile_shlib): New function.
+
2005-04-12 Paul Gilliam <pgilliam@us.ibm.com>
* lib/gdb.exp (test_compiler_info): Give argument a default value.
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index a41ab3c9f8..ce9d6f1e69 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1335,6 +1335,35 @@ proc gdb_compile {source dest type options} {
global gdb_wrapper_flags;
global gdb_wrapper_initialized;
+ # Add platform-specific options if a shared library was specified using
+ # "shlib=librarypath" in OPTIONS.
+ set new_options ""
+ set shlib_found 0
+ foreach opt $options {
+ if [regexp {^shlib=(.*)} $opt dummy_var shlib_name] {
+ if [test_compiler_info "xlc-*"] {
+ # IBM xlc compiler doesn't accept shared library named other
+ # than .so: use "-Wl," to bypass this
+ lappend source "-Wl,$shlib_name"
+ } else {
+ lappend source $shlib_name
+ }
+ if {$shlib_found == 0} {
+ set shlib_found 1
+ if { ([test_compiler_info "gcc-*"]
+ && ([istarget "powerpc*-*-aix*"]
+ || [istarget "rs6000*-*-aix*"] )) } {
+ lappend options "additional_flags=-L${objdir}/${subdir}"
+ } elseif { [istarget "mips-sgi-irix*"] } {
+ lappend options "additional_flags=-rpath ${objdir}/${subdir}"
+ }
+ }
+ } else {
+ lappend new_options $opt
+ }
+ }
+ set options $new_options
+
if [target_info exists gdb_stub] {
set options2 { "additional_flags=-Dusestubs" }
lappend options "libs=[target_info gdb_stub]";
@@ -1405,6 +1434,63 @@ proc gdb_compile_pthreads {source dest type options} {
}
}
+# Build a shared library from SOURCES. You must use get_compiler_info
+# first.
+
+proc gdb_compile_shlib {sources dest options} {
+ set obj_options $options
+
+ switch -glob [test_compiler_info] {
+ "xlc-*" {
+ lappend obj_options "additional_flags=-qpic"
+ }
+ "gcc-*" {
+ if { !([istarget "powerpc*-*-aix*"]
+ || [istarget "rs6000*-*-aix*"]) } {
+ lappend obj_options "additional_flags=-fpic"
+ }
+ }
+ default {
+ switch -glob [istarget] {
+ "hppa*-hp-hpux*" {
+ lappend obj_options "additional_flags=+z"
+ }
+ "mips-sgi-irix*" {
+ # Disable SGI compiler's implicit -Dsgi
+ lappend obj_options "additional_flags=-Usgi"
+ }
+ default {
+ # don't know what the compiler is...
+ }
+ }
+ }
+ }
+
+ set outdir [file dirname $dest]
+ set objects ""
+ foreach source $sources {
+ set sourcebase [file tail $source]
+ if {[gdb_compile $source "${outdir}/${sourcebase}.o" object $obj_options] != ""} {
+ return -1
+ }
+ lappend objects ${outdir}/${sourcebase}.o
+ }
+
+ if [istarget "hppa*-*-hpux*"] {
+ remote_exec build "ld -b ${objects} -o ${dest}"
+ } else {
+ set link_options $options
+ if [test_compiler_info "xlc-*"] {
+ lappend link_options "additional_flags=-qmkshrobj"
+ } else {
+ lappend link_options "additional_flags=-shared"
+ }
+ if {[gdb_compile "${objects}" "${dest}" executable $link_options] != ""} {
+ return -1
+ }
+ }
+}
+
# This is just like gdb_compile_pthreads, above, except that we always add the
# objc library for compiling Objective-C programs
proc gdb_compile_objc {source dest type options} {
OpenPOWER on IntegriCloud