From 44da2da10b10bc7e70095c3dc8737278c9a65149 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 27 Dec 2005 03:06:27 +0000 Subject: [PATCH] * 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. --- bfd/ChangeLog | 11 +++++++++++ bfd/coff-h8300.c | 12 ++++++------ bfd/coff-h8500.c | 14 +++++++------- bfd/coff-w65.c | 14 +++++++------- bfd/coff-z80.c | 4 ++-- bfd/coff-z8k.c | 16 ++++++++-------- bfd/ecoff.c | 5 ++--- bfd/linker.c | 9 ++++----- 8 files changed, 47 insertions(+), 38 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 08ab38a0af..97db8cd087 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,14 @@ +2005-12-27 Alan Modra + + * 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 * Makefile.am: Run "make dep-am". diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index 1fb94f85a4..ef29664e78 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 bef704b5d6..e9c878d820 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, . @@ -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 3119ad69b8..7a1cfb7392 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, . @@ -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 fe401d77b8..f39413f6e9 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 d2dc3815ad..8fc2f16923 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 cf2658a4c9..8c855b32b6 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 9e6199b835..67fe80451c 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) -- 2.34.1