This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Add -munwind-check=[none|warning|error]


Hi Jim,

Here is the updated patch to add -munwind-check=[none|warning|error].
I documented this new option.


H.J.
---
gas/

2005-02-02  H.J. Lu  <hongjiu.lu@intel.com>

	* NEWS: Mention "-munwind-check=[none|warning|error]".

	* config/tc-ia64.c (md): Add unwind_check.
	(in_procedure): When a directive isn't in procedure, warn if
	md.unwind_check is warning and return -1 if md.unwind_check
	isn't error.
	(in_prologue): Likewise.
	(in_body): Likewise.
	(md_parse_option): Handle "-munwind-check=[none|warning|error]".
	(md_show_usage): Add "-munwind-check=[none|warning|error]".
	(dot_endp): Abort if in_procedure returns -1.

	* doc/as.texinfo: Add "-munwind-check=[none|warning|error]".
	* doc/c-ia64.texi: Likewise.

gas/testcase

2005-02-02  H.J. Lu  <hongjiu.lu@intel.com>

	* gas/ia64/ia64.exp: Pass -munwind-check=error for unwind-err.

--- gas/NEWS.check	2004-12-10 14:20:32.000000000 -0800
+++ gas/NEWS	2005-02-09 17:16:14.885016326 -0800
@@ -1,5 +1,8 @@
 -*- text -*-
 
+* New command line option -munwind-check=[none|warning|error] for IA64
+  targets.
+
 * Port to MAXQ processor contributed by HCL Tech.
 
 * Added support for generating unwind tables for ARM ELF targets.
--- gas/config/tc-ia64.c.check	2005-02-03 12:00:26.000000000 -0800
+++ gas/config/tc-ia64.c	2005-02-09 16:53:15.468350820 -0800
@@ -231,6 +231,9 @@ static struct
       auto_align : 1,
       keep_pending_output : 1;
 
+    /* What to do when something is wrong with unwind directives.  */
+    enum { none = -1, warning = 0, error = 1 } unwind_check;
+
     /* Each bundle consists of up to three instructions.  We keep
        track of four most recent instructions so we can correctly set
        the end_of_insn_group for the last instruction in a bundle.  */
@@ -3074,6 +3077,16 @@ in_procedure (const char *directive)
   if (unwind.proc_start
       && (!unwind.saved_text_seg || strcmp (directive, "endp") == 0))
     return 1;
+  switch (md.unwind_check)
+    {
+    case warning:
+      as_warn (".%s outside of procedure", directive);
+    case none:
+      return -1;
+      break;
+    case error:
+      break;
+    }
   as_bad (".%s outside of procedure", directive);
   ignore_rest_of_line ();
   return 0;
@@ -3082,12 +3095,31 @@ in_procedure (const char *directive)
 static int
 in_prologue (const char *directive)
 {
-  if (in_procedure (directive))
+  switch (in_procedure (directive))
     {
+    case 1:
+      /* We are really in procedure.  */
       if (unwind.prologue)
 	return 1;
-      as_bad (".%s outside of prologue", directive);
-      ignore_rest_of_line ();
+      switch (md.unwind_check)
+	{
+	case warning:
+	  as_warn (".%s outside of prologue", directive);
+	case none:
+	  return -1;
+	  break;
+	case error:
+	  as_bad (".%s outside of prologue", directive);
+	  ignore_rest_of_line ();
+	  break;
+	}
+    case -1:
+      /* We aren't in procedure.  */
+      if (md.unwind_check != error)
+	return -1;
+      break;
+    default:
+      break;
     }
   return 0;
 }
@@ -3095,12 +3127,31 @@ in_prologue (const char *directive)
 static int
 in_body (const char *directive)
 {
-  if (in_procedure (directive))
+  switch (in_procedure (directive))
     {
+    case 1:
+      /* We are really in procedure.  */
       if (unwind.body)
 	return 1;
-      as_bad (".%s outside of body region", directive);
-      ignore_rest_of_line ();
+      switch (md.unwind_check)
+	{
+	case warning:
+	  as_warn (".%s outside of body region", directive);
+	case none:
+	  return -1;
+	  break;
+	case error:
+	  as_bad (".%s outside of body region", directive);
+	  ignore_rest_of_line ();
+	  break;
+	}
+    case -1:
+      /* We aren't in procedure.  */
+      if (md.unwind_check != error)
+	return -1;
+      break;
+    default:
+      break;
     }
   return 0;
 }
