This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Cleaning up the mips reloc handling


Another MIPS gas relocation bug, I'm afraid.  We're assembling:

        la $4,foo
        .comm foo,12

as:

   0:   3c040000        lui     a0,0x0
                        0: R_MIPS_HI16  foo
   4:   2484fff4        addiu   a0,a0,-12
                        4: R_MIPS_LO16  foo

and I think we have done since:

2003-06-11  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>

        * config/tc-mips.c (md_pcrel_from): Return actual pcrel address.
        (md_apply_fix3): Ignore non-special relocations. Remove superfluous
        exceptions from size assert. Remove most of the addend fixup
        specialcasing. Remove value, use valP directly. simplify fx_addnumber
        handling. Remove zero addend specialcases.
        (tc_gen_reloc): Use appropriate value for reloc2 addend. Remove
        the addend fixup specialcase.
        * config/tc-mips.h (MD_APPLY_SYM_VALUE): Define as 0.

The patch was a nice clean-up in general, but this particular bug seems
to be caused by one of the tc_gen_reloc hunks:

@@ -13864,7 +13790,7 @@ tc_gen_reloc (section, fixp)
       reloc2->address = (reloc->address
                         + (RELAX_RELOC2 (fixp->fx_frag->fr_subtype)
                            - RELAX_RELOC1 (fixp->fx_frag->fr_subtype)));
-      reloc2->addend = fixp->fx_addnumber
+      reloc2->addend = fixp->fx_addnumber - S_GET_VALUE (fixp->fx_addsy)
        + fixp->fx_frag->tc_frag_data.tc_fr_offset;
       reloc2->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_LO16);
       assert (reloc2->howto != NULL);

I think this is another instance of the infamous bfd_install_relocation
workaround.  To recap, bfd_install_relocation will often add the symbol
value to in-place addends in cases where we don't want it to, and we try
to compensate for this by subtracting the symbol value in md_apply_fix3.

However, this hack isn't needed for all symbols and relocation types.
One important case where it _isn't_ needed is in R_MIPS_GPREL* relocations.
This is because they're handled entirely by special howto functions,
and therefore bypass the troublesome code in b_i_r.

I think it's the special treatment of R_MIPS_GPREL* that's causing
problems here.  In non-PIC mode, "la $4,foo" will be assembled on the
assumption that "foo" is small data, but with a relaxed variant that
uses hi/lo accesses instead.  We don't want to apply the subtraction
to the original gp-relative sequence but we do want to apply it to the
relaxed hi/lo version.  That's what the change above seems to be doing,
but it's kicking in too often.

I think the immediate fix would be to guard the subtraction with
mips_need_elf_addend_fixup.  But I've lost count of the number of
times we've had to tweak this code, so I thought I'd have a go at
a "proper" fix.

Summary
-------

The idea is to bypass the symbol handling in bfd_install_relocation and
bfd_perform_relocation.  Rather than return bfd_reloc_continue (to tell
b_{i,p}_r to do their normal stuff) howto special_functions will instead
use a new mips-specific function, _bfd_mips_elf_generic_reloc.  This
function deals with the full calculation itself, much like the current
R_MIPS_GPREL* code does.

Although the idea itself is simple, there are a lot of knock-on effects.
I suspect some of them could be controversial.

Removing the chained reloc handling from elfn32-mips.c
------------------------------------------------------

One of the things blocking this change is the treatment of chained
relocations in elfn32-mips.c.  Each special function uses the
following macro:

#define GET_RELOC_ADDEND(obfd, sym, entry, sec)                         \
{                                                                       \
  /* If we're relocating, and this is an external symbol, we don't      \
     want to change anything.  */                                       \
    if ((obfd) != NULL                                                  \
        && ((sym)->flags & BSF_SECTION_SYM) == 0                        \
        && (! (entry)->howto->partial_inplace                           \
            || (entry)->addend == 0))                                   \
      {                                                                 \
        (entry)->address += (sec)->output_offset;                       \
        return bfd_reloc_ok;                                            \
      }                                                                 \
                                                                        \
    /* The addend of combined relocs is remembered and left for         \
       subsequent relocs.  */                                           \
    if (prev_reloc_address != (entry)->address                          \
        || prev_reloc_section != (sec))                                 \
      {                                                                 \
        prev_reloc_section = (sec);                                     \
        prev_reloc_address = (entry)->address;                          \
        prev_reloc_addend = (entry)->addend;                            \
      }                                                                 \
    else                                                                \
      (entry)->addend = prev_reloc_addend;                              \
}

The idea is that, if the previous relocation was against the same address,
we should use the result of that relocation as the addend.  But there are
a couple of things to note here:

   (1) The ABI is somewhat hazy about the valid values of r_sym in
       second and subsequent relocations.  It just says:

           The new composition rules are observed for 32-bit object files
           as well in the IRIX 6.0 linker and beyond (except for those
           related to having multiple relocation types in a record).

       which doesn't really help at all.  But in practice, I think the
       relocation will always be against symbol 0.  Certainly the assembler
       won't emit anything else[*].

       In which case, the macro seems to be largely a no-op.  The condition:

           if ((obfd) != NULL
               && ((sym)->flags & BSF_SECTION_SYM) == 0
               && (! (entry)->howto->partial_inplace
                   || (entry)->addend == 0))

       will always be true for second and subsequent relocations:

          (a) symbol 0 isn't a section symbol.
          (b) (entry)->addend can only be nonzero for in-place relocations
              if we're being called from the assembler.  But the assembler
              will always provide a zero addend for second and subsequent
              relocations.

       So the macro adjusts the relocation address and returns bfd_reloc_ok.
       But bfd_{install,perform}_relocation wouldn't have changed anything
       in this case anyway, even if we'd used _bfd_elf_generic_reloc.

       [*] Note that there isn't (AFAIK) any way of setting r_sym to the
           equivalent of ELF64's RSS_GP0 or RSS_LOC.  So if we're using the
           RSS_* values as the benchmark, the only other alternative would
           be RSS_GP, i.e. _gp.  But I'm unconvinced that this is ever used
           or useful.

   (2) IMO, the handling is wrong for the non-relocatable case:

       (a) The result of the previous relocation is supposed to be used
           as the addend in the next one.  But prev_reloc_addend is not
           properly updated; it contains the value of the addend _before_
           relocation.  (Well, except in the case of R_MIPS_SHIFT6.
           But even then, prev_reloc_addend won't contain the final value.)

       (b) According to the ABI, only the last relocation modifies the
           relocation field.  But with the current implementation, _every_
           relocation modifies the field.  This is especially unfortunate
           in the common cases of:

                R_MIPS_GPREL16 -> R_MIPS_SUB -> R_MIPS_HI16
                R_MIPS_GPREL16 -> R_MIPS_SUB -> R_MIPS_LO16

           We (correctly) treat R_MIPS_SUB as a 64-bit relocation, so when
           we come to process it, we'll clobber the instruction's opcode...

So I think we should do two things:

   (1) Say that second and subsequent relocations _must_ have an r_sym
       of 0.

   (2) Say that the !relocatable case isn't supported.  Getting it to work
       properly would be extremely difficult and there are many other
       relocations we can't handle, including all the GOT-related ones.

The special n32 handling is then redundant.  The only function that really
needs to handle chained relocations is _bfd_mips_elf_relocate_section
(which seems to work fine).

Reworking the handling of HI/LO pairs
-------------------------------------

There are two copies of the code to handle R_MIPS_HI16, R_MIPS_GOT16 and
R_MIPS_LO16 REL relocations, one in elf32-mips.c and one in elfn32-mips.c.
The n32 version was obviously cut&paste from the original version and
modified so that (1) it uses the GET_RELOC_ADDEND macro described above
and (2) it doesn't have the special treatment of _gp_disp.

But the treatment of _gp_disp in elf32-mips.c is really weird.
The R_MIPS_HI16 function goes to great lengths to calculate a
gp-relative offset:

    if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0)
      {
        bfd_boolean relocatable;
        bfd_vma gp;

        if (ret == bfd_reloc_undefined)
          abort ();

        if (output_bfd != NULL)
          relocatable = TRUE;
        else
          {
            relocatable = FALSE;
            output_bfd = symbol->section->output_section->owner;
          }

        ret = mips_elf_final_gp (output_bfd, symbol, relocatable,
                                 error_message, &gp);
        if (ret != bfd_reloc_ok)
          return ret;

        relocation = gp - reloc_entry->address;
      }
    ...
    relocation += symbol->section->output_section->vma;
    relocation += symbol->section->output_offset;
    relocation += reloc_entry->addend;
    ...
    n->addend = relocation;

which then gets used in the R_MIPS_LO16 relocation as follows:

    l = mips_hi16_list;
    while (l != NULL)
      {
        ... variables ...

        if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0)
          {
            gp_disp_relent = *reloc_entry;
            reloc_entry = &gp_disp_relent;
            reloc_entry->addend = l->addend;
          }
        else
          ...

        next = l->next;
        free (l);
        l = next;
      }
    ...
    /* Now do the LO16 reloc in the usual way.  */
    return mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
                                   input_section, output_bfd, error_message);

Notice how the high part relocation is never applied!  And it's pointless
to pass a new reloc_entry (with new addend) to mips_elf_generic_reloc.
All the function does is return bfd_reloc_ok if no action is needed and
bfd_reloc_continue otherwise.  In the latter case, the caller will use
the original relocation entry, not gp_disp_relent.

For some reason, there's also code to handle an orphaned LO16 relocation.
It suffers from the same problem:

  else if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0)
    {
      bfd_reloc_status_type ret;
      bfd_vma gp, relocation;

      /* FIXME: Does this case ever occur?  */
      ...

      gp_disp_relent = *reloc_entry;
      reloc_entry = &gp_disp_relent;
      reloc_entry->addend = relocation - 4;
    }

To summarise:

   (1) In relocatable output, the _gp_disp code is a no-op for .cpload
       sequences.  We still end up installing addends of zero, just like
       we would if the special handling weren't there.

   (2) If the user for some reason refers to _gp_disp + X directly, only
       16-bit Xs would be handled correctly.  The high part of the addend
       would be lost.

   (3) _gp_disp is broken for non-relocatable output because we don't modify
       the caller's arelent at all.

We can solve (2) simply by removing the _gp_disp code.  And I don't think
(3) matters since _gp_disp is only really designed to be used for PIC.
(As noted above, many of the other relocations used for PIC are also not
supported in the !relocatable case.)

Removing the _gp_disp code greatly simplifies the hi16/lo16 logic and
means we can reuse it for n32.  The patch therefore moves it into
elfxx-mips.c.

The point of all this (in case you were forgetting ;) was to install the
high part using _bfd_mips_elf_generic_reloc, thus making the high-part
relocations work without the assembler hack.  The changes above are almost
enough to make this possible, but we need one more: the R_MIPS_HI16 howtos
should have a rightshift of 16, not 0.

Changing the rightshift of R_MIPS_HI16 to 16
--------------------------------------------

This is only possible after a few tweaks to _bfd_mips_elf_relocate_section,
which applies the howto's rightshift in addition to, not instead of, the
usual high part shift.

Also, the function will shift the addend right before calling
mips_elf_calculate_relocation:

    addend >>= howto->rightshift;

and mips_elf_calculate_relocation will dutifully shift it left again
whenever rightshift != 0.  (See the handling of R_MIPS_GNU_REL16_S2
and R_MIPS_26.)

This seems a bit daft, especially in code that's supposed to handle both
REL and RELA relocations.  The patch removes the shifts from both caller
and callee.

Other existing workarounds
--------------------------

Several howto functions have:

  /* If we're relocating, and this is an external symbol, we don't want
     to change anything.  */
  if (output_bfd != NULL
      && (symbol->flags & BSF_SECTION_SYM) == 0
      && (symbol->flags & BSF_LOCAL) != 0)
    {
      reloc_entry->address += input_section->output_offset;
      return bfd_reloc_ok;
    }

