diff options
author | Ian Lance Taylor <ian@airs.com> | 2008-07-22 23:55:24 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2008-07-22 23:55:24 +0000 |
commit | 3481085102449795e77ce56d628a10e931bde4be (patch) | |
tree | f6510cf30a08cd3a890974e609b85960ce03ac24 /gold/layout.cc | |
parent | af6156ef8ded31c7b8e19fa7995e4de14a5b9639 (diff) | |
download | gdb-3481085102449795e77ce56d628a10e931bde4be.zip gdb-3481085102449795e77ce56d628a10e931bde4be.tar.gz gdb-3481085102449795e77ce56d628a10e931bde4be.tar.bz2 |
* options.h (class General_options): Define --check-sections.
* layout.cc (Layout::set_segment_offsets): Handle
--check-sections.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r-- | gold/layout.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gold/layout.cc b/gold/layout.cc index 8c7cd99..37edbb6c 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -1732,6 +1732,9 @@ Layout::set_segment_offsets(const Target* target, Output_segment* load_seg, } } + const bool check_sections = parameters->options().check_sections(); + Output_segment* last_load_segment = NULL; + bool was_readonly = false; for (Segment_list::iterator p = this->segment_list_.begin(); p != this->segment_list_.end(); @@ -1848,6 +1851,25 @@ Layout::set_segment_offsets(const Target* target, Output_segment* load_seg, if (((*p)->flags() & elfcpp::PF_W) == 0) was_readonly = true; + + // Implement --check-sections. We know that the segments + // are sorted by LMA. + if (check_sections && last_load_segment != NULL) + { + gold_assert(last_load_segment->paddr() <= (*p)->paddr()); + if (last_load_segment->paddr() + last_load_segment->memsz() + > (*p)->paddr()) + { + unsigned long long lb1 = last_load_segment->paddr(); + unsigned long long le1 = lb1 + last_load_segment->memsz(); + unsigned long long lb2 = (*p)->paddr(); + unsigned long long le2 = lb2 + (*p)->memsz(); + gold_error(_("load segment overlap [0x%llx -> 0x%llx] and " + "[0x%llx -> 0x%llx]"), + lb1, le1, lb2, le2); + } + } + last_load_segment = *p; } } |