From d79aff823e1aacb8a98d5aae759095912cc6f0af Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Thu, 25 Nov 2004 00:56:00 +0000 Subject: [PATCH] 2004-11-24 Paul Brook 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. --- bfd/ChangeLog | 4 ++++ bfd/elf.c | 25 +++++++++++++++++++++---- gas/testsuite/ChangeLog | 6 ++++++ gas/testsuite/gas/elf/group0a.d | 3 ++- gas/testsuite/gas/elf/group1a.d | 3 ++- gas/testsuite/gas/elf/section4.d | 4 ++-- 6 files changed, 37 insertions(+), 8 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a92af7be0..69ae52008 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,9 @@ 2004-11-24 Paul Brook + * elf.c (assign_section_numbers): Number SHT_GROUP sections first. + +2004-11-24 Paul Brook + * elf32-arm.c (elf32_arm_swap_symbol_in): New function. (elf32_arm_swap_symbol_out): New function. (elf32_arm_size_info): Add. diff --git a/bfd/elf.c b/bfd/elf.c index dcb5c3d58..ff322bbcb 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; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index eb3ebd45c..a8514c05a 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2004-11-24 Paul Brook + + * gas/elf/group0a.d: Adjust expected secion ordering. + * gas/elf/group1a.d: Ditto. + * gas/elf/section4.d: Ditto. + 2004-11-24 Nick Clifton * gas/iq2000/allinsn.exp: Remove IQ10 tests. diff --git a/gas/testsuite/gas/elf/group0a.d b/gas/testsuite/gas/elf/group0a.d index 9b2b967ba..8aedc0caa 100644 --- a/gas/testsuite/gas/elf/group0a.d +++ b/gas/testsuite/gas/elf/group0a.d @@ -3,7 +3,8 @@ #source: group0.s #... +[ ]*\[.*\][ ]+\.foo_group[ ]+GROUP.* +#... [ ]*\[.*\][ ]+\.foo[ ]+PROGBITS.*[ ]+AXG[ ]+.* [ ]*\[.*\][ ]+\.bar[ ]+PROGBITS.*[ ]+AG[ ]+.* -[ ]*\[.*\][ ]+\.foo_group[ ]+GROUP.* #pass diff --git a/gas/testsuite/gas/elf/group1a.d b/gas/testsuite/gas/elf/group1a.d index 2db4033af..a5b329875 100644 --- a/gas/testsuite/gas/elf/group1a.d +++ b/gas/testsuite/gas/elf/group1a.d @@ -3,8 +3,9 @@ #source: group1.s #... +[ ]*\[.*\][ ]+\.foo_group[ ]+GROUP.* +#... [ ]*\[.*\][ ]+\.text[ ]+PROGBITS.*[ ]+AX[ ]+.* #... [ ]*\[.*\][ ]+\.text[ ]+PROGBITS.*[ ]+AXG[ ]+.* -[ ]*\[.*\][ ]+\.foo_group[ ]+GROUP.* #pass diff --git a/gas/testsuite/gas/elf/section4.d b/gas/testsuite/gas/elf/section4.d index 2e417e7de..5cda69ba7 100644 --- a/gas/testsuite/gas/elf/section4.d +++ b/gas/testsuite/gas/elf/section4.d @@ -2,11 +2,11 @@ #name: label arithmetic with multiple same-name sections #... +[ ]*\[.*\][ ]+foo[ ]+GROUP.* +#... [ ]*\[.*\][ ]+\.text[ ]+PROGBITS.* #... [ ]*\[.*\][ ]+\.data[ ]+PROGBITS.* #... [ ]*\[.*\][ ]+\.text[ ]+PROGBITS.* -#... -[ ]*\[.*\][ ]+foo[ ]+GROUP.* #pass -- 2.11.4.GIT