blob: 8b43d2e5d3a06f696f762bae22c4d54469275e52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# 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.
#
# flags.exp overrides the dejagnu versions of libgloss_link_flags,
# newlib_link_flags, and newlib_include_flags.
load_lib flags.exp
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
# These values are initialized in the local site.exp file.
global srcdir objdir tmpdir
global host_triplet target_triplet
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]} {
set gluefile ${tmpdir}/testglue.o;
set result [build_wrapper $gluefile];
if { $result != "" } {
set gluefile [lindex $result 0];
set wrap_flags [lindex $result 1];
} else {
unset gluefile
}
}
if [string match $host_triplet $target_triplet] then {
if [string match "i686-pc-linux-gnu" $host_triplet] then {
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
global host_triplet target_triplet
verbose "In newlib_target_compile...\n"
lappend options "libs=-I$srcdir/include"
verbose "srcdir is $srcdir"
if {[target_info needs_status_wrapper] != "" && \
[target_info needs_status_wrapper] != "0" && \
[info exists gluefile] } {
lappend options "libs=$gluefile"
lappend options "LDFLAGS=$wrap_flags"
}
if [string match $host_triplet $target_triplet] then {
if [string match "i686-pc-linux-gnu" $host_triplet] then {
lappend options "libs=$objdir/crt0.o -lc -lgcc"
lappend options "LDFLAGS=-nostdlib -L$objdir/.libs [newlib_include_flags]"
}
}
return [target_compile $source $dest $type $options]
}
proc newlib_finish { } {
global old_ld_library_path
global host_triplet target_triplet
verbose "In newlib_finish...\n"
if [string match $host_triplet $target_triplet] then {
if [string match "i686-pc-linux-gnu" $host_triplet] then {
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;
}
}
|