aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf-bfd.h
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2007-12-15 09:33:51 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2007-12-15 09:33:51 +0000
commitca92cecbbead0c883df57e70fdb5b2541febd43b (patch)
tree31553d45b5aab65056a937f9a060b8988208bba4 /bfd/elf-bfd.h
parent155eaaa03139229166b0cdf83bd8cdd718bd1b08 (diff)
downloadgdb-ca92cecbbead0c883df57e70fdb5b2541febd43b.zip
gdb-ca92cecbbead0c883df57e70fdb5b2541febd43b.tar.gz
gdb-ca92cecbbead0c883df57e70fdb5b2541febd43b.tar.bz2
bfd/
* elf-bfd.h (eh_cie_fde): Add u.cie. Document how u.fde.cie_inf changes when removed == 0. (eh_frame_hdr_info): Add parsed_eh_frames. (_bfd_elf_begin_eh_frame_parsing): Declare. (_bfd_elf_parse_eh_frame): Declare. (_bfd_elf_end_eh_frame_parsing): Declare. * elf-eh-frame.c (_bfd_elf_begin_eh_frame_parsing): New function. (_bfd_elf_parse_eh_frame): New function, split out from _bfd_elf_discard_section_eh_frame. Make a first pass through the buffer to calculate the number of entries and CIEs. Allocate memory for them before the main loop. Replace current extended cie representation with a pair of pointers, one to the local eh_cie_fde and one to the full struct cie. Allocate a separate array of struct cies if not merging. Merge CIEs during the main loop and set up each u.cie.merged field. Point an FDE's cie_inf field directly at the local CIE. Initially assume that all entries should be removed. (_bfd_elf_end_eh_frame_parsing): New function. (_bfd_elf_discard_section_eh_frame): Assume that the section has already been parsed. Use a separate pass to mark entries that need to be kept. Use the u.cie.merged field to track a CIE's group representative. * elflink.c (bfd_elf_discard_info): Call _bfd_elf_parse_eh_frame before _bfd_elf_discard_section_eh_frame. Wrap loop with calls to _bfd_elf_begin_eh_frame_parsing and _bfd_elf_end_eh_frame_parsing.
Diffstat (limited to 'bfd/elf-bfd.h')
-rw-r--r--bfd/elf-bfd.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 42a1f74..c91af27 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -266,9 +266,22 @@ struct eh_cie_fde
{
union {
struct {
- /* The CIE that we have chosen to use for this FDE. */
+ /* If REMOVED == 1, this is the CIE that the FDE originally used.
+ The CIE belongs to the same .eh_frame input section as the FDE.
+
+ If REMOVED == 0, this is the CIE that we have chosen to use for
+ the output FDE. The CIE's REMOVED field is also 0, but the CIE
+ might belong to a different .eh_frame input section from the FDE. */
struct eh_cie_fde *cie_inf;
} fde;
+ struct {
+ /* In general, equivalent CIEs are grouped together, with one CIE
+ representing all the others in a group. If REMOVED == 0,
+ this CIE is the group representative. If REMOVED == 1,
+ following this pointer brings us "closer" to the CIE's group
+ representative, and reapplying always gives the representative. */
+ struct eh_cie_fde *merged;
+ } cie;
} u;
unsigned int reloc_index;
unsigned int size;
@@ -308,6 +321,8 @@ struct eh_frame_hdr_info
asection *hdr_sec;
unsigned int fde_count, array_count;
struct eh_frame_array_ent *array;
+ /* TRUE if all .eh_frames have been parsd. */
+ bfd_boolean parsed_eh_frames;
/* TRUE if .eh_frame_hdr should contain the sorted search table.
We build it if we successfully read all .eh_frame input sections
and recognize them. */
@@ -1723,6 +1738,13 @@ extern bfd_boolean _bfd_elf_strtab_emit
extern void _bfd_elf_strtab_finalize
(struct elf_strtab_hash *);
+extern void _bfd_elf_begin_eh_frame_parsing
+ (struct bfd_link_info *info);
+extern void _bfd_elf_parse_eh_frame
+ (bfd *, struct bfd_link_info *, asection *, struct elf_reloc_cookie *);
+extern void _bfd_elf_end_eh_frame_parsing
+ (struct bfd_link_info *info);
+
extern bfd_boolean _bfd_elf_discard_section_eh_frame
(bfd *, struct bfd_link_info *, asection *,
bfd_boolean (*) (bfd_vma, void *), struct elf_reloc_cookie *);