7b8bd72
http://sourceware.org/ml/gdb-patches/2010-03/msg01006.html
7b8bd72
Subject: [patch or FYI] testsuite: Fix prelink.exp on system w/unprelinked  system libs
7b8bd72
7b8bd72
Hi,
7b8bd72
7b8bd72
this is a more conservative variant superseded by:
7b8bd72
	[patch 4/6] testsuite: Unify to lib/prelink-support.exp
7b8bd72
	http://sourceware.org/ml/gdb-patches/2010-03/msg01002.html
7b8bd72
where gdb.base/prelink.exp is reworked on generic lib/prelink-support.exp.
7b8bd72
7b8bd72
I prefer the [patch 4/6] over this patch but this mail can serve also as an
7b8bd72
illustration of the current problem.
7b8bd72
7b8bd72
------------------------------------------------------------------------------
7b8bd72
7b8bd72
If your system for some reason currently does not have all the libraries
7b8bd72
prelinked gdb.base/prelink.exp will get UNRESOLVED randomly also affecting
7b8bd72
testsuite results diff.
7b8bd72
7b8bd72
Apparently the testcase already tried to avoid any system libraries
7b8bd72
dependencies by "-nodefaultlibs".  But currently it does has not worked that
7b8bd72
way.
7b8bd72
7b8bd72
"-lm" is contained already even in dejagnu's default_target_compile (not just
7b8bd72
in gdb/testsuite/lib/ada.exp).  But I do not know why it is there and which
7b8bd72
systems would get broken by some global gdb/testsuite/ "-lm" removal.
7b8bd72
7b8bd72
7b8bd72
Thanks,
7b8bd72
Jan
7b8bd72
7b8bd72
7b8bd72
2010-03-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
7b8bd72
7b8bd72
	Fix testcase false UNRESOLVED if system libraries are not prelinked.
7b8bd72
	* gdb.base/prelink.exp: New variables compile, board, err and mathlib.
7b8bd72
	Set clear board mathlib for ${libfile} compilation.
7b8bd72
7b8bd72
--- a/gdb/testsuite/gdb.base/prelink.exp
7b8bd72
+++ b/gdb/testsuite/gdb.base/prelink.exp
7b8bd72
@@ -42,7 +42,25 @@ set testfile "prelink"
7b8bd72
 
7b8bd72
 set libsrcfile ${testfile}-lib.c
7b8bd72
 set libfile ${objdir}/${subdir}/${testfile}.so
7b8bd72
-if { [gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]] != ""} {
7b8bd72
+
7b8bd72
+# default_target_compile would otherwise add "-lm" making the testcase
7b8bd72
+# dependent on whether the system libraries are already prelinked.
7b8bd72
+# prelink: Could not set /lib64/libm-2.11.1.so owner or mode: Operation not permitted
7b8bd72
+set compile {
7b8bd72
+    gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]
7b8bd72
+}
7b8bd72
+set board [target_info name]
7b8bd72
+if [board_info $board exists mathlib] {
7b8bd72
+    set mathlib [board_info $dest mathlib]
7b8bd72
+    set_board_info mathlib ""
7b8bd72
+    set err [eval $compile]
7b8bd72
+    set_board_info mathlib $mathlib
7b8bd72
+} else {
7b8bd72
+    set_board_info mathlib ""
7b8bd72
+    set err [eval $compile]
7b8bd72
+    unset_board_info mathlib
7b8bd72
+}
7b8bd72
+if {$err != ""} {
7b8bd72
     # If creating the shared library fails, maybe we don't have the right tools
7b8bd72
     return -1
7b8bd72
 }
7b8bd72