This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 3/3] Use the tail name as the output name of compile.
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Wed, 10 Jul 2013 14:55:14 +0800
- Subject: [PATCH 3/3] Use the tail name as the output name of compile.
- References: <1373439314-14099-1-git-send-email-yao at codesourcery dot com>
Hi,
I find this error in gdb.log:
$ ./solib-symbol-main
/home/yqi/solib-symbol-main: error while loading shared libraries:
a.out: cannot open shared object file: No such file or directory
and it is caused by the compilation option '-o a.out',
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 a.out
The info of ld explains about '--out-implib' that the import lib
should be called '*.a'.
`--out-implib FILE'
The linker will create the file FILE which will contain an import
lib corresponding to the DLL the linker is generating. This import
lib (which should be called `*.dll.a' or `*.a' may be used to link
clients against the generated DLL; this behaviour makes it
possible to skip a separate `dlltool' import library creation step.
[This option is specific to the i386 PE targeted port of the
linker]
the fix is to change '-o a.out' to '-o solib-symbol-lib.so',
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
This is what this patch does.
gdb/testsuite:
2013-07-10 Yao Qi <yao@codesourcery.com>
* lib/future.exp (gdb_default_target_compile): Use tail name of
$destfile as the output name of compile. Move the generated
file to $destfile on build.
---
gdb/testsuite/lib/future.exp | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
index 9855fdc..5d53e93 100644
--- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp
@@ -419,8 +419,8 @@ proc gdb_default_target_compile {source destfile type options} {
}
if {[is_remote host]} {
- append add_flags " -o a.out"
- remote_file host delete a.out
+ append add_flags " -o " [file tail $destfile]
+ remote_file host delete [file tail $destfile]
} else {
if { $destfile != "" } {
append add_flags " -o $destfile"
@@ -478,8 +478,8 @@ proc gdb_default_target_compile {source destfile type options} {
set compiler_flags $opts
if {[is_remote host]} {
- remote_upload host a.out $destfile
- remote_file host delete a.out
+ remote_upload host [file tail $destfile] $destfile
+ remote_file host delete [file tail $destfile]
}
set comp_output [prune_warnings [lindex $status 1]]
regsub "^\[\r\n\]+" $comp_output "" comp_output
--
1.7.7.6