1 # This shell script emits a C file. -*- C -*-
2 # Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
4 # This file is part of the GNU Binutils.
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.
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.
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,
22 # This file is sourced from elf32.em and from ELF targets that use
28 gld${EMULATION_NAME}_map_segments (bfd_boolean need_layout)
34 lang_relax_sections (need_layout);
37 if (link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour
38 && !link_info.relocatable)
40 bfd_size_type phdr_size;
42 phdr_size = elf_tdata (link_info.output_bfd)->program_header_size;
43 /* If we don't have user supplied phdrs, throw away any
44 previous linker generated program headers. */
45 if (lang_phdr_list == NULL)
46 elf_tdata (link_info.output_bfd)->segment_map = NULL;
47 if (!_bfd_elf_map_sections_to_segments (link_info.output_bfd,
49 einfo ("%F%P: map sections to segments failed: %E\n");
52 != elf_tdata (link_info.output_bfd)->program_header_size)
55 /* The first few times we allow any change to
59 < elf_tdata (link_info.output_bfd)->program_header_size)
60 /* After that we only allow the size to grow. */
63 elf_tdata (link_info.output_bfd)->program_header_size
68 while (need_layout && --tries);
71 einfo (_("%P%F: looping in map_segments"));