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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [lib/] [file-format.exp] - Blame information for rev 706

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 701 jeremybenn
#   Copyright (C) 1999, 2007 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 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 GCC; see the file COPYING3.  If not see
15
# .
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# gcc-bugs@gcc.gnu.org
19
 
20
# This file defines a proc for determining the file format in use by the
21
# target.  This is useful for tests that are only supported by certain file
22
# formats.  This procedure is defined in a separate file so that it can be
23
# included by other expect library files.
24
 
25
proc gcc_target_object_format { } {
26
    global gcc_target_object_format_saved
27
    global tool
28
 
29
    if [info exists gcc_target_object_format_saved] {
30
        verbose "gcc_target_object_format returning saved $gcc_target_object_format_saved" 2
31
    } elseif { [istarget *-*-darwin*] } {
32
        # Darwin doesn't necessarily have objdump, so hand-code it.
33
        set gcc_target_object_format_saved mach-o
34
    } elseif { [istarget hppa*-*-hpux*] } {
35
        # HP-UX doesn't necessarily have objdump, so hand-code it.
36
        if { [istarget hppa*64*-*-hpux*] } {
37
          set gcc_target_object_format_saved elf
38
        } else {
39
          set gcc_target_object_format_saved som
40
        }
41
    } else {
42
        set objdump_name [find_binutils_prog objdump]
43
        set open_file [open objfmtst.c w]
44
        puts $open_file "void foo(void) { }"
45
        close $open_file
46
 
47
        ${tool}_target_compile objfmtst.c objfmtst.o object ""
48
        file delete objfmtst.c
49
 
50
        set output [remote_exec host "$objdump_name" "--file-headers objfmtst.o"]
51
        set output [lindex $output 1]
52
 
53
        file delete objfmtst.o
54
 
55
        if ![ regexp "file format (.*)arch" $output dummy objformat ]  {
56
            verbose "Could not parse objdump output" 2
57
            set gcc_target_object_format_saved unknown
58
        } else {
59
            switch -regexp $objformat {
60
                elf          {
61
                    set gcc_target_object_format_saved elf
62
                }
63
                ecoff        {
64
                    set gcc_target_object_format_saved ecoff
65
                }
66
                coff         {
67
                    set gcc_target_object_format_saved coff
68
                }
69
                a\.out       {
70
                    set gcc_target_object_format_saved a.out
71
                }
72
                pe       {
73
                    set gcc_target_object_format_saved pe
74
                }
75
                som          {
76
                    set gcc_target_object_format_saved som
77
                }
78
                default      {
79
                    verbose "Unknown file format: $objformat" 3
80
                    set gcc_target_object_format_saved unknown
81
                }
82
            }
83
 
84
            verbose "gcc_target_object_format returning $gcc_target_object_format_saved" 2
85
        }
86
    }
87
 
88
    return $gcc_target_object_format_saved
89
}

powered by: WebSVN 2.1.0

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