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

Subversion Repositories open8_urisc

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

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 2003, 2004, 2005, 2007, 2008, 2009
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 elf32.em, and defines extra alpha
24
# specific routines.
25
#
26
fragment <
27
 
28
#include "elf/internal.h"
29
#include "elf/alpha.h"
30
#include "elf-bfd.h"
31
 
32
static bfd_boolean limit_32bit;
33
 
34
extern bfd_boolean elf64_alpha_use_secureplt;
35
 
36
 
37
/* Set the start address as in the Tru64 ld.  */
38
#define ALPHA_TEXT_START_32BIT 0x12000000
39
 
40
static void
41
alpha_after_open (void)
42
{
43
  if (bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
44
      && elf_object_id (link_info.output_bfd) == ALPHA_ELF_DATA)
45
    {
46
      unsigned int num_plt;
47
      lang_output_section_statement_type *os;
48
      lang_output_section_statement_type *plt_os[2];
49
 
50
      num_plt = 0;
51
      for (os = &lang_output_section_statement.head->output_section_statement;
52
           os != NULL;
53
           os = os->next)
54
        {
55
          if (os->constraint == SPECIAL && strcmp (os->name, ".plt") == 0)
56
            {
57
              if (num_plt < 2)
58
                plt_os[num_plt] = os;
59
              ++num_plt;
60
            }
61
        }
62
 
63
      if (num_plt == 2)
64
        {
65
          plt_os[0]->constraint = elf64_alpha_use_secureplt ? 0 : -1;
66
          plt_os[1]->constraint = elf64_alpha_use_secureplt ? -1 : 0;
67
        }
68
    }
69
 
70
  gld${EMULATION_NAME}_after_open ();
71
}
72
 
73
static void
74
alpha_after_parse (void)
75
{
76
  if (limit_32bit && !link_info.shared && !link_info.relocatable)
77
    lang_section_start (".interp",
78
                        exp_binop ('+',
79
                                   exp_intop (ALPHA_TEXT_START_32BIT),
80
                                   exp_nameop (SIZEOF_HEADERS, NULL)),
81
                        NULL);
82
 
83
  after_parse_default ();
84
}
85
 
86
static void
87
alpha_before_allocation (void)
88
{
89
  /* Call main function; we're just extending it.  */
90
  gld${EMULATION_NAME}_before_allocation ();
91
 
92
  /* Add -relax if -O, not -r, and not explicitly disabled.  */
93
  if (link_info.optimize && !link_info.relocatable && ! RELAXATION_DISABLED_BY_USER)
94
    ENABLE_RELAXATION;
95
}
96
 
97
static void
98
alpha_finish (void)
99
{
100
  if (limit_32bit)
101
    elf_elfheader (link_info.output_bfd)->e_flags |= EF_ALPHA_32BIT;
102
 
103
  finish_default ();
104
}
105
EOF
106
 
107
# Define some shell vars to insert bits of code into the standard elf
108
# parse_args and list_options functions.
109
#
110
PARSE_AND_LIST_PROLOGUE='
111
#define OPTION_TASO             300
112
#define OPTION_SECUREPLT        (OPTION_TASO + 1)
113
#define OPTION_NO_SECUREPLT     (OPTION_SECUREPLT + 1)
114
'
115
 
116
PARSE_AND_LIST_LONGOPTS='
117
  { "taso", no_argument, NULL, OPTION_TASO },
118
  { "secureplt", no_argument, NULL, OPTION_SECUREPLT },
119
  { "no-secureplt", no_argument, NULL, OPTION_NO_SECUREPLT },
120
'
121
 
122
PARSE_AND_LIST_OPTIONS='
123
  fprintf (file, _("\
124
  --taso                      Load executable in the lower 31-bit addressable\n\
125
                                virtual address range.\n\
126
  --secureplt                 Force PLT in text segment.\n\
127
  --no-secureplt              Force PLT in data segment.\n\
128
"));
129
'
130
 
131
PARSE_AND_LIST_ARGS_CASES='
132
    case OPTION_TASO:
133
      limit_32bit = 1;
134
      break;
135
    case OPTION_SECUREPLT:
136
      elf64_alpha_use_secureplt = TRUE;
137
      break;
138
    case OPTION_NO_SECUREPLT:
139
      elf64_alpha_use_secureplt = FALSE;
140
      break;
141
'
142
 
143
# Put these extra alpha routines in ld_${EMULATION_NAME}_emulation
144
#
145
LDEMUL_AFTER_OPEN=alpha_after_open
146
LDEMUL_AFTER_PARSE=alpha_after_parse
147
LDEMUL_BEFORE_ALLOCATION=alpha_before_allocation
148
LDEMUL_FINISH=alpha_finish

powered by: WebSVN 2.1.0

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