aboutsummaryrefslogtreecommitdiff
path: root/gold/ehframe.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-07-01 14:37:49 +0930
committerAlan Modra <amodra@gmail.com>2019-07-13 09:57:50 +0930
commit220f99066d6ce2a6caf17692fcc57d714d8f6910 (patch)
tree81dbd577f8116359ab582788dd808abaf08da32a /gold/ehframe.h
parent32f598441988e5a086ba8580e82f4944c3692eb5 (diff)
downloadgdb-220f99066d6ce2a6caf17692fcc57d714d8f6910.zip
gdb-220f99066d6ce2a6caf17692fcc57d714d8f6910.tar.gz
gdb-220f99066d6ce2a6caf17692fcc57d714d8f6910.tar.bz2
[GOLD] PowerPC notoc eh_frame
When generating notoc call and branch stubs without the benefit of pc-relative insns, the stubs need to use LR to access the run time PC. All LR changes must be described in .eh_frame if we're to support unwinding through asynchronous exceptions. That's what this patch does. The patch has gone through way too many iterations. At first I attempted to add multiple FDEs, one for each stub. That ran into difficulties with do_plt_fde_location which is only capable of setting the address of a single FDE per Output_data section, and with removing any FDEs added on a previous do_relax pass. Removing FDEs (git commit be897fb774) went overboard in matching the FDE contents. That means either stashing the contents created for add_eh_frame_for_plt to use when calling remove_eh_frame_for_plt, or recreating contents on the fly (*) just to remove FDEs. In fact, FDE content matching is quite unnecesary. FDEs added by a previous do_relax pass are those with u_.from_linker.post_map set. So they can easily be recognised just by looking at that flag. This patch keeps that part of the multiple FDE changes. In the end I went for just one FDE per stub group to describe the call stubs. That's reasonably efficient for the common case of only needing to describe the __tls_get_addr_opt call stub. We don't expect to be making many calls using notoc stubs without pc-relative insns. *) Which has it's own set of problems. The contents must be recreated using the old stub layout, but .eh_frame size can affect stub requirements so you need to temporarily keep the old .eh_frame size when creating new stubs, then reset .eh_frame size before adding new FDEs. * ehframe.cc (Fde::operator==): Delete. (Cie::remove_fde): Delete. (Eh_frame::remove_ehframe_for_plt): Delete fde_data and fde_length parameters. Remove all post-map plt FDEs. * ehframe.h (Fde:post_map): Make const, add variant to compare plt. (Fde::operator==): Delete. (Cie::remove_fde): Implement here. (Cie::last_fde): New accessor. (Eh_frame::remove_ehframe_for_plt): Update prototype. * layout.cc (Layout::remove_eh_frame_for_plt): Delete fde_data and fde_length parameters. * layout.h (Layout::remove_eh_frame_for_plt): Update prototype. * powerpc.cc (Stub_table::tls_get_addr_opt_bctrl_): Delete. (Stub_table::plt_fde_len_, plt_fde_, init_plt_fde): Delete. (Stub_table::add_plt_call_entry): Don't set tls_get_addr_opt_bctrl_. (eh_advance): New function. (stub_sort): New function. (Stub_table::add_eh_frame): Emit eh_frame for notoc plt calls and branches as well as __tls_get_addr_opt plt call stub. (Stub_table::remove_eh_frame): Update to suit.
Diffstat (limited to 'gold/ehframe.h')
-rw-r--r--gold/ehframe.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/gold/ehframe.h b/gold/ehframe.h
index ba65083..4fd8f3e 100644
--- a/gold/ehframe.h
+++ b/gold/ehframe.h
@@ -203,9 +203,14 @@ class Fde
// Return whether this FDE was added after merge mapping.
bool
- post_map()
+ post_map() const
{ return this->object_ == NULL && this->u_.from_linker.post_map; }
+ // Return whether this FDE was added for the PLT after merge mapping.
+ bool
+ post_map(const Output_data* plt) const
+ { return this->post_map() && this->u_.from_linker.plt == plt; }
+
// Write the FDE to OVIEW starting at OFFSET. FDE_ENCODING is the
// encoding, from the CIE. Round up the bytes to ADDRALIGN if
// necessary. ADDRESS is the virtual address of OVIEW. Record the
@@ -217,8 +222,6 @@ class Fde
section_offset_type cie_offset, unsigned char fde_encoding,
Eh_frame_hdr* eh_frame_hdr);
- bool operator==(const Fde&) const;
-
private:
// The object in which this FDE was seen. This will be NULL for a
// linker generated FDE.
@@ -300,9 +303,15 @@ class Cie
add_fde(Fde* fde)
{ this->fdes_.push_back(fde); }
- // Remove an FDE associated with this CIE. Only the last FDE may be removed.
+ // Remove the last FDE associated with this CIE.
void
- remove_fde(const Fde*);
+ remove_fde()
+ { this->fdes_.pop_back(); }
+
+ // Access the last FDE associated with this CIE.
+ const Fde*
+ last_fde() const
+ { return this->fdes_.back(); }
// Return the number of FDEs.
unsigned int
@@ -411,12 +420,10 @@ class Eh_frame : public Output_section_data
size_t cie_length, const unsigned char* fde_data,
size_t fde_length);
- // Remove unwind information for a PLT. Only the last FDE added may
- // be removed.
+ // Remove all post-map unwind information for a PLT.
void
remove_ehframe_for_plt(Output_data* plt, const unsigned char* cie_data,
- size_t cie_length, const unsigned char* fde_data,
- size_t fde_length);
+ size_t cie_length);
// Return the number of FDEs.
unsigned int