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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [binutils-2.20.1/] [ld/] [emultempl/] [z80.em] - Blame information for rev 818

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 205 julius
# This shell script emits C code -*- C -*-
2
# to keep track of the machine type of Z80 object files
3
# It does some substitutions.
4
#   Copyright 2005, 2007, 2008 Free Software Foundation, Inc.
5
# This file is part of the GNU Binutils.
6
#
7
# This program is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20
# MA 02110-1301, USA.
21
 
22
LDEMUL_BEFORE_PARSE=gldz80_before_parse
23
LDEMUL_RECOGNIZED_FILE=gldz80_recognized_file
24
LDEMUL_AFTER_OPEN=gldz80_after_open
25
 
26
fragment <
27
/* --- \begin{z80.em} */
28
/* Codes for machine types, bitwise or gives the code to use for the
29
   output.  */
30
#define M_Z80STRICT 1
31
#define M_Z80 3
32
#define M_Z80FULL 7
33
#define M_R800 11
34
#define M_Z80ANY 15
35
 
36
/* Bitwise or of the machine types seen so far.  */
37
static int result_mach_type;
38
 
39
static void
40
${LDEMUL_BEFORE_PARSE} (void)
41
{
42
#ifndef TARGET_                 /* I.e., if not generic.  */
43
  ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown);
44
#endif /* not TARGET_ */
45
  result_mach_type = M_Z80STRICT;
46
}
47
 
48
 
49
/* Update result_mach_type.  */
50
static bfd_boolean
51
${LDEMUL_RECOGNIZED_FILE} (lang_input_statement_type *entry)
52
{
53
  unsigned long mach_type;
54
 
55
  mach_type = bfd_get_mach (entry->the_bfd);
56
  switch (mach_type)
57
    {
58
    case bfd_mach_z80strict:
59
      result_mach_type |= M_Z80STRICT;
60
      break;
61
    case bfd_mach_z80:
62
      result_mach_type |= M_Z80;
63
      break;
64
    case bfd_mach_z80full:
65
      result_mach_type |= M_Z80FULL;
66
      break;
67
    case bfd_mach_r800:
68
      result_mach_type |= M_R800;
69
      break;
70
    default:
71
      result_mach_type |= M_Z80ANY;
72
    }
73
  return FALSE;
74
}
75
 
76
/* Set the machine type of the output file based on result_mach_type.  */
77
static void
78
gldz80_after_open (void)
79
{
80
  unsigned long mach_type;
81
 
82
  switch (result_mach_type)
83
    {
84
    case M_Z80STRICT:
85
      mach_type = bfd_mach_z80strict;
86
      break;
87
    case M_Z80:
88
      mach_type = bfd_mach_z80;
89
      break;
90
    case M_Z80FULL:
91
      mach_type = bfd_mach_z80full;
92
      break;
93
    case M_R800:
94
      mach_type = bfd_mach_r800;
95
      break;
96
    default:
97
      mach_type = 0;
98
    }
99
  bfd_set_arch_mach (link_info.output_bfd, bfd_arch_z80, mach_type);
100
}
101
/* --- \end{z80.em} */
102
EOF

powered by: WebSVN 2.1.0

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