aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2004-01-07 21:34:24 +0000
committerH.J. Lu <hjl.tools@gmail.com>2004-01-07 21:34:24 +0000
commitde0d9f330bbdc3b527f9e8c1769d228e403a8bb2 (patch)
treeb6be96d6401a79cf56e9681c9cc8a220ce59284d /bfd
parent73f209588f424a1db0c4206e5a894949027c66fd (diff)
downloadgdb-de0d9f330bbdc3b527f9e8c1769d228e403a8bb2.zip
gdb-de0d9f330bbdc3b527f9e8c1769d228e403a8bb2.tar.gz
gdb-de0d9f330bbdc3b527f9e8c1769d228e403a8bb2.tar.bz2
2004-01-07 H.J. Lu <hongjiu.lu@intel.com>
* elfxx-ia64.c (elfNN_ia64_relax_section): Don't install trampoline if it is known out of range.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elfxx-ia64.c21
2 files changed, 22 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a90f4f7..eec219a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Don't install
+ trampoline if it is known out of range.
+
2004-01-06 Alexandre Oliva <aoliva@redhat.com>
2003-12-17 Alexandre Oliva <aoliva@redhat.com>
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index aba571a..c699922 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -876,6 +876,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
if (is_branch)
{
+ bfd_signed_vma offset;
+
reladdr = (sec->output_section->vma
+ sec->output_offset
+ roff) & (bfd_vma) -4;
@@ -911,6 +913,13 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
/* Resize the current section to make room for the new branch. */
trampoff = (sec->_cooked_size + 15) & (bfd_vma) -16;
+
+ /* If trampoline is out of range, there is nothing we
+ can do. */
+ offset = trampoff - (roff & (bfd_vma) -4);
+ if (offset < -0x1000000 || offset > 0x0FFFFF0)
+ continue;
+
amt = trampoff + size;
contents = (bfd_byte *) bfd_realloc (contents, amt);
if (contents == NULL)
@@ -957,14 +966,18 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
}
else
{
+ /* If trampoline is out of range, there is nothing we
+ can do. */
+ offset = f->trampoff - (roff & (bfd_vma) -4);
+ if (offset < -0x1000000 || offset > 0x0FFFFF0)
+ continue;
+
/* Nop out the reloc, since we're finalizing things here. */
irel->r_info = ELFNN_R_INFO (0, R_IA64_NONE);
}
- /* Fix up the existing branch to hit the trampoline. Hope like
- hell this doesn't overflow too. */
- if (elfNN_ia64_install_value (abfd, contents + roff,
- f->trampoff - (roff & (bfd_vma) -4),
+ /* Fix up the existing branch to hit the trampoline. */
+ if (elfNN_ia64_install_value (abfd, contents + roff, offset,
r_type) != bfd_reloc_ok)
goto error_return;