which allowed Thiemo to remove the horrible double-subtraction hack
from md_apply_fix3.  But even this isn't needed if we bypass the
generic routines altogether.

PC-relative relocations
-----------------------

As well as the symbol subtraction hack, there's:

      /* This code was generated using trial and error and so is
         fragile and not trustworthy.  If you change it, you should
         rerun the elf-rel, elf-rel2, and empic testcases and ensure
         they still pass.  */
      if (fixP->fx_pcrel)
        {
          *valP += fixP->fx_frag->fr_address + fixP->fx_where;

          /* BFD's REL handling, for MIPS, is _very_ weird.
             This gives the right results, but it can't possibly
             be the way things are supposed to work.  */
          *valP += fixP->fx_frag->fr_address + fixP->fx_where;
        }

One of these can go away after the changes above.  As for the other,
well...

Within gas, the addnumber for a pc-relative relocation is the value
that we'd install if no relocation is needed.  I.e. it's based on
"target address - relocation address", with additional constant addend
where appropriate.  That seems to make sense to me.

But if we _do_ need a relocation, its addend should not include
"- relocation address".  I think we should therefore add the address
of the relocation in tc_gen_reloc, not here.  And in fact that's what
some of the !ELF code already does.

The end
-------

Patch tested by bootstrapping and regression testing gcc on mips-sgi-irix6.5
and mips64{,el}-linux-gnu (testing all three ABIs in each case).  Also tested
with gcc on various *-elf targets, including mipsisa64-elf and mips64vrel-elf.

There's very little coverage of "ld -r" and "ld --oformat" in the
existing testsuite.  I've therefore added a some new tests to
ld-mips-elf:

    reloc-1*:
      tests ld -r output and has separate .d files for elf32, elfn32
      and elf64.

    reloc-2*:
      tests ld --oformat=srec output.  This test should work whatever
      flavour of elf we have as the input files, and the output should
      be same in all cases.  There's therefore just a single .d file.

    reloc-3*:
      tests R_MIPS_GNU_REL_HI16 and R_MIPS_GNU_REL_LO16.  There are two
      .d tests, one for ld -r and one for srec output.  Since this
      requires -membedded-pic, it's for embedded targets only.

reloc-3-srec.d failed before the patch because we mishandled the
high-part relocations in the second input file.  Everything else
passed before the patch as well as after it.

Removing the "If we're relocating..." code from the elfn32-* version
of mips16_jump_reloc means that the mips16 tests now produce a
"not supported" message for n32 targets.  I think that's OK since
mips16 really isn't supported for n32.  The patch changes the test
cases to force -mabi=o64 instead.

Tested against the gas, ld & binutils testsuite with:

    mips-ecoff  mips{,el}-elf  mips64{,el}-elf  mips{,el}-linux-gnu
    mips64{,el}-linux-gnu  mips-sgi-irix6.5

OK to install?

There are a lot of other things that could be cleaned up, especially
wrt the gp-relative relocs.  But this patch is big enough already...

Richard


bfd/
	* elf32-mips.c (elf_mips_howto_table_rel): Replace all uses of
	mips_elf_generic_reloc with _bfd_mips_elf_generic_reloc.  Use
	_bfd_mips_elf_hi16_reloc for R_MIPS_HI16 and R_MIPS_GNU_REL_HI16,
	_bfd_mips_elf_lo16_reloc for R_MIPS_LO16 and R_MIPS_GNU_REL_LO16,
	and _bfd_mips_elf_got16_reloc for R_MIPS_GOT16.  Change rightshift
	to 16 for R_MIPS_HI16 and R_MIPS_GNU_REL_HI16.
	(mips_elf_generic_reloc, struct mips_hi16, mips_elf_hi16_reloc)
	(mips_elf_lo16_reloc, mips_elf_got16_reloc): Delete.
	(_bfd_mips_elf32_gprel16_reloc): Remove special case.
	(mips_elf_gprel32_reloc, mips32_64bit_reloc): Likewise.

	* elf64-mips.c (mips_elf64_howto_table_rel): Replace all uses of
	mips_elf_generic_reloc with _bfd_mips_elf_generic_reloc.  Use
	_bfd_mips_elf_hi16_reloc for R_MIPS_HI16, _bfd_mips_elf_lo16_reloc
	for R_MIPS_LO16 and _bfd_mips_elf_got16_reloc for R_MIPS_GOT16.
	Change R_MIPS_HI16's rightshift to 16.
	(mips_elf64_howto_table_rela): Replace all uses of
	mips_elf_generic_reloc with _bfd_mips_elf_generic_reloc.
	Use _bfd_mips_elf_generic_reloc for R_MIPS_GOT16 as well.
	(mips_elf64_hi16_reloc, mips_elf64_got16_reloc): Delete.
	(mips_elf64_shift6_reloc): Remove special case.  Use
	_bfd_mips_elf_generic_reloc instead of returning bfd_reloc_continue.

	* elfn32-mips.c (prev_reloc_section): Delete.
	(prev_reloc_address, prev_reloc_addend): Delete.
	(elf_mips_howto_table_rel, elf_mips_howto_table_rela): As for
	elf64-mips.c
	(GET_RELOC_ADDEND, SET_RELOC_ADDEND): Delete.
	(mips_elf_generic_reloc, struct mips_hi16, mips_elf_hi16_reloc)
	(mips_elf_lo16_reloc, mips_elf_got16_reloc): Delete.
	(mips_elf_gprel16_reloc): Delete use of GET_RELOC_ADDEND.
	(mips_elf_literal_reloc, mips_elf_gprel32_reloc): Likewise.
	(mips16_jump_reloc, mips16_gprel_reloc): Likewise.
	(mips_elf_shift6_reloc): Likewise.  Delete use of SET_RELOC_ADDEND.

	* elfxx-mips.c (_bfd_mips_elf_gprel16_with_gp): Use
	_bfd_relocate_contents to install an in-place addend.
	(mips_hi16): New structure.
	(mips_hi16_list): Moved from elf32-mips.c.
	(_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_got16_reloc): New functions.
	(_bfd_mips_elf_lo16_reloc, _bfd_mips_elf_generic_reloc): New functions.
	(mips_elf_calculate_relocation): Assume addend is unshifted.
	(_bfd_mips_elf_relocate_section): Don't apply the howto rightshift
	on top of the usual high-part shift.  Don't shift the addend right
	before calling mips_elf_calculate_relocation.

	* elfxx-mips.h (_bfd_mips_elf_hi16_reloc): Declare.
	(_bfd_mips_elf_got16_reloc, _bfd_mips_elf_lo16_reloc): Declare.
	(_bfd_mips_elf_generic_reloc): Declare.

gas/
	* config/tc-mips.c (mips_need_elf_addend_fixup): Delete.
	(md_apply_fix3): Remove bfd_install_relocation workarounds.
	(tc_gen_reloc): Likewise. Factor handling of pc-relative relocations
	and treat fx_addnumber as relative to the relocation address.

ld/testsuite/
	* ld-mips-elf/reloc-1[ab].s: New source files.
	* ld-mips-elf/reloc-1-{n32,n64,rel}.d: New tests.
	* ld-mips-elf/reloc-2[ab].s: New source files.
	* ld-mips-elf/reloc-2.{d,ld}: New test.
	* ld-mips-elf/reloc-3[ab].s: New source files.
	* ld-mips-elf/reloc-3-{r,srec}.d: New tests.
	* ld-mips-elf/mips-elf.exp: Run them.

Index: bfd/elf32-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mips.c,v
retrieving revision 1.171
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.171 elf32-mips.c
*** bfd/elf32-mips.c	7 Dec 2003 21:24:27 -0000	1.171
--- bfd/elf32-mips.c	14 Dec 2003 15:27:19 -0000
*************** Foundation, Inc., 59 Temple Place - Suit
*** 47,60 ****
  #define ECOFF_SIGNED_32
  #include "ecoffswap.h"
  
- static bfd_reloc_status_type mips_elf_generic_reloc
-   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
- static bfd_reloc_status_type mips_elf_hi16_reloc
-   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
- static bfd_reloc_status_type mips_elf_lo16_reloc
-   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
- static bfd_reloc_status_type mips_elf_got16_reloc
-   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
  static bfd_reloc_status_type gprel32_with_gp
    (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma);
  static bfd_reloc_status_type mips_elf_gprel32_reloc
--- 47,52 ----
*************** static reloc_howto_type elf_mips_howto_t
*** 120,126 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_NONE",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 112,118 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_NONE",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 135,141 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 127,133 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 150,156 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_32",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 142,148 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_32",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 165,171 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_REL32",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 157,163 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_REL32",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 183,189 ****
  	 			/* This needs complex overflow
  				   detection, because the upper four
  				   bits must match the PC + 4.  */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_26",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x03ffffff,		/* src_mask */
