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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [ld/] [emultempl/] [elf-generic.em] - Blame information for rev 832

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

Line No. Rev Author Line
1 38 julius
# This shell script emits a C file. -*- C -*-
2
#   Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
3
#
4
# This file is part of the GNU Binutils.
5
#
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19
# MA 02110-1301, USA.
20
#
21
 
22
# This file is sourced from elf32.em and from ELF targets that use
23
# generic.em.
24
#
25
fragment <
26
 
27
static void
28
gld${EMULATION_NAME}_map_segments (bfd_boolean need_layout)
29
{
30
  int tries = 10;
31
 
32
  do
33
    {
34
      if (need_layout)
35
        {
36
          lang_reset_memory_regions ();
37
 
38
          /* Resize the sections.  */
39
          lang_size_sections (NULL, TRUE);
40
 
41
          /* Redo special stuff.  */
42
          ldemul_after_allocation ();
43
 
44
          /* Do the assignments again.  */
45
          lang_do_assignments ();
46
 
47
          need_layout = FALSE;
48
        }
49
 
50
      if (link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour
51
          && !link_info.relocatable)
52
        {
53
          bfd_size_type phdr_size;
54
 
55
          phdr_size = elf_tdata (link_info.output_bfd)->program_header_size;
56
          /* If we don't have user supplied phdrs, throw away any
57
             previous linker generated program headers.  */
58
          if (lang_phdr_list == NULL)
59
            elf_tdata (link_info.output_bfd)->segment_map = NULL;
60
          if (!_bfd_elf_map_sections_to_segments (link_info.output_bfd,
61
                                                  &link_info))
62
            einfo ("%F%P: map sections to segments failed: %E\n");
63
 
64
          if (phdr_size
65
              != elf_tdata (link_info.output_bfd)->program_header_size)
66
            {
67
              if (tries > 6)
68
                /* The first few times we allow any change to
69
                   phdr_size .  */
70
                need_layout = TRUE;
71
              else if (phdr_size
72
                       < elf_tdata (link_info.output_bfd)->program_header_size)
73
                /* After that we only allow the size to grow.  */
74
                need_layout = TRUE;
75
              else
76
                elf_tdata (link_info.output_bfd)->program_header_size
77
                  = phdr_size;
78
            }
79
        }
80
    }
81
  while (need_layout && --tries);
82
 
83
  if (tries == 0)
84
    einfo (_("%P%F: looping in map_segments"));
85
}
86
EOF

powered by: WebSVN 2.1.0

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