dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] --tool_opts confuses get_multilibs


From: Adam Nemet
Subject: [PATCH] --tool_opts confuses get_multilibs
Date: 21 Oct 2002 21:13:20 -0700
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley)

Hi,

I ran into a libgloss problem while I was trying to test g++ with
multilibs together with --tool_opts -pipe.

When runtest.exp is invoked, it places the parameter of --tool_opt*
into a global variable TOOLS_OPTIONS which later gets passed to
get_multilibs in g++.exp.  If the argument of get_multilibs (args)
contains any options then that overrides the multilib options from the
board_info.  In turn, if that option is not a multilib option
get_multilibs will return the default multilibs.

For example in my case, I was trying to test with the Thumb multilibs:

  make check-g++//arm-sim/-mthumb RUNTESTFLAGS="--tool_opts -pipe"

And I ended up linking to the ARM version of libstdc++.

After the patch, get_multilibs does not override the multilib option
unless the --tool_opts is a valid multilib option.  Most of change is
just moving code around but unfortunately the diff below does not show
this really well.

The part where $compiler is determined was moved closer to the
beginning of the function along with the foreach loop that iterates
through the multilib options.  The only real change is in the body of
the loop where I finalize the value of the multilib option ($mopts).

Please apply the patch if it is acceptable.

Adam

2002-10-21  Adam Nemet  <address@hidden>

        * libgloss.exp (get_multilibs): Don't use the first argument
        passed to this function as the multilib option unless it is in
        fact a multilib option.

Index: libgloss.exp
===================================================================
RCS file: /cvs/src/src/dejagnu/lib/libgloss.exp,v
retrieving revision 1.9
diff -c -p -r1.9 libgloss.exp
*** libgloss.exp        26 Sep 2002 09:50:03 -0000      1.9
--- libgloss.exp        22 Oct 2002 03:06:14 -0000
*************** proc get_multilibs { args } {
*** 422,434 ****
            break;
        }
      }
!     if { [llength $args] > 0 } {
!       set mopts [lindex $args 0];
      } else {
!       if { [board_info $target_board exists multilib_flags] } {
!           set mopts [board_info $target_board multilib_flags];
!       } else {
!           set mopts ""
        }
      }
  
--- 422,471 ----
            break;
        }
      }
! 
!     regexp "/.* " $compiler compiler
!     set compiler [string trimright $compiler " "]
!     verbose "compiler is $compiler"
! 
!     if { [which $compiler] == 0 } {
!       return "";
!     }
! 
!     if { [board_info $target_board exists multilib_flags] } {
!       set mopts [board_info $target_board multilib_flags];
      } else {
!       set mopts ""
!     }
! 
!     set default_multilib [exec $compiler --print-multi-lib]
!     set default_multilib [lindex $default_multilib 0];
!     set extra [string trimleft $default_multilib ".;@@"]
! 
!     # extract the options and their directory names as know by gcc
!     foreach i "[exec $compiler --print-multi-lib]" {
!       if {$extra != ""} {
!           # string trimright would do the wrong thing if we included
!           # the leading @@ in $extra
!         set i [string trimright $i $extra"]
!           set i [string trimright $i "@@"];
!       }
!       set opts ""
!       set dir ""
!       regexp -- "\[a-z0-9=/\.-\]*;" $i dir
!       set dir [string trimright $dir "\;@"]
!       regexp -- "\;@address@hidden/\.-\]*" $i opts
!       set opts [split [string trimleft $opts "\;@@"] "@@"]
!       lappend multilibs "$dir {$opts }"
! 
!       # If args contains arguments don't use the first one as the
!       # multilib option unless it qualifies as a valid multilib option.
!       if { [llength $args] > 0 } {
!           set override_opt [lindex $args 0]
!           foreach j $opts {
!               if {$j == $override_opt} {
!                   set mopts $override_opt
!               }
!           }
        }
      }
  
*************** proc get_multilibs { args } {
*** 441,454 ****
        }
      }
  
-     regexp "/.* " $compiler compiler
-     set compiler [string trimright $compiler " "]
-     verbose "compiler is $compiler"
- 
-     if { [which $compiler] == 0 } {
-       return "";
-     }
- 
      if ![info exists comp_base_dir] {
        set comp_base_dir [file dirname [file dirname [file dirname [file 
dirname [file dirname [exec $compiler --print-prog-name=cc1]]]]]];
      }
--- 478,483 ----
*************** proc get_multilibs { args } {
*** 475,502 ****
            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];
-     set extra [string trimleft $default_multilib ".;@@"]
- 
-     # extract the options and their directory names as know by gcc
-     foreach i "[exec $compiler --print-multi-lib]" {
-       if {$extra != ""} {
-           # string trimright would do the wrong thing if we included
-           # the leading @@ in $extra
-         set i [string trimright $i $extra"]
-           set i [string trimright $i "@@"]
-       }
-       set opts ""
-       set dir ""
-       regexp -- "\[a-z0-9=/\.-\]*;" $i dir
-       set dir [string trimright $dir "\;@"]
-       regexp -- "\;@address@hidden/\.-\]*" $i opts
-       set opts [split [string trimleft $opts "\;@@"] "@@"]
-       lappend multilibs "$dir {$opts }"
      }
  
      # extract the MULTILIB_MATCHES from dumpspecs
--- 504,509 ----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]