--- 175,181 ----
  	 			/* This needs complex overflow
  				   detection, because the upper four
  				   bits must match the PC + 4.  */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_26",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x03ffffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 192,204 ****
  
    /* High 16 bits of symbol value.  */
    HOWTO (R_MIPS_HI16,		/* type */
! 	 0,			/* rightshift */
  	 2,			/* size (0 = byte, 1 = short, 2 = long) */
  	 16,			/* bitsize */
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_hi16_reloc,	/* special_function */
  	 "R_MIPS_HI16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 184,196 ----
  
    /* High 16 bits of symbol value.  */
    HOWTO (R_MIPS_HI16,		/* type */
! 	 16,			/* rightshift */
  	 2,			/* size (0 = byte, 1 = short, 2 = long) */
  	 16,			/* bitsize */
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_hi16_reloc, /* special_function */
  	 "R_MIPS_HI16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 213,219 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_lo16_reloc,	/* special_function */
  	 "R_MIPS_LO16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 205,211 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_lo16_reloc, /* special_function */
  	 "R_MIPS_LO16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 258,264 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_got16_reloc,	/* special_function */
  	 "R_MIPS_GOT16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 250,256 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_got16_reloc, /* special_function */
  	 "R_MIPS_GOT16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 273,279 ****
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_PC16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 265,271 ----
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_PC16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 288,294 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 280,286 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 324,330 ****
  	 FALSE,			/* pc_relative */
  	 6,			/* bitpos */
  	 complain_overflow_bitfield, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SHIFT5",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x000007c0,		/* src_mask */
--- 316,322 ----
  	 FALSE,			/* pc_relative */
  	 6,			/* bitpos */
  	 complain_overflow_bitfield, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SHIFT5",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x000007c0,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 341,347 ****
  	 FALSE,			/* pc_relative */
  	 6,			/* bitpos */
  	 complain_overflow_bitfield, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SHIFT6",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x000007c4,		/* src_mask */
--- 333,339 ----
  	 FALSE,			/* pc_relative */
  	 6,			/* bitpos */
  	 complain_overflow_bitfield, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SHIFT6",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x000007c4,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 371,377 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_DISP",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 363,369 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_DISP",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 386,392 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_PAGE",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 378,384 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_PAGE",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 401,407 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_OFST",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 393,399 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_OFST",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 416,422 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 408,414 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 431,437 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 423,429 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 446,452 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SUB",		/* name */
  	 TRUE,			/* partial_inplace */
  	 MINUS_ONE,		/* src_mask */
--- 438,444 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SUB",		/* name */
  	 TRUE,			/* partial_inplace */
  	 MINUS_ONE,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 466,472 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HIGHER",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 458,464 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HIGHER",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 481,487 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HIGHEST",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 473,479 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HIGHEST",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 496,502 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 488,494 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 511,517 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 503,509 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 526,532 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SCN_DISP",     /* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 518,524 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SCN_DISP",     /* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 547,553 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_JALR",	        /* name */
  	 FALSE,			/* partial_inplace */
  	 0x00000000,		/* src_mask */
--- 539,545 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_JALR",	        /* name */
  	 FALSE,			/* partial_inplace */
  	 0x00000000,		/* src_mask */
*************** static reloc_howto_type elf_mips16_gprel
*** 611,623 ****
  /* High 16 bits of symbol value, pc-relative.  */
  static reloc_howto_type elf_mips_gnu_rel_hi16 =
    HOWTO (R_MIPS_GNU_REL_HI16,	/* type */
! 	 0,			/* rightshift */
  	 2,			/* size (0 = byte, 1 = short, 2 = long) */
  	 16,			/* bitsize */
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_hi16_reloc,	/* special_function */
  	 "R_MIPS_GNU_REL_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffff,		/* src_mask */
--- 603,615 ----
  /* High 16 bits of symbol value, pc-relative.  */
  static reloc_howto_type elf_mips_gnu_rel_hi16 =
    HOWTO (R_MIPS_GNU_REL_HI16,	/* type */
! 	 16,			/* rightshift */
  	 2,			/* size (0 = byte, 1 = short, 2 = long) */
  	 16,			/* bitsize */
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_hi16_reloc, /* special_function */
  	 "R_MIPS_GNU_REL_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_gnu_rel
*** 633,639 ****
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_lo16_reloc,	/* special_function */
  	 "R_MIPS_GNU_REL_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffff,		/* src_mask */
--- 625,631 ----
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_lo16_reloc, /* special_function */
  	 "R_MIPS_GNU_REL_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_gnu_rel
*** 649,655 ****
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GNU_REL16_S2",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffff,		/* src_mask */
--- 641,647 ----
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GNU_REL16_S2",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_gnu_pcr
*** 665,671 ****
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_PC64",		/* name */
  	 TRUE,			/* partial_inplace */
  	 MINUS_ONE,		/* src_mask */
--- 657,663 ----
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_PC64",		/* name */
  	 TRUE,			/* partial_inplace */
  	 MINUS_ONE,		/* src_mask */
*************** static reloc_howto_type elf_mips_gnu_pcr
*** 681,687 ****
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_PC32",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 673,679 ----
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_PC32",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_gnu_vte
*** 720,979 ****
  	 0,			/* dst_mask */
  	 FALSE);		/* pcrel_offset */
  
- /* We use this instead of bfd_elf_generic_reloc because the latter
-    gets the handling of zero addends wrong. */
- static bfd_reloc_status_type
- mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
- 			asymbol *symbol, void *data ATTRIBUTE_UNUSED,
- 			asection *input_section, bfd *output_bfd,
- 			char **error_message ATTRIBUTE_UNUSED)
- {
-   /* If we're relocating, and this is an external symbol, we don't want
-      to change anything.  */
-   if (output_bfd != NULL
-       && (symbol->flags & BSF_SECTION_SYM) == 0
-       && (symbol->flags & BSF_LOCAL) != 0)
-     {
-       reloc_entry->address += input_section->output_offset;
-       return bfd_reloc_ok;
-     }
- 
-   /* Just go on, nothing to see here.  */
-   return bfd_reloc_continue;
- }
- 
- /* Do a R_MIPS_HI16 relocation.  This has to be done in combination
-    with a R_MIPS_LO16 reloc, because there is a carry from the LO16 to
-    the HI16.  Here we just save the information we need; we do the
-    actual relocation when we see the LO16.
- 
-    MIPS ELF requires that the LO16 immediately follow the HI16.  As a
-    GNU extension, for non-pc-relative relocations, we permit an
-    arbitrary number of HI16 relocs to be associated with a single LO16
-    reloc.  This extension permits gcc to output the HI and LO relocs
-    itself.
- 
-    This cannot be done for PC-relative relocations because both the HI16
-    and LO16 parts of the relocations must be done relative to the LO16
-    part, and there can be carry to or borrow from the HI16 part.  */
- 
- struct mips_hi16
- {
-   struct mips_hi16 *next;
-   bfd_byte *addr;
-   bfd_vma addend;
- };
- 
- /* FIXME: This should not be a static variable.  */
- 
- static struct mips_hi16 *mips_hi16_list;
- 
- static bfd_reloc_status_type
- mips_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
- 		     asymbol *symbol, void *data, asection *input_section,
- 		     bfd *output_bfd, char **error_message)
- {
-   bfd_reloc_status_type ret;
-   bfd_vma relocation;
-   struct mips_hi16 *n;
- 
-   /* If we're relocating, and this is an external symbol, we don't want
-      to change anything.  */
-   if (output_bfd != NULL
-       && (symbol->flags & BSF_SECTION_SYM) == 0
-       && (symbol->flags & BSF_LOCAL) != 0)
-     {
-       reloc_entry->address += input_section->output_offset;
-       return bfd_reloc_ok;
-     }
- 
-   ret = bfd_reloc_ok;
- 
-   if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0)
-     {
-       bfd_boolean relocatable;
-       bfd_vma gp;
- 
-       if (ret == bfd_reloc_undefined)
- 	abort ();
- 
-       if (output_bfd != NULL)
- 	relocatable = TRUE;
-       else
- 	{
- 	  relocatable = FALSE;
- 	  output_bfd = symbol->section->output_section->owner;
- 	}
- 
-       ret = mips_elf_final_gp (output_bfd, symbol, relocatable,
- 			       error_message, &gp);
-       if (ret != bfd_reloc_ok)
- 	return ret;
- 
-       relocation = gp - reloc_entry->address;
-     }
-   else
-     {
-       if (bfd_is_und_section (symbol->section) && output_bfd == NULL)
- 	ret = bfd_reloc_undefined;
- 
-       if (bfd_is_com_section (symbol->section))
- 	relocation = 0;
-       else
- 	relocation = symbol->value;
-     }
- 
-   relocation += symbol->section->output_section->vma;
-   relocation += symbol->section->output_offset;
-   relocation += reloc_entry->addend;
- 
-   if (reloc_entry->address > input_section->_cooked_size)
-     return bfd_reloc_outofrange;
- 
-   /* Save the information, and let LO16 do the actual relocation.  */
-   n = bfd_malloc (sizeof *n);
-   if (n == NULL)
-     return bfd_reloc_outofrange;
-   n->addr = (bfd_byte *) data + reloc_entry->address;
-   n->addend = relocation;
-   n->next = mips_hi16_list;
-   mips_hi16_list = n;
- 
-   if (output_bfd != NULL)
-     reloc_entry->address += input_section->output_offset;
- 
-   return ret;
- }
- 
- /* Do a R_MIPS_LO16 relocation.  This is a straightforward 16 bit
-    inplace relocation; this function exists in order to do the
-    R_MIPS_HI16 relocation described above.  */
- 
- static bfd_reloc_status_type
- mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- 		     void *data, asection *input_section, bfd *output_bfd,
- 		     char **error_message)
- {
-   arelent gp_disp_relent;
- 
-   if (mips_hi16_list != NULL)
-     {
-       struct mips_hi16 *l;
- 
-       l = mips_hi16_list;
-       while (l != NULL)
- 	{
- 	  unsigned long insn;
- 	  unsigned long val;
- 	  unsigned long vallo;
- 	  struct mips_hi16 *next;
- 
- 	  if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0)
- 	    {
- 	      gp_disp_relent = *reloc_entry;
- 	      reloc_entry = &gp_disp_relent;
- 	      reloc_entry->addend = l->addend;
- 	    }
- 	  else
- 	    {
- 	      /* Do the HI16 relocation.  Note that we actually don't need
- 		 to know anything about the LO16 itself, except where to
- 		 find the low 16 bits of the addend needed by the LO16.  */
- 	      insn = bfd_get_32 (abfd, l->addr);
- 	      vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
- 	      /* The low order 16 bits are always treated as a signed
- 		 value.  */
- 	      vallo = ((vallo & 0xffff) ^ 0x8000) - 0x8000;
- 	      val = ((insn & 0xffff) << 16) + vallo;
- 	      val += l->addend;
- 
- 	      /* If PC-relative, we need to subtract out the address of the LO
- 		 half of the HI/LO.  (The actual relocation is relative
- 		 to that instruction.)  */
- 	      if (reloc_entry->howto->pc_relative)
- 		val -= reloc_entry->address;
- 
- 	      /* At this point, "val" has the value of the combined HI/LO
- 		 pair.  If the low order 16 bits (which will be used for
- 		 the LO16 insn) are negative, then we will need an
- 		 adjustment for the high order 16 bits.  */
- 	      val += 0x8000;
- 	      val = (val >> 16) & 0xffff;
- 
- 	      insn &= ~ (bfd_vma) 0xffff;
- 	      insn |= val;
- 	      bfd_put_32 (abfd, insn, l->addr);
- 	    }
- 
- 	  next = l->next;
- 	  free (l);
- 	  l = next;
- 	}
- 
-       mips_hi16_list = NULL;
-     }
-   else if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0)
-     {
-       bfd_reloc_status_type ret;
-       bfd_vma gp, relocation;
- 
-       /* FIXME: Does this case ever occur?  */
- 
-       ret = mips_elf_final_gp (output_bfd, symbol, TRUE, error_message, &gp);
-       if (ret != bfd_reloc_ok)
- 	return ret;
- 
-       relocation = gp - reloc_entry->address;
-       relocation += symbol->section->output_section->vma;
-       relocation += symbol->section->output_offset;
-       relocation += reloc_entry->addend;
- 
-       if (reloc_entry->address > input_section->_cooked_size)
- 	return bfd_reloc_outofrange;
- 
-       gp_disp_relent = *reloc_entry;
-       reloc_entry = &gp_disp_relent;
-       reloc_entry->addend = relocation - 4;
-     }
- 
-   /* Now do the LO16 reloc in the usual way.  */
-   return mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- 				 input_section, output_bfd, error_message);
- }
- 
- /* Do a R_MIPS_GOT16 reloc.  This is a reloc against the global offset
-    table used for PIC code.  If the symbol is an external symbol, the
-    instruction is modified to contain the offset of the appropriate
-    entry in the global offset table.  If the symbol is a section
-    symbol, the next reloc is a R_MIPS_LO16 reloc.  The two 16 bit
-    addends are combined to form the real addend against the section
-    symbol; the GOT16 is modified to contain the offset of an entry in
-    the global offset table, and the LO16 is modified to offset it
-    appropriately.  Thus an offset larger than 16 bits requires a
-    modified value in the global offset table.
- 
-    This implementation suffices for the assembler, but the linker does
-    not yet know how to create global offset tables.  */
- 
- static bfd_reloc_status_type
- mips_elf_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- 		      void *data, asection *input_section, bfd *output_bfd,
- 		      char **error_message)
- {
-   /* If we're relocating, and this is an external symbol, we don't want
-      to change anything.  */
-   if (output_bfd != NULL
-       && (symbol->flags & BSF_SECTION_SYM) == 0
-       && (symbol->flags & BSF_LOCAL) != 0)
-     {
-       reloc_entry->address += input_section->output_offset;
-       return bfd_reloc_ok;
-     }
- 
-   return mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data,
- 			      input_section, output_bfd, error_message);
- }
- 
  /* Set the GP value for OUTPUT_BFD.  Returns FALSE if this is a
     dangerous relocation.  */
  
