summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog11
-rw-r--r--bfd/coff-h8300.c12
-rw-r--r--bfd/coff-h8500.c14
-rw-r--r--bfd/coff-w65.c14
-rw-r--r--bfd/coff-z80.c4
-rw-r--r--bfd/coff-z8k.c16
-rw-r--r--bfd/ecoff.c5
-rw-r--r--bfd/linker.c9
8 files changed, 47 insertions, 38 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 08ab38a0af9..97db8cd0879 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,16 @@
2005-12-27 Alan Modra <amodra@bigpond.net.au>
+ * coff-h8300.c (h8300_reloc16_extra_cases): Use input section
+ "output_offset" instead of link order "offset".
+ * coff-h8500.c (extra_case): Likewise.
+ * coff-w65.c (w65_reloc16_extra_cases): Likewise.
+ * coff-z80.c (extra_case): Likewise.
+ * coff-z8k.c (extra_case): Likewise.
+ * linker.c (default_indirect_link_order): Likewise, "size" too.
+ * ecoff.c (ecoff_indirect_link_order): Likewise.
+
+2005-12-27 Alan Modra <amodra@bigpond.net.au>
+
* Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c
index 1fb94f85a49..ef29664e782 100644
--- a/bfd/coff-h8300.c
+++ b/bfd/coff-h8300.c
@@ -671,7 +671,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info,
/* Get the address of the target of this branch. */
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
- dot = (link_order->offset
+ dot = (input_section->output_offset
+ dst_address
+ link_order->u.indirect.section->output_section->vma);
@@ -703,7 +703,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info,
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
/* Get the address of the instruction (not the reloc). */
- dot = (link_order->offset
+ dot = (input_section->output_offset
+ dst_address
+ link_order->u.indirect.section->output_section->vma + 1);
@@ -817,7 +817,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info,
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
/* Get the address of the next instruction. */
- dot = (link_order->offset
+ dot = (input_section->output_offset
+ dst_address
+ link_order->u.indirect.section->output_section->vma + 1);
@@ -864,7 +864,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info,
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
/* Get the address of the instruction (not the reloc). */
- dot = (link_order->offset
+ dot = (input_section->output_offset
+ dst_address
+ link_order->u.indirect.section->output_section->vma - 1);
@@ -925,7 +925,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info,
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
/* Get the address of the instruction (not the reloc). */
- dot = (link_order->offset
+ dot = (input_section->output_offset
+ dst_address
+ link_order->u.indirect.section->output_section->vma + 2);
@@ -1064,7 +1064,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info,
/* Get the address of the target of this branch. */
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
- dot = (link_order->offset
+ dot = (input_section->output_offset
+ dst_address
+ link_order->u.indirect.section->output_section->vma) + 1;
diff --git a/bfd/coff-h8500.c b/bfd/coff-h8500.c
index bef704b5d6b..e9c878d820a 100644
--- a/bfd/coff-h8500.c
+++ b/bfd/coff-h8500.c
@@ -1,5 +1,5 @@
/* BFD back-end for Renesas H8/500 COFF binaries.
- Copyright 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Contributed by Cygnus Support.
Written by Steve Chamberlain, <sac@cygnus.com>.
@@ -245,9 +245,9 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
{
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
- bfd_vma dot = link_order->offset
- + *dst_ptr
- + link_order->u.indirect.section->output_section->vma;
+ bfd_vma dot = (*dst_ptr
+ + input_section->output_offset
+ + input_section->output_section->vma);
int gap = dst - dot - 1; /* -1 since were in the odd byte of the
word and the pc's been incremented. */
@@ -269,9 +269,9 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
{
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
- bfd_vma dot = link_order->offset
- + *dst_ptr
- + link_order->u.indirect.section->output_section->vma;
+ bfd_vma dot = (*dst_ptr
+ + input_section->output_offset
+ + input_section->output_section->vma);
int gap = dst - dot - 1; /* -1 since were in the odd byte of the
word and the pc's been incremented. */
diff --git a/bfd/coff-w65.c b/bfd/coff-w65.c
index 3119ad69b89..7a1cfb73928 100644
--- a/bfd/coff-w65.c
+++ b/bfd/coff-w65.c
@@ -1,5 +1,5 @@
/* BFD back-end for WDC 65816 COFF binaries.
- Copyright 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written by Steve Chamberlain, <sac@cygnus.com>.
@@ -316,9 +316,9 @@ w65_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
{
int gap = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
- bfd_vma dot = link_order->offset
- + dst_address
- + link_order->u.indirect.section->output_section->vma;
+ bfd_vma dot = (dst_address
+ + input_section->output_offset
+ + input_section->output_section->vma);
gap -= dot + 1;
if (gap < -128 || gap > 127)
@@ -340,9 +340,9 @@ w65_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
{
bfd_vma gap = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
- bfd_vma dot = link_order->offset
- + dst_address
- + link_order->u.indirect.section->output_section->vma;
+ bfd_vma dot = (dst_address
+ + input_section->output_offset
+ + input_section->output_section->vma);
/* This wraps within the page, so ignore the relativeness, look at the
high part. */
diff --git a/bfd/coff-z80.c b/bfd/coff-z80.c
index fe401d77b86..f39413f6e9c 100644
--- a/bfd/coff-z80.c
+++ b/bfd/coff-z80.c
@@ -200,8 +200,8 @@ extra_case (bfd *in_abfd,
{
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
- bfd_vma dot = (link_order->offset
- + *dst_ptr
+ bfd_vma dot = (*dst_ptr
+ + input_section->output_offset
+ input_section->output_section->vma);
int gap = dst - dot - 1; /* -1, Since the offset is relative
to the value of PC after reading
diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c
index d2dc3815ad0..8fc2f169239 100644
--- a/bfd/coff-z8k.c
+++ b/bfd/coff-z8k.c
@@ -230,8 +230,8 @@ extra_case (bfd *in_abfd,
{
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
- bfd_vma dot = (link_order->offset
- + *dst_ptr
+ bfd_vma dot = (*dst_ptr
+ + input_section->output_offset
+ input_section->output_section->vma);
int gap = dst - dot - 1; /* -1, since we're in the odd byte of the
word and the pc's been incremented. */
@@ -258,8 +258,8 @@ extra_case (bfd *in_abfd,
{
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
- bfd_vma dot = (link_order->offset
- + *dst_ptr
+ bfd_vma dot = (*dst_ptr
+ + input_section->output_offset
+ input_section->output_section->vma);
int gap = dst - dot - 1; /* -1, since we're in the odd byte of the
word and the pc's been incremented. */
@@ -289,8 +289,8 @@ extra_case (bfd *in_abfd,
{
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
- bfd_vma dot = (link_order->offset
- + *dst_ptr
+ bfd_vma dot = (*dst_ptr
+ + input_section->output_offset
+ input_section->output_section->vma);
int gap = dst - dot - 2;
@@ -318,8 +318,8 @@ extra_case (bfd *in_abfd,
{
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
- bfd_vma dot = (link_order->offset
- + *dst_ptr
+ bfd_vma dot = (*dst_ptr
+ + input_section->output_offset
+ input_section->output_section->vma);
int gap = dst - dot - 2;
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index cf2658a4c9b..8c855b32b66 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -4002,11 +4002,10 @@ ecoff_indirect_link_order (bfd *output_bfd,
BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0);
- if (link_order->size == 0)
- return TRUE;
-
input_section = link_order->u.indirect.section;
input_bfd = input_section->owner;
+ if (input_section->size == 0)
+ return TRUE;
BFD_ASSERT (input_section->output_section == output_section);
BFD_ASSERT (input_section->output_offset == link_order->offset);
diff --git a/bfd/linker.c b/bfd/linker.c
index 9e6199b835a..67fe80451c2 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -2717,11 +2717,10 @@ default_indirect_link_order (bfd *output_bfd,
BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0);
- if (link_order->size == 0)
- return TRUE;
-
input_section = link_order->u.indirect.section;
input_bfd = input_section->owner;
+ if (input_section->size == 0)
+ return TRUE;
BFD_ASSERT (input_section->output_section == output_section);
BFD_ASSERT (input_section->output_offset == link_order->offset);
@@ -2810,9 +2809,9 @@ default_indirect_link_order (bfd *output_bfd,
goto error_return;
/* Output the section contents. */
- loc = link_order->offset * bfd_octets_per_byte (output_bfd);
+ loc = input_section->output_offset * bfd_octets_per_byte (output_bfd);
if (! bfd_set_section_contents (output_bfd, output_section,
- new_contents, loc, link_order->size))
+ new_contents, loc, input_section->size))
goto error_return;
if (contents != NULL)