From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ralf Baechle To: Mark Mitchell Cc: binutils@sourceware.cygnus.com Subject: Re: R_MIPS_26 testcase Date: Wed, 04 Aug 1999 14:47:00 -0000 Message-id: <19990804234523.A21269@uni-koblenz.de> References: <19990804171542.A15318@uni-koblenz.de> <19990804134926T.mitchell@codesourcery.com> <19990804230046.B15625@uni-koblenz.de> X-SW-Source: 1999-08/msg00026.html This seems to fix test case #6. > else if (r_type == R_MIPS16_26 || r_type == R_MIPS16_26) ^^^^^^^^^^^ ^^^^^^^^^^^ Note that nice typo in your code ... Ralf Index: binutils-cygnus/bfd/elf32-mips.c =================================================================== RCS file: /cvs/binutils/binutils/bfd/elf32-mips.c,v retrieving revision 1.44 diff -u -r1.44 elf32-mips.c --- elf32-mips.c 1999/08/04 16:32:34 1.44 +++ elf32-mips.c 1999/08/04 21:22:52 @@ -6599,6 +6599,13 @@ /* There's nothing to do for non-local relocations. */ continue; + if (r_type == R_MIPS_26 || r_type == R_MIPS16_26) + /* The addend is stored without its two least + significant bits (which are always zero.) In a + non-relocateable link, calculate_relocation will do + this shift; here, we must do it ourselves. */ + addend <<= 2; + r_symndx = ELF32_R_SYM (rel->r_info); sym = local_syms + r_symndx; if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) @@ -6610,12 +6617,6 @@ || r_type == R_MIPS_GPREL32) addend -= (_bfd_get_gp_value (output_bfd) - _bfd_get_gp_value (input_bfd)); - else if (r_type == R_MIPS16_26 || r_type == R_MIPS16_26) - /* The addend is stored without its two least - significant bits (which are always zero.) In a - non-relocateable link, calculate_relocation will do - this shift; here, we must do it ourselves. */ - addend <<= 2; /* 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.