From 10181a0dce686bb01df699b50899dde238245c2d Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Sun, 13 Oct 2002 21:22:49 +0000 Subject: [PATCH] * config/tc-mips.c (s_gpdword): New function. (mips_pseudo_table): Add .gpdword. (mips_need_elf_addend_fixup): never for NEWABI. (md_apply_fix3): Don't mark BFD_RELOC64 after GPREL16 or GPREL32 as done. (s_cpadd): Generate .cpadd on NEWABI. --- gas/ChangeLog | 9 ++++++++ gas/config/tc-mips.c | 54 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index ab8f58427b2..484556d59bd 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,12 @@ +2002-10-13 Eric Christopher , Alexandre Oliva + + * config/tc-mips.c (s_gpdword): New function. + (mips_pseudo_table): Add .gpdword. + (mips_need_elf_addend_fixup): never for NEWABI. + (md_apply_fix3): Don't mark BFD_RELOC64 after GPREL16 or + GPREL32 as done. + (s_cpadd): Generate .cpadd on NEWABI. + 2002-10-12 Elias Athanasopoulos * config/tc-ppc.c (ppc_cleanup): Make 'i' unsigned int. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 45a27fc53c1..5a30e51ab1a 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -860,6 +860,7 @@ static void s_cprestore PARAMS ((int)); static void s_cpreturn PARAMS ((int)); static void s_gpvalue PARAMS ((int)); static void s_gpword PARAMS ((int)); +static void s_gpdword PARAMS ((int)); static void s_cpadd PARAMS ((int)); static void s_insn PARAMS ((int)); static void md_obj_begin PARAMS ((void)); @@ -961,6 +962,7 @@ static const pseudo_typeS mips_pseudo_table[] = {"cpreturn", s_cpreturn, 0}, {"gpvalue", s_gpvalue, 0}, {"gpword", s_gpword, 0}, + {"gpdword", s_gpdword, 0}, {"cpadd", s_cpadd, 0}, {"insn", s_insn, 0}, @@ -11105,6 +11107,9 @@ md_apply_fix3 (fixP, valP, seg) /* 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 + || (fixP->fx_r_type == BFD_RELOC_64 + && (previous_fx_r_type == BFD_RELOC_GPREL32 + || previous_fx_r_type == BFD_RELOC_GPREL16)) || (previous_fx_r_type == BFD_RELOC_MIPS_SUB && (fixP->fx_r_type == BFD_RELOC_HI16_S || fixP->fx_r_type == BFD_RELOC_LO16)))) @@ -12303,6 +12308,50 @@ s_gpword (ignore) demand_empty_rest_of_line (); } +static void +s_gpdword (ignore) + int ignore ATTRIBUTE_UNUSED; +{ + symbolS *label; + expressionS ex; + char *p; + + /* When not generating PIC code, this is treated as .dword. */ + if (mips_pic != SVR4_PIC) + { + s_cons (3); + return; + } + + label = insn_labels != NULL ? insn_labels->label : NULL; + mips_emit_delays (true); + if (auto_align) + mips_align (3, 0, label); + mips_clear_insn_labels (); + + expression (&ex); + + if (ex.X_op != O_symbol || ex.X_add_number != 0) + { + as_bad (_("Unsupported use of .gpdword")); + ignore_rest_of_line (); + } + + p = frag_more (8); + md_number_to_chars (p, (valueT) 0, 8); + fix_new_exp (frag_now, p - frag_now->fr_literal, 8, &ex, false, + BFD_RELOC_GPREL32); + + /* GPREL32 composed with 64 gives a 64-bit GP offset. */ + ex.X_op = O_absent; + ex.X_add_symbol = 0; + ex.X_add_number = 0; + fix_new_exp (frag_now, p - frag_now->fr_literal, 8, &ex, false, + BFD_RELOC_64); + + demand_empty_rest_of_line (); +} + /* Handle the .cpadd pseudo-op. This is used when dealing with switch tables in SVR4 PIC code. */ @@ -12313,9 +12362,8 @@ s_cpadd (ignore) int icnt = 0; int reg; - /* This is ignored when not generating SVR4 PIC code or if this is NewABI - code. */ - if (mips_pic != SVR4_PIC || HAVE_NEWABI) + /* This is ignored when not generating SVR4 PIC code. */ + if (mips_pic != SVR4_PIC) { s_ignore (0); return; -- 2.30.2