Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Paul Gilliam <pgilliam@us.ibm.com>
To: gdb-patches@sources.redhat.com
Cc: Daniel Jacobowitz <drow@false.org>
Subject: [patch] add testsuite infrastructure to deal with shared libraries
Date: Wed, 06 Apr 2005 17:52:00 -0000	[thread overview]
Message-ID: <200504061049.10971.pgilliam@us.ibm.com> (raw)
In-Reply-To: <20050401231259.GA3382@nevyn.them.org>

This patch is a slightly tweeked version of a part of this patch:
	http://sources.redhat.com/ml/gdb-patches/2004-11/msg00538.html

The first part of the patch modifies 'gdb_compile' to add platform-specific options to
'target_compile' if a shared library was specified using "shlib=librarypath" in the options
argument to 'gdb_compile'.

The second part of the patch adds the new proc 'gdb_compile_shlib' which is used to 
build shared libraries in platform-specific ways.

The tweek is to use 'test_compile_info' instead of $gcc_compiled.

-=# Paul #=-
PS: How do I indicate in the change log that this is really the work of  Daniel Jacobowitz?
--

04-06-2005  Paul Gilliam  <pgilliam@us.ibm.com>

	* testsuite/lib/gdb.exp: Add infrastructure for share libs:
        (gdb_compile): Handle shlib=.  (gdb_compile_shlib): New function.


Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.58
diff -c -3 -p -r1.58 gdb.exp
*** lib/gdb.exp	10 Sep 2004 01:04:59 -0000	1.58
--- lib/gdb.exp	6 Apr 2005 17:23:15 -0000
*************** proc gdb_compile {source dest type optio
*** 1324,1329 ****
--- 1324,1352 ----
      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] {
+            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]";
*************** proc gdb_compile_objc {source dest type 
*** 1434,1439 ****
--- 1457,1506 ----
      }
  }
  
+ # Build a shared library from SOURCES.  You must use get_compiler_info
+ # first.
+ 
+ proc gdb_compile_shlib {sources dest options} {
+     global gcc_compiled
+ 
+     set obj_options $options
+     if { ! [test_compiler_info "gcc-*"]} {
+        if [istarget "hppa*-hp-hpux*"] then {
+            lappend obj_options "additional_flags=+z"
+        } elseif { [istarget "mips-sgi-irix*"] } {
+            # Disable SGI compiler's implicit -Dsgi
+            lappend obj_options "additional_flags=-Usgi"
+        } else {
+            # don't know what the compiler is...
+        }
+     } else {
+        if { !([istarget "powerpc*-*-aix*"]
+               || [istarget "rs6000*-*-aix*"]) } {
+            lappend obj_options "additional_flags=-fpic"
+        }
+     }
+ 
+     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
+        lappend link_options "additional_flags=-shared"
+        if {[gdb_compile "${objects}" "${dest}" executable $link_options] != ""} {
+            return -1
+        }
+     }
+ }
+ 
  proc send_gdb { string } {
      global suppress_flag;
      if { $suppress_flag } {


  reply	other threads:[~2005-04-06 17:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-01 22:43 [patch] Allow compilation by IBM's xlc compiler Paul Gilliam
2005-04-01 22:45 ` Daniel Jacobowitz
2005-04-01 23:07   ` Paul Gilliam
2005-04-01 23:13     ` Daniel Jacobowitz
2005-04-06 17:52       ` Paul Gilliam [this message]
2005-04-12 18:25         ` [patch] add testsuite infrastructure to deal with shared libraries (now supports IBM's xlc compiler) Paul Gilliam
2005-04-14 19:07           ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200504061049.10971.pgilliam@us.ibm.com \
    --to=pgilliam@us.ibm.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox