diff options
author | Ian Lance Taylor <ian@airs.com> | 1995-12-01 21:44:38 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1995-12-01 21:44:38 +0000 |
commit | 3b95078004bdd59e5381e9a8dd85d895deace44f (patch) | |
tree | 03e37e2736165efd7350ca4bf9020734d8d903e2 /bfd/elf.c | |
parent | ce0ee4bf49c5fe5e1d77cb1487bd6629b1b333db (diff) | |
download | gdb-3b95078004bdd59e5381e9a8dd85d895deace44f.zip gdb-3b95078004bdd59e5381e9a8dd85d895deace44f.tar.gz gdb-3b95078004bdd59e5381e9a8dd85d895deace44f.tar.bz2 |
* elf.c (assign_file_positions_for_segments): Sort the sections in
each segment.
(get_program_header_size): Return the right size if segment_map is
not NULL.
(copy_private_bfd_data): Don't bother to sort the sections.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -1797,6 +1797,12 @@ assign_file_positions_for_segments (abfd) unsigned int i; asection **secpp; + /* If elf_segment_map is not from map_sections_to_segments, the + sections may not be correctly ordered. */ + if (m->count > 0) + qsort (m->sections, (size_t) m->count, sizeof (asection *), + elf_sort_sections); + p->p_type = m->p_type; if (m->p_flags_valid) @@ -2019,6 +2025,17 @@ get_program_header_size (abfd) if (elf_tdata (abfd)->program_header_size != 0) return elf_tdata (abfd)->program_header_size; + if (elf_tdata (abfd)->segment_map != NULL) + { + struct elf_segment_map *m; + + segs = 0; + for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) + ++segs; + elf_tdata (abfd)->program_header_size = segs * bed->s->sizeof_phdr; + return elf_tdata (abfd)->program_header_size; + } + /* Assume we will need exactly two PT_LOAD segments: one for text and one for data. */ segs = 2; @@ -2539,9 +2556,6 @@ copy_private_bfd_data (ibfd, obfd) } } BFD_ASSERT (isec == csecs); - if (csecs > 0) - qsort (m->sections, (size_t) csecs, sizeof (asection *), - elf_sort_sections); m->count = csecs; *pm = m; |