2002-04-25 04:53:30 +08:00
|
|
|
# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
|
|
|
#
|
|
|
|
# Permission to use, copy, modify, and distribute this software
|
|
|
|
# is freely granted, provided that this notice is preserved.
|
|
|
|
#
|
|
|
|
|
2002-05-02 01:05:44 +08:00
|
|
|
# flags.exp overrides the dejagnu versions of libgloss_link_flags,
|
|
|
|
# newlib_link_flags, and newlib_include_flags.
|
|
|
|
load_lib flags.exp
|
|
|
|
|
2002-04-25 04:53:30 +08:00
|
|
|
proc newlib_version { } {
|
|
|
|
global tool_version
|
|
|
|
|
|
|
|
verbose "In newlib version...\n"
|
|
|
|
|
|
|
|
return $tool_version
|
|
|
|
}
|
|
|
|
|
|
|
|
set newlib_initialized 0
|
|
|
|
|
|
|
|
proc newlib_init { args } {
|
|
|
|
global gluefile wrap_flags
|
|
|
|
global newlib_initialized
|
|
|
|
global target_info
|
2002-05-01 06:38:07 +08:00
|
|
|
# These values are initialized in the local site.exp file.
|
2005-07-05 08:11:50 +08:00
|
|
|
global srcdir objdir tmpdir
|
2002-05-01 06:38:07 +08:00
|
|
|
global host_triplet target_triplet
|
2002-04-25 04:53:30 +08:00
|
|
|
global old_ld_library_path
|
|
|
|
|
|
|
|
verbose "In newlib_init...\n"
|
|
|
|
|
|
|
|
if { $newlib_initialized == 1 } { return; }
|
|
|
|
|
|
|
|
if {[target_info needs_status_wrapper] != "" && \
|
|
|
|
[target_info needs_status_wrapper] != "0" && \
|
|
|
|
![info exists gluefile]} {
|
2005-07-05 08:11:50 +08:00
|
|
|
set gluefile ${tmpdir}/testglue.o;
|
2002-04-25 04:53:30 +08:00
|
|
|
set result [build_wrapper $gluefile];
|
|
|
|
if { $result != "" } {
|
|
|
|
set gluefile [lindex $result 0];
|
|
|
|
set wrap_flags [lindex $result 1];
|
|
|
|
} else {
|
|
|
|
unset gluefile
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-01 06:38:07 +08:00
|
|
|
if [string match $host_triplet $target_triplet] then {
|
|
|
|
if [string match "i686-pc-linux-gnu" $host_triplet] then {
|
2002-04-25 04:53:30 +08:00
|
|
|
set old_ld_library_path [getenv LD_LIBRARY_PATH]
|
|
|
|
setenv LD_LIBRARY_PATH "$objdir/.libs"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
proc newlib_target_compile { source dest type options } {
|
|
|
|
global gluefile wrap_flags
|
|
|
|
global srcdir objdir
|
2002-05-01 06:38:07 +08:00
|
|
|
global host_triplet target_triplet
|
2002-04-25 04:53:30 +08:00
|
|
|
|
|
|
|
verbose "In newlib_target_compile...\n"
|
2002-10-19 02:18:49 +08:00
|
|
|
|
|
|
|
lappend options "libs=-I$srcdir/include"
|
|
|
|
verbose "srcdir is $srcdir"
|
2002-04-25 04:53:30 +08:00
|
|
|
|
|
|
|
if {[target_info needs_status_wrapper] != "" && \
|
|
|
|
[target_info needs_status_wrapper] != "0" && \
|
|
|
|
[info exists gluefile] } {
|
|
|
|
lappend options "libs=$gluefile"
|
2022-01-21 12:45:23 +08:00
|
|
|
lappend options "LDFLAGS=$wrap_flags"
|
2002-04-25 04:53:30 +08:00
|
|
|
}
|
|
|
|
|
2002-05-01 06:38:07 +08:00
|
|
|
if [string match $host_triplet $target_triplet] then {
|
|
|
|
if [string match "i686-pc-linux-gnu" $host_triplet] then {
|
2002-05-02 01:05:44 +08:00
|
|
|
lappend options "libs=$objdir/crt0.o -lc -lgcc"
|
2022-01-21 12:45:23 +08:00
|
|
|
lappend options "LDFLAGS=-nostdlib -L$objdir/.libs [newlib_include_flags]"
|
2002-04-25 04:53:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return [target_compile $source $dest $type $options]
|
|
|
|
}
|
|
|
|
|
|
|
|
proc newlib_finish { } {
|
|
|
|
global old_ld_library_path
|
2002-05-01 06:38:07 +08:00
|
|
|
global host_triplet target_triplet
|
2002-04-25 04:53:30 +08:00
|
|
|
|
|
|
|
verbose "In newlib_finish...\n"
|
|
|
|
|
2002-05-01 06:38:07 +08:00
|
|
|
if [string match $host_triplet $target_triplet] then {
|
|
|
|
if [string match "i686-pc-linux-gnu" $host_triplet] then {
|
2002-04-25 04:53:30 +08:00
|
|
|
setenv LD_LIBRARY_PATH "$old_ld_library_path"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
proc newlib_exit { } {
|
|
|
|
global gluefile;
|
|
|
|
|
|
|
|
verbose "In newlib_exit...\n"
|
|
|
|
|
|
|
|
if [info exists gluefile] {
|
|
|
|
file_on_build delete $gluefile;
|
|
|
|
unset gluefile;
|
|
|
|
}
|
|
|
|
}
|