From: Daniel Jacobowitz <drow@mvista.com>
To: Richard Henderson <rth@redhat.com>
Cc: binutils@sources.redhat.com
Subject: Re: Missing .cprestore warning
Date: Thu, 23 Aug 2001 11:02:00 -0000 [thread overview]
Message-ID: <20010823110354.A26420@nevyn.them.org> (raw)
In-Reply-To: <20010814174300.A8706@redhat.com>
On Tue, Aug 14, 2001 at 05:43:00PM -0700, Richard Henderson wrote:
> On Tue, Aug 14, 2001 at 01:20:56PM -0700, Daniel Jacobowitz wrote:
> > Is there another logical place we could reset this? Perhaps in .end?
>
> That sounds ideal.
How about this patch, then? This catches all the stupid mistakes I
made while working on giving _mcount a stack frame properly.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
2001-08-23 Daniel Jacobowitz <drow@mvista.com>
* tc-mips.c (mips_cprestore_valid): New flag.
(mips_frame_reg_valid): New flag.
(macro) [M_JAL_2]: Check both flags.
[M_JAL_A]: Likewise.
(s_cprestore): Set mips_cprestore_valid.
(tc_get_register): If setting mips_frame_reg, set
mips_frame_reg_valid and clear mips_cprestore_valid.
(s_mips_ent): Clear both flags.
(s_mips_end): Clear both flags.
Index: tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.68
diff -u -p -r1.68 tc-mips.c
--- tc-mips.c 2001/08/21 01:13:05 1.68
+++ tc-mips.c 2001/08/23 17:56:41
@@ -414,10 +414,18 @@ static int auto_align = 1;
variable. */
static offsetT mips_cprestore_offset = -1;
+/* Whether mips_cprestore_offset has been set in the current function
+ (or whether it has already been warned about, if not). */
+static int mips_cprestore_valid = 0;
+
/* This is the register which holds the stack frame, as set by the
.frame pseudo-op. This is needed to implement .cprestore. */
static int mips_frame_reg = SP;
+/* Whether mips_frame_reg has been set in the current function
+ (or whether it has already been warned about, if not). */
+static int mips_frame_reg_valid = 0;
+
/* To output NOP instructions correctly, we need to keep information
about the previous two instructions. */
@@ -4654,6 +4662,18 @@ macro (ip)
as_warn (_("No .cprestore pseudo-op used in PIC code"));
else
{
+ if (! mips_frame_reg_valid)
+ {
+ as_warn (_("No .frame pseudo-op used in PIC code"));
+ /* Quiet this warning. */
+ mips_frame_reg_valid = 1;
+ }
+ if (! mips_cprestore_valid)
+ {
+ as_warn (_("No .cprestore pseudo-op used in PIC code"));
+ /* Quiet this warning. */
+ mips_cprestore_valid = 1;
+ }
expr1.X_add_number = mips_cprestore_offset;
macro_build ((char *) NULL, &icnt, &expr1,
HAVE_32BIT_ADDRESSES ? "lw" : "ld",
@@ -4754,6 +4774,18 @@ macro (ip)
as_warn (_("No .cprestore pseudo-op used in PIC code"));
else
{
+ if (! mips_frame_reg_valid)
+ {
+ as_warn (_("No .frame pseudo-op used in PIC code"));
+ /* Quiet this warning. */
+ mips_frame_reg_valid = 1;
+ }
+ if (! mips_cprestore_valid)
+ {
+ as_warn (_("No .cprestore pseudo-op used in PIC code"));
+ /* Quiet this warning. */
+ mips_cprestore_valid = 1;
+ }
if (mips_opts.noreorder)
macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
"nop", "");
@@ -10537,6 +10569,7 @@ s_cprestore (ignore)
}
mips_cprestore_offset = get_absolute_expression ();
+ mips_cprestore_valid = 1;
ex.X_op = O_constant;
ex.X_add_symbol = NULL;
@@ -10743,7 +10776,11 @@ tc_get_register (frame)
input_line_pointer += 2;
}
if (frame)
- mips_frame_reg = reg != 0 ? reg : SP;
+ {
+ mips_frame_reg = reg != 0 ? reg : SP;
+ mips_frame_reg_valid = 1;
+ mips_cprestore_valid = 0;
+ }
return reg;
}
@@ -11798,6 +11835,10 @@ s_mips_end (x)
symbolS *p;
int maybe_text;
+ /* Following functions need their own .frame and .cprestore directives. */
+ mips_frame_reg_valid = 0;
+ mips_cprestore_valid = 0;
+
if (!is_end_of_line[(unsigned char) *input_line_pointer])
{
p = get_symbol ();
@@ -11915,6 +11956,10 @@ s_mips_ent (aent)
if (!aent)
{
+ /* This function needs its own .frame and .cprestore directives. */
+ mips_frame_reg_valid = 0;
+ mips_cprestore_valid = 0;
+
cur_proc_ptr = &cur_proc;
memset (cur_proc_ptr, '\0', sizeof (procS));
prev parent reply other threads:[~2001-08-23 11:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-14 13:20 Daniel Jacobowitz
2001-08-14 17:43 ` Richard Henderson
2001-08-23 11:02 ` Daniel Jacobowitz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010823110354.A26420@nevyn.them.org \
--to=drow@mvista.com \
--cc=binutils@sources.redhat.com \
--cc=rth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).