This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 2/3] Remove the directory of DEST in proc gdb_compile_shlib
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Wed, 10 Jul 2013 14:55:13 +0800
- Subject: [PATCH 2/3] Remove the directory of DEST in proc gdb_compile_shlib
- References: <1373439314-14099-1-git-send-email-yao at codesourcery dot com>
Hi,
In proc gdb_compile_shlib, ${dest} is the file path on build. It
makes no sense to pass the name to link option, like
'--out-implib,${dest}.a', because compilation and link is done on
host. We'll see the following error:
i686-mingw32-gcc.exe solib-symbol-lib.c.o -shared
-Wl,--out-implib,/scratch/yqi/i686-pc-linux-gnu-lite-trunk/mingw32-gdb/gdb/testsuite/gdb.base/solib-symbol-lib.so.a
-g -Wl,-Bsymbolic set_unbuffered_mode_saved.o -lm -o
solib-symbol-lib.so (timeout = 300)
Can't open .lib file:
/scratch/yqi/i686-pc-linux-gnu-lite-trunk/mingw32-gdb/gdb/testsuite/gdb.base/solib-symbol-lib.so.a^M^M
collect2.exe: error: ld returned 1 exit status
This patch gets rid of the path on build, only keeps the tail
name, and move the file to ${dest}.a on host.
With this patch applied, the compilation is ok now,
i686-mingw32-gcc.exe solib-symbol-lib.c.o -shared
-Wl,--out-implib,solib-symbol-lib.so.a -g -Wl,-Bsymbolic
set_unbuffered_mode_saved.o -lm -o solib-symbol-lib.so
gdb/testsuite:
2013-07-10 Yao Qi <yao@codesourcery.com>
* lib/gdb.exp (gdb_compile_shlib): Pass the tail name of $dest
to link options. Move the generated file to $dest.a on host.
---
gdb/testsuite/lib/gdb.exp | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 4541126..cd9d0c4 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2793,7 +2793,8 @@ proc gdb_compile_shlib {sources dest options} {
if { ([istarget "*-*-mingw*"]
|| [istarget *-*-cygwin*]
|| [istarget *-*-pe*])} {
- lappend link_options "additional_flags=-Wl,--out-implib,${dest}.a"
+ set name [file tail ${dest}]
+ lappend link_options "additional_flags=-Wl,--out-implib,${name}.a"
} elseif [is_remote target] {
# By default, we do not set the soname. This causes the linker
# on ELF systems to create a DT_NEEDED entry in the executable
@@ -2809,7 +2810,15 @@ proc gdb_compile_shlib {sources dest options} {
if {[gdb_compile "${objects}" "${dest}" executable $link_options] != ""} {
return -1
}
+ if { ([istarget "*-*-mingw*"]
+ || [istarget *-*-cygwin*]
+ || [istarget *-*-pe*])} {
+ set dest_tail_name [file tail ${dest}]
+ remote_upload host $dest_tail_name.a ${dest}.a
+ remote_file host delete $dest_tail_name.a
+ }
}
+ return ""
}
# This is just like gdb_compile_shlib, above, except that it tries compiling
--
1.7.7.6