OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [dejagnu/] [lib/] [libgloss.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# Copyright (C) 92, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
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 2 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, write to the Free Software
15
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-dejagnu@prep.ai.mit.edu
19
 
20
# This file was written by Rob Savoye. (rob@cygnus.com)
21
 
22
# this contains a list of gcc options and their respective directories.
23
 
24
#
25
# Find the pieces of libgloss for testing the GNU development tools
26
# needed to link a set of object files into an executable.
27
# This usually means setting the -L and -B paths correctly.
28
#
29
proc libgloss_link_flags { args } {
30
    global target_cpu
31
    global srcdir
32
 
33
    # libgloss doesn't work native
34
    if [isnative] {
35
        return ""
36
    }
37
 
38
    # if we're on a remote host, we can't search for the file, so we can only
39
    # use an installed compiler, so we don't add any paths here.
40
    if [is_remote host] {
41
        return ""
42
    }
43
 
44
    set gccpath "[get_multilibs]"
45
 
46
    # map the target_cpu to the proper libgloss directory. unfortunately, these
47
    # directory names are hardcoded into libgloss.
48
    switch -glob -- $target_cpu {
49
        "sparc86x" {
50
            set cpu sparc
51
        }
52
        "sparclite" {
53
            set cpu sparc
54
        }
55
        "sparclet" {
56
            set cpu sparc
57
        }
58
        "sparc64*" {
59
            set cpu sparc
60
        }
61
        "hppa*" {
62
            set cpu pa
63
        }
64
        "mips*" {
65
            set cpu mips
66
        }
67
        "powerpc*" {
68
            set cpu rs6000
69
        }
70
        "d10v*" {
71
            set cpu libnosys
72
        }
73
        default {
74
            set cpu $target_cpu
75
        }
76
    }
77
 
78
    set gloss_srcdir ""
79
    # look for the libgloss srcdir sp we can find the linker scripts
80
    set gloss_srcdir [lookfor_file ${srcdir} libgloss/$cpu]
81
 
82
    # set the proper paths for gcc if the target subdir exists, else assume we
83
    # have no libgloss support for this target.
84
    if { $gloss_srcdir == "" } {
85
        return ""
86
    }
87
    if [file exists $gccpath/libgloss/$cpu] {
88
        verbose "Libgloss path is $gccpath/libgloss/$cpu" 2
89
        return "-B$gccpath/libgloss/$cpu/ -L$gccpath/libgloss/$cpu -L$gloss_srcdir"
90
    } else {
91
        verbose -log "No libgloss support for this target." 2
92
        return ""
93
    }
94
}
95
 
96
# There aren't any, but we'll be orthogonal here.
97
 
98
proc libgloss_include_flags { args } {
99
    return ""
100
}
101
 
102
#
103
# Find the newlib libraries in the current source tree.
104
#
105
proc newlib_link_flags { args } {
106
    global tool_root_dir
107
 
108
    # libgloss doesn't work native
109
    if [isnative] {
110
        return ""
111
    }
112
 
113
    # if we're on a remote host, we can't search for the file, so we can only
114
    # use an installed compiler, so we don't add any paths here.
115
    if [is_remote host] {
116
        return ""
117
    }
118
 
119
    set ld_script_path [lookfor_file ${tool_root_dir} "ld/ldscripts"];
120
    if { $ld_script_path != "" } {
121
        set result "-L[file dirname $ld_script_path]"
122
    } else {
123
        set result ""
124
    }
125
 
126
    set gccpath "[get_multilibs]"
127
 
128
    verbose "Looking for $gccpath/newlib"
129
    if [file exists $gccpath/newlib] {
130
        verbose "Newlib path is $gccpath/newlib"
131
        return "$result -B$gccpath/newlib/ -L$gccpath/newlib"
132
    } else {
133
        verbose "No newlib support for this target"
134
        return "$result"
135
    }
136
}
137
 
138
proc newlib_include_flags { args } {
139
    global srcdir
140
 
141
    if [isnative] {
142
        return ""
143
    }
144
 
145
    if [is_remote host] {
146
        return ""
147
    }
148
 
149
    set gccpath "[get_multilibs]"
150
 
151
    if [file exists $gccpath/newlib] {
152
        verbose "Newlib path is $gccpath/newlib"
153
 
154
        set newlib_dir [lookfor_file ${srcdir} newlib/libc/include/assert.h]
155
        if { ${newlib_dir} != "" } {
156
            set newlib_dir [file dirname ${newlib_dir}]
157
        }
158
        return " -I$gccpath/newlib/targ-include -I${newlib_dir}"
159
    } else {
160
        verbose "No newlib support for this target"
161
    }
162
}
163
 
164
proc libio_include_flags { args } {
165
    global srcdir
166
    global tool_root_dir
167
 
168
    if [is_remote host] {
169
        return ""
170
    }
171
 
172
    set gccpath "[get_multilibs]"
173
 
174
    if { $gccpath == "" } {
175
        set gccpath "$tool_root_dir";
176
    }
177
 
178
    set libio_bin_dir [lookfor_file ${gccpath} libio/_G_config.h];
179
 
180
    # linux doesn't build _G_config.h and the test above fails, so
181
    # we search for iostream.list too.
182
    if { $libio_bin_dir == "" } {
183
        set libio_bin_dir [lookfor_file ${gccpath} libio/iostream.list];
184
    }
185
 
186
    set libio_src_dir [lookfor_file ${srcdir} libio/Makefile.in]
187
    if { $libio_bin_dir != "" && $libio_src_dir != "" } {
188
        set libio_src_dir [file dirname ${libio_src_dir}]
189
        set libio_bin_dir [file dirname ${libio_bin_dir}];
190
        return " -I${libio_src_dir} -I${libio_bin_dir}"
191
    } else {
192
        return ""
193
    }
194
}
195
 
196
proc libio_link_flags { args } {
197
    if [is_remote host] {
198
        return ""
199
    }
200
 
201
    set gccpath "[get_multilibs]"
202
 
203
    set libio_dir [lookfor_file ${gccpath} libio/libio.a]
204
    if { $libio_dir != "" } {
205
        return "-L[file dirname ${libio_dir}]"
206
    } else {
207
        return ""
208
    }
209
}
210
 
211
proc g++_include_flags { args } {
212
    global srcdir
213
 
214
    if [is_remote host] {
215
        return ""
216
    }
217
 
218
    set gccpath [get_multilibs]
219
    set libio_dir ""
220
    set flags ""
221
 
222
    set dir [lookfor_file ${srcdir} libg++]
223
    if { ${dir} != "" } {
224
        append flags "-I${dir} -I${dir}/src "
225
    }
226
    set dir [lookfor_file ${srcdir} libstdc++]
227
    if { ${dir} != "" } {
228
        append flags "-I${dir} -I${dir}/stl"
229
    }
230
    return "$flags"
231
}
232
 
233
proc g++_link_flags { args } {
234
    global srcdir
235
    global ld_library_path
236
 
237
    set gccpath [get_multilibs];
238
    set libio_dir ""
239
    set flags ""
240
    set ld_library_path "."
241
 
242
    if { $gccpath != "" } {
243
        if [file exists "${gccpath}/lib/libstdc++.a"] {
244
            append ld_library_path ":${gccpath}/lib"
245
        }
246
        if [file exists "${gccpath}/libg++/libg++.a"] {
247
            append flags "-L${gccpath}/libg++ "
248
            append ld_library_path ":${gccpath}/libg++"
249
        }
250
        if [file exists "${gccpath}/libstdc++/libstdc++.a"] {
251
            append flags "-L${gccpath}/libstdc++ "
252
            append ld_library_path ":${gccpath}/libstdc++"
253
        }
254
        if [file exists "${gccpath}/libiberty/libiberty.a"] {
255
            append flags "-L${gccpath}/libiberty "
256
        }
257
        if [file exists "${gccpath}/librx/librx.a"] {
258
            append flags "-L${gccpath}/librx "
259
        }
260
    } else {
261
        global tool_root_dir;
262
 
263
        set libgpp [lookfor_file ${tool_root_dir} libg++];
264
        if { $libgpp != "" } {
265
            append flags "-L${libgpp} ";
266
            append ld_library_path ":${libgpp}"
267
        }
268
        set libstdcpp [lookfor_file ${tool_root_dir} libstdc++];
269
        if { $libstdcpp != "" } {
270
            append flags "-L${libstdcpp} ";
271
            append ld_library_path ":${libstdcpp}"
272
        }
273
        set libiberty [lookfor_file ${tool_root_dir} libiberty];
274
        if { $libiberty != "" } {
275
            append flags "-L${libiberty} ";
276
        }
277
        set librx [lookfor_file ${tool_root_dir} librx];
278
        if { $librx != "" } {
279
            append flags "-L${librx} ";
280
        }
281
    }
282
    return "$flags"
283
}
284
 
285
proc libstdc++_include_flags { args } {
286
    global srcdir
287
 
288
    if [is_remote host] {
289
        return ""
290
    }
291
 
292
    set gccpath [get_multilibs]
293
    set libio_dir ""
294
    set flags ""
295
 
296
    set dir [lookfor_file ${srcdir} libstdc++]
297
    if { ${dir} != "" } {
298
        append flags "-I${dir} -I${dir}/stl"
299
    }
300
    return "$flags"
301
}
302
 
303
proc libstdc++_link_flags { args } {
304
    global srcdir
305
    global ld_library_path
306
 
307
    set gccpath [get_multilibs];
308
    set libio_dir ""
309
    set flags ""
310
 
311
    if { $gccpath != "" } {
312
        if [file exists "${gccpath}/libstdc++/libstdc++.a"] {
313
            append flags "-L${gccpath}/libstdc++ "
314
            append ld_library_path ":${gccpath}/libstdc++"
315
        }
316
        if [file exists "${gccpath}/libiberty/libiberty.a"] {
317
            append flags "-L${gccpath}/libiberty "
318
        }
319
        if [file exists "${gccpath}/librx/librx.a"] {
320
            append flags "-L${gccpath}/librx "
321
        }
322
    } else {
323
        global tool_root_dir;
324
 
325
        set libstdcpp [lookfor_file ${tool_root_dir} libstdc++];
326
        if { $libstdcpp != "" } {
327
            append flags "-L${libstdcpp} ";
328
            append ld_library_path ":${libstdcpp}"
329
        }
330
        set libiberty [lookfor_file ${tool_root_dir} libiberty];
331
        if { $libiberty != "" } {
332
            append flags "-L${libiberty} ";
333
        }
334
        set librx [lookfor_file ${tool_root_dir} librx];
335
        if { $librx != "" } {
336
            append flags "-L${librx} ";
337
        }
338
    }
339
    return "$flags"
340
}
341
 
342
#
343
# Get the list of directories and -m options for gcc. This is kinda bogus that
344
# generic testing software needs support for gcc hardwired in, but to make
345
# testing the GNU tools work right, there didn't seem to be any other way.
346
#
347
 
348
proc get_multilibs { args } {
349
    global target_alias
350
    global board
351
    global board_info
352
 
353
    # if we're on a remote host, we can't search for the file, so we can only
354
    # use an installed compiler, so we don't add any paths here.
355
    if [is_remote host] {
356
        return ""
357
    }
358
 
359
    if [info exists board] {
360
        set target_board $board;
361
    } else {
362
        set target_board [target_info name];
363
    }
364
 
365
    if { [llength $args] == 0 } {
366
        if [board_info $target_board exists multitop] {
367
            return "[board_info $target_board multitop]";
368
        }
369
 
370
        set board_info($target_board,multitop) ""
371
    }
372
 
373
    if { [board_info $target_board exists compiler] } {
374
        set compiler [board_info $target_board compiler];
375
    } else {
376
        set compiler [find_gcc];
377
    }
378
 
379
    if { $compiler == "" } {
380
        return "";
381
    }
382
 
383
    foreach x "$compiler" {
384
        if [regexp "^-B" "$x"] {
385
            regsub "^-B" "$x" "" comp_base_dir;
386
            set comp_base_dir [file dirname $comp_base_dir];
387
            break;
388
        }
389
    }
390
    if { [llength $args] > 0 } {
391
        set mopts [lindex $args 0];
392
    } else {
393
        if { [board_info $target_board exists multilib_flags] } {
394
            set mopts [board_info $target_board multilib_flags];
395
        } else {
396
            set mopts ""
397
        }
398
    }
399
 
400
    regsub "^-" $mopts "" moptions
401
    regsub -all " -" $moptions " " dirty_moptions
402
    set moptions ""
403
    foreach x [split $dirty_moptions " "] {
404
        if { $x != "" && [lsearch -exact $moptions $x] < 0 } {
405
            lappend moptions $x
406
        }
407
    }
408
 
409
    regexp "/.* " $compiler compiler
410
    set compiler [string trimright $compiler " "]
411
    verbose "compiler is $compiler"
412
 
413
    if { [which $compiler] == 0 } {
414
        return "";
415
    }
416
 
417
    if ![info exists comp_base_dir] {
418
        set comp_base_dir [file dirname [file dirname [file dirname [file dirname [file dirname [exec $compiler --print-prog-name=cc1]]]]]];
419
    }
420
 
421
    # set output [exec $objdump_name --file-headers objfmtst.o ]
422
    set default_multilib [exec $compiler --print-multi-lib]
423
    set default_multilib [lindex $default_multilib 0];
424
    set extra [string trimleft $default_multilib "."]
425
 
426
    # extract the options and their directory names as know by gcc
427
    foreach i "[exec $compiler --print-multi-lib]" {
428
        if {$extra != ""} {
429
          set i [string trimright $i $extra"]
430
        }
431
        set opts ""
432
        set dir ""
433
        regexp -- "\[a-z0-9=/\.-\]*;" $i dir
434
        set dir [string trimright $dir "\;@"]
435
        regexp -- "\;@*\[\@a-zA-Z0-9=/\.-\]*" $i opts
436
        set opts [split [string trimleft $opts "\;@"] "@"]
437
        lappend multilibs "$dir {$opts }"
438
    }
439
 
440
    # extract the MULTILIB_MATCHES from dumpspecs
441
    set multimatches ""
442
    set lines [split [exec $compiler -dumpspecs] "\n"]
443
    for {set i 0} {$i <= [llength $lines] - 1} {incr i 1} {
444
        if {"*multilib_matches:" == "[lindex $lines $i]"} {
445
            set multimatches [lindex $lines [expr $i + 1]]
446
            break
447
        }
448
    }
449
    # if we find some
450
    if {$multimatches != ""} {
451
        # Split it into a list of pairs. If an moptions are the first
452
        # of a pair, then replace it with the second.  If an moption
453
        # is not in multimatches, we assume it's not a multilib option
454
 
455
        set splitmatches [split $multimatches ";"]
456
        set multimatches ""
457
        foreach i $splitmatches {
458
            lappend multimatches [split $i " "]
459
        }
460
        verbose "multimatches: $multimatches" 3
461
 
462
        verbose "options before multimatches: $moptions" 3
463
        set toptions $moptions
464
        set moptions ""
465
        foreach i $toptions {
466
            foreach j $multimatches {
467
                verbose "comparing [lindex $j 0] == $i" 3
468
                if {[lindex $j 0] == $i} {
469
                    lappend moptions [lindex $j 1]
470
                }
471
            }
472
        }
473
        verbose "options after multimatches: $moptions" 3
474
    }
475
 
476
    # search for the top level multilib directory
477
    set multitop [lookfor_file "${comp_base_dir}" "${target_alias}"]
478
    if { $multitop == "" } {
479
        set multitop [lookfor_file "${comp_base_dir}" "libraries"]
480
        if { $multitop == "" } {
481
            set multitop "[lookfor_file ${comp_base_dir} gcc/xgcc]"
482
            if { $multitop != "" } {
483
                set multitop [file dirname [file dirname $multitop]];
484
            } else {
485
                return ""
486
            }
487
        }
488
    }
489
 
490
    # make a list of -m options from the various compiler config variables
491
    set gccpath ""
492
 
493
    # compare the lists of gcc options with the list of support multilibs
494
    verbose "Supported multilibs are: $multilibs" 3
495
    set best 0;
496
    foreach i "$multilibs" {
497
        set hits 0
498
        set opts [lindex $i 1];
499
        if { [llength $opts] <= [llength $moptions] } {
500
            foreach j "$moptions" {
501
                # see if all the -m options match any of the multilibs
502
                verbose "Looking in $i for $j" 3
503
                if { [lsearch -exact $opts $j] >= 0 } {
504
                    incr hits
505
                }
506
            }
507
 
508
            if { $hits > $best } {
509
                verbose "[lindex $i 0] is better, using as gcc path" 2
510
                set gccpath "[lindex $i 0]"
511
                set best $hits;
512
            }
513
        }
514
    }
515
    if ![info exists multitop] {
516
        return "";
517
    }
518
 
519
    verbose "gccpath is $gccpath" 3
520
 
521
    if [file exists $multitop/$gccpath] {
522
        verbose "GCC path is $multitop/$gccpath" 3
523
        if { [llength $args] == 0 } {
524
            set board_info($target_board,multitop) "$multitop/$gccpath"
525
        }
526
        return "$multitop/$gccpath"
527
    } else {
528
        verbose "GCC path is $multitop" 3
529
        if { [llength $args] == 0 } {
530
            set board_info($target_board,multitop) "$multitop"
531
        }
532
        return "$multitop"
533
    }
534
}
535
 
536
proc find_binutils_prog { name } {
537
    global tool_root_dir;
538
 
539
    if ![is_remote host] {
540
 
541
        set file [lookfor_file $tool_root_dir $name];
542
        if { $file == "" } {
543
            set file [lookfor_file $tool_root_dir ${name}-new];
544
        }
545
        if { $file == "" } {
546
            set file [lookfor_file $tool_root_dir binutils/$name];
547
        }
548
        if { $file == "" } {
549
            set file [lookfor_file $tool_root_dir binutils/${name}-new];
550
        }
551
        if { $file != "" } {
552
            set NAME "$file";
553
        } else {
554
            set NAME [transform $name];
555
        }
556
    } else {
557
        set NAME [transform $name]
558
    }
559
    return $NAME;
560
}
561
 
562
proc find_gcc {} {
563
    global tool_root_dir
564
 
565
    if ![is_remote host] {
566
        set file [lookfor_file $tool_root_dir xgcc];
567
        if { $file == "" } {
568
            set file [lookfor_file $tool_root_dir gcc/xgcc];
569
        }
570
        if { $file != "" } {
571
            set CC "$file -B[file dirname $file]/";
572
        } else {
573
            set CC [transform gcc];
574
        }
575
    } else {
576
        set CC [transform gcc]
577
    }
578
    return $CC;
579
}
580
 
581
proc find_gcj {} {
582
    global tool_root_dir
583
 
584
    if ![is_remote host] {
585
        set file [lookfor_file $tool_root_dir gcj];
586
        if { $file == "" } {
587
            set file [lookfor_file $tool_root_dir gcc/gcj];
588
        }
589
        if { $file != "" } {
590
            set CC "$file -B[file dirname $file]/";
591
        } else {
592
            set CC [transform gcj];
593
        }
594
    } else {
595
        set CC [transform gcj]
596
    }
597
    return $CC;
598
}
599
 
600
proc find_g++ {} {
601
    global tool_root_dir
602
 
603
    if ![is_remote host] {
604
        set file [lookfor_file $tool_root_dir g++];
605
        if { $file == "" } {
606
            set file [lookfor_file $tool_root_dir gcc/g++];
607
        }
608
        if { $file != "" } {
609
            set CC "$file -B[file dirname $file]/";
610
        } else {
611
            set CC [transform g++];
612
        }
613
    } else {
614
        set CC [transform g++]
615
    }
616
    return $CC;
617
}
618
 
619
proc find_g77 {} {
620
    global tool_root_dir
621
 
622
    if ![is_remote host] {
623
        set file [lookfor_file $tool_root_dir g77];
624
        if { $file == "" } {
625
            set file [lookfor_file $tool_root_dir gcc/g77];
626
        }
627
        if { $file != "" } {
628
            set CC "$file -B[file dirname $file]/";
629
        } else {
630
            set CC [transform g77];
631
        }
632
    } else {
633
        set CC [transform g77]
634
    }
635
    return $CC;
636
}
637
 
638
proc find_nm {} {
639
    global tool_root_dir
640
 
641
    set NM ""
642
    if ![is_remote host] {
643
        set NM [lookfor_file $tool_root_dir nm-new]
644
        if {$NM == ""} {
645
            set NM [lookfor_file $tool_root_dir binutils/nm-new]
646
        }
647
    }
648
    if { $NM == ""} {
649
        set NM [transform nm];
650
    }
651
    return $NM;
652
}
653
 
654
proc process_multilib_options { args } {
655
    global board;
656
    global board_variant_list;
657
    global is_gdb_remote;
658
 
659
    set is_gdb_remote 0;
660
 
661
    if [board_info $board exists multilib_flags] {
662
        return;
663
    }
664
    eval add_multilib_option $args;
665
 
666
    set multilib_flags "";
667
 
668
    foreach x $board_variant_list {
669
        regsub -all "^\[ \t\]*" "$x" "" x;
670
        regsub -all "\[ \t\]*$" "$x" "" x;
671
 
672
        if { $x == "" } {
673
            continue;
674
        }
675
        case $x in {
676
            { aout } {
677
                set_board_info obj_format "a.out";
678
            }
679
            { elf } {
680
                set_board_info obj_format "elf";
681
            }
682
            { pe } {
683
                set_board_info obj_format "pe";
684
            }
685
            { ecoff } {
686
                set_board_info obj_format "ecoff";
687
            }
688
            { stabs } {
689
                set_board_info debug_flags "-gstabs";
690
            }
691
            { dwarf2 } {
692
                set_board_info debug_flags "-gdwarf2";
693
            }
694
            { gdb:*=* } {
695
                regsub "^gdb:\[^=\]*=(.*)$" "$x" "\\1" value;
696
                regsub "^gdb:(\[^=\]*)=.*$" "$x" "\\1" variable;
697
                set_board_info $variable "$value";
698
            }
699
            { gdb*remote } {
700
                set is_gdb_remote 1;
701
            }
702
            { little*endian el EL } {
703
                append multilib_flags " -EL";
704
            }
705
            { big*endian eb EB } {
706
                append multilib_flags " -EB";
707
            }
708
            { "soft*float" } {
709
                append multilib_flags " -msoft-float"
710
            }
711
            { "-*" } {
712
                append multilib_flags " $x";
713
            }
714
            default {
715
                append multilib_flags " -m$x";
716
            }
717
        }
718
    }
719
    set_board_info multilib_flags $multilib_flags;
720
}
721
 
722
proc add_multilib_option { args } {
723
    global board_variant_list
724
 
725
    if ![info exists board_variant_list] {
726
        set board_variant_list ""
727
    }
728
    set board_variant_list [concat $args $board_variant_list];
729
}
730
 
731
proc find_gas { } {
732
    global tool_root_dir
733
 
734
    set AS ""
735
 
736
    if ![is_remote host] {
737
        set AS [lookfor_file $tool_root_dir as-new];
738
        if { $AS == "" } {
739
            set AS [lookfor_file $tool_root_dir gas/as-new];
740
        }
741
    }
742
    if { $AS == "" } {
743
        set AS [transform as];
744
    }
745
    return $AS;
746
}
747
 
748
proc find_ld { } {
749
    global tool_root_dir
750
 
751
    set LD ""
752
 
753
    if ![is_remote host] {
754
        set LD [lookfor_file $tool_root_dir ld-new];
755
        if { $LD == "" } {
756
            set LD [lookfor_file $tool_root_dir ld/ld-new];
757
        }
758
    }
759
    if { $LD == "" } {
760
        set LD [transform ld];
761
    }
762
    return $LD;
763
}
764
 
765
proc build_wrapper { gluefile } {
766
    global libdir
767
 
768
    if [target_info exists wrap_m68k_aout] {
769
        set flags "additional_flags=-DWRAP_M68K_AOUT";
770
        set result "";
771
    } elseif [target_info exists uses_underscores] {
772
        set flags "additional_flags=-DUNDERSCORES";
773
        set result "-Wl,-wrap,__exit -Wl,-wrap,_main -Wl,-wrap,_abort";
774
    } else {
775
        set flags "";
776
        if [target_info exists is_vxworks] {
777
            set flags "additional_flags=-DVXWORKS";
778
        }
779
        set result "-Wl,-wrap,exit -Wl,-wrap,main -Wl,-wrap,abort";
780
    }
781
    if [target_info exists wrap_compile_flags] {
782
        lappend flags "additional_flags=[target_info wrap_compile_flags]";
783
    }
784
    if { [target_compile ${libdir}/testglue.c ${gluefile} object $flags] == "" } {
785
        set gluefile [remote_download host ${gluefile} testglue.o];
786
        return [list $gluefile $result];
787
    } else {
788
        return ""
789
    }
790
}
791
 
792
 
793
proc winsup_include_flags { args } {
794
    global srcdir
795
 
796
    if [isnative] {
797
        return ""
798
    }
799
 
800
    if [is_remote host] {
801
        return ""
802
    }
803
 
804
    set gccpath "[get_multilibs]"
805
 
806
    if [file exists $gccpath/winsup] {
807
        verbose "Winsup path is $gccpath/winsup"
808
 
809
        set winsup_dir [lookfor_file ${srcdir} winsup/include/windows.h]
810
        if { ${winsup_dir} != "" } {
811
            set winsup_dir [file dirname ${winsup_dir}]
812
            return " -I${winsup_dir}"
813
        }
814
    }
815
    verbose "No winsup support for this target"
816
 
817
}
818
#
819
# Find the winsup libraries in the current source tree.
820
#
821
proc winsup_link_flags { args } {
822
    # libgloss doesn't work native
823
    if [isnative] {
824
        return ""
825
    }
826
 
827
    # if we're on a remote host, we can't search for the file, so we can only
828
    # use an installed compiler, so we don't add any paths here.
829
    if [is_remote host] {
830
        return ""
831
    }
832
 
833
    set gccpath "[get_multilibs]"
834
 
835
    verbose "Looking for $gccpath/winsup"
836
    if [file exists $gccpath/winsup] {
837
        verbose "Winsup path is $gccpath/newlib"
838
        return "-B$gccpath/winsup/ -L$gccpath/winsup"
839
    } else {
840
        verbose "No winsup support for this target"
841
        return ""
842
    }
843
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.