GNU Binutils with patches for OS216
Revision | 9acd786df49d30f422f4fa6d747c5ea5aec6c31b (tree) |
---|---|
Zeit | 2015-04-21 04:57:30 |
Autor | H.J. Lu <hjl.tools@gmai...> |
Commiter | H.J. Lu |
Place .shstrtab before debug sections
@@ -5616,7 +5616,7 @@ static bfd_boolean | ||
5616 | 5616 | _bfd_elf_assign_file_positions_for_non_load (bfd *abfd) |
5617 | 5617 | { |
5618 | 5618 | file_ptr off; |
5619 | - Elf_Internal_Shdr **shdrpp, **end_shdrpp; | |
5619 | + Elf_Internal_Shdr **shdrpp, **end_shdrpp, **debug_shdrpp = NULL; | |
5620 | 5620 | Elf_Internal_Shdr *shdrp; |
5621 | 5621 | Elf_Internal_Ehdr *i_ehdrp; |
5622 | 5622 | const struct elf_backend_data *bed; |
@@ -5677,14 +5677,18 @@ _bfd_elf_assign_file_positions_for_non_load (bfd *abfd) | ||
5677 | 5677 | name, FALSE)) |
5678 | 5678 | return FALSE; |
5679 | 5679 | |
5680 | + if (debug_shdrpp == NULL) | |
5681 | + debug_shdrpp = shdrpp; | |
5682 | + | |
5680 | 5683 | /* Update section size and contents. */ |
5681 | 5684 | shdrp->sh_size = sec->size; |
5682 | 5685 | shdrp->contents = sec->contents; |
5683 | 5686 | shdrp->bfd_section->contents = NULL; |
5684 | 5687 | } |
5685 | - off = _bfd_elf_assign_file_position_for_section (shdrp, | |
5686 | - off, | |
5687 | - TRUE); | |
5688 | + else | |
5689 | + off = _bfd_elf_assign_file_position_for_section (shdrp, | |
5690 | + off, | |
5691 | + TRUE); | |
5688 | 5692 | } |
5689 | 5693 | } |
5690 | 5694 | } |
@@ -5696,6 +5700,15 @@ _bfd_elf_assign_file_positions_for_non_load (bfd *abfd) | ||
5696 | 5700 | shdrp->sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd)); |
5697 | 5701 | off = _bfd_elf_assign_file_position_for_section (shdrp, off, TRUE); |
5698 | 5702 | |
5703 | + /* Place DWARF debug sections after section name section. */ | |
5704 | + if (debug_shdrpp) | |
5705 | + for (shdrpp = debug_shdrpp; shdrpp < end_shdrpp; shdrpp++) | |
5706 | + { | |
5707 | + shdrp = *shdrpp; | |
5708 | + if (shdrp->sh_offset == -1) | |
5709 | + off = _bfd_elf_assign_file_position_for_section (shdrp, off, TRUE); | |
5710 | + } | |
5711 | + | |
5699 | 5712 | /* Place the section headers. */ |
5700 | 5713 | i_ehdrp = elf_elfheader (abfd); |
5701 | 5714 | bed = get_elf_backend_data (abfd); |