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

Subversion Repositories open8_urisc

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

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
#   Copyright 2010
3
#   Free Software Foundation, Inc.
4
#
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
 
23
# This file is sourced from generic.em.
24
 
25
fragment <
26
#include "getopt.h"
27
 
28
static void
29
gld${EMULATION_NAME}_before_parse (void)
30
{
31
  ldfile_set_output_arch ("${ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
32
  config.dynamic_link = TRUE;
33
  config.has_shared = FALSE; /* Not yet.  */
34
}
35
 
36
/* This is called before the input files are opened.  We add the
37
   standard library.  */
38
 
39
static void
40
gld${EMULATION_NAME}_create_output_section_statements (void)
41
{
42
  lang_add_input_file ("imagelib", lang_input_file_is_l_enum, NULL);
43
  lang_add_input_file ("starlet", lang_input_file_is_l_enum, NULL);
44
  lang_add_input_file ("sys\$public_vectors", lang_input_file_is_l_enum, NULL);
45
}
46
 
47
/* Try to open a dynamic archive.  This is where we know that VMS
48
   shared images (dynamic libraries) have an extension of .exe.  */
49
 
50
static bfd_boolean
51
gld${EMULATION_NAME}_open_dynamic_archive (const char *arch ATTRIBUTE_UNUSED,
52
                                           search_dirs_type *search,
53
                                           lang_input_statement_type *entry)
54
{
55
  char *string;
56
 
57
  if (! entry->maybe_archive)
58
    return FALSE;
59
 
60
  string = (char *) xmalloc (strlen (search->name)
61
                             + strlen (entry->filename)
62
                             + sizeof "/.exe");
63
 
64
  sprintf (string, "%s/%s.exe", search->name, entry->filename);
65
 
66
  if (! ldfile_try_open_bfd (string, entry))
67
    {
68
      free (string);
69
      return FALSE;
70
    }
71
 
72
  entry->filename = string;
73
 
74
  return TRUE;
75
}
76
 
77
static int
78
gld${EMULATION_NAME}_find_potential_libraries
79
  (char *name, lang_input_statement_type *entry)
80
{
81
  return ldfile_open_file_search (name, entry, "", ".olb");
82
}
83
 
84
/* Place an orphan section.  We use this to put random OVR sections.
85
   Much borrowed from elf32.em.  */
86
 
87
static lang_output_section_statement_type *
88
vms_place_orphan (asection *s,
89
                  const char *secname ATTRIBUTE_UNUSED,
90
                  int constraint ATTRIBUTE_UNUSED)
91
{
92
  static struct orphan_save hold_data =
93
    {
94
      "\$DATA\$",
95
      SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_DATA,
96
      0, 0, 0, 0
97
    };
98
 
99
  /* We have nothing to say for anything other than a final link or an excluded
100
     section.  */
101
  if (link_info.relocatable
102
      || (s->flags & (SEC_EXCLUDE | SEC_LOAD)) != SEC_LOAD)
103
    return NULL;
104
 
105
  /* FIXME: we should place sections by VMS program section flags.  */
106
 
107
  /* Only handle data sections.  */
108
  if ((s->flags & SEC_DATA) == 0)
109
    return NULL;
110
 
111
  if (hold_data.os == NULL)
112
    hold_data.os = lang_output_section_find (hold_data.name);
113
 
114
  if (hold_data.os != NULL)
115
    {
116
      lang_add_section (&hold_data.os->children, s, hold_data.os);
117
      return hold_data.os;
118
    }
119
  else
120
    return NULL;
121
}
122
 
123
/* VMS specific options.  */
124
#define OPTION_IDENTIFICATION           (300  + 1)
125
 
126
static void
127
gld${EMULATION_NAME}_add_options
128
  (int ns ATTRIBUTE_UNUSED,
129
   char **shortopts ATTRIBUTE_UNUSED,
130
   int nl,
131
   struct option **longopts,
132
   int nrl ATTRIBUTE_UNUSED,
133
   struct option **really_longopts ATTRIBUTE_UNUSED)
134
{
135
  static const struct option xtra_long[] = {
136
    {"identification", required_argument, NULL, OPTION_IDENTIFICATION},
137
    {NULL, no_argument, NULL, 0}
138
  };
139
 
140
  *longopts
141
    = xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long));
142
  memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long));
143
}
144
 
145
static void
146
gld${EMULATION_NAME}_list_options (FILE *file)
147
{
148
  fprintf (file, _("  --identification           Set the identification of the output\n"));
149
}
150
 
151
static bfd_boolean
152
gld${EMULATION_NAME}_handle_option (int optc)
153
{
154
  switch (optc)
155
    {
156
    default:
157
      return FALSE;
158
 
159
    case OPTION_IDENTIFICATION:
160
      /* Currently ignored.  */
161
      break;
162
    }
163
 
164
  return TRUE;
165
}
166
 
167
EOF
168
 
169
LDEMUL_PLACE_ORPHAN=vms_place_orphan
170
LDEMUL_BEFORE_PARSE=gld"$EMULATION_NAME"_before_parse
171
LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=gld"$EMULATION_NAME"_create_output_section_statements
172
LDEMUL_FIND_POTENTIAL_LIBRARIES=gld"$EMULATION_NAME"_find_potential_libraries
173
LDEMUL_OPEN_DYNAMIC_ARCHIVE=gld"$EMULATION_NAME"_open_dynamic_archive
174
LDEMUL_ADD_OPTIONS=gld"$EMULATION_NAME"_add_options
175
LDEMUL_HANDLE_OPTION=gld"$EMULATION_NAME"_handle_option
176
LDEMUL_LIST_OPTIONS=gld"$EMULATION_NAME"_list_options

powered by: WebSVN 2.1.0

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