@@ -4315,8 +4366,18 @@ dot_endp (dummy)
   char *name, *p, c;
   symbolS *sym;
 
-  if (!in_procedure ("endp"))
-    return;
+  switch (in_procedure ("endp"))
+    {
+    case 1:
+      break;
+    case -1:
+      /* We can't ignore this error.  */
+      as_fatal (".endp can't be outside of procedure");
+      break;
+    default:
+      return;
+      break;
+    }
 
   if (unwind.saved_text_seg)
     {
@@ -6794,6 +6855,18 @@ md_parse_option (c, arg)
 	  md.flags |= EF_IA_64_BE;
 	  default_big_endian = 1;
 	}
+      else if (strncmp (arg, "unwind-check=", 13) == 0)
+	{
+	  arg += 13;
+	  if (strcmp (arg, "none") == 0)
+	    md.unwind_check = none;
+	  else if (strcmp (arg, "warning") == 0)
+	    md.unwind_check = warning;
+	  else if (strcmp (arg, "error") == 0)
+	    md.unwind_check = error;
+	  else
+	    return 0;
+	}
       else
 	return 0;
       break;
@@ -6897,6 +6970,8 @@ IA-64 options:\n\
 			  EF_IA_64_NOFUNCDESC_CONS_GP)\n\
   -milp32|-milp64|-mlp64|-mp64	select data model (default -mlp64)\n\
   -mle | -mbe		  select little- or big-endian byte order (default -mle)\n\
+  -munwind-check=[none|warning|error]\n\
+			  unwind directive check (default -munwind-check=warning)\n\
   -x | -xexplicit	  turn on dependency violation checking (default)\n\
   -xauto		  automagically remove dependency violations\n\
   -xdebug		  debug dependency violation checker\n"),
--- gas/doc/as.texinfo.check	2004-11-23 09:09:23.000000000 -0800
+++ gas/doc/as.texinfo	2005-02-09 17:17:26.952728318 -0800
@@ -315,6 +315,7 @@ gcc(1), ld(1), and the Info entries for 
    [@b{-mconstant-gp}|@b{-mauto-pic}]
    [@b{-milp32}|@b{-milp64}|@b{-mlp64}|@b{-mp64}]
    [@b{-mle}|@b{mbe}]
+   [@b{-munwind-check=none}|@b{-munwind-check=warning}|@b{-munwind-check=error}]
    [@b{-x}|@b{-xexplicit}] [@b{-xauto}] [@b{-xdebug}]
 @end ifset
 @ifset IP2K
--- gas/doc/c-ia64.texi.check	2003-10-27 11:00:37.000000000 -0800
+++ gas/doc/c-ia64.texi	2005-02-09 17:21:36.747535035 -0800
@@ -65,6 +65,16 @@ These options select the byte order.  Th
 byte order (default) and @code{-mbe} selects big-endian byte order.  Note that
 IA-64 machine code always uses little-endian byte order.
 
+@item -munwind-check=none
+@item -munwind-check=warning
+@item -munwind-check=error
+These options control if asssembler will do when a unwind directive
+check fails. @code{-munwind-check=none} will make asssembler not to do
+any check. @code{-munwind-check=warning} will make asssembler to issue
+a warning when a unwind directive check fails, which is the default.
+@code{-munwind-check=error} will make asssembler to treat a unwind
+directive check failure as an error.
+
 @item -x
 @item -xexplicit
 These options turn on dependency violation checking.  This checking is turned on by
--- gas/testsuite/gas/ia64/ia64.exp.check	2005-02-03 12:00:27.000000000 -0800
+++ gas/testsuite/gas/ia64/ia64.exp	2005-02-09 16:53:15.469350691 -0800
@@ -69,5 +69,5 @@ if [istarget "ia64-*"] then {
     run_list_test "last" ""
     run_list_test "proc" ""
     run_list_test "slot2" ""
-    run_list_test "unwind-err" ""
+    run_list_test "unwind-err" "-munwind-check=error"
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]