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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [ld/] [emultempl/] [gld960.em] - Blame information for rev 333

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

Line No. Rev Author Line
1 145 khays
# This shell script emits a C file. -*- C -*-
2
# It does some substitutions.
3
fragment <
4
/* Copyright 1991, 1992, 1994, 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008
5
   Free Software Foundation, Inc.
6
 
7
   This file is part of the GNU Binutils.
8
 
9
   This program is free software; you can redistribute it and/or modify
10
   it under the terms of the GNU General Public License as published by
11
   the Free Software Foundation; either version 3 of the License, or
12
   (at your option) any later version.
13
 
14
   This program is distributed in the hope that it will be useful,
15
   but WITHOUT ANY WARRANTY; without even the implied warranty of
16
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
   GNU General Public License for more details.
18
 
19
   You should have received a copy of the GNU General Public License
20
   along with this program; if not, write to the Free Software
21
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22
   MA 02110-1301, USA.  */
23
 
24
 
25
/* Emulate the Intel's port of  gld.  */
26
 
27
#include "sysdep.h"
28
#include "bfd.h"
29
#include "libiberty.h"
30
#include "bfdlink.h"
31
 
32
#include "ld.h"
33
#include "ldmisc.h"
34
#include "ldmain.h"
35
 
36
#include "ldexp.h"
37
#include "ldlang.h"
38
#include "ldfile.h"
39
#include "ldemul.h"
40
 
41
static void gld960_before_parse (void)
42
{
43
  char *env ;
44
  env =  getenv("G960LIB");
45
  if (env) {
46
    ldfile_add_library_path(env, FALSE);
47
  }
48
  env = getenv("G960BASE");
49
  if (env)
50
    ldfile_add_library_path (concat (env, "/lib", (const char *) NULL), FALSE);
51
  ldfile_output_architecture = bfd_arch_i960;
52
}
53
 
54
static void
55
gld960_set_output_arch (void)
56
{
57
  bfd_set_arch_mach (link_info.output_bfd,
58
                     ldfile_output_architecture, bfd_mach_i960_core);
59
}
60
 
61
static char *
62
gld960_choose_target (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
63
{
64
  char *from_outside = getenv(TARGET_ENVIRON);
65
  output_filename = "b.out";
66
 
67
  if (from_outside != (char *)NULL)
68
    return from_outside;
69
 
70
  return "b.out.little";
71
}
72
 
73
static char *
74
gld960_get_script (int *isfile)
75
EOF
76
 
77
if test -n "$COMPILE_IN"
78
then
79
# Scripts compiled in.
80
 
81
# sed commands to quote an ld script as a C string.
82
sc="-f stringify.sed"
83
 
84
fragment <
85
{
86
  *isfile = 0;
87
 
88
  if (link_info.relocatable && config.build_constructors)
89
    return
90
EOF
91
sed $sc ldscripts/${EMULATION_NAME}.xu                 >> e${EMULATION_NAME}.c
92
echo '  ; else if (link_info.relocatable) return'     >> e${EMULATION_NAME}.c
93
sed $sc ldscripts/${EMULATION_NAME}.xr                 >> e${EMULATION_NAME}.c
94
echo '  ; else if (!config.text_read_only) return'     >> e${EMULATION_NAME}.c
95
sed $sc ldscripts/${EMULATION_NAME}.xbn                >> e${EMULATION_NAME}.c
96
echo '  ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
97
sed $sc ldscripts/${EMULATION_NAME}.xn                 >> e${EMULATION_NAME}.c
98
echo '  ; else return'                                 >> e${EMULATION_NAME}.c
99
sed $sc ldscripts/${EMULATION_NAME}.x                  >> e${EMULATION_NAME}.c
100
echo '; }'                                             >> e${EMULATION_NAME}.c
101
 
102
else
103
# Scripts read from the filesystem.
104
 
105
fragment <
106
{
107
  *isfile = 1;
108
 
109
  if (link_info.relocatable && config.build_constructors)
110
    return "ldscripts/${EMULATION_NAME}.xu";
111
  else if (link_info.relocatable)
112
    return "ldscripts/${EMULATION_NAME}.xr";
113
  else if (!config.text_read_only)
114
    return "ldscripts/${EMULATION_NAME}.xbn";
115
  else if (!config.magic_demand_paged)
116
    return "ldscripts/${EMULATION_NAME}.xn";
117
  else
118
    return "ldscripts/${EMULATION_NAME}.x";
119
}
120
EOF
121
 
122
fi
123
 
124
fragment <
125
 
126
struct ld_emulation_xfer_struct ld_gld960_emulation =
127
{
128
  gld960_before_parse,
129
  syslib_default,
130
  hll_default,
131
  after_parse_default,
132
  after_open_default,
133
  after_allocation_default,
134
  gld960_set_output_arch,
135
  gld960_choose_target,
136
  before_allocation_default,
137
  gld960_get_script,
138
  "960",
139
  "",
140
  finish_default,
141
  NULL, /* create output section statements */
142
  NULL, /* open dynamic archive */
143
  NULL, /* place orphan */
144
  NULL, /* set symbols */
145
  NULL, /* parse args */
146
  NULL, /* add_options */
147
  NULL, /* handle_option */
148
  NULL, /* unrecognized file */
149
  NULL, /* list options */
150
  NULL, /* recognized file */
151
  NULL, /* find_potential_libraries */
152
  NULL  /* new_vers_pattern */
153
};
154
EOF

powered by: WebSVN 2.1.0

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