This is an update to the multi-sim.patch to make it more flexible when searching for the dynamic linker and system libraries. This change uses '--print-search-dirs' to find directories to search instead of '--print-sysroot' because using the latter still meant you had to know where to look under the sysroot (lib or usr/lib for example). We (Imagination) are making some changes in the sysroot layout for the GCC toolchain we build and having multi-sim.exp be more flexible allows us to support both the old and new layouts with the same baseboard when testing.
Steve Ellcey sell...@imgtec.com 2015-05-11 Steve Ellcey <sell...@imgtec.com> * baseboards/multi-sim.exp (get_library_dirlist): New proc. (dynamic_linker_flag): Use get_library_dirlist to find dynamic linker. (rpath_flags): Use get_library_dirlist to set rpath. diff --git a/baseboards/multi-sim.exp b/baseboards/multi-sim.exp index c588fd7..bf79118 100644 --- a/baseboards/multi-sim.exp +++ b/baseboards/multi-sim.exp @@ -40,25 +40,38 @@ load_generic_config "sim" # basic-sim.exp is a basic description for the standard Cygnus simulator. load_base_board_description "basic-sim" +proc get_library_dirlist { args } { + global board + set compiler "[board_info $board compiler]" + set mflags "[board_info $board multilib_flags]" + set result [remote_exec host "$compiler $mflags --print-search-dirs"] + set regresult [regexp {(libraries: =)(\S*)} $result dummy1 dummy2 libdirlist] + if {$regresult == 0} { + perror "Could not find compilers library search path." + } + return [split $libdirlist :] +} + proc dynamic_linker_flag { args } { global board set compiler "[board_info $board compiler]" set mflags "[board_info $board multilib_flags]" - set result [remote_exec host "$compiler $mflags --print-sysroot"] - set output [lindex $result 1] - set toutput [string trimright $output] - set dynlinkerdir "$toutput/usr/lib" - set dynlinker [glob -directory $dynlinkerdir ld-*.so] + set searchdirs [get_library_dirlist] + foreach i $searchdirs { + set dynlinker [glob -nocomplain -directory $i ld-*.so] + if { $dynlinker != "" } break + } verbose "dynamic_linker_flag: -Wl,--dynamic-linker=$dynlinker" return "-Wl,--dynamic-linker=$dynlinker" } + proc rpath_flags { args } { global board set compiler "[board_info $board compiler]" set mflags "[board_info $board multilib_flags] [libgloss_include_flags] [newlib_include_flags] [libgloss_link_flags] [libgloss_link_flags]" set rpathflags "" set gccpath [get_multilibs] - foreach i {libgcc_s.so libstdc++.so libgfortran.so libatomic.so libc.so} { + foreach i {libgcc_s.so libstdc++.so libgfortran.so libatomic.so} { set result [remote_exec host "$compiler $mflags --print-file-name=$i"] set output [lindex $result 1] set rpathdir [file dirname $output] @@ -86,6 +99,10 @@ proc rpath_flags { args } { set rpathflags "$rpathflags -Wl,-rpath=$rpathdir" } } + set searchdirs [get_library_dirlist] + foreach i $searchdirs { + set rpathflags "$rpathflags -Wl,-rpath=$i" + } verbose "rpath_flags: $rpathflags" return $rpathflags } _______________________________________________ DejaGnu mailing list DejaGnu@gnu.org https://lists.gnu.org/mailman/listinfo/dejagnu