tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Consistent WARN_REFERENCES for assembler



Hi all,
unless there are objections, I am going to commit the attached patch
soon. It replaces the use of stabs for WARN_REFERENCES in assembler code
with the modernish .gnu.warning sections. Platforms that already used
this now consistently use .pushsection / .popsection.

Joerg
Index: alpha/include/asm.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/alpha/include/asm.h,v
retrieving revision 1.30
diff -u -p -r1.30 asm.h
--- alpha/include/asm.h 9 Feb 2007 21:55:01 -0000       1.30
+++ alpha/include/asm.h 19 Dec 2010 20:23:23 -0000
@@ -628,11 +628,15 @@ label:    ASCIZ msg;                                      
        \
  * WARN_REFERENCES: create a warning if the specified symbol is referenced.
  */
 #ifdef __STDC__
-#define        WARN_REFERENCES(_sym,_msg)                              \
-       .section .gnu.warning. ## _sym ; .ascii _msg ; .text
+#define        WARN_REFERENCES(sym,msg)                                        
\
+       .pushsection .gnu.warning. ## sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #else
-#define        WARN_REFERENCES(_sym,_msg)                              \
-       .section .gnu.warning./**/_sym ; .ascii _msg ; .text
+#define        WARN_REFERENCES(sym,msg)                                        
\
+       .pushsection .gnu.warning./**/sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #endif /* __STDC__ */
 
 /*
Index: amd64/include/asm.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/amd64/include/asm.h,v
retrieving revision 1.13
diff -u -p -r1.13 asm.h
--- amd64/include/asm.h 26 Oct 2008 00:08:15 -0000      1.13
+++ amd64/include/asm.h 19 Dec 2010 20:18:09 -0000
@@ -119,15 +119,16 @@
        .globl alias;                                                   \
        alias = sym
 
-/* XXXfvdl do not use stabs here */
 #ifdef __STDC__
 #define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg ## ,30,0,0,0 ;                                       \
-       .stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
+       .pushsection .gnu.warning. ## sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #else
 #define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg,30,0,0,0 ;                                           \
-       .stabs __STRING(sym),1,0,0,0
+       .pushsection .gnu.warning./**/sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #endif /* __STDC__ */
 
 #else  /*      __x86_64__      */
Index: arm/include/asm.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/arm/include/asm.h,v
retrieving revision 1.12
diff -u -p -r1.12 asm.h
--- arm/include/asm.h   29 Aug 2008 19:00:25 -0000      1.12
+++ arm/include/asm.h   19 Dec 2010 20:21:22 -0000
@@ -139,9 +139,17 @@
        .globl alias;                                                   \
        alias = sym
 
+#ifdef __STDC__
 #define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg,30,0,0,0 ;                                           \
-       .stabs __STRING(_C_LABEL(sym)),1,0,0,0
+       .pushsection .gnu.warning. ## sym;                              \
+       .ascii msg;                                                     \
+       .popsection
+#else
+#define        WARN_REFERENCES(sym,msg)                                        
\
+       .pushsection .gnu.warning./**/sym;                              \
+       .ascii msg;                                                     \
+       .popsection
+#endif /* __STDC__ */
 
 #ifdef __thumb__
 # define XPUSH         push
Index: hppa/include/asm.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/hppa/include/asm.h,v
retrieving revision 1.11
diff -u -p -r1.11 asm.h
--- hppa/include/asm.h  8 Mar 2010 07:42:46 -0000       1.11
+++ hppa/include/asm.h  19 Dec 2010 20:17:18 -0000
@@ -135,13 +135,15 @@
 
 #ifdef __STDC__
 #define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg ## ,30,0,0,0 ;                                       \
-       .stabs __STRING(sym) ## ,1,0,0,0
+       .pushsection .gnu.warning. ## sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #else
 #define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg,30,0,0,0 ;                                           \
-       .stabs __STRING(sym),1,0,0,0
-#endif
+       .pushsection .gnu.warning./**/sym;                              \
+       .ascii msg;                                                     \
+       .popsection
+#endif /* __STDC__ */
 
 #define        BSS(n,s)        .comm n, s
 #define        SZREG   4
Index: i386/include/asm.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/i386/include/asm.h,v
retrieving revision 1.38
diff -u -p -r1.38 asm.h
--- i386/include/asm.h  3 May 2008 05:54:52 -0000       1.38
+++ i386/include/asm.h  19 Dec 2010 20:01:14 -0000
@@ -205,16 +205,14 @@
 
 #ifdef __STDC__
 #define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg ## ,30,0,0,0 ;                                       \
-       .stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
-#elif defined(__ELF__)
-#define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg,30,0,0,0 ;                                           \
-       .stabs __STRING(sym),1,0,0,0
+       .pushsection .gnu.warning. ## sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #else
 #define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg,30,0,0,0 ;                                           \
-       .stabs __STRING(_/**/sym),1,0,0,0
+       .pushsection .gnu.warning./**/sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #endif /* __STDC__ */
 
 #endif /* !_I386_ASM_H_ */
Index: m68k/include/asm.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/m68k/include/asm.h,v
retrieving revision 1.25
diff -u -p -r1.25 asm.h
--- m68k/include/asm.h  28 Apr 2008 20:23:26 -0000      1.25
+++ m68k/include/asm.h  19 Dec 2010 20:16:06 -0000
@@ -206,15 +206,15 @@
        alias = sym
 
 #ifdef __STDC__
-#define        __STRING(x)                     #x
 #define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg ## ,30,0,0,0 ;                                       \
-       .stabs __STRING(_ ## sym) ## ,1,0,0,0
+       .pushsection .gnu.warning. ## sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #else
-#define        __STRING(x)                     "x"
 #define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg,30,0,0,0 ;                                           \
-       .stabs __STRING(_/**/sym),1,0,0,0
+       .pushsection .gnu.warning./**/sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #endif /* __STDC__ */
 
 /*
Index: mips/include/asm.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/mips/include/asm.h,v
retrieving revision 1.42
diff -u -p -r1.42 asm.h
--- mips/include/asm.h  7 Jul 2010 01:19:09 -0000       1.42
+++ mips/include/asm.h  19 Dec 2010 20:21:08 -0000
@@ -118,11 +118,15 @@
  * WARN_REFERENCES: create a warning if the specified symbol is referenced.
  */
 #ifdef __STDC__
-#define        WARN_REFERENCES(_sym,_msg)                              \
-       .section .gnu.warning. ## _sym ; .ascii _msg ; .text
+#define        WARN_REFERENCES(sym,msg)                                        
\
+       .pushsection .gnu.warning. ## sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #else
-#define        WARN_REFERENCES(_sym,_msg)                              \
-       .section .gnu.warning./**/_sym ; .ascii _msg ; .text
+#define        WARN_REFERENCES(sym,msg)                                        
\
+       .pushsection .gnu.warning./**/sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #endif /* __STDC__ */
 
 /*
Index: powerpc/include/asm.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/powerpc/include/asm.h,v
retrieving revision 1.29
diff -u -p -r1.29 asm.h
--- powerpc/include/asm.h       9 Mar 2010 22:36:41 -0000       1.29
+++ powerpc/include/asm.h       19 Dec 2010 20:20:57 -0000
@@ -138,11 +138,15 @@ y:        .quad   .y,.TOC.@tocbase,0;     \
        alias = sym
 
 #ifdef __STDC__
-#define        WARN_REFERENCES(_sym,_msg)                              \
-       .section .gnu.warning. ## _sym ; .ascii _msg ; .text
+#define        WARN_REFERENCES(sym,msg)                                        
\
+       .pushsection .gnu.warning. ## sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #else
-#define        WARN_REFERENCES(_sym,_msg)                              \
-       .section .gnu.warning./**/_sym ; .ascii _msg ; .text
+#define        WARN_REFERENCES(sym,msg)                                        
\
+       .pushsection .gnu.warning./**/sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #endif /* __STDC__ */
 
 #ifdef _KERNEL
Index: sh3/include/asm.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/sh3/include/asm.h,v
retrieving revision 1.26
diff -u -p -r1.26 asm.h
--- sh3/include/asm.h   19 Sep 2008 03:02:35 -0000      1.26
+++ sh3/include/asm.h   19 Dec 2010 20:18:39 -0000
@@ -227,7 +227,16 @@
        .globl _C_LABEL(alias);                                         \
        _C_LABEL(alias) = _C_LABEL(sym)
 
-#define        WARN_REFERENCES(_sym,_msg)                              \
-       .section .gnu.warning._sym; .ascii _msg; .previous
+#ifdef __STDC__
+#define        WARN_REFERENCES(sym,msg)                                        
\
+       .pushsection .gnu.warning. ## sym;                              \
+       .ascii msg;                                                     \
+       .popsection
+#else
+#define        WARN_REFERENCES(sym,msg)                                        
\
+       .pushsection .gnu.warning./**/sym;                              \
+       .ascii msg;                                                     \
+       .popsection
+#endif /* __STDC__ */
 
 #endif /* !_SH3_ASM_H_ */
Index: sparc/include/asm.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/sparc/include/asm.h,v
retrieving revision 1.16
diff -u -p -r1.16 asm.h
--- sparc/include/asm.h 20 Jan 2006 22:02:40 -0000      1.16
+++ sparc/include/asm.h 19 Dec 2010 20:19:35 -0000
@@ -183,26 +183,16 @@
 /*
  * WARN_REFERENCES: create a warning if the specified symbol is referenced.
  */
-#ifdef __ELF__
 #ifdef __STDC__
-#define        WARN_REFERENCES(_sym,_msg)                              \
-       .section .gnu.warning. ## _sym ; .ascii _msg ; .text
-#else
-#define        WARN_REFERENCES(_sym,_msg)                              \
-       .section .gnu.warning./**/_sym ; .ascii _msg ; .text
-#endif /* __STDC__ */
-#else
-#ifdef __STDC__
-#define        __STRING(x)                     #x
 #define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg ## ,30,0,0,0 ;                                       \
-       .stabs __STRING(_ ## sym) ## ,1,0,0,0
+       .pushsection .gnu.warning. ## sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #else
-#define        __STRING(x)                     "x"
 #define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg,30,0,0,0 ;                                           \
-       .stabs __STRING(_/**/sym),1,0,0,0
+       .pushsection .gnu.warning./**/sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #endif /* __STDC__ */
-#endif /* __ELF__ */
 
 #endif /* _ASM_H_ */
Index: vax/include/asm.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/arch/vax/include/asm.h,v
retrieving revision 1.21
diff -u -p -r1.21 asm.h
--- vax/include/asm.h   31 Aug 2008 23:23:42 -0000      1.21
+++ vax/include/asm.h   19 Dec 2010 20:21:51 -0000
@@ -94,12 +94,14 @@
 
 #ifdef __STDC__
 #define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg ## ,30,0,0,0 ;                                       \
-       .stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
+       .pushsection .gnu.warning. ## sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #else
 #define        WARN_REFERENCES(sym,msg)                                        
\
-       .stabs msg,30,0,0,0 ;                                           \
-       .stabs __STRING(_C_LABEL(sym)),1,0,0,0
+       .pushsection .gnu.warning./**/sym;                              \
+       .ascii msg;                                                     \
+       .popsection
 #endif /* __STDC__ */
 
 #endif /* !_VAX_ASM_H_ */


Home | Main Index | Thread Index | Old Index