1 | # Copyright (C) 2002, 2011 by Red Hat, Incorporated. All rights reserved. |
---|
2 | # |
---|
3 | # Permission to use, copy, modify, and distribute this software |
---|
4 | # is freely granted, provided that this notice is preserved. |
---|
5 | # |
---|
6 | |
---|
7 | # flags.exp: overrides the dejagnu versions of libgloss_link_flags, |
---|
8 | # newlib_link_flags, and newlib_include_flags. |
---|
9 | |
---|
10 | # These versions of the procedures generate link and include flags |
---|
11 | # by searching for the needed files in the current build and source |
---|
12 | # directories, rather than in the build and source paths of the |
---|
13 | # compiler being used. |
---|
14 | |
---|
15 | if {![llength [info procs saved_libgloss_link_flags]]} { |
---|
16 | rename libgloss_link_flags saved_libgloss_link_flags |
---|
17 | } |
---|
18 | |
---|
19 | proc libgloss_link_flags { args } { |
---|
20 | global target_cpu |
---|
21 | # These values come from the local site.exp. |
---|
22 | global srcdir objdir |
---|
23 | global multibuildtop |
---|
24 | |
---|
25 | if {![info exists multibuildtop]} { |
---|
26 | return [saved_libgloss_link_flags $args] |
---|
27 | } |
---|
28 | |
---|
29 | verbose "In newlib version of libgloss_link_flags...\n" |
---|
30 | |
---|
31 | if [isnative] { |
---|
32 | return "" |
---|
33 | } |
---|
34 | |
---|
35 | if [is_remote host] { |
---|
36 | return "" |
---|
37 | } |
---|
38 | |
---|
39 | set target_build_path "$objdir/.." |
---|
40 | |
---|
41 | set gloss_srcdir [lookfor_file ${srcdir} libgloss/$target_cpu] |
---|
42 | |
---|
43 | if { $gloss_srcdir == "" } { |
---|
44 | return "" |
---|
45 | } |
---|
46 | |
---|
47 | if [file exists $target_build_path/libgloss/$target_cpu] { |
---|
48 | verbose "libgloss path is $target_build_path/libgloss/$target_cpu" 2 |
---|
49 | return "-B$target_build_path/libgloss/$target_cpu/ -L$target_build_path/libgloss/$target_cpu -L$gloss_srcdir" |
---|
50 | } else { |
---|
51 | verbose -log "No libgloss support for this target." 2 |
---|
52 | return "" |
---|
53 | } |
---|
54 | } |
---|
55 | |
---|
56 | proc newlib_link_flags { args } { |
---|
57 | global tool_root_dir |
---|
58 | global srcdir objdir |
---|
59 | |
---|
60 | verbose "In newlib version of newlib_link_flags...\n" |
---|
61 | |
---|
62 | if [is_remote host] { |
---|
63 | return "" |
---|
64 | } |
---|
65 | |
---|
66 | set ld_script_path [lookfor_file ${tool_root_dir} "ld/ldscripts"]; |
---|
67 | if { $ld_script_path != "" } { |
---|
68 | set result "-L[file dirname $ld_script_path]" |
---|
69 | } else { |
---|
70 | set result "" |
---|
71 | } |
---|
72 | |
---|
73 | return "$result -B$objdir -L$objdir" |
---|
74 | } |
---|
75 | |
---|
76 | proc newlib_include_flags { args } { |
---|
77 | global srcdir objdir |
---|
78 | |
---|
79 | verbose "In newlib version of newlib_include_flags...\n" |
---|
80 | |
---|
81 | if [is_remote host] { |
---|
82 | return "" |
---|
83 | } |
---|
84 | |
---|
85 | set newlib_dir [lookfor_file ${srcdir} newlib/libc/include/assert.h] |
---|
86 | if { ${newlib_dir} != "" } { |
---|
87 | set newlib_dir [file dirname ${newlib_dir}] |
---|
88 | } |
---|
89 | return " -I$objdir/targ-include -I$objdir -I${newlib_dir}" |
---|
90 | } |
---|