diff options
author | Tristan Gingold <gingold@adacore.com> | 2017-03-17 11:12:05 +0100 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2017-03-21 12:00:30 +0100 |
commit | 21701718895d186285e6daf04cc7342c6c88fb03 (patch) | |
tree | 69ce1047b28b00ef516fd2bf5c6d5fef8715c3e4 /ld | |
parent | cee59b3feac9a8f6300a5b788e3db4e15af2a894 (diff) | |
download | gdb-21701718895d186285e6daf04cc7342c6c88fb03.zip gdb-21701718895d186285e6daf04cc7342c6c88fb03.tar.gz gdb-21701718895d186285e6daf04cc7342c6c88fb03.tar.bz2 |
ld: check overflow only for allocated sections.
* ldlang.c (lang_check_section_addresses): Check only for
allocated sections.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 5 | ||||
-rw-r--r-- | ld/ldlang.c | 29 |
2 files changed, 20 insertions, 14 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 4af309b..e42df38 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2017-03-21 gingold <gingold@gingold-Precision-7510> + + * ldlang.c (lang_check_section_addresses): Check only for + allocated sections. + 2017-03-17 Alan Modra <amodra@gmail.com> * testsuite/ld-elf/sec64k.exp: Don't run on h8300 and ip2k. diff --git a/ld/ldlang.c b/ld/ldlang.c index 8c1d829..5a42659 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -4776,24 +4776,25 @@ lang_check_section_addresses (void) lang_memory_region_type *m; bfd_boolean overlays; - /* Detect address space overflow. */ + /* Detect address space overflow on allocated sections. */ addr_mask = ((bfd_vma) 1 << (bfd_arch_bits_per_address (link_info.output_bfd) - 1)) - 1; addr_mask = (addr_mask << 1) + 1; for (s = link_info.output_bfd->sections; s != NULL; s = s->next) - { - s_end = (s->vma + s->size) & addr_mask; - if (s_end != 0 && s_end < (s->vma & addr_mask)) - einfo (_("%X%P: section %s VMA wraps around address space\n"), - s->name); - else - { - s_end = (s->lma + s->size) & addr_mask; - if (s_end != 0 && s_end < (s->lma & addr_mask)) - einfo (_("%X%P: section %s LMA wraps around address space\n"), - s->name); - } - } + if ((s->flags & SEC_ALLOC) != 0) + { + s_end = (s->vma + s->size) & addr_mask; + if (s_end != 0 && s_end < (s->vma & addr_mask)) + einfo (_("%X%P: section %s VMA wraps around address space\n"), + s->name); + else + { + s_end = (s->lma + s->size) & addr_mask; + if (s_end != 0 && s_end < (s->lma & addr_mask)) + einfo (_("%X%P: section %s LMA wraps around address space\n"), + s->name); + } + } if (bfd_count_sections (link_info.output_bfd) <= 1) return; |