aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-arm.c
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@st.com>2009-03-06 08:57:58 +0000
committerChristophe Lyon <christophe.lyon@st.com>2009-03-06 08:57:58 +0000
commit8cd931b713e8ef36bdedb6015562c9f0fd1b8e4f (patch)
tree721be252e02b29c125acf2567292b0f0a45f87bc /bfd/elf32-arm.c
parentf0da3b538d1fec3f9e4707409ea200e3b625f12a (diff)
downloadgdb-8cd931b713e8ef36bdedb6015562c9f0fd1b8e4f.zip
gdb-8cd931b713e8ef36bdedb6015562c9f0fd1b8e4f.tar.gz
gdb-8cd931b713e8ef36bdedb6015562c9f0fd1b8e4f.tar.bz2
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.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 607ba04..f534290 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;