aboutsummaryrefslogtreecommitdiff
path: root/gold/layout.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2011-08-27 01:28:18 +0000
committerCary Coutant <ccoutant@google.com>2011-08-27 01:28:18 +0000
commit8ea8cd50dda899e110495d5d4251706bc7c8bb1e (patch)
treee835bae6def9161cfce1098985b124aef2ecf4e6 /gold/layout.h
parent53c8030fecbe40b6a676dd52b89e03ef563c2f0c (diff)
downloadgdb-8ea8cd50dda899e110495d5d4251706bc7c8bb1e.zip
gdb-8ea8cd50dda899e110495d5d4251706bc7c8bb1e.tar.gz
gdb-8ea8cd50dda899e110495d5d4251706bc7c8bb1e.tar.bz2
* layout.cc (Free_list::allocate): Provide guarantee of minimum
remaining hole size when allocating. (Layout::make_output_section): Set fill methods for debug sections. * layout.h (Free_list::Free_list_node): Move from private to public. (Free_list::set_min_hole_size): New function. (Free_list::begin, Free_list::end): New functions. (Free_list::min_hole_): New data member. * output.cc: Include dwarf.h. (Output_fill_debug_info::do_minimum_hole_size): New function. (Output_fill_debug_info::do_write): New function. (Output_fill_debug_line::do_minimum_hole_size): New function. (Output_fill_debug_line::do_write): New function. (Output_section::Output_section): Initialize new data member. (Output_section::set_final_data_size): Ensure patch space is larger than minimum hole size. (Output_section::do_write): Fill holes in debug sections. * output.h (Output_fill): New class. (Output_fill_debug_info): New class. (Output_fill_debug_line): New class. (Output_section::set_free_space_fill): New function. (Output_section::free_space_fill_): New data member. * testsuite/Makefile.am (incremental_test_3): Add --incremental-patch option. (incremental_test_4): Likewise. (incremental_test_5): Likewise. (incremental_test_6): Likewise. (incremental_copy_test): Likewise. (incremental_common_test_1): Likewise. * testsuite/Makefile.in: Regenerate.
Diffstat (limited to 'gold/layout.h')
-rw-r--r--gold/layout.h48
1 files changed, 39 insertions, 9 deletions
diff --git a/gold/layout.h b/gold/layout.h
index 1497f12..05cb50f 100644
--- a/gold/layout.h
+++ b/gold/layout.h
@@ -71,34 +71,60 @@ is_compressed_debug_section(const char* secname);
class Free_list
{
public:
+ struct Free_list_node
+ {
+ Free_list_node(off_t start, off_t end)
+ : start_(start), end_(end)
+ { }
+ off_t start_;
+ off_t end_;
+ };
+ typedef std::list<Free_list_node>::const_iterator Const_iterator;
+
Free_list()
- : list_(), last_remove_(list_.begin()), extend_(false), length_(0)
+ : list_(), last_remove_(list_.begin()), extend_(false), length_(0),
+ min_hole_(0)
{ }
+ // Initialize the free list for a section of length LEN.
+ // If EXTEND is true, free space may be allocated past the end.
void
init(off_t len, bool extend);
+ // Set the minimum hole size that is allowed when allocating
+ // from the free list.
+ void
+ set_min_hole_size(off_t min_hole)
+ { this->min_hole_ = min_hole; }
+
+ // Remove a chunk from the free list.
void
remove(off_t start, off_t end);
+ // Allocate a chunk of space from the free list of length LEN,
+ // with alignment ALIGN, and minimum offset MINOFF.
off_t
allocate(off_t len, uint64_t align, off_t minoff);
+ // Return an iterator for the beginning of the free list.
+ Const_iterator
+ begin() const
+ { return this->list_.begin(); }
+
+ // Return an iterator for the end of the free list.
+ Const_iterator
+ end() const
+ { return this->list_.end(); }
+
+ // Dump the free list (for debugging).
void
dump();
+ // Print usage statistics.
static void
print_stats();
private:
- struct Free_list_node
- {
- Free_list_node(off_t start, off_t end)
- : start_(start), end_(end)
- { }
- off_t start_;
- off_t end_;
- };
typedef std::list<Free_list_node>::iterator Iterator;
// The free list.
@@ -113,6 +139,10 @@ class Free_list
// The total length of the section, segment, or file.
off_t length_;
+ // The minimum hole size allowed. When allocating from the free list,
+ // we must not leave a hole smaller than this.
+ off_t min_hole_;
+
// Statistics:
// The total number of free lists used.
static unsigned int num_lists;