summaryrefslogtreecommitdiffstats
path: root/bfd
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
parentf0da3b538d1fec3f9e4707409ea200e3b625f12a (diff)
downloadppe42-binutils-8cd931b713e8ef36bdedb6015562c9f0fd1b8e4f.tar.gz
ppe42-binutils-8cd931b713e8ef36bdedb6015562c9f0fd1b8e4f.zip
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')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf32-arm.c32
2 files changed, 29 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index bc12f9f328..f15e157dd8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2009-03-05 Christophe Lyon <christophe.lyon@st.com>
+ * elf32-arm.c (group_sections): Take next section size into
+ account before accepting to group it.
+
+2009-03-05 Christophe Lyon <christophe.lyon@st.com>
+
* elf32-arm.c (arm_type_of_stub): Handle long branches targetting
PLT entries.
(elf32_arm_final_link_relocate): Likewise.
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;
OpenPOWER on IntegriCloud