| 1 | // ehframe.h -- handle exception frame sections for gold -*- C++ -*- |
| 2 | |
| 3 | // Copyright 2006, 2007 Free Software Foundation, Inc. |
| 4 | // Written by Ian Lance Taylor <iant@google.com>. |
| 5 | |
| 6 | // This file is part of gold. |
| 7 | |
| 8 | // This program is free software; you can redistribute it and/or modify |
| 9 | // it under the terms of the GNU General Public License as published by |
| 10 | // the Free Software Foundation; either version 3 of the License, or |
| 11 | // (at your option) any later version. |
| 12 | |
| 13 | // This program is distributed in the hope that it will be useful, |
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | // GNU General Public License for more details. |
| 17 | |
| 18 | // You should have received a copy of the GNU General Public License |
| 19 | // along with this program; if not, write to the Free Software |
| 20 | // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
| 21 | // MA 02110-1301, USA. |
| 22 | |
| 23 | #ifndef GOLD_EHFRAME_H |
| 24 | #define GOLD_EHFRAME_H |
| 25 | |
| 26 | #include "output.h" |
| 27 | |
| 28 | namespace gold |
| 29 | { |
| 30 | |
| 31 | // This class manages the .eh_frame_hdr section, which holds the data |
| 32 | // for the PT_GNU_EH_FRAME segment. gcc's unwind support code uses |
| 33 | // the PT_GNU_EH_FRAME segment to find the list of FDEs. This saves |
| 34 | // the time required to register the exception handlers at startup |
| 35 | // time and when a shared object is loaded, and the time required to |
| 36 | // deregister the exception handlers when a shared object is unloaded. |
| 37 | |
| 38 | // FIXME: gcc supports using storing a sorted lookup table for the |
| 39 | // FDEs in the PT_GNU_EH_FRAME segment, but we do not yet generate |
| 40 | // that. |
| 41 | |
| 42 | class Eh_frame_hdr : public Output_section_data |
| 43 | { |
| 44 | public: |
| 45 | Eh_frame_hdr(Output_section* eh_frame_section); |
| 46 | |
| 47 | // Set the final data size. |
| 48 | void |
| 49 | do_set_address(uint64_t address, off_t offset); |
| 50 | |
| 51 | // Write the data to the file. |
| 52 | void |
| 53 | do_write(Output_file*); |
| 54 | |
| 55 | private: |
| 56 | // The .eh_frame section. |
| 57 | Output_section* eh_frame_section_; |
| 58 | }; |
| 59 | |
| 60 | } // End namespace gold. |
| 61 | |
| 62 | #endif // !defined(GOLD_EHFRAME_H) |