diff options
author | Nick Clifton <nickc@redhat.com> | 2020-10-05 10:40:07 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-10-05 10:40:07 +0100 |
commit | b71702f1c01052b70b4fd8157982eadc2132fc24 (patch) | |
tree | 55fbf234a5e3fc887375ce3c3bcec983dce38417 /bfd/elf.c | |
parent | 1ba0655539bcbde49171691582d5e804c3e4f975 (diff) | |
download | gdb-b71702f1c01052b70b4fd8157982eadc2132fc24.zip gdb-b71702f1c01052b70b4fd8157982eadc2132fc24.tar.gz gdb-b71702f1c01052b70b4fd8157982eadc2132fc24.tar.bz2 |
GAS: Update the .section directive so that a numeric section index can be provided when the "o" flag is used.
PR 26253
gas * config/obj-elf.c (obj_elf_section): Accept a numeric value for
the "o" section flag. Interpret it as a section index. Allow an
index of zero.
* doc/as.texi: Document the new behaviour.
* NEWS: Mention the new feature. Tidy entries.
* testsuite/gas/elf/sh-link-zero.s: New test.
* testsuite/gas/elf/sh-link-zero.d: New test driver.
* testsuite/gas/elf/elf.exp: Run the new test.
* testsuite/gas/elf/section21.l: Updated expected assembler
output.
bfd * elf.c (_bfd_elf_setup_sections): Do not complain about an
sh_link value of zero when the SLF_LINK_ORDER flag is set.
(assign_section_numbers): Likewise.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 32 |
1 files changed, 10 insertions, 22 deletions
@@ -848,16 +848,14 @@ _bfd_elf_setup_sections (bfd *abfd) if ((this_hdr->sh_flags & SHF_LINK_ORDER) != 0) { unsigned int elfsec = this_hdr->sh_link; - /* FIXME: The old Intel compiler and old strip/objcopy may - not set the sh_link or sh_info fields. Hence we could - get the situation where elfsec is 0. */ + /* An sh_link value of 0 is now allowed. It indicates that linked + to section has already been discarded, but that the current + section has been retained for some other reason. This linking + section is still a candidate for later garbage collection + however. */ if (elfsec == 0) { - const struct elf_backend_data *bed = get_elf_backend_data (abfd); - bed->link_order_error_handler - /* xgettext:c-format */ - (_("%pB: warning: sh_link not set for section `%pA'"), - abfd, s); + elf_linked_to_section (s) = NULL; } else { @@ -3888,6 +3886,10 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) if ((d->this_hdr.sh_flags & SHF_LINK_ORDER) != 0) { s = elf_linked_to_section (sec); + /* We can now have a NULL linked section pointer. + This happens when the sh_link field is 0, which is done + when a linked to section is discarded but the linking + section has been retained for some reason. */ if (s) { /* Check discarded linkonce section. */ @@ -3923,20 +3925,6 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) s = s->output_section; d->this_hdr.sh_link = elf_section_data (s)->this_idx; } - else - { - /* PR 290: - The Intel C compiler generates SHT_IA_64_UNWIND with - SHF_LINK_ORDER. But it doesn't set the sh_link or - sh_info fields. Hence we could get the situation - where s is NULL. */ - const struct elf_backend_data *bed - = get_elf_backend_data (abfd); - bed->link_order_error_handler - /* xgettext:c-format */ - (_("%pB: warning: sh_link not set for section `%pA'"), - abfd, sec); - } } switch (d->this_hdr.sh_type) |