--- 712,717 ----
*************** _bfd_mips_elf32_gprel16_reloc (bfd *abfd
*** 1078,1093 ****
    bfd_reloc_status_type ret;
    bfd_vma gp;
  
-   /* If we're relocating, and this is an external symbol, we don't want
-      to change anything.  */
-   if (output_bfd != NULL
-       && (symbol->flags & BSF_SECTION_SYM) == 0
-       && (symbol->flags & BSF_LOCAL) != 0)
-     {
-       reloc_entry->address += input_section->output_offset;
-       return bfd_reloc_ok;
-     }
- 
    if (output_bfd != NULL)
      relocatable = TRUE;
    else
--- 816,821 ----
*************** mips_elf_gprel32_reloc (bfd *abfd, arele
*** 1118,1134 ****
    bfd_reloc_status_type ret;
    bfd_vma gp;
  
-   /* If we're relocating, and this is an external symbol, we don't want
-      to change anything.  */
-   if (output_bfd != NULL
-       && (symbol->flags & BSF_SECTION_SYM) == 0
-       && (symbol->flags & BSF_LOCAL) != 0)
-     {
-       *error_message = (char *)
- 	_("32bits gp relative relocation occurs for an external symbol");
-       return bfd_reloc_outofrange;
-     }
- 
    if (output_bfd != NULL)
      relocatable = TRUE;
    else
--- 846,851 ----
*************** gprel32_with_gp (bfd *abfd, asymbol *sym
*** 1194,1212 ****
     sign extension.  */
  
  static bfd_reloc_status_type
! mips32_64bit_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
! 		    void *data, asection *input_section, bfd *output_bfd,
! 		    char **error_message)
  {
    bfd_reloc_status_type r;
    arelent reloc32;
    unsigned long val;
    bfd_size_type addr;
- 
-   r = mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- 			      input_section, output_bfd, error_message);
-   if (r != bfd_reloc_continue)
-     return r;
  
    /* Do a normal 32 bit relocation on the lower 32 bits.  */
    reloc32 = *reloc_entry;
--- 911,925 ----
     sign extension.  */
  
  static bfd_reloc_status_type
! mips32_64bit_reloc (bfd *abfd, arelent *reloc_entry,
! 		    asymbol *symbol ATTRIBUTE_UNUSED,
! 		    void *data, asection *input_section,
! 		    bfd *output_bfd, char **error_message)
  {
    bfd_reloc_status_type r;
    arelent reloc32;
    unsigned long val;
    bfd_size_type addr;
  
    /* Do a normal 32 bit relocation on the lower 32 bits.  */
    reloc32 = *reloc_entry;
Index: bfd/elf64-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-mips.c,v
retrieving revision 1.56
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.56 elf64-mips.c
*** bfd/elf64-mips.c	7 Dec 2003 21:24:28 -0000	1.56
--- bfd/elf64-mips.c	14 Dec 2003 15:27:19 -0000
*************** static void mips_elf64_write_rel
*** 104,111 ****
    (bfd *, asection *, Elf_Internal_Shdr *, int *, void *);
  static void mips_elf64_write_rela
    (bfd *, asection *, Elf_Internal_Shdr *, int *, void *);
- static bfd_reloc_status_type mips_elf64_hi16_reloc
-   (bfd *, arelent *, asymbol *,	void *, asection *, bfd *, char **);
  static bfd_reloc_status_type mips_elf64_gprel16_reloc
    (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
  static bfd_reloc_status_type mips_elf64_literal_reloc
--- 104,109 ----
*************** static bfd_reloc_status_type mips_elf64_
*** 114,121 ****
    (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
  static bfd_reloc_status_type mips_elf64_shift6_reloc
    (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
- static bfd_reloc_status_type mips_elf64_got16_reloc
-   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
  static bfd_reloc_status_type mips16_jump_reloc
    (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
  static bfd_reloc_status_type mips16_gprel_reloc
--- 112,117 ----
*************** static reloc_howto_type mips_elf64_howto
*** 155,161 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_NONE",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 151,157 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_NONE",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 170,176 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 166,172 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 185,191 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_32",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 181,187 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_32",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 200,206 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_REL32",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 196,202 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_REL32",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 218,224 ****
  				/* This needs complex overflow
  				   detection, because the upper 36
  				   bits must match the PC + 4.  */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_26",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x03ffffff,		/* src_mask */
--- 214,220 ----
  				/* This needs complex overflow
  				   detection, because the upper 36
  				   bits must match the PC + 4.  */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_26",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x03ffffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 230,242 ****
  
    /* High 16 bits of symbol value.  */
    HOWTO (R_MIPS_HI16,		/* type */
! 	 0,			/* rightshift */
  	 2,			/* size (0 = byte, 1 = short, 2 = long) */
  	 16,			/* bitsize */
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf64_hi16_reloc,	/* special_function */
  	 "R_MIPS_HI16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 226,238 ----
  
    /* High 16 bits of symbol value.  */
    HOWTO (R_MIPS_HI16,		/* type */
! 	 16,			/* rightshift */
  	 2,			/* size (0 = byte, 1 = short, 2 = long) */
  	 16,			/* bitsize */
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_hi16_reloc, /* special_function */
  	 "R_MIPS_HI16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 251,257 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_LO16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 247,253 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_lo16_reloc, /* special_function */
  	 "R_MIPS_LO16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 296,302 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf64_got16_reloc, /* special_function */
  	 "R_MIPS_GOT16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 292,298 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_got16_reloc, /* special_function */
  	 "R_MIPS_GOT16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 311,317 ****
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_PC16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 307,313 ----
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_PC16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 326,332 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 322,328 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 360,366 ****
  	 FALSE,			/* pc_relative */
  	 6,			/* bitpos */
  	 complain_overflow_bitfield, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_SHIFT5",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x000007c0,		/* src_mask */
--- 356,362 ----
  	 FALSE,			/* pc_relative */
  	 6,			/* bitpos */
  	 complain_overflow_bitfield, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_SHIFT5",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x000007c0,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 390,396 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_64",		/* name */
  	 TRUE,			/* partial_inplace */
  	 MINUS_ONE,		/* src_mask */
--- 386,392 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_64",		/* name */
  	 TRUE,			/* partial_inplace */
  	 MINUS_ONE,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 405,411 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_DISP",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 401,407 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_DISP",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 420,426 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_PAGE",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 416,422 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_PAGE",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 435,441 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_OFST",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 431,437 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_OFST",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 450,456 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 446,452 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 465,471 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 461,467 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 480,486 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_SUB",		/* name */
  	 TRUE,			/* partial_inplace */
  	 MINUS_ONE,		/* src_mask */
--- 476,482 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_SUB",		/* name */
  	 TRUE,			/* partial_inplace */
  	 MINUS_ONE,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 496,502 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_INSERT_A",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 492,498 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_INSERT_A",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 513,519 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_INSERT_B",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 509,515 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_INSERT_B",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 529,535 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_DELETE",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 525,531 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_DELETE",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 553,559 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 549,555 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 568,574 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 564,570 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 583,589 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_SCN_DISP",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 579,585 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_SCN_DISP",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 597,603 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_REL16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffff,		/* src_mask */
--- 593,599 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_REL16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 617,623 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_RELGOT",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 613,619 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_RELGOT",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 633,639 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_JALR",	        /* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 629,635 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_JALR",	        /* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 653,659 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_NONE",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 649,655 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_NONE",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 668,674 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 664,670 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 683,689 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_32",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 679,685 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_32",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 698,704 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_REL32",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 694,700 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_REL32",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 716,722 ****
  				/* This needs complex overflow
  				   detection, because the upper 36
  				   bits must match the PC + 4.  */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_26",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 712,718 ----
  				/* This needs complex overflow
  				   detection, because the upper 36
  				   bits must match the PC + 4.  */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_26",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 731,737 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_HI16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 727,733 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_HI16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 746,752 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_LO16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 742,748 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_LO16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 791,797 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf64_got16_reloc, /* special_function */
  	 "R_MIPS_GOT16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 787,793 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 806,812 ****
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_PC16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 802,808 ----
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_PC16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 821,827 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 817,823 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 855,861 ****
  	 FALSE,			/* pc_relative */
  	 6,			/* bitpos */
  	 complain_overflow_bitfield, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_SHIFT5",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 851,857 ----
  	 FALSE,			/* pc_relative */
  	 6,			/* bitpos */
  	 complain_overflow_bitfield, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_SHIFT5",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 885,891 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_64",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 881,887 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_64",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 900,906 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_DISP",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 896,902 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_DISP",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 915,921 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_PAGE",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 911,917 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_PAGE",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 930,936 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_OFST",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 926,932 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_OFST",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 945,951 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_HI16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 941,947 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_HI16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 960,966 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_LO16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 956,962 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GOT_LO16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 975,981 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_SUB",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 971,977 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_SUB",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 991,997 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_INSERT_A",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 987,993 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_INSERT_A",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 1008,1014 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_INSERT_B",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1004,1010 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_INSERT_B",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 1024,1030 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_DELETE",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1020,1026 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_DELETE",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 1039,1045 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HIGHER",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1035,1041 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HIGHER",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 1054,1060 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HIGHEST",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1050,1056 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HIGHEST",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 1069,1075 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL_HI16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1065,1071 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL_HI16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 1084,1090 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL_LO16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1080,1086 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_CALL_LO16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 1099,1105 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_SCN_DISP",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1095,1101 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_SCN_DISP",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 1113,1119 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_REL16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1109,1115 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_REL16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 1133,1139 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_RELGOT",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1129,1135 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_RELGOT",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type mips_elf64_howto
*** 1149,1155 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_JALR",	        /* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1145,1151 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_JALR",	        /* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_gnu_rel
*** 1233,1239 ****
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GNU_REL16_S2",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 1229,1235 ----
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GNU_REL16_S2",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_gnu_rel
*** 1249,1255 ****
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 bfd_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GNU_REL16_S2",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1245,1251 ----
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc,	/* special_function */
  	 "R_MIPS_GNU_REL16_S2",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** mips_elf64_be_swap_reloca_out (bfd *abfd
*** 1411,1476 ****
  			      (Elf64_Mips_External_Rela *) dst);
  }
  
- /* Do a R_MIPS_HI16 relocation.  */
- 
- static bfd_reloc_status_type
- mips_elf64_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
- 		       asymbol *symbol, void *data ATTRIBUTE_UNUSED,
- 		       asection *input_section, bfd *output_bfd,
- 		       char **error_message ATTRIBUTE_UNUSED)
- {
-   /* If we're relocating, and this is an external symbol, we don't
-      want to change anything.  */
-   if (output_bfd != NULL
-       && (symbol->flags & BSF_SECTION_SYM) == 0
-       && (symbol->flags & BSF_LOCAL) != 0)
-     {
-       reloc_entry->address += input_section->output_offset;
-       return bfd_reloc_ok;
-     }
- 
-   if (reloc_entry->howto->partial_inplace)
-     {
-       if (((reloc_entry->addend & 0xffff) + 0x8000) & ~0xffff)
- 	reloc_entry->addend += 0x8000;
-     }
- 
-   return bfd_reloc_continue;
- }
- 
- /* Do a R_MIPS_GOT16 reloc.  This is a reloc against the global offset
-    table used for PIC code.  If the symbol is an external symbol, the
-    instruction is modified to contain the offset of the appropriate
-    entry in the global offset table.  If the symbol is a section
-    symbol, the next reloc is a R_MIPS_LO16 reloc.  The two 16 bit
-    addends are combined to form the real addend against the section
-    symbol; the GOT16 is modified to contain the offset of an entry in
-    the global offset table, and the LO16 is modified to offset it
-    appropriately.  Thus an offset larger than 16 bits requires a
-    modified value in the global offset table.
- 
-    This implementation suffices for the assembler, but the linker does
-    not yet know how to create global offset tables.  */
- 
- static bfd_reloc_status_type
- mips_elf64_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- 			void *data, asection *input_section, bfd *output_bfd,
- 			char **error_message)
- {
-   /* If we're relocating, and this is a local symbol, we can handle it
-      just like an R_MIPS_HI16.  */
-   if (output_bfd != NULL
-       && ((symbol->flags & BSF_SECTION_SYM) != 0
- 	  || (symbol->flags & BSF_LOCAL) == 0))
-     return mips_elf64_hi16_reloc (abfd, reloc_entry, symbol, data,
- 				  input_section, output_bfd, error_message);
- 
- 
-   /* Otherwise we try to handle it as R_MIPS_GOT_DISP.  */
-   return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- 				input_section, output_bfd, error_message);
- }
- 
  /* Set the GP value for OUTPUT_BFD.  Returns FALSE if this is a
     dangerous relocation.  */
  
--- 1407,1412 ----
*************** mips_elf64_gprel32_reloc (bfd *abfd, are
*** 1716,1743 ****
     the rest is at bits 6-10. The bitpos already got right by the howto.  */
  
  static bfd_reloc_status_type
! mips_elf64_shift6_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
! 			 asymbol *symbol, void *data ATTRIBUTE_UNUSED,
! 			 asection *input_section, bfd *output_bfd,
! 			 char **error_message ATTRIBUTE_UNUSED)
  {
-   /* If we're relocating, and this is an external symbol, we don't
-      want to change anything.  */
-   if (output_bfd != NULL
-       && (symbol->flags & BSF_SECTION_SYM) == 0
-       && (symbol->flags & BSF_LOCAL) != 0)
-     {
-       reloc_entry->address += input_section->output_offset;
-       return bfd_reloc_ok;
-     }
- 
    if (reloc_entry->howto->partial_inplace)
      {
        reloc_entry->addend = ((reloc_entry->addend & 0x00007c0)
  			     | (reloc_entry->addend & 0x00000800) >> 9);
      }
  
!   return bfd_reloc_continue;
  }
  
  /* Handle a mips16 jump.  */
--- 1652,1670 ----
     the rest is at bits 6-10. The bitpos already got right by the howto.  */
  
  static bfd_reloc_status_type
! mips_elf64_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
! 			 void *data, asection *input_section, bfd *output_bfd,
! 			 char **error_message)
  {
    if (reloc_entry->howto->partial_inplace)
      {
        reloc_entry->addend = ((reloc_entry->addend & 0x00007c0)
  			     | (reloc_entry->addend & 0x00000800) >> 9);
      }
  
!   return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
! 				      input_section, output_bfd,
! 				      error_message);
  }
  
  /* Handle a mips16 jump.  */
Index: bfd/elfn32-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfn32-mips.c,v
retrieving revision 1.16
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.16 elfn32-mips.c
*** bfd/elfn32-mips.c	7 Dec 2003 21:24:28 -0000	1.16
--- bfd/elfn32-mips.c	14 Dec 2003 15:27:20 -0000
*************** Foundation, Inc., 59 Temple Place - Suit
*** 47,60 ****
  #define ECOFF_SIGNED_32
  #include "ecoffswap.h"
  
- static bfd_reloc_status_type mips_elf_generic_reloc
-   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
- static bfd_reloc_status_type mips_elf_hi16_reloc
-   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
- static bfd_reloc_status_type mips_elf_lo16_reloc
-   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
- static bfd_reloc_status_type mips_elf_got16_reloc
-   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
  static bfd_boolean mips_elf_assign_gp
    (bfd *, bfd_vma *);
  static bfd_reloc_status_type mips_elf_final_gp
--- 47,52 ----
*************** static irix_compat_t elf_n32_mips_irix_c
*** 95,104 ****
  extern const bfd_target bfd_elf32_nbigmips_vec;
  extern const bfd_target bfd_elf32_nlittlemips_vec;
  
- static asection *prev_reloc_section = NULL;
- static bfd_vma prev_reloc_address = -1;
- static bfd_vma prev_reloc_addend = 0;
- 
  /* Nonzero if ABFD is using the N32 ABI.  */
  #define ABI_N32_P(abfd) \
    ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
--- 87,92 ----
*************** static reloc_howto_type elf_mips_howto_t
*** 126,132 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_NONE",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 114,120 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_NONE",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 141,147 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 129,135 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 156,162 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_32",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 144,150 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_32",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 171,177 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_REL32",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 159,165 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_REL32",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 189,195 ****
  	 			/* This needs complex overflow
  				   detection, because the upper four
  				   bits must match the PC + 4.  */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_26",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x03ffffff,		/* src_mask */
--- 177,183 ----
  	 			/* This needs complex overflow
  				   detection, because the upper four
  				   bits must match the PC + 4.  */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_26",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x03ffffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 201,213 ****
  
    /* High 16 bits of symbol value.  */
    HOWTO (R_MIPS_HI16,		/* type */
! 	 0,			/* rightshift */
  	 2,			/* size (0 = byte, 1 = short, 2 = long) */
  	 16,			/* bitsize */
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_hi16_reloc,	/* special_function */
  	 "R_MIPS_HI16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 189,201 ----
  
    /* High 16 bits of symbol value.  */
    HOWTO (R_MIPS_HI16,		/* type */
! 	 16,			/* rightshift */
  	 2,			/* size (0 = byte, 1 = short, 2 = long) */
  	 16,			/* bitsize */
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_hi16_reloc, /* special_function */
  	 "R_MIPS_HI16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 222,228 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_lo16_reloc,	/* special_function */
  	 "R_MIPS_LO16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 210,216 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_lo16_reloc, /* special_function */
  	 "R_MIPS_LO16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 267,273 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_got16_reloc,	/* special_function */
  	 "R_MIPS_GOT16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 255,261 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_got16_reloc, /* special_function */
  	 "R_MIPS_GOT16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 282,288 ****
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_PC16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 270,276 ----
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_PC16",		/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 297,303 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 285,291 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 333,339 ****
  	 FALSE,			/* pc_relative */
  	 6,			/* bitpos */
  	 complain_overflow_bitfield, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SHIFT5",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x000007c0,		/* src_mask */
--- 321,327 ----
  	 FALSE,			/* pc_relative */
  	 6,			/* bitpos */
  	 complain_overflow_bitfield, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SHIFT5",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x000007c0,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 363,369 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_64",		/* name */
  	 TRUE,			/* partial_inplace */
  	 MINUS_ONE,		/* src_mask */
--- 351,357 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_64",		/* name */
  	 TRUE,			/* partial_inplace */
  	 MINUS_ONE,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 378,384 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_DISP",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 366,372 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_DISP",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 393,399 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_PAGE",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 381,387 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_PAGE",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 408,414 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_OFST",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 396,402 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_OFST",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 423,429 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 411,417 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 438,444 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 426,432 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 453,459 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SUB",		/* name */
  	 TRUE,			/* partial_inplace */
  	 MINUS_ONE,		/* src_mask */
--- 441,447 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SUB",		/* name */
  	 TRUE,			/* partial_inplace */
  	 MINUS_ONE,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 469,475 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_INSERT_A",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 457,463 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_INSERT_A",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 486,492 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_INSERT_B",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 474,480 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_INSERT_B",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 502,508 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_DELETE",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 490,496 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_DELETE",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 526,532 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 514,520 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL_HI16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 541,547 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 529,535 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL_LO16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 556,562 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SCN_DISP",     /* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 544,550 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SCN_DISP",     /* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 570,576 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_REL16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffff,		/* src_mask */
--- 558,564 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_REL16",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 590,596 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_RELGOT",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
--- 578,584 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_RELGOT",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0xffffffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 606,612 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_JALR",	        /* name */
  	 FALSE,			/* partial_inplace */
  	 0x00000000,		/* src_mask */
--- 594,600 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_JALR",	        /* name */
  	 FALSE,			/* partial_inplace */
  	 0x00000000,		/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 626,632 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_NONE",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 614,620 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_NONE",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 641,647 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 629,635 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 656,662 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_32",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 644,650 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_32",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 671,677 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_REL32",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 659,665 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_REL32",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 689,695 ****
  				/* This needs complex overflow
  				   detection, because the upper 36
  				   bits must match the PC + 4.  */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_26",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 677,683 ----
  				/* This needs complex overflow
  				   detection, because the upper 36
  				   bits must match the PC + 4.  */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_26",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 704,710 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HI16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 692,698 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HI16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 719,725 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_LO16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 707,713 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_LO16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 764,770 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_got16_reloc,	/* special_function */
  	 "R_MIPS_GOT16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 752,758 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 779,785 ****
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_PC16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 767,773 ----
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_PC16",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 794,800 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 782,788 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 828,834 ****
  	 FALSE,			/* pc_relative */
  	 6,			/* bitpos */
  	 complain_overflow_bitfield, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SHIFT5",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 816,822 ----
  	 FALSE,			/* pc_relative */
  	 6,			/* bitpos */
  	 complain_overflow_bitfield, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SHIFT5",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 858,864 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_64",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 846,852 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_64",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 873,879 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_DISP",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 861,867 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_DISP",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 888,894 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_PAGE",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 876,882 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_PAGE",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 903,909 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_OFST",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 891,897 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_OFST",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 918,924 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_HI16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 906,912 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_HI16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 933,939 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_LO16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 921,927 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GOT_LO16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 948,954 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SUB",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 936,942 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SUB",		/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 964,970 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_INSERT_A",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 952,958 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_INSERT_A",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 981,987 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_INSERT_B",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 969,975 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_INSERT_B",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 997,1003 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_DELETE",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 985,991 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_DELETE",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 1012,1018 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HIGHER",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1000,1006 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HIGHER",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 1027,1033 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HIGHEST",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1015,1021 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_HIGHEST",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 1042,1048 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL_HI16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1030,1036 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL_HI16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 1057,1063 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL_LO16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1045,1051 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_CALL_LO16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 1072,1078 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SCN_DISP",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1060,1066 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_SCN_DISP",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 1087,1093 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_REL16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1075,1081 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_REL16",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 1107,1113 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_RELGOT",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1095,1101 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_RELGOT",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_howto_t
*** 1123,1129 ****
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_JALR",	        /* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
--- 1111,1117 ----
  	 FALSE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_dont, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_JALR",	        /* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
*************** static reloc_howto_type elf_mips_gnu_rel
*** 1207,1213 ****
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GNU_REL16_S2",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
--- 1195,1201 ----
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GNU_REL16_S2",	/* name */
  	 TRUE,			/* partial_inplace */
  	 0x0000ffff,		/* src_mask */
*************** static reloc_howto_type elf_mips_gnu_rel
*** 1223,1446 ****
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GNU_REL16_S2",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
  	 0x0000ffff,		/* dst_mask */
  	 TRUE);			/* pcrel_offset */
  
- /* This is derived from bfd_elf_generic_reloc.  NewABI allows us to have
-    several relocations against the same address.  The addend is derived
-    from the addends of preceding relocations.  If we don't need to
-    do something special,  we simply keep track of the addend.  */
- 
- #define GET_RELOC_ADDEND(obfd, sym, entry, sec)				\
- {									\
-   /* If we're relocating, and this is an external symbol, we don't	\
-      want to change anything.  */					\
-     if ((obfd) != NULL							\
- 	&& ((sym)->flags & BSF_SECTION_SYM) == 0			\
- 	&& (! (entry)->howto->partial_inplace				\
- 	    || (entry)->addend == 0))					\
-       {									\
-         (entry)->address += (sec)->output_offset;			\
-         return bfd_reloc_ok;						\
-       }									\
- 									\
-     /* The addend of combined relocs is remembered and left for		\
-        subsequent relocs.  */						\
-     if (prev_reloc_address != (entry)->address				\
- 	|| prev_reloc_section != (sec))					\
-       {									\
- 	prev_reloc_section = (sec);					\
-         prev_reloc_address = (entry)->address;				\
-         prev_reloc_addend = (entry)->addend;				\
-       }									\
-     else								\
-       (entry)->addend = prev_reloc_addend;				\
- }
- 
- #define SET_RELOC_ADDEND(entry)						\
- {									\
-   prev_reloc_addend = (entry)->addend;					\
- }
- 
- static bfd_reloc_status_type
- mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
- 			asymbol *symbol, void *data ATTRIBUTE_UNUSED,
- 			asection *input_section, bfd *output_bfd,
- 			char **error_message ATTRIBUTE_UNUSED)
- {
-   GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
- 
-   return bfd_reloc_continue;
- }
- 
- /* Do a R_MIPS_HI16 relocation.  This has to be done in combination
-    with a R_MIPS_LO16 reloc, because there is a carry from the LO16 to
-    the HI16.  Here we just save the information we need; we do the
-    actual relocation when we see the LO16.
- 
-    MIPS ELF requires that the LO16 immediately follow the HI16.  As a
-    GNU extension, for non-pc-relative relocations, we permit an
-    arbitrary number of HI16 relocs to be associated with a single LO16
-    reloc.  This extension permits gcc to output the HI and LO relocs
-    itself.
- 
-    This cannot be done for PC-relative relocations because both the HI16
-    and LO16 parts of the relocations must be done relative to the LO16
-    part, and there can be carry to or borrow from the HI16 part.  */
- 
- struct mips_hi16
- {
-   struct mips_hi16 *next;
-   bfd_byte *addr;
-   bfd_vma addend;
- };
- 
- /* FIXME: This should not be a static variable.  */
- 
- static struct mips_hi16 *mips_hi16_list;
- 
- static bfd_reloc_status_type
- mips_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
- 		     asymbol *symbol, void *data, asection *input_section,
- 		     bfd *output_bfd, char **error_message ATTRIBUTE_UNUSED)
- {
-   bfd_reloc_status_type ret;
-   bfd_vma relocation;
-   struct mips_hi16 *n;
- 
-   GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
- 
-   ret = bfd_reloc_ok;
- 
-   if (bfd_is_und_section (symbol->section) && output_bfd == NULL)
-     ret = bfd_reloc_undefined;
- 
-   if (bfd_is_com_section (symbol->section))
-     relocation = 0;
-   else
-     relocation = symbol->value;
- 
-   relocation += symbol->section->output_section->vma;
-   relocation += symbol->section->output_offset;
-   relocation += reloc_entry->addend;
- 
-   if (reloc_entry->address > input_section->_cooked_size)
-     return bfd_reloc_outofrange;
- 
-   /* Save the information, and let LO16 do the actual relocation.  */
-   n = bfd_malloc (sizeof *n);
-   if (n == NULL)
-     return bfd_reloc_outofrange;
-   n->addr = (bfd_byte *) data + reloc_entry->address;
-   n->addend = relocation;
-   n->next = mips_hi16_list;
-   mips_hi16_list = n;
- 
-   if (output_bfd != NULL)
-     reloc_entry->address += input_section->output_offset;
- 
-   return ret;
- }
- 
- /* Do a R_MIPS_LO16 relocation.  This is a straightforward 16 bit
-    inplace relocation; this function exists in order to do the
-    R_MIPS_HI16 relocation described above.  */
- 
- static bfd_reloc_status_type
- mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- 		     void *data, asection *input_section, bfd *output_bfd,
- 		     char **error_message)
- {
-   if (mips_hi16_list != NULL)
-     {
-       struct mips_hi16 *l;
- 
-       l = mips_hi16_list;
-       while (l != NULL)
- 	{
- 	  unsigned long insn;
- 	  unsigned long val;
- 	  unsigned long vallo;
- 	  struct mips_hi16 *next;
- 
- 	  /* Do the HI16 relocation.  Note that we actually don't need
- 	     to know anything about the LO16 itself, except where to
- 	     find the low 16 bits of the addend needed by the LO16.  */
- 	  insn = bfd_get_32 (abfd, l->addr);
- 	  vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
- 
- 	  /* The low order 16 bits are always treated as a signed
- 	     value.  */
- 	  vallo = ((vallo & 0xffff) ^ 0x8000) - 0x8000;
- 	  val = ((insn & 0xffff) << 16) + vallo;
- 	  val += l->addend;
- 
- 	  /* If PC-relative, we need to subtract out the address of the LO
- 	     half of the HI/LO.  (The actual relocation is relative
- 	     to that instruction.)  */
- 	  if (reloc_entry->howto->pc_relative)
- 	    val -= reloc_entry->address;
- 
- 	  /* At this point, "val" has the value of the combined HI/LO
- 	     pair.  If the low order 16 bits (which will be used for
- 	     the LO16 insn) are negative, then we will need an
- 	     adjustment for the high order 16 bits.  */
- 	  val += 0x8000;
- 	  val = (val >> 16) & 0xffff;
- 
- 	  insn &= ~ (bfd_vma) 0xffff;
- 	  insn |= val;
- 	  bfd_put_32 (abfd, insn, l->addr);
- 
- 	  next = l->next;
- 	  free (l);
- 	  l = next;
- 	}
- 
-       mips_hi16_list = NULL;
-     }
- 
-   /* Now do the LO16 reloc in the usual way.  */
-   return mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- 				 input_section, output_bfd, error_message);
- }
- 
- /* Do a R_MIPS_GOT16 reloc.  This is a reloc against the global offset
-    table used for PIC code.  If the symbol is an external symbol, the
-    instruction is modified to contain the offset of the appropriate
-    entry in the global offset table.  If the symbol is a section
-    symbol, the next reloc is a R_MIPS_LO16 reloc.  The two 16 bit
-    addends are combined to form the real addend against the section
-    symbol; the GOT16 is modified to contain the offset of an entry in
-    the global offset table, and the LO16 is modified to offset it
-    appropriately.  Thus an offset larger than 16 bits requires a
-    modified value in the global offset table.
- 
-    This implementation suffices for the assembler, but the linker does
-    not yet know how to create global offset tables.  */
- 
- static bfd_reloc_status_type
- mips_elf_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
- 		      void *data, asection *input_section, bfd *output_bfd,
- 		      char **error_message)
- {
-   /* If we're relocating, and this is a local symbol, we can handle it
-      just like an R_MIPS_HI16.  */
-   if (output_bfd != NULL
-       && ((symbol->flags & BSF_SECTION_SYM) != 0
- 	  || (symbol->flags & BSF_LOCAL) == 0))
-     return mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data,
- 				input_section, output_bfd, error_message);
- 
-   /* Otherwise we try to handle it as R_MIPS_GOT_DISP.  */
-   return mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
- 				 input_section, output_bfd, error_message);
- }
- 
  /* Set the GP value for OUTPUT_BFD.  Returns FALSE if this is a
     dangerous relocation.  */
  
