* config/tc-mips.c (RDATA_SECTION_NAME): Define.

(macro): Correct M_LI_SS SVR4_PIC/EMBEDDED_PIC case.  After M_LI_D
	or M_L_DOB or label dob, force a new frag to avoid getting
	confused in tc_gen_reloc.
	(mips_ip): Use RDATA_SECTION_NAME, not .rdata.
	(s_change_sec): Likewise.
This commit is contained in:
Ian Lance Taylor
1994-06-06 17:16:16 +00:00
parent 30f34d07c7
commit d2c71068e8
2 changed files with 48 additions and 18 deletions

View File

@ -1,3 +1,12 @@
Mon Jun 6 13:10:54 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* config/tc-mips.c (RDATA_SECTION_NAME): Define.
(macro): Correct M_LI_SS SVR4_PIC/EMBEDDED_PIC case. After M_LI_D
or M_L_DOB or label dob, force a new frag to avoid getting
confused in tc_gen_reloc.
(mips_ip): Use RDATA_SECTION_NAME, not .rdata.
(s_change_sec): Likewise.
Fri Jun 3 23:35:36 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) Fri Jun 3 23:35:36 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* read.c (emit_expr): Use memset to zero out memory, rather than * read.c (emit_expr): Use memset to zero out memory, rather than

View File

@ -90,6 +90,17 @@ static char *mips_regmask_frag;
const char *mips_target_format = DEFAULT_TARGET_FORMAT; const char *mips_target_format = DEFAULT_TARGET_FORMAT;
/* The name of the readonly data section. */
#ifdef OBJ_AOUT
#define RDATA_SECTION_NAME ".data"
#endif
#ifdef OBJ_ECOFF
#define RDATA_SECTION_NAME ".rdata"
#endif
#ifdef OBJ_ELF
#define RDATA_SECTION_NAME ".rodata"
#endif
/* These variables are filled in with the masks of registers used. /* These variables are filled in with the masks of registers used.
The object format code reads them and puts them in the appropriate The object format code reads them and puts them in the appropriate
place. */ place. */
@ -2987,17 +2998,22 @@ macro (ip)
&& offset_expr.X_add_number == 0); && offset_expr.X_add_number == 0);
macro_build ((char *) NULL, &icnt, &offset_expr, "lwc1", "T,o(b)", macro_build ((char *) NULL, &icnt, &offset_expr, "lwc1", "T,o(b)",
treg, (int) BFD_RELOC_MIPS_LITERAL, GP); treg, (int) BFD_RELOC_MIPS_LITERAL, GP);
return;
} }
else if (mips_pic == SVR4_PIC else if (mips_pic == SVR4_PIC
|| mips_pic == EMBEDDED_PIC) || mips_pic == EMBEDDED_PIC)
{ {
assert (imm_expr.X_op == O_constant); assert (imm_expr.X_op == O_constant);
load_register (&icnt, treg, &imm_expr); load_register (&icnt, AT, &imm_expr);
macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
"mtc1", "t,G", AT, treg);
break;
} }
else else
{
abort (); abort ();
return; return;
}
case M_LI_D: case M_LI_D:
/* We know that sym is in the .rdata section. First we get the /* We know that sym is in the .rdata section. First we get the
@ -3044,6 +3060,11 @@ macro (ip)
} }
} }
/* To avoid confusion in tc_gen_reloc, we must ensure that this
does not become a variant frag. */
frag_wane (frag_now);
frag_new (0);
break; break;
case M_LI_DD: case M_LI_DD:
@ -3100,6 +3121,12 @@ macro (ip)
macro_build ((char *) NULL, &icnt, &offset_expr, "lwc1", "T,o(b)", macro_build ((char *) NULL, &icnt, &offset_expr, "lwc1", "T,o(b)",
byte_order == LITTLE_ENDIAN ? treg + 1 : treg, byte_order == LITTLE_ENDIAN ? treg + 1 : treg,
(int) r, breg); (int) r, breg);
/* To avoid confusion in tc_gen_reloc, we must ensure that this
does not become a variant frag. */
frag_wane (frag_now);
frag_new (0);
if (breg != AT) if (breg != AT)
return; return;
break; break;
@ -4478,10 +4505,12 @@ mips_ip (str, ip)
{ {
default: /* unused default case avoids warnings. */ default: /* unused default case avoids warnings. */
case 'L': case 'L':
newname = (mips_pic != SVR4_PIC ? ".lit8" : ".rdata"); newname = (mips_pic != SVR4_PIC
? ".lit8"
: RDATA_SECTION_NAME);
break; break;
case 'F': case 'F':
newname = ".rdata"; newname = RDATA_SECTION_NAME;
break; break;
case 'l': case 'l':
assert (mips_pic == NO_PIC); assert (mips_pic == NO_PIC);
@ -5507,13 +5536,9 @@ s_change_sec (sec)
break; break;
case 'r': case 'r':
#ifdef OBJ_ECOFF seg = subseg_new (RDATA_SECTION_NAME,
subseg_new (".rdata", (subsegT) get_absolute_expression ()); (subsegT) get_absolute_expression ());
demand_empty_rest_of_line ();
break;
#else /* ! defined (OBJ_ECOFF) */
#ifdef OBJ_ELF #ifdef OBJ_ELF
seg = subseg_new (".rodata", (subsegT) get_absolute_expression ());
bfd_set_section_flags (stdoutput, seg, bfd_set_section_flags (stdoutput, seg,
(SEC_ALLOC (SEC_ALLOC
| SEC_LOAD | SEC_LOAD
@ -5521,13 +5546,9 @@ s_change_sec (sec)
| SEC_RELOC | SEC_RELOC
| SEC_DATA)); | SEC_DATA));
bfd_set_section_alignment (stdoutput, seg, 4); bfd_set_section_alignment (stdoutput, seg, 4);
#endif
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
break; break;
#else /* ! defined (OBJ_ELF) */
s_data (0);
break;
#endif /* ! defined (OBJ_ELF) */
#endif /* ! defined (OBJ_ECOFF) */
case 's': case 's':
#ifdef GPOPT #ifdef GPOPT