* config/tc-mips.c (mips_fix_adjustable): New function.
authorIan Lance Taylor <ian@airs.com>
Thu, 30 Jan 1997 21:19:36 +0000 (21:19 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 30 Jan 1997 21:19:36 +0000 (21:19 +0000)
* config/tc-mips.h (tc_fix_adjustable): Call mips_fix_adjustable.
(mips_fix_adjustable): Declare.

gas/ChangeLog
gas/config/tc-mips.c
gas/config/tc-mips.h

index 72df81c..86a744a 100644 (file)
@@ -12,6 +12,10 @@ Thu Jan 30 12:28:18 1997  Alan Modra  <alan@spri.levels.unisa.edu.au>
 
 Thu Jan 30 12:08:40 1997  Ian Lance Taylor  <ian@cygnus.com>
 
+       * config/tc-mips.c (mips_fix_adjustable): New function.
+       * config/tc-mips.h (tc_fix_adjustable): Call mips_fix_adjustable.
+       (mips_fix_adjustable): Declare.
+
        Ideas from Srinivas Addagarla <srinivas@cdotd.ernet.in>:
        * read.c (read_a_source_file): After doing an mri_pending_align,
        adjust the line_label if there is one.
index 3378aeb..4a59ab9 100644 (file)
@@ -9449,6 +9449,32 @@ md_estimate_size_before_relax (fragp, segtype)
     return RELAX_NEW (fragp->fr_subtype) - RELAX_OLD (fragp->fr_subtype);
 }
 
+/* This is called to see whether a reloc against a defined symbol
+   should be converted into a reloc against a section.  Don't adjust
+   MIPS16 jump relocations, so we don't have to worry about the format
+   of the offset in the .o file.  Don't adjust relocations against
+   externally visible mips16 symbols, so that the linker can find them
+   if it needs to set up a stub.  */
+
+int
+mips_fix_adjustable (fixp)
+     fixS *fixp;
+{
+  if (fixp->fx_r_type == BFD_RELOC_MIPS16_JMP)
+    return 0;
+  if (fixp->fx_addsy == NULL)
+    return 1;
+  if (! S_IS_EXTERNAL (fixp->fx_addsy)
+      && ! S_IS_WEAK (fixp->fx_addsy))
+    return 1;
+#ifdef S_GET_OTHER
+  if (OUTPUT_FLAVOR == bfd_target_elf_flavour
+      && S_GET_OTHER (fixp->fx_addsy) == STO_MIPS16)
+    return 0;
+#endif
+  return 1;
+}
+
 /* Translate internal representation of relocation info to BFD target
    format.  */
 
index 31654f7..4a1eca4 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-mips.h -- header file for tc-mips.c.
-   Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
    Contributed by the OSF and Ralph Campbell.
    Written by Keith Knowles and Ralph Campbell, working independently.
    Modified for ECOFF support by Ian Lance Taylor of Cygnus Support.
@@ -57,9 +57,6 @@ extern int mips_relax_frag PARAMS ((struct frag *, long));
    embedded PIC code.  */
 #define DIFF_EXPR_OK
 
-#define LITTLE_ENDIAN   1234
-#define BIG_ENDIAN      4321
-
 /* Default to big endian.  */
 #ifndef TARGET_BYTES_LITTLE_ENDIAN
 #undef  TARGET_BYTES_BIG_ENDIAN
@@ -91,7 +88,7 @@ extern void mips_define_label PARAMS ((struct symbol *));
 #define tc_frob_file() mips_frob_file ()
 extern void mips_frob_file PARAMS ((void));
 
-#ifdef OBJ_ELF
+#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
 #define tc_frob_file_after_relocs mips_frob_file_after_relocs
 extern void mips_frob_file_after_relocs PARAMS ((void));
 #endif
@@ -99,9 +96,8 @@ extern void mips_frob_file_after_relocs PARAMS ((void));
 #define TC_CONS_FIX_NEW cons_fix_new_mips
 extern void cons_fix_new_mips ();
 
-/* Don't adjust MIPS16 jump relocations to section addresses, so we
-   don't have to worry about the format of the offset in the .o file.  */
-#define tc_fix_adjustable(fixp) ((fixp)->fx_r_type != BFD_RELOC_MIPS16_JMP)
+#define tc_fix_adjustable(fixp) mips_fix_adjustable (fixp)
+extern int mips_fix_adjustable PARAMS ((struct fix *));
 
 /* When generating embedded PIC code we must keep PC relative
    relocations.  */
@@ -116,7 +112,7 @@ extern int mips_force_relocation ();
 extern unsigned long mips_gprmask;
 extern unsigned long mips_cprmask[4];
 
-#ifdef OBJ_ELF
+#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
 
 #define elf_tc_final_processing mips_elf_final_processing
 extern void mips_elf_final_processing PARAMS ((void));
@@ -148,7 +144,4 @@ extern void mips_flush_pending_output PARAMS ((void));
 extern void mips_enable_auto_align PARAMS ((void));
 #define md_elf_section_change_hook()   mips_enable_auto_align()
 
-extern void mips_init_after_args PARAMS ((void));
-#define tc_init_after_args mips_init_after_args
-
 #endif /* TC_MIPS */