+2007-08-13 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (elf_modify_segment_map): Add remove_empty_load param.
+ Don't remove empty PT_LOAD header if false.
+ (_bfd_elf_map_sections_to_segments): If user phdrs, pass false
+ to elf_modify_segment_map.
+ (assign_file_positions_for_load_sections): Pass false to
+ elf_modify_segment_map.
+
2007-08-13 Alan Modra <amodra@bigpond.net.au>
* elf64-ppc.c (ADDI_R12_R12, LD_R11_0R2, LD_R2_0R2): Define.
/* Possibly add or remove segments from the segment map. */
static bfd_boolean
-elf_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
+elf_modify_segment_map (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean remove_empty_load)
{
struct elf_segment_map **m;
const struct elf_backend_data *bed;
}
(*m)->count = new_count;
- if ((*m)->p_type == PT_LOAD && (*m)->count == 0)
+ if (remove_empty_load && (*m)->p_type == PT_LOAD && (*m)->count == 0)
*m = (*m)->next;
else
m = &(*m)->next;
struct elf_segment_map *m;
asection **sections = NULL;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ bfd_boolean no_user_phdrs;
- if (elf_tdata (abfd)->segment_map == NULL
- && bfd_count_sections (abfd) != 0)
+ no_user_phdrs = elf_tdata (abfd)->segment_map == NULL;
+ if (no_user_phdrs && bfd_count_sections (abfd) != 0)
{
asection *s;
unsigned int i;
elf_tdata (abfd)->segment_map = mfirst;
}
- if (!elf_modify_segment_map (abfd, info))
+ if (!elf_modify_segment_map (abfd, info, no_user_phdrs))
return FALSE;
for (count = 0, m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
unsigned int i, j;
if (link_info == NULL
- && !elf_modify_segment_map (abfd, link_info))
+ && !elf_modify_segment_map (abfd, link_info, FALSE))
return FALSE;
alloc = 0;