bfd/
[binutils-gdb.git] / bfd / cpu-ns32k.c
index 074eb70a62ccc09845c2524d844b3f67e66559c3..0ba256035dce6a8e7be2ea2aa29b1042573ab111 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD support for the ns32k architecture.
-   Copyright 1990, 1991, 1994, 1995, 1998, 2000, 2001, 2002, 2003, 2004
-   Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003,
+   2004, 2005 Free Software Foundation, Inc.
    Almost totally rewritten by Ian Dall from initial work
    by Andrew Cagney.
 
@@ -170,7 +170,6 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
   bfd_vma relocation;
   bfd_reloc_status_type flag = bfd_reloc_ok;
   bfd_size_type addr = reloc_entry->address;
-  bfd_size_type sz;
   bfd_vma output_base = 0;
   reloc_howto_type *howto = reloc_entry->howto;
   asection *reloc_target_output_section;
@@ -192,8 +191,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
     flag = bfd_reloc_undefined;
 
   /* Is the address of the relocation really within the section?  */
-  sz = input_section->rawsize ? input_section->rawsize : input_section->size;
-  if (reloc_entry->address > sz)
+  if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
     return bfd_reloc_outofrange;
 
   /* Work out which section the relocation is targeted at and the
@@ -281,7 +279,6 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
          /* WTF?? */
          if (abfd->xvec->flavour == bfd_target_coff_flavour)
            {
-#if 1
              /* For m68k-coff, the addend was being subtracted twice during
                 relocation with -r.  Removing the line below this comment
                 fixes that problem; see PR 2953.
@@ -357,7 +354,6 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
                   7) if they are different you have to figure out which
                      version is right.  */
              relocation -= reloc_entry->addend;
-#endif
              reloc_entry->addend = 0;
            }
          else
@@ -804,11 +800,9 @@ _bfd_ns32k_final_link_relocate (howto, input_bfd, input_section, contents,
      bfd_vma addend;
 {
   bfd_vma relocation;
-  bfd_size_type sz;
 
   /* Sanity check the address.  */
-  sz = input_section->rawsize ? input_section->rawsize : input_section->size;
-  if (address > sz)
+  if (address > bfd_get_section_limit (input_bfd, input_section))
     return bfd_reloc_outofrange;
 
   /* This function assumes that we are dealing with a basic relocation