xref: /aosp_15_r20/external/libffi/testsuite/lib/wrapper.exp (revision 1fd5a2e1d639cd1ddf29dd0c484c123bbd850c21)
1*1fd5a2e1SPrashanth Swaminathan#   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
2*1fd5a2e1SPrashanth Swaminathan
3*1fd5a2e1SPrashanth Swaminathan# This program is free software; you can redistribute it and/or modify
4*1fd5a2e1SPrashanth Swaminathan# it under the terms of the GNU General Public License as published by
5*1fd5a2e1SPrashanth Swaminathan# the Free Software Foundation; either version 3 of the License, or
6*1fd5a2e1SPrashanth Swaminathan# (at your option) any later version.
7*1fd5a2e1SPrashanth Swaminathan#
8*1fd5a2e1SPrashanth Swaminathan# This program is distributed in the hope that it will be useful,
9*1fd5a2e1SPrashanth Swaminathan# but WITHOUT ANY WARRANTY; without even the implied warranty of
10*1fd5a2e1SPrashanth Swaminathan# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11*1fd5a2e1SPrashanth Swaminathan# GNU General Public License for more details.
12*1fd5a2e1SPrashanth Swaminathan#
13*1fd5a2e1SPrashanth Swaminathan# You should have received a copy of the GNU General Public License
14*1fd5a2e1SPrashanth Swaminathan# along with GCC; see the file COPYING3.  If not see
15*1fd5a2e1SPrashanth Swaminathan# <http://www.gnu.org/licenses/>.
16*1fd5a2e1SPrashanth Swaminathan
17*1fd5a2e1SPrashanth Swaminathan# This file contains GCC-specifics for status wrappers for test programs.
18*1fd5a2e1SPrashanth Swaminathan
19*1fd5a2e1SPrashanth Swaminathan# ${tool}_maybe_build_wrapper -- Build wrapper object if the target
20*1fd5a2e1SPrashanth Swaminathan# needs it.  FILENAME is the path to the wrapper file.  If there are
21*1fd5a2e1SPrashanth Swaminathan# additional arguments, they are command-line options to provide to
22*1fd5a2e1SPrashanth Swaminathan# the compiler when compiling FILENAME.
23*1fd5a2e1SPrashanth Swaminathan
24*1fd5a2e1SPrashanth Swaminathanproc ${tool}_maybe_build_wrapper { filename args } {
25*1fd5a2e1SPrashanth Swaminathan    global gluefile wrap_flags
26*1fd5a2e1SPrashanth Swaminathan
27*1fd5a2e1SPrashanth Swaminathan    if { [target_info needs_status_wrapper] != "" \
28*1fd5a2e1SPrashanth Swaminathan 	 && [target_info needs_status_wrapper] != "0" \
29*1fd5a2e1SPrashanth Swaminathan	 && ![info exists gluefile] } {
30*1fd5a2e1SPrashanth Swaminathan	set saved_wrap_compile_flags [target_info wrap_compile_flags]
31*1fd5a2e1SPrashanth Swaminathan	set flags [join $args " "]
32*1fd5a2e1SPrashanth Swaminathan	# The wrapper code may contain code that gcc objects on.  This
33*1fd5a2e1SPrashanth Swaminathan	# became true for dejagnu-1.4.4.  The set of warnings and code
34*1fd5a2e1SPrashanth Swaminathan	# that gcc objects on may change, so just make sure -w is always
35*1fd5a2e1SPrashanth Swaminathan	# passed to turn off all warnings.
36*1fd5a2e1SPrashanth Swaminathan	set_currtarget_info wrap_compile_flags \
37*1fd5a2e1SPrashanth Swaminathan	    "$saved_wrap_compile_flags -w $flags"
38*1fd5a2e1SPrashanth Swaminathan	set result [build_wrapper $filename]
39*1fd5a2e1SPrashanth Swaminathan	set_currtarget_info wrap_compile_flags "$saved_wrap_compile_flags"
40*1fd5a2e1SPrashanth Swaminathan	if { $result != "" } {
41*1fd5a2e1SPrashanth Swaminathan	    set gluefile [lindex $result 0]
42*1fd5a2e1SPrashanth Swaminathan	    set wrap_flags [lindex $result 1]
43*1fd5a2e1SPrashanth Swaminathan	}
44*1fd5a2e1SPrashanth Swaminathan    }
45*1fd5a2e1SPrashanth Swaminathan}
46