* [patch] Allow compilation by IBM's xlc compiler @ 2005-04-01 22:43 Paul Gilliam 2005-04-01 22:45 ` Daniel Jacobowitz 0 siblings, 1 reply; 7+ messages in thread From: Paul Gilliam @ 2005-04-01 22:43 UTC (permalink / raw) To: gdb-patches ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] Allow compilation by IBM's xlc compiler 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 0 siblings, 1 reply; 7+ messages in thread From: Daniel Jacobowitz @ 2005-04-01 22:45 UTC (permalink / raw) To: Paul Gilliam; +Cc: gdb-patches On Fri, Apr 01, 2005 at 02:40:16PM -0800, Paul Gilliam wrote: > > Several of your mails have been empty - not useful. Also, they could all do with a little explanation. The patches for -shared are not great. I posted a testcase (several months ago, for a patch which is still pending) which moved the PIC/shared tests to lib/gdb.exp. One of us should dust off that patch if you need to add cases to every one of them. -- Daniel Jacobowitz CodeSourcery, LLC ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] Allow compilation by IBM's xlc compiler 2005-04-01 22:45 ` Daniel Jacobowitz @ 2005-04-01 23:07 ` Paul Gilliam 2005-04-01 23:13 ` Daniel Jacobowitz 0 siblings, 1 reply; 7+ messages in thread From: Paul Gilliam @ 2005-04-01 23:07 UTC (permalink / raw) To: gdb-patches On Friday 01 April 2005 14:45, Daniel Jacobowitz wrote: > On Fri, Apr 01, 2005 at 02:40:16PM -0800, Paul Gilliam wrote: > > > > > > Several of your mails have been empty - not useful. Please don't exagerate: it's only 40% 8-) > Also, they could all do with a little explanation. I thought the subject was enough, but if you want more detail, I can do that. Basicly we're just trying to get the testsuite to run with the IBM xlc compiler. For the most part, it's just renameing the flags: -qmkshrobj for -shared, -qpic for -fpic and that kind of thing. In one case, xlc was puting out a warning that gcc doesn't and that had be turned off. > The patches for -shared are not great. I posted a testcase (several > months ago, for a patch which is still pending) which moved the > PIC/shared tests to lib/gdb.exp. One of us should dust off that patch > if you need to add cases to every one of them. > Could you give me a URL to your testsuite patch? I have 6 or so of these so If you have a better way, I'd love to use it. Thanks, -=# Paul #=- ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] Allow compilation by IBM's xlc compiler 2005-04-01 23:07 ` Paul Gilliam @ 2005-04-01 23:13 ` Daniel Jacobowitz 2005-04-06 17:52 ` [patch] add testsuite infrastructure to deal with shared libraries Paul Gilliam 0 siblings, 1 reply; 7+ messages in thread From: Daniel Jacobowitz @ 2005-04-01 23:13 UTC (permalink / raw) To: gdb-patches On Fri, Apr 01, 2005 at 03:03:35PM -0800, Paul Gilliam wrote: > On Friday 01 April 2005 14:45, Daniel Jacobowitz wrote: > > On Fri, Apr 01, 2005 at 02:40:16PM -0800, Paul Gilliam wrote: > > > > > > > > > > Several of your mails have been empty - not useful. > > Please don't exagerate: it's only 40% 8-) They were still coming in when I wrote that :-) > > Also, they could all do with a little explanation. > > I thought the subject was enough, but if you want more detail, I can do that. > Basicly we're just trying to get the testsuite to run with the IBM xlc compiler. > For the most part, it's just renameing the flags: -qmkshrobj for -shared, > -qpic for -fpic and that kind of thing. In one case, xlc was puting out a warning > that gcc doesn't and that had be turned off. Explanations with the patch, please. No exceptions. I want to be able to look back in the archives and understand why a patch was needed. > > The patches for -shared are not great. I posted a testcase (several > > months ago, for a patch which is still pending) which moved the > > PIC/shared tests to lib/gdb.exp. One of us should dust off that patch > > if you need to add cases to every one of them. > > > > Could you give me a URL to your testsuite patch? I have 6 or so of these so If > you have a better way, I'd love to use it. http://sources.redhat.com/ml/gdb-patches/2004-11/msg00538.html The testcase should wait until the patch it's testing is reviewed, but you can use the lib/gdb.exp bits. -- Daniel Jacobowitz CodeSourcery, LLC ^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch] add testsuite infrastructure to deal with shared libraries 2005-04-01 23:13 ` Daniel Jacobowitz @ 2005-04-06 17:52 ` Paul Gilliam 2005-04-12 18:25 ` [patch] add testsuite infrastructure to deal with shared libraries (now supports IBM's xlc compiler) Paul Gilliam 0 siblings, 1 reply; 7+ messages in thread From: Paul Gilliam @ 2005-04-06 17:52 UTC (permalink / raw) To: gdb-patches; +Cc: Daniel Jacobowitz 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 } { ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] add testsuite infrastructure to deal with shared libraries (now supports IBM's xlc compiler) 2005-04-06 17:52 ` [patch] add testsuite infrastructure to deal with shared libraries Paul Gilliam @ 2005-04-12 18:25 ` Paul Gilliam 2005-04-14 19:07 ` Daniel Jacobowitz 0 siblings, 1 reply; 7+ messages in thread From: Paul Gilliam @ 2005-04-12 18:25 UTC (permalink / raw) To: gdb-patches; +Cc: Daniel Jacobowitz On Wednesday 06 April 2005 10:49, Paul Gilliam wrote: > 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? Here is a new version of the patch. This version allows for using IBM's xlc compiler. Ok to commit? -=# Paul #=- 2005-04-12 Paul Gilliam <pgilliam@us.ibm.com> * lib/gdb.exp (gdb_compile) (gdb_compile_shlib)(NEW): Add infrustructure for building and using shared libraries Index: lib/gdb.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.59 diff -c -3 -p -r1.59 gdb.exp *** lib/gdb.exp 6 Apr 2005 21:38:48 -0000 1.59 --- lib/gdb.exp 11 Apr 2005 22:10:07 -0000 *************** proc gdb_compile {source dest type optio *** 1335,1340 **** --- 1335,1369 ---- 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]"; *************** proc gdb_compile_pthreads {source dest t *** 1405,1410 **** --- 1434,1497 ---- } } + # 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} { ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] add testsuite infrastructure to deal with shared libraries (now supports IBM's xlc compiler) 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 0 siblings, 0 replies; 7+ messages in thread From: Daniel Jacobowitz @ 2005-04-14 19:07 UTC (permalink / raw) To: Paul Gilliam; +Cc: gdb-patches On Tue, Apr 12, 2005 at 10:23:27AM -0800, Paul Gilliam wrote: > On Wednesday 06 April 2005 10:49, Paul Gilliam wrote: > > 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? By listing more than one name in the changelog, like this. You haven't got the knack of GNU changelogs quite down yet... 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. > + set link_options options That ought to be $options. Note that this is my bug from the original posting. I'm checking in the attached, which includes that and a formatting fix. -- Daniel Jacobowitz CodeSourcery, LLC 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. Index: lib/gdb.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.60 diff -u -p -r1.60 gdb.exp --- lib/gdb.exp 12 Apr 2005 20:14:35 -0000 1.60 +++ lib/gdb.exp 14 Apr 2005 19:05:24 -0000 @@ -1335,6 +1335,35 @@ proc gdb_compile {source dest type optio 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 t } } +# 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} { ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-04-14 19:07 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 ` [patch] add testsuite infrastructure to deal with shared libraries Paul Gilliam 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox