This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

[PATCH] strict .register checking


On Sun, Dec 12, 1999 at 10:55:27PM -0800, David S. Miller wrote:
>    Date: Mon, 13 Dec 1999 07:55:46 +0100
>    From: Jakub Jelinek <jakub@redhat.com>
> 
>    But it will require hacking up the kernel to add .register's where
>    needed for the assembly...
> 
> Not if we turn the .register checking off in the kernel makefiles.
> 
> We have so many radical/slick uses of these reserved globals in the
> kernel, and we control the entire code image's usage of such things,
> so it makes absolutely no sense for as/ld to verify things for us
> because it will be more pain than it's worth to teach it the tricks
> we are doing.

Ok, agreed. How about this?
Attached are gcc patch to enable it and gas patch to implement
-undeclared-regs option as counterpart to -no-undeclared-regs. The last one
from these wins, so in the linux kernel we can add
-Wa,-undeclared-regs
to CFLAGS/AFLAGS (if as accepts them) and be done with it.

Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.26 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________
1999-12-13  Jakub Jelinek  <jakub@redhat.com>

	* config/sparc/sparc.h (ASM_ARCH64_SPEC): Pass -no-undeclared-regs
	to gas if it supports .register pseudo.

--- gcc/config/sparc/sparc.h.jj	Mon Dec 13 19:16:16 1999
+++ gcc/config/sparc/sparc.h	Mon Dec 13 23:12:17 1999
@@ -309,7 +309,11 @@ Unrecognized value in TARGET_CPU_DEFAULT
    This is what GAS uses.  Add %(asm_arch) to ASM_SPEC to enable.  */
 
 #define ASM_ARCH32_SPEC "-32"
+#ifdef HAVE_AS_REGISTER_PSEUDO_OP
+#define ASM_ARCH64_SPEC "-64 -no-undeclared-regs"
+#else
 #define ASM_ARCH64_SPEC "-64"
+#endif
 #define ASM_ARCH_DEFAULT_SPEC \
 (DEFAULT_ARCH32_P ? ASM_ARCH32_SPEC : ASM_ARCH64_SPEC)
 
1999-12-13  Jakub Jelinek  <jakub@redhat.com>

	* config/tc-sparc.c (OPTION_UNDECLARED_REGS): New option.
	(md_parse_option): Handle it.
	(md_show_usage): Document it.
	
--- binutils/gas/config/tc-sparc.c.jj	Tue Nov 30 11:31:11 1999
+++ binutils/gas/config/tc-sparc.c	Mon Dec 13 09:09:19 1999
@@ -413,6 +413,8 @@ struct option md_longopts[] = {
 #ifdef OBJ_ELF
 #define OPTION_NO_UNDECLARED_REGS (OPTION_MD_BASE + 12)
   {"no-undeclared-regs", no_argument, NULL, OPTION_NO_UNDECLARED_REGS},
+#define OPTION_UNDECLARED_REGS (OPTION_MD_BASE + 13)
+  {"undeclared-regs", no_argument, NULL, OPTION_UNDECLARED_REGS},
 #endif
   {NULL, no_argument, NULL, 0}
 };
@@ -568,6 +570,10 @@ md_parse_option (c, arg)
     case OPTION_NO_UNDECLARED_REGS:
       no_undeclared_regs = 1;
       break;
+
+    case OPTION_UNDECLARED_REGS:
+      no_undeclared_regs = 0;
+      break;
 #endif
 
     default:
@@ -621,6 +627,10 @@ md_show_usage (stream)
   fprintf (stream, _("\
 -KPIC			generate PIC\n\
 -V			print assembler version number\n\
+-undeclared-regs	ignore application global register usage without\n\
+			appropriate .register directive (default)\n\
+-no-undeclared-regs	force error on application global register usage\n\
+			without appropriate .register directive\n\
 -q			ignored\n\
 -Qy, -Qn		ignored\n\
 -s			ignored\n"));

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