diff options
author | Alan Modra <amodra@gmail.com> | 2014-08-22 09:12:09 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2014-08-22 10:09:09 +0930 |
commit | 4564fb94daa76c3b339507f0f985dc139f2db8ba (patch) | |
tree | d791cced98f6053c95bada6c96045eb8c5e588f8 /bfd/elf-eh-frame.c | |
parent | da44f4e5464f82dec79eb5885961c6466dd3bf6a (diff) | |
download | gdb-4564fb94daa76c3b339507f0f985dc139f2db8ba.zip gdb-4564fb94daa76c3b339507f0f985dc139f2db8ba.tar.gz gdb-4564fb94daa76c3b339507f0f985dc139f2db8ba.tar.bz2 |
Delete redundant struct cie field
cie->output_sec is used to when merging CIEs to ensure that only CIEs
from the same output section are merged. I noticed an assignment to
this field in _bfd_elf_parse_eh_frame, and thought "That's wrong,
output_section isn't set properly when _bfd_elf_parse_eh_frame is
called from gc-sections code". It turns out that this assignment is
premature, and in fact a dead store. find_merged_cie overwrites with
the correct value before the field is ever used. On looking a little
more it becomes apparent that cie->cie_inf.u.cie.u.sec->output_section
holds the same value, so cie->output_sec is redundant.
* elf-eh-frame.c (struct cie): Delete "output_sec" field.
(cie_eq, cie_compute_hash): Use output_section from cie_inf instead.
Diffstat (limited to 'bfd/elf-eh-frame.c')
-rw-r--r-- | bfd/elf-eh-frame.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index 7783b08..d56440c 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -46,7 +46,6 @@ struct cie } sym; unsigned int reloc_index; } personality; - asection *output_sec; struct eh_cie_fde *cie_inf; unsigned char per_encoding; unsigned char lsda_encoding; @@ -232,7 +231,8 @@ cie_eq (const void *e1, const void *e2) && c1->augmentation_size == c2->augmentation_size && memcmp (&c1->personality, &c2->personality, sizeof (c1->personality)) == 0 - && c1->output_sec == c2->output_sec + && (c1->cie_inf->u.cie.u.sec->output_section + == c2->cie_inf->u.cie.u.sec->output_section) && c1->per_encoding == c2->per_encoding && c1->lsda_encoding == c2->lsda_encoding && c1->fde_encoding == c2->fde_encoding @@ -266,7 +266,7 @@ cie_compute_hash (struct cie *c) h = iterative_hash_object (c->ra_column, h); h = iterative_hash_object (c->augmentation_size, h); h = iterative_hash_object (c->personality, h); - h = iterative_hash_object (c->output_sec, h); + h = iterative_hash_object (c->cie_inf->u.cie.u.sec->output_section, h); h = iterative_hash_object (c->per_encoding, h); h = iterative_hash_object (c->lsda_encoding, h); h = iterative_hash_object (c->fde_encoding, h); @@ -625,7 +625,6 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, cie->cie_inf = this_inf; cie->length = hdr_length; - cie->output_sec = sec->output_section; start = buf; REQUIRE (read_byte (&buf, end, &cie->version)); @@ -1072,7 +1071,6 @@ find_merged_cie (bfd *abfd, struct bfd_link_info *info, asection *sec, } /* See if we can merge this CIE with an earlier one. */ - cie->output_sec = sec->output_section; cie_compute_hash (cie); if (hdr_info->cies == NULL) { |