Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2004-2020 Free Software Foundation, Inc. |
42159ca5 TT |
2 | # |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
5 | # the Free Software Foundation; either version 3 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
8 | # This program is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | ||
16 | load_lib libgloss.exp | |
17 | ||
18 | # FIXME:brobecker/2004-03-31: | |
19 | # The following functions should eventually be part of dejagnu. Even after | |
20 | # these functions becomes available in dejagnu, we will keep for a while | |
21 | # a copy here in order to avoid increasing the dejagnu version | |
22 | # requirement. | |
23 | ||
24 | proc gdb_find_gnatmake {} { | |
25 | global tool_root_dir | |
26 | ||
27 | set root "$tool_root_dir/gcc" | |
28 | set GM "" | |
29 | ||
30 | if ![is_remote host] { | |
31 | set file [lookfor_file $root gnatmake] | |
32 | if { $file != "" } { | |
33 | set GM "$file -I$root/ada/rts --GCC=$root/xgcc --GNATBIND=$root/gnatbind --GNATLINK=$root/gnatlink -cargs -B$root -largs --GCC=$root/xgcc -margs"; | |
34 | } | |
35 | } | |
36 | ||
37 | if {$GM == ""} { | |
38 | set GM [transform gnatmake] | |
39 | } | |
40 | ||
41 | return $GM | |
42 | } | |
43 | ||
24f75ead IB |
44 | proc gdb_find_gdc {} { |
45 | global tool_root_dir | |
46 | print "Tool Root: $tool_root_dir" | |
47 | ||
48 | if {![is_remote host]} { | |
49 | set file [lookfor_file $tool_root_dir gdc] | |
50 | if { $file == "" } { | |
51 | set file [lookfor_file $tool_root_dir gcc/gdc] | |
52 | } | |
53 | if { $file != "" } { | |
54 | set CC "$file -B[file dirname $file]/" | |
55 | } else { | |
56 | set CC [transform gdc] | |
57 | } | |
58 | } else { | |
59 | set CC [transform gdc] | |
60 | } | |
61 | print "CC: $CC" | |
62 | return $CC | |
63 | } | |
64 | ||
42159ca5 TT |
65 | proc gdb_find_gfortran {} { |
66 | global tool_root_dir | |
67 | ||
68 | if {![is_remote host]} { | |
69 | set file [lookfor_file $tool_root_dir gfortran] | |
70 | if { $file == "" } { | |
71 | set file [lookfor_file $tool_root_dir gcc/gfortran] | |
72 | } | |
73 | if { $file != "" } { | |
74 | set CC "$file -B[file dirname $file]/" | |
75 | } else { | |
76 | set CC [transform gfortran] | |
77 | } | |
78 | } else { | |
79 | set CC [transform gfortran] | |
80 | } | |
81 | return $CC | |
82 | } | |
83 | ||
a766d390 DE |
84 | proc gdb_find_go {} { |
85 | global tool_root_dir | |
86 | ||
87 | set GO "" | |
88 | ||
89 | if {![is_remote host]} { | |
90 | set file [lookfor_file $tool_root_dir gccgo] | |
91 | if { $file != "" } { | |
92 | set root [file dirname $file] | |
93 | set GO "$file -B$root/gcc/" | |
94 | } | |
95 | } | |
96 | ||
97 | if { $GO == "" } { | |
98 | set GO [transform gccgo] | |
99 | } | |
100 | ||
101 | return $GO | |
102 | } | |
103 | ||
104 | proc gdb_find_go_linker {} { | |
105 | return [find_go] | |
106 | } | |
107 | ||
67218854 TT |
108 | proc gdb_find_rustc {} { |
109 | global tool_root_dir | |
110 | if {![is_remote host]} { | |
111 | set rustc [lookfor_file $tool_root_dir rustc] | |
112 | if {$rustc == ""} { | |
113 | set rustc rustc | |
114 | } | |
115 | } else { | |
116 | set rustc "" | |
117 | } | |
118 | if {$rustc != ""} { | |
119 | append rustc " --color never" | |
120 | } | |
121 | return $rustc | |
122 | } | |
123 | ||
f61d5529 DE |
124 | proc gdb_find_ldd {} { |
125 | global LDD_FOR_TARGET | |
126 | if [info exists LDD_FOR_TARGET] { | |
127 | set ldd $LDD_FOR_TARGET | |
128 | } else { | |
129 | set ldd "ldd" | |
130 | } | |
131 | return $ldd | |
132 | } | |
133 | ||
4fa7d390 DE |
134 | proc gdb_find_objcopy {} { |
135 | global OBJCOPY_FOR_TARGET | |
136 | if [info exists OBJCOPY_FOR_TARGET] { | |
137 | set objcopy $OBJCOPY_FOR_TARGET | |
138 | } else { | |
139 | set objcopy [transform objcopy] | |
140 | } | |
141 | return $objcopy | |
142 | } | |
143 | ||
c74f7d1c JT |
144 | # find target objdump |
145 | proc gdb_find_objdump {} { | |
146 | global OBJDUMP_FOR_TARGET | |
147 | if [info exists OBJDUMP_FOR_TARGET] { | |
148 | set objdump $OBJDUMP_FOR_TARGET | |
149 | } else { | |
150 | set objdump [transform objdump] | |
151 | } | |
152 | return $objdump | |
153 | } | |
154 | ||
4fa7d390 DE |
155 | proc gdb_find_readelf {} { |
156 | global READELF_FOR_TARGET | |
157 | if [info exists READELF_FOR_TARGET] { | |
158 | set readelf $READELF_FOR_TARGET | |
159 | } else { | |
160 | set readelf [transform readelf] | |
161 | } | |
162 | return $readelf | |
163 | } | |
164 | ||
57e5e645 SDJ |
165 | proc gdb_find_eu-unstrip {} { |
166 | global EU_UNSTRIP_FOR_TARGET | |
167 | if [info exists EU_UNSTRIP_FOR_TARGET] { | |
168 | set eu_unstrip $EU_UNSTRIP_FOR_TARGET | |
169 | } else { | |
170 | set eu_unstrip [transform eu-unstrip] | |
171 | } | |
172 | return $eu_unstrip | |
173 | } | |
174 | ||
42159ca5 TT |
175 | proc gdb_default_target_compile {source destfile type options} { |
176 | global target_triplet | |
177 | global tool_root_dir | |
178 | global CFLAGS_FOR_TARGET | |
179 | global compiler_flags | |
180 | ||
181 | if { $destfile == "" && $type != "preprocess" && $type != "none" } { | |
182 | error "Must supply an output filename for the compile to default_target_compile" | |
183 | } | |
184 | ||
6ebea266 | 185 | set early_flags "" |
42159ca5 TT |
186 | set add_flags "" |
187 | set libs "" | |
188 | set compiler_type "c" | |
189 | set compiler "" | |
a766d390 DE |
190 | set linker "" |
191 | # linker_opts_order is one of "sources-then-flags", "flags-then-sources". | |
6ebea266 DE |
192 | # The order matters for things like -Wl,--as-needed. The default is to |
193 | # preserve existing behavior. | |
a766d390 | 194 | set linker_opts_order "sources-then-flags" |
42159ca5 TT |
195 | set ldflags "" |
196 | set dest [target_info name] | |
197 | ||
198 | if {[info exists CFLAGS_FOR_TARGET]} { | |
199 | append add_flags " $CFLAGS_FOR_TARGET" | |
200 | } | |
201 | ||
202 | if {[info exists target_info(host,name)]} { | |
203 | set host [host_info name] | |
204 | } else { | |
205 | set host "unix" | |
206 | } | |
207 | ||
208 | foreach i $options { | |
209 | ||
210 | if { $i == "ada" } { | |
211 | set compiler_type "ada" | |
212 | if {[board_info $dest exists adaflags]} { | |
213 | append add_flags " [target_info adaflags]" | |
214 | } | |
215 | if {[board_info $dest exists gnatmake]} { | |
216 | set compiler [target_info gnatmake] | |
217 | } else { | |
218 | set compiler [find_gnatmake] | |
219 | } | |
220 | } | |
221 | ||
222 | if { $i == "c++" } { | |
223 | set compiler_type "c++" | |
224 | if {[board_info $dest exists cxxflags]} { | |
225 | append add_flags " [target_info cxxflags]" | |
226 | } | |
227 | append add_flags " [g++_include_flags]" | |
228 | if {[board_info $dest exists c++compiler]} { | |
229 | set compiler [target_info c++compiler] | |
230 | } else { | |
231 | set compiler [find_g++] | |
232 | } | |
233 | } | |
234 | ||
24f75ead IB |
235 | if { $i == "d" } { |
236 | set compiler_type "d" | |
237 | if {[board_info $dest exists dflags]} { | |
238 | append add_flags " [target_info dflags]" | |
239 | } | |
240 | if {[board_info $dest exists dcompiler]} { | |
241 | set compiler [target_info dcompiler] | |
242 | } else { | |
243 | set compiler [find_gdc] | |
244 | } | |
245 | } | |
246 | ||
42159ca5 TT |
247 | if { $i == "f77" } { |
248 | set compiler_type "f77" | |
249 | if {[board_info $dest exists f77flags]} { | |
250 | append add_flags " [target_info f77flags]" | |
251 | } | |
252 | if {[board_info $dest exists f77compiler]} { | |
253 | set compiler [target_info f77compiler] | |
254 | } else { | |
255 | set compiler [find_g77] | |
256 | } | |
257 | } | |
258 | ||
259 | if { $i == "f90" } { | |
260 | set compiler_type "f90" | |
261 | if {[board_info $dest exists f90flags]} { | |
262 | append add_flags " [target_info f90flags]" | |
263 | } | |
264 | if {[board_info $dest exists f90compiler]} { | |
265 | set compiler [target_info f90compiler] | |
266 | } else { | |
267 | set compiler [find_gfortran] | |
268 | } | |
269 | } | |
270 | ||
a766d390 DE |
271 | if { $i == "go" } { |
272 | set compiler_type "go" | |
273 | if {[board_info $dest exists goflags]} { | |
274 | append add_flags " [target_info goflags]" | |
275 | } | |
276 | if {[board_info $dest exists gocompiler]} { | |
277 | set compiler [target_info gocompiler] | |
278 | } else { | |
279 | set compiler [find_go] | |
280 | } | |
281 | if {[board_info $dest exists golinker]} { | |
282 | set linker [target_info golinker] | |
283 | } else { | |
284 | set linker [find_go_linker] | |
285 | } | |
286 | if {[board_info $dest exists golinker_opts_order]} { | |
287 | set linker_opts_order [target_info golinker_opts_order] | |
288 | } | |
289 | } | |
290 | ||
67218854 TT |
291 | if { $i == "rust" } { |
292 | set compiler_type "rust" | |
293 | if {[board_info $dest exists rustflags]} { | |
294 | append add_flags " [target_info rustflags]" | |
295 | } | |
296 | if {[board_info $dest exists rustflags]} { | |
297 | set compiler [target_info rustflags] | |
298 | } else { | |
299 | set compiler [find_rustc] | |
300 | } | |
301 | } | |
302 | ||
42159ca5 TT |
303 | if {[regexp "^dest=" $i]} { |
304 | regsub "^dest=" $i "" tmp | |
305 | if {[board_info $tmp exists name]} { | |
306 | set dest [board_info $tmp name] | |
307 | } else { | |
308 | set dest $tmp | |
309 | } | |
310 | } | |
311 | if {[regexp "^compiler=" $i]} { | |
312 | regsub "^compiler=" $i "" tmp | |
313 | set compiler $tmp | |
314 | } | |
6ebea266 DE |
315 | if {[regexp "^early_flags=" $i]} { |
316 | regsub "^early_flags=" $i "" tmp | |
317 | append early_flags " $tmp" | |
318 | } | |
42159ca5 TT |
319 | if {[regexp "^additional_flags=" $i]} { |
320 | regsub "^additional_flags=" $i "" tmp | |
321 | append add_flags " $tmp" | |
322 | } | |
323 | if {[regexp "^ldflags=" $i]} { | |
324 | regsub "^ldflags=" $i "" tmp | |
325 | append ldflags " $tmp" | |
326 | } | |
327 | if {[regexp "^libs=" $i]} { | |
328 | regsub "^libs=" $i "" tmp | |
329 | append libs " $tmp" | |
330 | } | |
331 | if {[regexp "^incdir=" $i]} { | |
332 | regsub "^incdir=" $i "-I" tmp | |
333 | append add_flags " $tmp" | |
334 | } | |
335 | if {[regexp "^libdir=" $i]} { | |
336 | regsub "^libdir=" $i "-L" tmp | |
337 | append add_flags " $tmp" | |
338 | } | |
339 | if {[regexp "^ldscript=" $i]} { | |
340 | regsub "^ldscript=" $i "" ldscript | |
341 | } | |
342 | if {[regexp "^redirect=" $i]} { | |
343 | regsub "^redirect=" $i "" redirect | |
344 | } | |
345 | if {[regexp "^optimize=" $i]} { | |
346 | regsub "^optimize=" $i "" optimize | |
347 | } | |
348 | if {[regexp "^timeout=" $i]} { | |
349 | regsub "^timeout=" $i "" timeout | |
350 | } | |
351 | } | |
352 | ||
353 | if {[board_info $host exists cflags_for_target]} { | |
354 | append add_flags " [board_info $host cflags_for_target]" | |
355 | } | |
356 | ||
357 | global CC_FOR_TARGET | |
358 | global CXX_FOR_TARGET | |
24f75ead | 359 | global D_FOR_TARGET |
42159ca5 TT |
360 | global F77_FOR_TARGET |
361 | global F90_FOR_TARGET | |
362 | global GNATMAKE_FOR_TARGET | |
a766d390 DE |
363 | global GO_FOR_TARGET |
364 | global GO_LD_FOR_TARGET | |
67218854 | 365 | global RUSTC_FOR_TARGET |
42159ca5 TT |
366 | |
367 | if {[info exists GNATMAKE_FOR_TARGET]} { | |
368 | if { $compiler_type == "ada" } { | |
369 | set compiler $GNATMAKE_FOR_TARGET | |
370 | } | |
371 | } | |
372 | ||
373 | if {[info exists CC_FOR_TARGET]} { | |
374 | if { $compiler == "" } { | |
375 | set compiler $CC_FOR_TARGET | |
376 | } | |
377 | } | |
378 | ||
379 | if {[info exists CXX_FOR_TARGET]} { | |
380 | if { $compiler_type == "c++" } { | |
381 | set compiler $CXX_FOR_TARGET | |
382 | } | |
383 | } | |
384 | ||
24f75ead IB |
385 | if {[info exists D_FOR_TARGET]} { |
386 | if { $compiler_type == "d" } { | |
387 | set compiler $D_FOR_TARGET | |
388 | } | |
389 | } | |
390 | ||
42159ca5 TT |
391 | if {[info exists F77_FOR_TARGET]} { |
392 | if { $compiler_type == "f77" } { | |
393 | set compiler $F77_FOR_TARGET | |
394 | } | |
395 | } | |
396 | ||
397 | if {[info exists F90_FOR_TARGET]} { | |
398 | if { $compiler_type == "f90" } { | |
399 | set compiler $F90_FOR_TARGET | |
400 | } | |
401 | } | |
402 | ||
a766d390 DE |
403 | if { $compiler_type == "go" } { |
404 | if {[info exists GO_FOR_TARGET]} { | |
405 | set compiler $GO_FOR_TARGET | |
406 | } | |
407 | if {[info exists GO_LD_FOR_TARGET]} { | |
408 | set linker $GO_LD_FOR_TARGET | |
409 | } | |
410 | } | |
411 | ||
67218854 TT |
412 | if {[info exists RUSTC_FOR_TARGET]} { |
413 | if {$compiler_type == "rust"} { | |
414 | set compiler $RUSTC_FOR_TARGET | |
415 | } | |
416 | } | |
417 | ||
a766d390 DE |
418 | if { $type == "executable" && $linker != "" } { |
419 | set compiler $linker | |
420 | } | |
421 | ||
42159ca5 TT |
422 | if { $compiler == "" } { |
423 | set compiler [board_info $dest compiler] | |
424 | if { $compiler == "" } { | |
425 | return "default_target_compile: No compiler to compile with" | |
426 | } | |
427 | } | |
428 | ||
429 | if {![is_remote host]} { | |
430 | if { [which $compiler] == 0 } { | |
431 | return "default_target_compile: Can't find $compiler." | |
432 | } | |
433 | } | |
434 | ||
435 | if {$type == "object"} { | |
67218854 TT |
436 | if {$compiler_type == "rust"} { |
437 | append add_flags "--emit obj" | |
438 | } else { | |
439 | append add_flags " -c" | |
440 | } | |
42159ca5 TT |
441 | } |
442 | ||
443 | if { $type == "preprocess" } { | |
444 | append add_flags " -E" | |
445 | } | |
446 | ||
447 | if { $type == "assembly" } { | |
448 | append add_flags " -S" | |
449 | } | |
450 | ||
451 | if {[board_info $dest exists cflags]} { | |
452 | append add_flags " [board_info $dest cflags]" | |
453 | } | |
454 | ||
455 | if { $type == "executable" } { | |
456 | if {[board_info $dest exists ldflags]} { | |
457 | append add_flags " [board_info $dest ldflags]" | |
458 | } | |
459 | if { $compiler_type == "c++" } { | |
460 | append add_flags " [g++_link_flags]" | |
461 | } | |
462 | if {[isnative]} { | |
463 | # This is a lose. | |
464 | catch "glob -nocomplain $tool_root_dir/libstdc++/libstdc++.so* $tool_root_dir/libstdc++/libstdc++.sl" tmp | |
465 | if { ${tmp} != "" } { | |
466 | if {[regexp ".*solaris2.*" $target_triplet]} { | |
467 | # Solaris 2 | |
468 | append add_flags " -R$tool_root_dir/libstdc++" | |
469 | } elseif {[regexp ".*(osf|irix5|linux).*" $target_triplet]} { | |
470 | # OSF/1 or IRIX 5 | |
471 | append add_flags " -Wl,-rpath,$tool_root_dir/libstdc++" | |
42159ca5 TT |
472 | } |
473 | } | |
474 | } | |
475 | } | |
476 | ||
477 | if {![info exists ldscript]} { | |
478 | set ldscript [board_info $dest ldscript] | |
479 | } | |
480 | ||
481 | foreach i $options { | |
482 | if { $i == "debug" } { | |
483 | if {[board_info $dest exists debug_flags]} { | |
484 | append add_flags " [board_info $dest debug_flags]" | |
485 | } else { | |
486 | append add_flags " -g" | |
487 | } | |
488 | } | |
489 | } | |
490 | ||
491 | if {[info exists optimize]} { | |
492 | append add_flags " $optimize" | |
493 | } | |
494 | ||
495 | if { $type == "executable" } { | |
496 | append add_flags " $ldflags" | |
497 | foreach x $libs { | |
498 | if {[file exists $x]} { | |
499 | append source " $x" | |
500 | } else { | |
501 | append add_flags " $x" | |
502 | } | |
503 | } | |
504 | ||
505 | if {[board_info $dest exists libs]} { | |
506 | append add_flags " [board_info $dest libs]" | |
507 | } | |
508 | ||
509 | # This probably isn't such a good idea, but it avoids nasty | |
510 | # hackiness in the testsuites. | |
511 | # The math library must be linked in before the C library. The C | |
512 | # library is linked in by the linker script, so this must be before | |
513 | # the linker script. | |
514 | if {[board_info $dest exists mathlib]} { | |
515 | append add_flags " [board_info $dest mathlib]" | |
516 | } else { | |
517 | append add_flags " -lm" | |
518 | } | |
519 | ||
520 | # This must be added here. | |
521 | append add_flags " $ldscript" | |
522 | ||
523 | if {[board_info $dest exists remote_link]} { | |
524 | # Relink option. | |
525 | append add_flags " -Wl,-r" | |
526 | } | |
527 | if {[board_info $dest exists output_format]} { | |
528 | append add_flags " -Wl,-oformat,[board_info $dest output_format]" | |
529 | } | |
530 | } | |
531 | ||
532 | if {[board_info $dest exists multilib_flags]} { | |
533 | append add_flags " [board_info $dest multilib_flags]" | |
534 | } | |
535 | ||
536 | verbose "doing compile" | |
537 | ||
538 | set sources "" | |
539 | if {[is_remote host]} { | |
540 | foreach x $source { | |
541 | set file [remote_download host $x] | |
542 | if { $file == "" } { | |
543 | warning "Unable to download $x to host." | |
544 | return "Unable to download $x to host." | |
545 | } else { | |
546 | append sources " $file" | |
547 | } | |
548 | } | |
549 | } else { | |
550 | set sources $source | |
551 | } | |
552 | ||
553 | if {[is_remote host]} { | |
1f74d3b5 YQ |
554 | append add_flags " -o " [file tail $destfile] |
555 | remote_file host delete [file tail $destfile] | |
42159ca5 TT |
556 | } else { |
557 | if { $destfile != "" } { | |
558 | append add_flags " -o $destfile" | |
559 | } | |
560 | } | |
561 | ||
562 | # This is obscure: we put SOURCES at the end when building an | |
563 | # object, because otherwise, in some situations, libtool will | |
564 | # become confused about the name of the actual source file. | |
a766d390 DE |
565 | switch $type { |
566 | "object" { | |
6ebea266 | 567 | set opts "$early_flags $add_flags $sources" |
a766d390 DE |
568 | } |
569 | "executable" { | |
570 | switch $linker_opts_order { | |
571 | "flags-then-sources" { | |
6ebea266 | 572 | set opts "$early_flags $add_flags $sources" |
a766d390 DE |
573 | } |
574 | "sources-then-flags" { | |
6ebea266 | 575 | set opts "$early_flags $sources $add_flags" |
a766d390 DE |
576 | } |
577 | default { | |
578 | error "Invalid value for board_info linker_opts_order" | |
579 | } | |
580 | } | |
581 | } | |
582 | default { | |
6ebea266 | 583 | set opts "$early_flags $sources $add_flags" |
a766d390 | 584 | } |
42159ca5 TT |
585 | } |
586 | ||
587 | if {[is_remote host]} { | |
588 | if {[host_info exists use_at]} { | |
589 | set fid [open "atfile" "w"] | |
590 | puts $fid "$opts" | |
591 | close $fid | |
592 | set opts "@[remote_download host atfile]" | |
593 | remote_file build delete atfile | |
594 | } | |
595 | } | |
596 | ||
597 | verbose "Invoking the compiler as $compiler $opts" 2 | |
598 | ||
599 | if {[info exists redirect]} { | |
600 | verbose "Redirecting output to $redirect" 2 | |
601 | set status [remote_exec host "$compiler $opts" "" "" $redirect] | |
602 | } else { | |
603 | if {[info exists timeout]} { | |
604 | verbose "Setting timeout to $timeout" 2 | |
605 | set status [remote_exec host "$compiler $opts" "" "" "" $timeout] | |
606 | } else { | |
607 | set status [remote_exec host "$compiler $opts"] | |
608 | } | |
609 | } | |
610 | ||
611 | set compiler_flags $opts | |
612 | if {[is_remote host]} { | |
1f74d3b5 YQ |
613 | remote_upload host [file tail $destfile] $destfile |
614 | remote_file host delete [file tail $destfile] | |
42159ca5 TT |
615 | } |
616 | set comp_output [prune_warnings [lindex $status 1]] | |
617 | regsub "^\[\r\n\]+" $comp_output "" comp_output | |
618 | if { [lindex $status 0] != 0 } { | |
619 | verbose -log "compiler exited with status [lindex $status 0]" | |
620 | } | |
621 | if { [lindex $status 1] != "" } { | |
622 | verbose -log "output is:\n[lindex $status 1]" 2 | |
623 | } | |
624 | if { [lindex $status 0] != 0 && "${comp_output}" == "" } { | |
625 | set comp_output "exit status is [lindex $status 0]" | |
626 | } | |
627 | return ${comp_output} | |
628 | } | |
629 | ||
630 | # See if the version of dejaGNU being used to run the testsuite is | |
631 | # recent enough to contain support for building Ada programs or not. | |
632 | # If not, then use the functions above in place of the ones provided | |
633 | # by dejaGNU. This is only temporary (brobecker/2004-03-31). | |
634 | ||
635 | set use_gdb_compile 0 | |
636 | if {[info procs find_gnatmake] == ""} { | |
637 | rename gdb_find_gnatmake find_gnatmake | |
638 | set use_gdb_compile 1 | |
639 | } | |
640 | ||
641 | if {[info procs find_gfortran] == ""} { | |
642 | rename gdb_find_gfortran find_gfortran | |
643 | set use_gdb_compile 1 | |
644 | } | |
645 | ||
a766d390 DE |
646 | if {[info procs find_go_linker] == ""} { |
647 | rename gdb_find_go find_go | |
648 | rename gdb_find_go_linker find_go_linker | |
bb2af9cc | 649 | set use_gdb_compile 1 |
a766d390 DE |
650 | } |
651 | ||
24f75ead IB |
652 | if {[info procs find_gdc] == ""} { |
653 | rename gdb_find_gdc find_gdc | |
654 | set use_gdb_compile 1 | |
655 | } | |
656 | ||
67218854 TT |
657 | if {[info procs find_rustc] == ""} { |
658 | rename gdb_find_rustc find_rustc | |
659 | set use_gdb_compile 1 | |
660 | } | |
661 | ||
42159ca5 TT |
662 | if {$use_gdb_compile} { |
663 | catch {rename default_target_compile {}} | |
664 | rename gdb_default_target_compile default_target_compile | |
665 | } | |
9cc8e32c JK |
666 | |
667 | ||
668 | # Provide 'lreverse' missing in Tcl before 7.5. | |
669 | ||
670 | if {[info procs lreverse] == ""} { | |
671 | proc lreverse { arg } { | |
672 | set retval {} | |
673 | while { [llength $retval] < [llength $arg] } { | |
674 | lappend retval [lindex $arg end-[llength $retval]] | |
675 | } | |
676 | return $retval | |
677 | } | |
678 | } | |
49b4de64 JK |
679 | |
680 | # Various ccache versions provide incorrect debug info such as ignoring | |
681 | # different current directory, breaking GDB testsuite. | |
682 | set env(CCACHE_DISABLE) 1 | |
683 | unset -nocomplain env(CCACHE_NODISABLE) |