public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>, binutils@sourceware.org
Subject: Re: PATCH: Add --size-check=[error|warning]
Date: Fri, 18 Mar 2011 11:20:00 -0000	[thread overview]
Message-ID: <20110318112002.GC13754@bubble.grove.modra.org> (raw)
In-Reply-To: <20110316235606.GW6275@bubble.grove.modra.org>

On Thu, Mar 17, 2011 at 10:26:06AM +1030, Alan Modra wrote:
> Oh, another thing that just occurred to me:  Reporting the .size
> expression symbols is likely not as useful as reporting the function
> symbol, and it's actually a lot easier to report the function..

Like this.

	* config/obj-elf.c (elf_frob_symbol): Report S_SET_SIZE symbol
	on .size expression errors rather than ones in the size expression.

Index: gas/config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.139
diff -u -p -r1.139 obj-elf.c
--- gas/config/obj-elf.c	16 Mar 2011 12:58:26 -0000	1.139
+++ gas/config/obj-elf.c	18 Mar 2011 02:50:30 -0000
@@ -1896,49 +1901,12 @@ elf_frob_symbol (symbolS *symp, int *pun
 	S_SET_SIZE (symp, size->X_add_number);
       else
 	{
-	  const char *op_name = NULL;
-	  const char *add_name = NULL;
-	  PRINTF_LIKE ((*as_error));
-
 	  if (flag_size_check == size_check_error)
-	    as_error = as_bad;
+	    as_bad (_(".size expression for %s "
+		      "does not evaluate to a constant"), S_GET_NAME (symp));
 	  else
-	    as_error = as_warn;
-
-	  if (size->X_op == O_subtract)
-	    {
-	      op_name = S_GET_NAME (size->X_op_symbol);
-	      add_name = S_GET_NAME (size->X_add_symbol);
-	      if (strcmp (op_name, FAKE_LABEL_NAME) == 0)
-		op_name = NULL;
-	      if (strcmp (add_name, FAKE_LABEL_NAME) == 0)
-		add_name = NULL;
-
-	      if (op_name && add_name)
-		as_error (_(".size expression with symbols `%s' and "
-			    "`%s' does not evaluate to a constant"),
-			  op_name, add_name);
-	      else
-		{
-		  const char *name;
-
-		  if (op_name)
-		    name = op_name;
-		  else if (add_name)
-		    name = add_name;
-		  else
-		    name = NULL;
-
-		  if (name)
-		    as_error (_(".size expression with symbol `%s' "
-				"does not evaluate to a constant"),
-			      name);
-		}
-	    }
-	  
-	  if (!op_name && !add_name)
-	    as_error (_(".size expression does not evaluate to a "
-			"constant"));
+	    as_warn (_(".size expression for %s "
+		       "does not evaluate to a constant"), S_GET_NAME (symp));
 	}
       free (sy_obj->size);
       sy_obj->size = NULL;

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2011-03-18 11:20 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11 16:58 H.J. Lu
2011-03-11 17:04 ` Jan Beulich
2011-03-11 17:20   ` H.J. Lu
2011-03-14  8:44     ` Jan Beulich
2011-03-14  9:55       ` Ingo Molnar
2011-03-14 10:41         ` Alan Modra
2011-03-14 10:50           ` Pekka Enberg
2011-03-14 18:04             ` Alan Cox
2011-03-14 10:52           ` Jan Beulich
     [not found]           ` <AANLkTi=3AiLaw5Gnis8Ha4eRXirk0s-Cnk2zzN12YDpH__45869.1711457961$1300099861$gmane$org@mail.gmail.com>
2011-03-14 11:03             ` Andreas Schwab
2011-03-14 11:12               ` Pekka Enberg
2011-03-14 12:02                 ` Andreas Schwab
2011-03-14 12:13                   ` Ingo Molnar
2011-03-14 12:55                     ` Andreas Schwab
2011-03-14 13:17                       ` Ingo Molnar
2011-03-14 14:11                         ` Andreas Schwab
2011-03-14 12:11                 ` Ingo Molnar
2011-03-14 12:23           ` Ingo Molnar
2011-03-14 12:26             ` Ingo Molnar
2011-03-14 13:16             ` git bisect plus fixes (was: PATCH: Add --size-check=[error|warning]) Ralf Wildenhues
2011-03-14 13:55       ` PATCH: Add --size-check=[error|warning] H.J. Lu
2011-03-16 23:56 ` Alan Modra
2011-03-18 11:20   ` Alan Modra [this message]
2011-03-18 11:59     ` Alan Modra
2011-03-14 11:02 Sedat Dilek
2011-03-14 11:25 ` Jan Beulich
2011-03-14 11:35   ` Ingo Molnar
2011-03-14 11:39   ` Sedat Dilek
2011-03-14 11:53     ` Sedat Dilek
2011-03-14 12:22       ` Jan Beulich
2011-03-14 12:38         ` Sedat Dilek
2011-03-14 15:56         ` Ian Lance Taylor
2011-03-14 18:02           ` H. Peter Anvin
2011-03-14 16:33   ` H. Peter Anvin
2011-03-14 19:24     ` Steven Rostedt
2011-03-14 20:06       ` Linus Torvalds
2011-03-14 12:57 ` Ingo Molnar

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=20110318112002.GC13754@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.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).