From 0d7f9025b93665f88f0d3d1dcf412aca14a2a63e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 30 Jan 1997 21:19:36 +0000 Subject: [PATCH] * config/tc-mips.c (mips_fix_adjustable): New function. * config/tc-mips.h (tc_fix_adjustable): Call mips_fix_adjustable. (mips_fix_adjustable): Declare. --- gas/ChangeLog | 4 ++++ gas/config/tc-mips.c | 26 ++++++++++++++++++++++++++ gas/config/tc-mips.h | 17 +++++------------ 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 72df81c1ec1..86a744a2b24 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -12,6 +12,10 @@ Thu Jan 30 12:28:18 1997 Alan Modra Thu Jan 30 12:08:40 1997 Ian Lance Taylor + * 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 : * read.c (read_a_source_file): After doing an mri_pending_align, adjust the line_label if there is one. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 3378aeb48c6..4a59ab9a1e2 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -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. */ diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h index 31654f7b987..4a1eca4e476 100644 --- a/gas/config/tc-mips.h +++ b/gas/config/tc-mips.h @@ -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 */ -- 2.30.2