This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

PATCH for dejagnu-980528


While looking into the problem that egcs testsuites can't find
libstdc++, I ran into a bug of dejagnu.

Appended a patch that fixes this problem.

Carlo Wood
-- 
 carlo@runaway.xs4all.nl

===============================================================================

Problem description:

In dejagnu/lib/libgloss.exp in proc get_multilibs, dejagnu searches for
the top level multilib directory by using `lookfor_file' relative to
$comp_base_dir on respectively "$target_alias", "libraries" and "gcc/xgcc".

Under normal circumstances, the directory that should be found for the
egcs package is "libraries".  However, dejagnu will ONLY find it when
the first try (looking for "$target_alias") fails.

The procedure `lookfor_file' descends the directory tree down to ../../..
and inadvertently finds "/usr/$target_alias", where "/usr" is a parent
directory of "$comp_base_dir".

Example values are as follows:

Suppose ${comp_base_dir} == /usr/src/egcs/egcs-cvs-objdir
        ${target_alias}  == i686-pc-linux-gnu
Then dejagnu-980528 will find "/usr/i686-pc-linux-gnu" of a previous install,
while it SHOULD find "/usr/src/egcs/egcs-cvs-objdir/libraries".

In order to let "/usr/src/egcs/egcs-cvs-objdir/libraries" have precedence
over "/usr/src/egcs/egcs-cvs-objdir/../../../i686-pc-linux-gnu" I think
that the number of '..' should be minimized.

It appears to me that "libraries" is a special case that will always happen
in "$comp_base_dir" directly anyway, or else at least earlier then
"$target_alias".

The proposed patch makes get_multilibs looks for the top level directory in
this order:

$comp_base_dir/$target_alias
$comp_base_dir/libraries
$comp_base_dir/gcc/xgcc		--> if found, return "$comp_base_dir"
$comp_base_dir/../$target_alias
$comp_base_dir/../libraries
$comp_base_dir/../gcc/xgcc	--> if found, return "$comp_base_dir/.."
$comp_base_dir/../../$target_alias
$comp_base_dir/../../libraries
$comp_base_dir/../../gcc/xgcc	--> if found, return "$comp_base_dir/../.."
$comp_base_dir/../../../$target_alias
$comp_base_dir/../../../libraries

Please let me know if this is acceptable for addition in your next snapshot.
Any suggestions welcome :).  CC me at carlo@runaway.xs4all.nl
as I am not subbed to this list.

Patch is tested and functional.

==============================================================================

diff -rc dejagnu-980528/dejagnu/lib/libgloss.exp dejagnu-980528.multitop/dejagnu/lib/libgloss.exp
*** dejagnu-980528/dejagnu/lib/libgloss.exp	Tue Apr 28 23:14:44 1998
--- dejagnu-980528.multitop/dejagnu/lib/libgloss.exp	Fri Jun 26 02:56:03 1998
***************
*** 428,444 ****
  
  
      # 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
--- 428,451 ----
  
  
      # search for the top level multilib directory
!     set dir $comp_base_dir
!     foreach i ".. ../.. ../../.. ../../../.." {
! 	if [file exists $dir/$target_alias] {
! 	    set multitop $dir/$target_alias
! 	    break;
  	}
+ 	if [file exists $dir/libraries] {
+ 	    set multitop $dir/libraries
+ 	    break;
+ 	}
+ 	if [file exists $dir/gcc/xgcc] {
+ 	    set multitop [file dirname [file dirname $dir/gcc/xgcc]];
+ 	    break;
+ 	}
+ 	if { $i == "../../../.." } {
+ 	    return ""
+ 	}
+ 	set dir [remote_file build dirname $dir];
      }
  
      # make a list of -m<foo> options from the various compiler config variables


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