OLD | NEW |
1 # Copyright 2004, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 2004-2013 Free Software Foundation, Inc. |
2 # | 2 # |
3 # This program is free software; you can redistribute it and/or modify | 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 | 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 | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 set GO [transform gccgo] | 77 set GO [transform gccgo] |
78 } | 78 } |
79 | 79 |
80 return $GO | 80 return $GO |
81 } | 81 } |
82 | 82 |
83 proc gdb_find_go_linker {} { | 83 proc gdb_find_go_linker {} { |
84 return [find_go] | 84 return [find_go] |
85 } | 85 } |
86 | 86 |
| 87 proc gdb_find_ldd {} { |
| 88 global LDD_FOR_TARGET |
| 89 if [info exists LDD_FOR_TARGET] { |
| 90 set ldd $LDD_FOR_TARGET |
| 91 } else { |
| 92 set ldd "ldd" |
| 93 } |
| 94 return $ldd |
| 95 } |
| 96 |
| 97 proc gdb_find_objcopy {} { |
| 98 global OBJCOPY_FOR_TARGET |
| 99 if [info exists OBJCOPY_FOR_TARGET] { |
| 100 set objcopy $OBJCOPY_FOR_TARGET |
| 101 } else { |
| 102 set objcopy [transform objcopy] |
| 103 } |
| 104 return $objcopy |
| 105 } |
| 106 |
| 107 proc gdb_find_readelf {} { |
| 108 global READELF_FOR_TARGET |
| 109 if [info exists READELF_FOR_TARGET] { |
| 110 set readelf $READELF_FOR_TARGET |
| 111 } else { |
| 112 set readelf [transform readelf] |
| 113 } |
| 114 return $readelf |
| 115 } |
| 116 |
87 proc gdb_default_target_compile {source destfile type options} { | 117 proc gdb_default_target_compile {source destfile type options} { |
88 global target_triplet | 118 global target_triplet |
89 global tool_root_dir | 119 global tool_root_dir |
90 global CFLAGS_FOR_TARGET | 120 global CFLAGS_FOR_TARGET |
91 global compiler_flags | 121 global compiler_flags |
92 | 122 |
93 if { $destfile == "" && $type != "preprocess" && $type != "none" } { | 123 if { $destfile == "" && $type != "preprocess" && $type != "none" } { |
94 error "Must supply an output filename for the compile to default_target_
compile" | 124 error "Must supply an output filename for the compile to default_target_
compile" |
95 } | 125 } |
96 | 126 |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 return "Unable to download $x to host." | 442 return "Unable to download $x to host." |
413 } else { | 443 } else { |
414 append sources " $file" | 444 append sources " $file" |
415 } | 445 } |
416 } | 446 } |
417 } else { | 447 } else { |
418 set sources $source | 448 set sources $source |
419 } | 449 } |
420 | 450 |
421 if {[is_remote host]} { | 451 if {[is_remote host]} { |
422 » append add_flags " -o a.out" | 452 » append add_flags " -o " [file tail $destfile] |
423 » remote_file host delete a.out | 453 » remote_file host delete [file tail $destfile] |
424 } else { | 454 } else { |
425 if { $destfile != "" } { | 455 if { $destfile != "" } { |
426 append add_flags " -o $destfile" | 456 append add_flags " -o $destfile" |
427 } | 457 } |
428 } | 458 } |
429 | 459 |
430 # This is obscure: we put SOURCES at the end when building an | 460 # This is obscure: we put SOURCES at the end when building an |
431 # object, because otherwise, in some situations, libtool will | 461 # object, because otherwise, in some situations, libtool will |
432 # become confused about the name of the actual source file. | 462 # become confused about the name of the actual source file. |
433 switch $type { | 463 switch $type { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 if {[info exists timeout]} { | 501 if {[info exists timeout]} { |
472 verbose "Setting timeout to $timeout" 2 | 502 verbose "Setting timeout to $timeout" 2 |
473 set status [remote_exec host "$compiler $opts" "" "" "" $timeout] | 503 set status [remote_exec host "$compiler $opts" "" "" "" $timeout] |
474 } else { | 504 } else { |
475 set status [remote_exec host "$compiler $opts"] | 505 set status [remote_exec host "$compiler $opts"] |
476 } | 506 } |
477 } | 507 } |
478 | 508 |
479 set compiler_flags $opts | 509 set compiler_flags $opts |
480 if {[is_remote host]} { | 510 if {[is_remote host]} { |
481 » remote_upload host a.out $destfile | 511 » remote_upload host [file tail $destfile] $destfile |
482 » remote_file host delete a.out | 512 » remote_file host delete [file tail $destfile] |
483 } | 513 } |
484 set comp_output [prune_warnings [lindex $status 1]] | 514 set comp_output [prune_warnings [lindex $status 1]] |
485 regsub "^\[\r\n\]+" $comp_output "" comp_output | 515 regsub "^\[\r\n\]+" $comp_output "" comp_output |
486 if { [lindex $status 0] != 0 } { | 516 if { [lindex $status 0] != 0 } { |
487 verbose -log "compiler exited with status [lindex $status 0]" | 517 verbose -log "compiler exited with status [lindex $status 0]" |
488 } | 518 } |
489 if { [lindex $status 1] != "" } { | 519 if { [lindex $status 1] != "" } { |
490 verbose -log "output is:\n[lindex $status 1]" 2 | 520 verbose -log "output is:\n[lindex $status 1]" 2 |
491 } | 521 } |
492 if { [lindex $status 0] != 0 && "${comp_output}" == "" } { | 522 if { [lindex $status 0] != 0 && "${comp_output}" == "" } { |
(...skipping 21 matching lines...) Expand all Loading... |
514 if {[info procs find_go_linker] == ""} { | 544 if {[info procs find_go_linker] == ""} { |
515 rename gdb_find_go find_go | 545 rename gdb_find_go find_go |
516 rename gdb_find_go_linker find_go_linker | 546 rename gdb_find_go_linker find_go_linker |
517 set use_gdb_compile 1 | 547 set use_gdb_compile 1 |
518 } | 548 } |
519 | 549 |
520 if {$use_gdb_compile} { | 550 if {$use_gdb_compile} { |
521 catch {rename default_target_compile {}} | 551 catch {rename default_target_compile {}} |
522 rename gdb_default_target_compile default_target_compile | 552 rename gdb_default_target_compile default_target_compile |
523 } | 553 } |
| 554 |
| 555 |
| 556 # Provide 'lreverse' missing in Tcl before 7.5. |
| 557 |
| 558 if {[info procs lreverse] == ""} { |
| 559 proc lreverse { arg } { |
| 560 set retval {} |
| 561 while { [llength $retval] < [llength $arg] } { |
| 562 lappend retval [lindex $arg end-[llength $retval]] |
| 563 } |
| 564 return $retval |
| 565 } |
| 566 } |
OLD | NEW |