* coff-h8300.c (h8300_reloc16_extra_cases): Use input section
authorAlan Modra <amodra@gmail.com>
Tue, 27 Dec 2005 03:06:27 +0000 (03:06 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 27 Dec 2005 03:06:27 +0000 (03:06 +0000)
"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.

bfd/ChangeLog
bfd/coff-h8300.c
bfd/coff-h8500.c
bfd/coff-w65.c
bfd/coff-z80.c
bfd/coff-z8k.c
bfd/ecoff.c
bfd/linker.c

index 08ab38a0af9b2a82922558e3f3d01c1538b777a9..97db8cd0879e5594175290e8ded2e25ce67b26d2 100644 (file)
@@ -1,3 +1,14 @@
+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".
index 1fb94f85a49604c515e4fa19c19cafacaedda273..ef29664e782150d43ff81acee1ffbfc37377f2bf 100644 (file)
@@ -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;
 
index bef704b5d6bfda90524b052bc60b09b1683e39be..e9c878d820a09292d5c730c713f5a3a2382b6ef4 100644 (file)
@@ -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.  */
 
index 3119ad69b89131a4bb2a312b0912dc18ce9a2fb4..7a1cfb73928b1e2c81e16e88c99b768b808d41d9 100644 (file)
@@ -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.  */
index fe401d77b867e28a9c4809a9c57b07f0f03157c2..f39413f6e9c7c04d48c5e1d4e90f7f6e7ef76187 100644 (file)
@@ -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
index d2dc3815ad02d59e11ebe0188c96eebfbf3d58dc..8fc2f1692398cb1451654ea0935effae3c184262 100644 (file)
@@ -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;
 
index cf2658a4c9bf07a2ec4e35a2926f5f4ec34ea5a3..8c855b32b66720962af0e5ec068aa325a49bd961 100644 (file)
@@ -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);
index 9e6199b835a5b40b682e751126f7a6fa0517b982..67fe80451c2e4c97742327ae860fc7cdcf68a8ca 100644 (file)
@@ -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)