--- 1211,1223 ----
  	 TRUE,			/* pc_relative */
  	 0,			/* bitpos */
  	 complain_overflow_signed, /* complain_on_overflow */
! 	 _bfd_mips_elf_generic_reloc, /* special_function */
  	 "R_MIPS_GNU_REL16_S2",	/* name */
  	 FALSE,			/* partial_inplace */
  	 0,			/* src_mask */
  	 0x0000ffff,		/* dst_mask */
  	 TRUE);			/* pcrel_offset */
  
  /* Set the GP value for OUTPUT_BFD.  Returns FALSE if this is a
     dangerous relocation.  */
  
*************** mips_elf_gprel16_reloc (bfd *abfd ATTRIB
*** 1542,1549 ****
    bfd_reloc_status_type ret;
    bfd_vma gp;
  
-   GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
- 
    if (output_bfd != NULL)
      relocatable = TRUE;
    else
--- 1319,1324 ----
*************** mips_elf_literal_reloc (bfd *abfd, arele
*** 1573,1580 ****
    bfd_reloc_status_type ret;
    bfd_vma gp;
  
-   GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
- 
    /* FIXME: The entries in the .lit8 and .lit4 sections should be merged.  */
    if (output_bfd != NULL)
      relocatable = TRUE;
--- 1348,1353 ----
*************** mips_elf_gprel32_reloc (bfd *abfd, arele
*** 1606,1613 ****
    bfd_reloc_status_type ret;
    bfd_vma gp;
  
-   GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
- 
    /* R_MIPS_GPREL32 relocations are defined for local symbols only.  */
    if (output_bfd != NULL
        && (symbol->flags & BSF_SECTION_SYM) == 0
--- 1379,1384 ----
*************** gprel32_with_gp (bfd *abfd, asymbol *sym
*** 1684,1719 ****
     the rest is at bits 6-10. The bitpos already got right by the howto.  */
  
  static bfd_reloc_status_type
! mips_elf_shift6_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
! 		       asymbol *symbol, void *data ATTRIBUTE_UNUSED,
! 		       asection *input_section, bfd *output_bfd,
! 		       char **error_message ATTRIBUTE_UNUSED)
  {
-   GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
- 
    if (reloc_entry->howto->partial_inplace)
      {
        reloc_entry->addend = ((reloc_entry->addend & 0x00007c0)
  			     | (reloc_entry->addend & 0x00000800) >> 9);
      }
  
!   SET_RELOC_ADDEND (reloc_entry)
! 
!   return bfd_reloc_continue;
  }
  
  /* Handle a mips16 jump.  */
  
  static bfd_reloc_status_type
! mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
! 		   asymbol *symbol, void *data ATTRIBUTE_UNUSED,
! 		   asection *input_section, bfd *output_bfd,
  		   char **error_message ATTRIBUTE_UNUSED)
  {
    static bfd_boolean warned = FALSE;
  
-   GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
- 
    /* FIXME.  */
    if (! warned)
      (*_bfd_error_handler)
--- 1455,1487 ----
     the rest is at bits 6-10. The bitpos already got right by the howto.  */
  
  static bfd_reloc_status_type
! mips_elf_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
! 		       void *data, asection *input_section, bfd *output_bfd,
! 		       char **error_message)
  {
    if (reloc_entry->howto->partial_inplace)
      {
        reloc_entry->addend = ((reloc_entry->addend & 0x00007c0)
  			     | (reloc_entry->addend & 0x00000800) >> 9);
      }
  
!   return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
! 				      input_section, output_bfd,
! 				      error_message);
  }
  
  /* Handle a mips16 jump.  */
  
  static bfd_reloc_status_type
! mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED,
! 		   arelent *reloc_entry ATTRIBUTE_UNUSED,
! 		   asymbol *symbol ATTRIBUTE_UNUSED,
! 		   void *data ATTRIBUTE_UNUSED,
! 		   asection *input_section, bfd *output_bfd ATTRIBUTE_UNUSED,
  		   char **error_message ATTRIBUTE_UNUSED)
  {
    static bfd_boolean warned = FALSE;
  
    /* FIXME.  */
    if (! warned)
      (*_bfd_error_handler)
*************** mips16_gprel_reloc (bfd *abfd, arelent *
*** 1739,1746 ****
    bfd_signed_vma val;
    bfd_vma relocation;
  
-   GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
- 
    if (output_bfd != NULL)
      relocatable = TRUE;
    else
--- 1507,1512 ----
*************** mips16_gprel_reloc (bfd *abfd, arelent *
*** 1804,1812 ****
  
    return bfd_reloc_ok;
  }
- 
- #undef GET_RELOC_ADDEND
- #undef SET_RELOC_ADDEND
  
  /* A mapping from BFD reloc types to MIPS ELF reloc types.  */
  
--- 1570,1575 ----
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.87
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.87 elfxx-mips.c
*** bfd/elfxx-mips.c	8 Dec 2003 20:04:34 -0000	1.87
--- bfd/elfxx-mips.c	14 Dec 2003 15:27:22 -0000
*************** _bfd_mips_elf_gprel16_with_gp (bfd *abfd
*** 1082,1089 ****
  			       bfd_boolean relocatable, void *data, bfd_vma gp)
  {
    bfd_vma relocation;
-   unsigned long insn = 0;
    bfd_signed_vma val;
  
    if (bfd_is_com_section (symbol->section))
      relocation = 0;
--- 1082,1089 ----
  			       bfd_boolean relocatable, void *data, bfd_vma gp)
  {
    bfd_vma relocation;
    bfd_signed_vma val;
+   bfd_reloc_status_type status;
  
    if (bfd_is_com_section (symbol->section))
      relocation = 0;
*************** _bfd_mips_elf_gprel16_with_gp (bfd *abfd
*** 1099,1111 ****
    /* Set val to the offset into the section or symbol.  */
    val = reloc_entry->addend;
  
!   if (reloc_entry->howto->partial_inplace)
!     {
!       insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
!       val += insn & 0xffff;
!     }
! 
!   _bfd_mips_elf_sign_extend(val, 16);
  
    /* Adjust val for the final section location and GP value.  If we
       are producing relocatable output, we don't want to do this for
--- 1099,1105 ----
    /* Set val to the offset into the section or symbol.  */
    val = reloc_entry->addend;
  
!   _bfd_mips_elf_sign_extend (val, 16);
  
    /* Adjust val for the final section location and GP value.  If we
       are producing relocatable output, we don't want to do this for
*************** _bfd_mips_elf_gprel16_with_gp (bfd *abfd
*** 1116,1131 ****
  
    if (reloc_entry->howto->partial_inplace)
      {
!       insn = (insn & ~0xffff) | (val & 0xffff);
!       bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
      }
    else
      reloc_entry->addend = val;
  
    if (relocatable)
      reloc_entry->address += input_section->output_offset;
!   else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0))
!     return bfd_reloc_overflow;
  
    return bfd_reloc_ok;
  }
--- 1110,1324 ----
  
    if (reloc_entry->howto->partial_inplace)
      {
!       status = _bfd_relocate_contents (reloc_entry->howto, abfd, val,
! 				       (bfd_byte *) data
! 				       + reloc_entry->address);
!       if (status != bfd_reloc_ok)
! 	return status;
      }
    else
      reloc_entry->addend = val;
  
    if (relocatable)
      reloc_entry->address += input_section->output_offset;
! 
!   return bfd_reloc_ok;
! }
! 
! /* Used to store a REL high-part relocation such as R_MIPS_HI16 or
!    R_MIPS_GOT16.  REL is the relocation, INPUT_SECTION is the section
!    that contains the relocation field and DATA points to the start of
!    INPUT_SECTION.  */
! 
! struct mips_hi16
! {
!   struct mips_hi16 *next;
!   bfd_byte *data;
!   asection *input_section;
!   arelent rel;
! };
! 
! /* FIXME: This should not be a static variable.  */
! 
! static struct mips_hi16 *mips_hi16_list;
! 
! /* A howto special_function for REL *HI16 relocations.  We can only
!    calculate the correct value once we've seen the partnering
!    *LO16 relocation, so just save the information for later.
! 
!    The ABI requires that the *LO16 immediately follow the *HI16.
!    However, as a GNU extension, we permit an arbitrary number of
!    *HI16s to be associated with a single *LO16.  This significantly
!    simplies the relocation handling in gcc.  */
! 
! bfd_reloc_status_type
! _bfd_mips_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
! 			  asymbol *symbol ATTRIBUTE_UNUSED, void *data,
! 			  asection *input_section, bfd *output_bfd,
! 			  char **error_message ATTRIBUTE_UNUSED)
! {
!   struct mips_hi16 *n;
! 
!   if (reloc_entry->address > input_section->_cooked_size)
!     return bfd_reloc_outofrange;
! 
!   n = bfd_malloc (sizeof *n);
!   if (n == NULL)
!     return bfd_reloc_outofrange;
! 
!   n->next = mips_hi16_list;
!   n->data = data;
!   n->input_section = input_section;
!   n->rel = *reloc_entry;
!   mips_hi16_list = n;
! 
!   if (output_bfd != NULL)
!     reloc_entry->address += input_section->output_offset;
! 
!   return bfd_reloc_ok;
! }
! 
! /* A howto special_function for REL R_MIPS_GOT16 relocations.  This is just
!    like any other 16-bit relocation when applied to global symbols, but is
!    treated in the same as R_MIPS_HI16 when applied to local symbols.  */
! 
! bfd_reloc_status_type
! _bfd_mips_elf_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
! 			   void *data, asection *input_section,
! 			   bfd *output_bfd, char **error_message)
! {
!   if ((symbol->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
!       || bfd_is_und_section (bfd_get_section (symbol))
!       || bfd_is_com_section (bfd_get_section (symbol)))
!     /* The relocation is against a global symbol.  */
!     return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
! 					input_section, output_bfd,
! 					error_message);
! 
!   return _bfd_mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data,
! 				   input_section, output_bfd, error_message);
! }
! 
! /* A howto special_function for REL *LO16 relocations.  The *LO16 itself
!    is a straightforward 16 bit inplace relocation, but we must deal with
!    any partnering high-part relocations as well.  */
! 
! bfd_reloc_status_type
! _bfd_mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
! 			  void *data, asection *input_section,
! 			  bfd *output_bfd, char **error_message)
! {
!   bfd_vma vallo;
! 
!   if (reloc_entry->address > input_section->_cooked_size)
!     return bfd_reloc_outofrange;
! 
!   vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
!   while (mips_hi16_list != NULL)
!     {
!       bfd_reloc_status_type ret;
!       struct mips_hi16 *hi;
! 
!       hi = mips_hi16_list;
! 
!       /* R_MIPS_GOT16 relocations are something of a special case.  We
! 	 want to install the addend in the same way as for a R_MIPS_HI16
! 	 relocation (with a rightshift of 16).  However, since GOT16
! 	 relocations can also be used with global symbols, their howto
! 	 has a rightshift of 0.  */
!       if (hi->rel.howto->type == R_MIPS_GOT16)
! 	hi->rel.howto = MIPS_ELF_RTYPE_TO_HOWTO (abfd, R_MIPS_HI16, FALSE);
! 
!       /* VALLO is a signed 16-bit number.  Bias it by 0x8000 so that any
! 	 carry or borrow will induce a change of +1 or -1 in the high part.  */
!       hi->rel.addend += (vallo + 0x8000) & 0xffff;
! 
!       /* R_MIPS_GNU_REL_HI16 relocations are relative to the address of the
! 	 lo16 relocation, not their own address.  If we're calculating the
! 	 final value, and hence subtracting the "PC", subtract the offset
! 	 of the lo16 relocation from here.  */
!       if (output_bfd == NULL && hi->rel.howto->type == R_MIPS_GNU_REL_HI16)
! 	hi->rel.addend -= reloc_entry->address - hi->rel.address;
! 
!       ret = _bfd_mips_elf_generic_reloc (abfd, &hi->rel, symbol, hi->data,
! 					 hi->input_section, output_bfd,
! 					 error_message);
!       if (ret != bfd_reloc_ok)
! 	return ret;
! 
!       mips_hi16_list = hi->next;
!       free (hi);
!     }
! 
!   return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
! 				      input_section, output_bfd,
! 				      error_message);
! }
! 
! /* A generic howto special_function.  This calculates and installs the
!    relocation itself, thus avoiding the oft-discussed problems in
!    bfd_perform_relocation and bfd_install_relocation.  */
! 
! bfd_reloc_status_type
! _bfd_mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
! 			     asymbol *symbol, void *data ATTRIBUTE_UNUSED,
! 			     asection *input_section, bfd *output_bfd,
! 			     char **error_message ATTRIBUTE_UNUSED)
! {
!   bfd_signed_vma val;
!   bfd_reloc_status_type status;
!   bfd_boolean relocatable;
! 
!   relocatable = (output_bfd != NULL);
! 
!   if (reloc_entry->address > input_section->_cooked_size)
!     return bfd_reloc_outofrange;
! 
!   /* Build up the field adjustment in VAL.  */
!   val = 0;
!   if (!relocatable || (symbol->flags & BSF_SECTION_SYM) != 0)
!     {
!       /* Either we're calculating the final field value or we have a
! 	 relocation against a section symbol.  Add in the section's
! 	 offset or address.  */
!       val += symbol->section->output_section->vma;
!       val += symbol->section->output_offset;
!     }
! 
!   if (!relocatable)
!     {
!       /* We're calculating the final field value.  Add in the symbol's value
! 	 and, if pc-relative, subtract the address of the field itself.  */
!       val += symbol->value;
!       if (reloc_entry->howto->pc_relative)
! 	{
! 	  val -= input_section->output_section->vma;
! 	  val -= input_section->output_offset;
! 	  val -= reloc_entry->address;
! 	}
!     }
! 
!   /* VAL is now the final adjustment.  If we're keeping this relocation
!      in the output file, and if the relocation uses a separate addend,
!      we just need to add VAL to that addend.  Otherwise we need to add
!      VAL to the relocation field itself.  */
!   if (relocatable && !reloc_entry->howto->partial_inplace)
!     reloc_entry->addend += val;
!   else
!     {
!       /* Add in the separate addend, if any.  */
!       val += reloc_entry->addend;
! 
!       /* Add VAL to the relocation field.  */
!       status = _bfd_relocate_contents (reloc_entry->howto, abfd, val,
! 				       (bfd_byte *) data
! 				       + reloc_entry->address);
!       if (status != bfd_reloc_ok)
! 	return status;
!     }
! 
!   if (relocatable)
!     reloc_entry->address += input_section->output_offset;
  
    return bfd_reloc_ok;
  }
