diff options
| author | Christophe Lyon <christophe.lyon@st.com> | 2009-03-06 08:57:58 +0000 |
|---|---|---|
| committer | Christophe Lyon <christophe.lyon@st.com> | 2009-03-06 08:57:58 +0000 |
| commit | ee5210332dd5ddbd3f3072b7d225fb0b0a3ff131 (patch) | |
| tree | a95ce133f02dc268d3f0054c0a315d4f3ce17db2 /bfd/elf32-arm.c | |
| parent | df4ee5434d7fb11edc1ae5c1691a2775f41769ab (diff) | |
| download | binutils-redhat-ee5210332dd5ddbd3f3072b7d225fb0b0a3ff131.tar.gz | |
09-03-05 Christophe Lyon <christophe.lyon@st.com>
bfd/
* elf32-arm.c (group_sections): Take next section size into
account before accepting to group it.
testsuite/
* ld-arm/arm-elf.exp: Add new farcall-group-limit test.
* ld-arm/farcall-group-limit.d: New file.
* ld-arm/farcall-group3.s: New file.
* ld-arm/farcall-group4.s: New file.
Diffstat (limited to 'bfd/elf32-arm.c')
| -rw-r--r-- | bfd/elf32-arm.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 607ba04ada..f534290ee8 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -3554,11 +3554,20 @@ group_sections (struct elf32_arm_link_hash_table *htab, bfd_size_type total; curr = head; - total = head->size; - while ((next = NEXT_SEC (curr)) != NULL - && ((total += next->output_offset - curr->output_offset) - < stub_group_size)) + total = 0; + while ((next = NEXT_SEC (curr)) != NULL) + { + if ( (total + next->output_offset - curr->output_offset + + next->size) + < stub_group_size ) + { + total += next->output_offset - curr->output_offset; + } + else + break; + curr = next; + } /* OK, the size from the start to the start of CURR is less than stub_group_size and thus can be handled by one stub @@ -3579,11 +3588,18 @@ group_sections (struct elf32_arm_link_hash_table *htab, bytes after the stub section can be handled by it too. */ if (!stubs_always_after_branch) { - total = 0; - while (next != NULL - && ((total += next->output_offset - head->output_offset) - < stub_group_size)) + total = head->size; + while (next != NULL) { + if ( (total + next->output_offset - head->output_offset + + next->size) + < stub_group_size ) + { + total += next->output_offset - head->output_offset; + } + else + break; + head = next; next = NEXT_SEC (head); htab->stub_group[head->id].link_sec = curr; |
