This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

dejagnu: multilib detection improvement


It appears that dejagnu's multilib detection was implemented a very
long time ago, way before GCC supported -print-multi-directory, so it
had to duplicate the techniques used by GCC to decide which multilib
directory to use.  Unfortunately, a number of new features have gone
into GCC's multilibbing features, that made dejagnu's multilib
inference code incorrect.  I had one case in which some default
options, that was mapped by MULTILIB_REDUNDANT_DIRS to a certain
multilib, but that dejagnu insisted on using a different multilib
directory for.

Instead of trying to improve dejagnu's multilib inference engine, I
just arranged for it to use GCC.

I'm checking this into sources.redhat.com, but I hope it can make it
to the GNU CVS tree of dejagnu too.

Index: dejagnu/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* lib/libgloss.exp [get_multilibs]: Compute multitop earlier, and
	use --print-multi-directory if available.

Index: dejagnu/lib/libgloss.exp
===================================================================
RCS file: /cvs/src/src/dejagnu/lib/libgloss.exp,v
retrieving revision 1.5
diff -u -p -r1.5 libgloss.exp
--- dejagnu/lib/libgloss.exp 2002/02/05 17:01:59 1.5
+++ dejagnu/lib/libgloss.exp 2002/02/09 02:03:27
@@ -453,6 +453,30 @@ proc get_multilibs { args } {
 	set comp_base_dir [file dirname [file dirname [file dirname [file dirname [file dirname [exec $compiler --print-prog-name=cc1]]]]]];
     }
 
+    # search for the top level multilib directory
+    set multitop [lookfor_file "${comp_base_dir}" "${target_alias}"]
+    if { $multitop == "" } {
+	set multitop [lookfor_file "${comp_base_dir}" "libraries"]
+	if { $multitop == "" } {
+	    set multitop "[lookfor_file ${comp_base_dir} gcc/xgcc]"
+	    if { $multitop != "" } {
+		set multitop [file dirname [file dirname $multitop]];
+	    } else {
+		return ""
+	    }
+	}
+    }
+
+    set gccpath [eval exec "$compiler" --print-multi-directory $mopts];
+    set gccpath [lindex $gccpath 0];
+    if { $gccpath != "" } {
+	verbose "GCC path is $gccpath";
+	if { [llength $args] == 0 } {
+	    set board_info($target_board,multitop) "$multitop/$gccpath"
+	}
+	return "$multitop/$gccpath";
+    }
+
     # set output [exec $objdump_name --file-headers objfmtst.o ]
     set default_multilib [exec $compiler --print-multi-lib]
     set default_multilib [lindex $default_multilib 0];
@@ -506,20 +530,6 @@ proc get_multilibs { args } {
 	    }
 	}
 	verbose "options after multimatches: $moptions" 3
-    }
-
-    # search for the top level multilib directory
-    set multitop [lookfor_file "${comp_base_dir}" "${target_alias}"]
-    if { $multitop == "" } {
-	set multitop [lookfor_file "${comp_base_dir}" "libraries"]
-	if { $multitop == "" } {
-	    set multitop "[lookfor_file ${comp_base_dir} gcc/xgcc]"
-	    if { $multitop != "" } {
-		set multitop [file dirname [file dirname $multitop]];
-	    } else {
-		return ""
-	    }
-	}
     }
 
     # make a list of -m<foo> options from the various compiler config variables

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]