aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2004-11-25 00:56:00 +0000
committerPaul Brook <paul@codesourcery.com>2004-11-25 00:56:00 +0000
commit47cc2cf5192b9e5ad2f7571393127d8c378f8d66 (patch)
tree0e89569d218fcb5c91575ff9393766f29ea29899 /bfd/elf.c
parent7a851328aefe8c32e90b66e6699ed8b37cfcf4a4 (diff)
downloadgdb-47cc2cf5192b9e5ad2f7571393127d8c378f8d66.zip
gdb-47cc2cf5192b9e5ad2f7571393127d8c378f8d66.tar.gz
gdb-47cc2cf5192b9e5ad2f7571393127d8c378f8d66.tar.bz2
2004-11-24 Paul Brook <paul@codesourcery.com>
bfd/ * elf.c (assign_section_numbers): Number SHT_GROUP sections first. gas/testsuite/ * gas/elf/group0a.d: Adjust expected secion ordering. * gas/elf/group1a.d: Ditto. * gas/elf/section4.d: Ditto.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index dcb5c3d..ff322bb 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2725,18 +2725,35 @@ assign_section_numbers (bfd *abfd)
unsigned int section_number, secn;
Elf_Internal_Shdr **i_shdrp;
bfd_size_type amt;
+ struct bfd_elf_section_data *d;
section_number = 1;
_bfd_elf_strtab_clear_all_refs (elf_shstrtab (abfd));
+ /* Put SHT_GROUP sections first. */
for (sec = abfd->sections; sec; sec = sec->next)
{
- struct bfd_elf_section_data *d = elf_section_data (sec);
+ d = elf_section_data (sec);
- if (section_number == SHN_LORESERVE)
- section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- d->this_idx = section_number++;
+ if (d->this_hdr.sh_type == SHT_GROUP)
+ {
+ if (section_number == SHN_LORESERVE)
+ section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ d->this_idx = section_number++;
+ }
+ }
+
+ for (sec = abfd->sections; sec; sec = sec->next)
+ {
+ d = elf_section_data (sec);
+
+ if (d->this_hdr.sh_type != SHT_GROUP)
+ {
+ if (section_number == SHN_LORESERVE)
+ section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ d->this_idx = section_number++;
+ }
_bfd_elf_strtab_addref (elf_shstrtab (abfd), d->this_hdr.sh_name);
if ((sec->flags & SEC_RELOC) == 0)
d->rel_idx = 0;