*************** mips_elf_calculate_relocation (bfd *abfd
*** 3203,3209 ****
        break;
  
      case R_MIPS_GNU_REL16_S2:
!       value = symbol + _bfd_mips_elf_sign_extend (addend << 2, 18) - p;
        overflowed_p = mips_elf_overflow_p (value, 18);
        value = (value >> 2) & howto->dst_mask;
        break;
--- 3396,3402 ----
        break;
  
      case R_MIPS_GNU_REL16_S2:
!       value = symbol + _bfd_mips_elf_sign_extend (addend, 18) - p;
        overflowed_p = mips_elf_overflow_p (value, 18);
        value = (value >> 2) & howto->dst_mask;
        break;
*************** mips_elf_calculate_relocation (bfd *abfd
*** 3226,3234 ****
  	 R_MIPS_26 case here.  */
      case R_MIPS_26:
        if (local_p)
! 	value = (((addend << 2) | ((p + 4) & 0xf0000000)) + symbol) >> 2;
        else
! 	value = (_bfd_mips_elf_sign_extend (addend << 2, 28) + symbol) >> 2;
        value &= howto->dst_mask;
        break;
  
--- 3419,3427 ----
  	 R_MIPS_26 case here.  */
      case R_MIPS_26:
        if (local_p)
! 	value = ((addend | ((p + 4) & 0xf0000000)) + symbol) >> 2;
        else
! 	value = (_bfd_mips_elf_sign_extend (addend, 28) + symbol) >> 2;
        value &= howto->dst_mask;
        break;
  
*************** _bfd_mips_elf_relocate_section (bfd *out
*** 6067,6073 ****
  	      addend = mips_elf_obtain_contents (howto, rel, input_bfd,
  						 contents);
  	      addend &= howto->src_mask;
- 	      addend <<= howto->rightshift;
  
  	      /* For some kinds of relocations, the ADDEND is a
  		 combination of the addend stored in two different
--- 6260,6265 ----
*************** _bfd_mips_elf_relocate_section (bfd *out
*** 6131,6136 ****
--- 6323,6330 ----
  			    | ((addend & 0x7e00000) >> 16)
  			    | (addend & 0x1f));
  		}
+ 	      else
+ 		addend <<= howto->rightshift;
  	    }
  	  else
  	    addend = rel->r_addend;
*************** _bfd_mips_elf_relocate_section (bfd *out
*** 6170,6202 ****
  	    /* Adjust the addend appropriately.  */
  	    addend += local_sections[r_symndx]->output_offset;
  
! 	  if (howto->partial_inplace)
  	    {
! 	      /* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16,
! 		 then we only want to write out the high-order 16 bits.
! 		 The subsequent R_MIPS_LO16 will handle the low-order bits.
! 	       */
! 	      if (r_type == R_MIPS_HI16 || r_type == R_MIPS_GOT16
  		  || r_type == R_MIPS_GNU_REL_HI16)
  		addend = mips_elf_high (addend);
  	      else if (r_type == R_MIPS_HIGHER)
  		addend = mips_elf_higher (addend);
  	      else if (r_type == R_MIPS_HIGHEST)
  		addend = mips_elf_highest (addend);
! 	    }
  
! 	  if (rela_relocation_p)
! 	    /* If this is a RELA relocation, just update the addend.
! 	       We have to cast away constness for REL.  */
! 	    rel->r_addend = addend;
! 	  else
! 	    {
! 	      /* Otherwise, we have to write the value back out.  Note
! 		 that we use the source mask, rather than the
! 		 destination mask because the place to which we are
! 		 writing will be source of the addend in the final
! 		 link.  */
! 	      addend >>= howto->rightshift;
  	      addend &= howto->src_mask;
  
  	      if (r_type == R_MIPS_64 && ! NEWABI_P (output_bfd))
--- 6364,6388 ----
  	    /* Adjust the addend appropriately.  */
  	    addend += local_sections[r_symndx]->output_offset;
  
! 	  if (rela_relocation_p)
! 	    /* If this is a RELA relocation, just update the addend.  */
! 	    rel->r_addend = addend;
! 	  else
  	    {
! 	      if (r_type == R_MIPS_HI16
! 		  || r_type == R_MIPS_GOT16
  		  || r_type == R_MIPS_GNU_REL_HI16)
  		addend = mips_elf_high (addend);
  	      else if (r_type == R_MIPS_HIGHER)
  		addend = mips_elf_higher (addend);
  	      else if (r_type == R_MIPS_HIGHEST)
  		addend = mips_elf_highest (addend);
! 	      else
! 		addend >>= howto->rightshift;
  
! 	      /* We use the source mask, rather than the destination
! 		 mask because the place to which we are writing will be
! 		 source of the addend in the final link.  */
  	      addend &= howto->src_mask;
  
  	      if (r_type == R_MIPS_64 && ! NEWABI_P (output_bfd))
*************** _bfd_mips_elf_relocate_section (bfd *out
*** 6259,6266 ****
  	use_saved_addend_p = TRUE;
        else
  	use_saved_addend_p = FALSE;
- 
-       addend >>= howto->rightshift;
  
        /* Figure out what value we are supposed to relocate.  */
        switch (mips_elf_calculate_relocation (output_bfd, input_bfd,
--- 6445,6450 ----
Index: bfd/elfxx-mips.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.h,v
retrieving revision 1.16
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.16 elfxx-mips.h
*** bfd/elfxx-mips.h	8 Dec 2003 20:04:34 -0000	1.16
--- bfd/elfxx-mips.h	14 Dec 2003 15:27:22 -0000
*************** extern bfd_reloc_status_type _bfd_mips_e
*** 103,108 ****
--- 103,116 ----
    (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma);
  extern bfd_reloc_status_type _bfd_mips_elf32_gprel16_reloc
    (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+ extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc
+   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+ extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc
+   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+ extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc
+   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+ extern bfd_reloc_status_type _bfd_mips_elf_generic_reloc
+   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
  extern unsigned long _bfd_elf_mips_mach
    (flagword);
  extern bfd_boolean _bfd_mips_relax_section
Index: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.240
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.240 tc-mips.c
*** gas/config/tc-mips.c	6 Dec 2003 13:52:23 -0000	1.240
--- gas/config/tc-mips.c	14 Dec 2003 15:27:25 -0000
*************** mips_validate_fix (struct fix *fixP, ase
*** 11339,11369 ****
    return 1;
  }
  
- #ifdef OBJ_ELF
- static int
- mips_need_elf_addend_fixup (fixS *fixP)
- {
-   if (S_GET_OTHER (fixP->fx_addsy) == STO_MIPS16)
-     return 1;
-   if (mips_pic == EMBEDDED_PIC
-       && S_IS_WEAK (fixP->fx_addsy))
-     return 1;
-   if (mips_pic != EMBEDDED_PIC
-       && (S_IS_WEAK (fixP->fx_addsy)
- 	  || S_IS_EXTERNAL (fixP->fx_addsy))
-       && !S_IS_COMMON (fixP->fx_addsy))
-     return 1;
-   if (((bfd_get_section_flags (stdoutput,
- 			       S_GET_SEGMENT (fixP->fx_addsy))
- 	& (SEC_LINK_ONCE | SEC_MERGE)) != 0)
-       || !strncmp (segment_name (S_GET_SEGMENT (fixP->fx_addsy)),
- 		   ".gnu.linkonce",
- 		   sizeof (".gnu.linkonce") - 1))
-     return 1;
-   return 0;
- }
- #endif
- 
  /* Apply a fixup to the object file.  */
  
  void
--- 11339,11344 ----
*************** md_apply_fix3 (fixS *fixP, valueT *valP,
*** 11389,11449 ****
  
    buf = (bfd_byte *) (fixP->fx_frag->fr_literal + fixP->fx_where);
  
-   /* If we aren't adjusting this fixup to be against the section
-      symbol, we need to adjust the value.  */
- #ifdef OBJ_ELF
-   if (fixP->fx_addsy != NULL && OUTPUT_FLAVOR == bfd_target_elf_flavour)
-     {
-       if (mips_need_elf_addend_fixup (fixP)
- 	  && howto->partial_inplace
- 	  && fixP->fx_r_type != BFD_RELOC_GPREL16
- 	  && fixP->fx_r_type != BFD_RELOC_GPREL32
- 	  && fixP->fx_r_type != BFD_RELOC_MIPS16_GPREL)
- 	{
- 	  /* In this case, the bfd_install_relocation routine will
- 	     incorrectly add the symbol value back in.  We just want
- 	     the addend to appear in the object file.
- 
- 	     The condition above used to include
- 	     "&& (! fixP->fx_pcrel || howto->pcrel_offset)".
- 
- 	     However, howto can't be trusted here, because we
- 	     might change the reloc type in tc_gen_reloc.  We can
- 	     check howto->partial_inplace because that conversion
- 	     happens to preserve howto->partial_inplace; but it
- 	     does not preserve howto->pcrel_offset.  I've just
- 	     eliminated the check, because all MIPS PC-relative
- 	     relocations are marked howto->pcrel_offset.
- 
- 	     howto->pcrel_offset was originally added for
- 	     R_MIPS_PC16, which is generated for code like
- 
- 		    globl g1 .text
- 		    .text
- 		    .space 20
- 	     g1:
- 	     x:
- 		    bal g1
- 	   */
- 	  *valP -= S_GET_VALUE (fixP->fx_addsy);
- 	}
- 
-       /* This code was generated using trial and error and so is
- 	 fragile and not trustworthy.  If you change it, you should
- 	 rerun the elf-rel, elf-rel2, and empic testcases and ensure
- 	 they still pass.  */
-       if (fixP->fx_pcrel)
- 	{
- 	  *valP += fixP->fx_frag->fr_address + fixP->fx_where;
- 
- 	  /* BFD's REL handling, for MIPS, is _very_ weird.
- 	     This gives the right results, but it can't possibly
- 	     be the way things are supposed to work.  */
- 	  *valP += fixP->fx_frag->fr_address + fixP->fx_where;
- 	}
-     }
- #endif
- 
    /* We are not done if this is a composite relocation to set up gp.  */
    if (fixP->fx_addsy == NULL && ! fixP->fx_pcrel
        && !(fixP->fx_r_type == BFD_RELOC_MIPS_SUB
--- 11364,11369 ----
*************** tc_gen_reloc (asection *section ATTRIBUT
*** 13390,13441 ****
  	as_fatal (_("Double check fx_r_type in tc-mips.c:tc_gen_reloc"));
        fixp->fx_r_type = BFD_RELOC_GPREL32;
      }
!   else if (fixp->fx_r_type == BFD_RELOC_PCREL_LO16)
      {
!       if (OUTPUT_FLAVOR == bfd_target_elf_flavour)
! 	reloc->addend = fixp->fx_addnumber;
        else
  	{
! 	  /* We use a special addend for an internal RELLO reloc.  */
  	  if (symbol_section_p (fixp->fx_addsy))
! 	    reloc->addend = reloc->address - S_GET_VALUE (fixp->fx_subsy);
  	  else
! 	    reloc->addend = fixp->fx_addnumber + reloc->address;
  	}
-     }
-   else if (fixp->fx_r_type == BFD_RELOC_PCREL_HI16_S)
-     {
-       assert (fixp->fx_next != NULL
- 	      && fixp->fx_next->fx_r_type == BFD_RELOC_PCREL_LO16);
- 
-       /* The reloc is relative to the RELLO; adjust the addend
- 	 accordingly.  */
-       if (OUTPUT_FLAVOR == bfd_target_elf_flavour)
- 	reloc->addend = fixp->fx_next->fx_addnumber;
        else
  	{
! 	  /* We use a special addend for an internal RELHI reloc.  */
! 	  if (symbol_section_p (fixp->fx_addsy))
! 	    reloc->addend = (fixp->fx_next->fx_frag->fr_address
! 			     + fixp->fx_next->fx_where
! 			     - S_GET_VALUE (fixp->fx_subsy));
  	  else
! 	    reloc->addend = (fixp->fx_addnumber
! 			     + fixp->fx_next->fx_frag->fr_address
! 			     + fixp->fx_next->fx_where);
  	}
      }
-   else if (fixp->fx_pcrel == 0 || OUTPUT_FLAVOR == bfd_target_elf_flavour)
-     reloc->addend = fixp->fx_addnumber;
    else
!     {
!       if (OUTPUT_FLAVOR != bfd_target_aout_flavour)
! 	/* A gruesome hack which is a result of the gruesome gas reloc
! 	   handling.  */
! 	reloc->addend = reloc->address;
!       else
! 	reloc->addend = -reloc->address;
!     }
  
    /* If this is a variant frag, we may need to adjust the existing
       reloc and generate a new one.  */
--- 13310,13358 ----
  	as_fatal (_("Double check fx_r_type in tc-mips.c:tc_gen_reloc"));
        fixp->fx_r_type = BFD_RELOC_GPREL32;
      }
!   else if (fixp->fx_pcrel)
      {
!       bfd_vma pcrel_address;
! 
!       /* Set PCREL_ADDRESS to this relocation's "PC".  The PC for high
! 	 high-part relocs is the address of the low-part reloc.  */
!       if (fixp->fx_r_type == BFD_RELOC_PCREL_HI16_S)
! 	{
! 	  assert (fixp->fx_next != NULL
! 		  && fixp->fx_next->fx_r_type == BFD_RELOC_PCREL_LO16);
! 	  pcrel_address = (fixp->fx_next->fx_where
! 			   + fixp->fx_next->fx_frag->fr_address);
! 	}
        else
+ 	pcrel_address = reloc->address;
+ 
+       if (OUTPUT_FLAVOR == bfd_target_elf_flavour)
  	{
! 	  /* At this point, fx_addnumber is "symbol offset - pcrel_address".
! 	     Relocations want only the symbol offset.  */
! 	  reloc->addend = fixp->fx_addnumber + pcrel_address;
! 	}
!       else if (fixp->fx_r_type == BFD_RELOC_PCREL_LO16
! 	       || fixp->fx_r_type == BFD_RELOC_PCREL_HI16_S)
! 	{
! 	  /* We use a special addend for an internal RELLO or RELHI reloc.  */
  	  if (symbol_section_p (fixp->fx_addsy))
! 	    reloc->addend = pcrel_address - S_GET_VALUE (fixp->fx_subsy);
  	  else
! 	    reloc->addend = fixp->fx_addnumber + pcrel_address;
  	}
        else
  	{
! 	  if (OUTPUT_FLAVOR != bfd_target_aout_flavour)
! 	    /* A gruesome hack which is a result of the gruesome gas reloc
! 	       handling.  */
! 	    reloc->addend = pcrel_address;
  	  else
! 	    reloc->addend = -pcrel_address;
  	}
      }
    else
!     reloc->addend = fixp->fx_addnumber;
  
    /* If this is a variant frag, we may need to adjust the existing
       reloc and generate a new one.  */
*************** tc_gen_reloc (asection *section ATTRIBUT
*** 13484,13491 ****
        reloc2->address = (reloc->address
  			 + (RELAX_RELOC2 (fixp->fx_frag->fr_subtype)
  			    - RELAX_RELOC1 (fixp->fx_frag->fr_subtype)));
!       reloc2->addend = fixp->fx_addnumber - S_GET_VALUE (fixp->fx_addsy)
! 	+ fixp->fx_frag->tc_frag_data.tc_fr_offset;
        reloc2->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_LO16);
        assert (reloc2->howto != NULL);
  
--- 13401,13407 ----
        reloc2->address = (reloc->address
  			 + (RELAX_RELOC2 (fixp->fx_frag->fr_subtype)
  			    - RELAX_RELOC1 (fixp->fx_frag->fr_subtype)));
!       reloc2->addend = reloc->addend;
        reloc2->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_LO16);
        assert (reloc2->howto != NULL);
  
  

Attachment: relocs-ld-tests.diff.bz2
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]