From 46a92fde532aec31ad31edda66fc7d79a459f75d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 15 Mar 1997 02:14:44 +0000 Subject: [PATCH] * config/tc-mips.c (md_estimate_size_before_relax): Handle the case of a symbol equated to another symbol when using SVR4_PIC. --- gas/ChangeLog | 3 +++ gas/config/tc-mips.c | 28 ++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 6059604b714..bd15f3c2b82 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,8 @@ Fri Mar 14 15:33:38 1997 Ian Lance Taylor + * config/tc-mips.c (md_estimate_size_before_relax): Handle the + case of a symbol equated to another symbol when using SVR4_PIC. + * Makefile.in (TARG_CPU_DEP_sparc): Add opcode/sparc.h. Thu Mar 13 11:20:51 1997 Ian Lance Taylor diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 5290f3b9d68..b76b903dfe0 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -8068,12 +8068,12 @@ struct option md_longopts[] = { {"mips16", no_argument, NULL, OPTION_MIPS16}, #define OPTION_NO_MIPS16 (OPTION_MD_BASE + 23) {"no-mips16", no_argument, NULL, OPTION_NO_MIPS16}, - /* start-sanitize-5900 */ + /* start-sanitize-r5900 */ #define OPTION_M5900 (OPTION_MD_BASE + 24) {"m5900", no_argument, NULL, OPTION_M5900}, #define OPTION_NO_M5900 (OPTION_MD_BASE + 25) {"no-m5900", no_argument, NULL, OPTION_NO_M5900}, - /* end-sanitize-5900 */ + /* end-sanitize-r5900 */ #define OPTION_CALL_SHARED (OPTION_MD_BASE + 7) #define OPTION_NON_SHARED (OPTION_MD_BASE + 8) @@ -9922,7 +9922,26 @@ md_estimate_size_before_relax (fragp, segtype) } else if (mips_pic == SVR4_PIC) { - asection *symsec = fragp->fr_symbol->bsym->section; + symbolS *sym; + asection *symsec; + + sym = fragp->fr_symbol; + + /* Handle the case of a symbol equated to another symbol. */ + while (sym->sy_value.X_op == O_symbol + && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym))) + { + symbolS *n; + + /* It's possible to get a loop here in a badly written + program. */ + n = sym->sy_value.X_add_symbol; + if (n == sym) + break; + sym = n; + } + + symsec = S_GET_SEGMENT (sym); /* This must duplicate the test in adjust_reloc_syms. */ change = (symsec != &bfd_und_section @@ -9969,7 +9988,8 @@ mips_fix_adjustable (fixp) return 1; #ifdef S_GET_OTHER if (OUTPUT_FLAVOR == bfd_target_elf_flavour - && S_GET_OTHER (fixp->fx_addsy) == STO_MIPS16) + && S_GET_OTHER (fixp->fx_addsy) == STO_MIPS16 + && fixp->fx_subsy == NULL) return 0; #endif return 1; -- 2.30.2