[commit] Fix gdb_compile shlib_load for OpenBSD
Mark Kettenis
mark.kettenis@xs4all.nl
Sun Sep 9 22:19:00 GMT 2007
OpenBSD doesn't need (and doesn't have) -ldl, and doesn't know about
$ORIGIN. So I fixed it with a special case.
While fixing this I found out that $objdir and $subdir aren't known
here. Rather than importing them with a global statement, I calculate
the directory from $dest.
Perhaps we should consider doing the same for the default case instead
of relying on $ORIGIN, since I'm not sure $ORIGIN is available on all
systems.
Committed as obvious.
Mark
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.1444
diff -u -p -r1.1444 ChangeLog
--- ChangeLog 9 Sep 2007 21:30:59 -0000 1.1444
+++ ChangeLog 9 Sep 2007 22:15:04 -0000
@@ -1,3 +1,9 @@
+2007-09-10 Mark Kettenis <kettenis@gnu.org>
+
+ * lib/gdb.exp (gdb_compile): OpenBSD doesn't need -dl, and doesn't
+ know about $ORIGIN. Calculate output dir from $dest instead of
+ using ${objdir}/{$subdir}.
+
2007-09-09 Mark Kettenis <kettenis@gnu.org>
* gdb.base/gcore-buffer-overflow.exp: Check whether gdb supports
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.87
diff -u -p -r1.87 gdb.exp
--- lib/gdb.exp 1 Sep 2007 08:16:16 -0000 1.87
+++ lib/gdb.exp 9 Sep 2007 22:15:05 -0000
@@ -1520,11 +1520,13 @@ 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 {
+ set outdir [file dirname $dest]
+
+ # 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
@@ -1542,9 +1544,9 @@ proc gdb_compile {source dest type optio
if { ([test_compiler_info "gcc-*"]
&& ([istarget "powerpc*-*-aix*"]
|| [istarget "rs6000*-*-aix*"] )) } {
- lappend options "additional_flags=-L${objdir}/${subdir}"
+ lappend options "additional_flags=-L${outdir}"
} elseif { [istarget "mips-sgi-irix*"] } {
- lappend options "additional_flags=-rpath ${objdir}/${subdir}"
+ lappend options "additional_flags=-rpath ${outdir}"
}
}
} elseif { $opt == "shlib_load" } {
@@ -1554,6 +1556,8 @@ proc gdb_compile {source dest type optio
|| [istarget arm*-*-symbianelf*]
|| [istarget hppa*-*-hpux*])} {
# Do not need anything.
+ } elseif { [istarget *-*-openbsd*] } {
+ lappend new_options "additional_flags=-Wl,-rpath,${outdir}"
} else {
lappend new_options "libs=-ldl"
lappend new_options "additional_flags=-Wl,-rpath,\\\$ORIGIN"
@@ -1561,8 +1565,8 @@ proc gdb_compile {source dest type optio
} else {
lappend new_options $opt
}
- }
- set options $new_options
+ }
+ set options $new_options
if [target_info exists gdb_stub] {
set options2 { "additional_flags=-Dusestubs" }
More information about the Gdb-patches
mailing list