From a6f7e0c05a63a1d1c15da12e9641877aa1c4768e Mon Sep 17 00:00:00 2001 From: thorpej Date: Wed, 2 Dec 1998 00:58:42 +0000 Subject: [PATCH] Implement WARN_REFERENCES(). --- sys/arch/alpha/include/asm.h | 16 +++++++++++++++- sys/arch/arm32/include/asm.h | 13 ++++++++++++- sys/arch/i386/include/asm.h | 13 ++++++++++++- sys/arch/m68k/include/asm.h | 13 ++++++++++++- sys/arch/mips/include/asm.h | 16 +++++++++++++++- sys/arch/pc532/include/asm.h | 13 ++++++++++++- sys/arch/powerpc/include/asm.h | 10 +++++++++- sys/arch/sparc/include/asm.h | 13 ++++++++++++- sys/arch/sparc64/include/asm.h | 26 +++++++++++++++++++++++++- sys/arch/vax/include/asm.h | 13 ++++++++++++- 10 files changed, 136 insertions(+), 10 deletions(-) diff --git a/sys/arch/alpha/include/asm.h b/sys/arch/alpha/include/asm.h index 404be719ae97..b803d7cbd1bb 100644 --- a/sys/arch/alpha/include/asm.h +++ b/sys/arch/alpha/include/asm.h @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.21 1998/10/13 11:39:26 kleink Exp $ */ +/* $NetBSD: asm.h,v 1.22 1998/12/02 00:58:42 thorpej Exp $ */ /* * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University @@ -621,6 +621,20 @@ label: ASCIZ msg; \ #endif #endif +/* + * WARN_REFERENCES: create a warning if the specified symbol is referenced + * (ELF only). + */ +#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__ */ +#endif /* __ELF__ */ + /* * Kernel RCS ID tag and copyright macros */ diff --git a/sys/arch/arm32/include/asm.h b/sys/arch/arm32/include/asm.h index 693528413fe9..22145dfdfd6d 100644 --- a/sys/arch/arm32/include/asm.h +++ b/sys/arch/arm32/include/asm.h @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.9 1998/04/01 22:50:22 mark Exp $ */ +/* $NetBSD: asm.h,v 1.10 1998/12/02 00:58:42 thorpej Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -84,4 +84,15 @@ #define RCSID(x) .text; .asciz x +#ifdef __STDC__ +#define WARN_REFERENCES(sym,msg) \ + .stabs \" ## msg ## \",30,0,0,0 ; \ + .stabs \"_ ## sym ## \",1,0,0,0 +#else +#define WARN_REFERENCES_STRING(x) "x" +#define WARN_REFERENCES(sym,msg) \ + .stabs msg,30,0,0,0 ; \ + .stabs WARN_REFERENCES_STRING(_/**/sym),1,0,0,0 +#endif /* __STDC__ */ + #endif /* !_ARM_ASM_H_ */ diff --git a/sys/arch/i386/include/asm.h b/sys/arch/i386/include/asm.h index 210315697d67..dce54787ed35 100644 --- a/sys/arch/i386/include/asm.h +++ b/sys/arch/i386/include/asm.h @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.10 1997/07/05 20:49:19 thorpej Exp $ */ +/* $NetBSD: asm.h,v 1.11 1998/12/02 00:58:43 thorpej Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -93,4 +93,15 @@ #define RCSID(x) .text; .asciz x +#ifdef __STDC__ +#define WARN_REFERENCES(sym,msg) \ + .stabs \" ## msg ## \",30,0,0,0 ; \ + .stabs \"_ ## sym ## \",1,0,0,0 +#else +#define WARN_REFERENCES_STRING(x) "x" +#define WARN_REFERENCES(sym,msg) \ + .stabs msg,30,0,0,0 ; \ + .stabs WARN_REFERENCES_STRING(_/**/sym),1,0,0,0 +#endif /* __STDC__ */ + #endif /* !_I386_ASM_H_ */ diff --git a/sys/arch/m68k/include/asm.h b/sys/arch/m68k/include/asm.h index 5db3cc2f078d..236ac0de5740 100644 --- a/sys/arch/m68k/include/asm.h +++ b/sys/arch/m68k/include/asm.h @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.15 1997/10/04 17:34:08 thorpej Exp $ */ +/* $NetBSD: asm.h,v 1.16 1998/12/02 00:58:43 thorpej Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -180,4 +180,15 @@ #endif /* _KERNEL */ +#ifdef __STDC__ +#define WARN_REFERENCES(sym,msg) \ + .stabs \" ## msg ## \",30,0,0,0 ; \ + .stabs \"_ ## sym ## \",1,0,0,0 +#else +#define WARN_REFERENCES_STRING(x) "x" +#define WARN_REFERENCES(sym,msg) \ + .stabs msg,30,0,0,0 ; \ + .stabs WARN_REFERENCES_STRING(_/**/sym),1,0,0,0 +#endif /* __STDC__ */ + #endif /* _ASM_H_ */ diff --git a/sys/arch/mips/include/asm.h b/sys/arch/mips/include/asm.h index a30446822cef..a4b4f6c7dc92 100644 --- a/sys/arch/mips/include/asm.h +++ b/sys/arch/mips/include/asm.h @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.13 1997/07/20 09:47:03 jonathan Exp $ */ +/* $NetBSD: asm.h,v 1.14 1998/12/02 00:58:43 thorpej Exp $ */ /* * Copyright (c) 1992, 1993 @@ -92,6 +92,20 @@ # endif #endif +/* + * WARN_REFERENCES: create a warning if the specified symbol is referenced + * (ELF only, and thus, no leading underscores). + */ +#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__ */ +#endif /* __ELF__ */ + /* * LEAF(x) * diff --git a/sys/arch/pc532/include/asm.h b/sys/arch/pc532/include/asm.h index 34b1c4ec8dc0..23720abaaa72 100644 --- a/sys/arch/pc532/include/asm.h +++ b/sys/arch/pc532/include/asm.h @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.12 1998/04/03 23:01:37 matthias Exp $ */ +/* $NetBSD: asm.h,v 1.13 1998/12/02 00:58:43 thorpej Exp $ */ /* * Mach Operating System @@ -215,4 +215,15 @@ #endif +#ifdef __STDC__ +#define WARN_REFERENCES(sym,msg) \ + .stabs \" ## msg ## \",30,0,0,0 ; \ + .stabs \"_ ## sym ## \",1,0,0,0 +#else +#define WARN_REFERENCES_STRING(x) "x" +#define WARN_REFERENCES(sym,msg) \ + .stabs msg,30,0,0,0 ; \ + .stabs WARN_REFERENCES_STRING(_/**/sym),1,0,0,0 +#endif /* __STDC__ */ + #endif diff --git a/sys/arch/powerpc/include/asm.h b/sys/arch/powerpc/include/asm.h index 17d91e189b97..bad6d53fd81c 100644 --- a/sys/arch/powerpc/include/asm.h +++ b/sys/arch/powerpc/include/asm.h @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.4 1998/11/24 11:17:17 tsubai Exp $ */ +/* $NetBSD: asm.h,v 1.5 1998/12/02 00:58:43 thorpej Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -76,4 +76,12 @@ #define RCSID(x) .text; .asciz x +#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__ */ + #endif /* !_PPC_ASM_H_ */ diff --git a/sys/arch/sparc/include/asm.h b/sys/arch/sparc/include/asm.h index ba4af3bc97cb..ccd4952c8555 100644 --- a/sys/arch/sparc/include/asm.h +++ b/sys/arch/sparc/include/asm.h @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.7 1998/07/01 21:42:51 tv Exp $ */ +/* $NetBSD: asm.h,v 1.8 1998/12/02 00:58:43 thorpej Exp $ */ /* * Copyright (c) 1994 Allen Briggs @@ -105,4 +105,15 @@ #define RCSID(name) .asciz name +#ifdef __STDC__ +#define WARN_REFERENCES(sym,msg) \ + .stabs \" ## msg ## \",30,0,0,0 ; \ + .stabs \"_ ## sym ## \",1,0,0,0 +#else +#define WARN_REFERENCES_STRING(x) "x" +#define WARN_REFERENCES(sym,msg) \ + .stabs msg,30,0,0,0 ; \ + .stabs WARN_REFERENCES_STRING(_/**/sym),1,0,0,0 +#endif /* __STDC__ */ + #endif /* _ASM_H_ */ diff --git a/sys/arch/sparc64/include/asm.h b/sys/arch/sparc64/include/asm.h index d8f2033d728d..603be7331226 100644 --- a/sys/arch/sparc64/include/asm.h +++ b/sys/arch/sparc64/include/asm.h @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.5 1998/10/06 05:16:34 eeh Exp $ */ +/* $NetBSD: asm.h,v 1.6 1998/12/02 00:58:43 thorpej Exp $ */ /* * Copyright (c) 1994 Allen Briggs @@ -110,4 +110,28 @@ #define RCSID(name) .asciz name +/* + * 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 WARN_REFERENCES(sym,msg) \ + .stabs \" ## msg ## \",30,0,0,0 ; \ + .stabs \"_ ## sym ## \",1,0,0,0 +#else +#define WARN_REFERENCES_STRING(x) "x" +#define WARN_REFERENCES(sym,msg) \ + .stabs msg,30,0,0,0 ; \ + .stabs WARN_REFERENCES_STRING(_/**/sym),1,0,0,0 +#endif /* __STDC__ */ +#endif /* __ELF__ */ + #endif /* _ASM_H_ */ diff --git a/sys/arch/vax/include/asm.h b/sys/arch/vax/include/asm.h index 9ba564a9f78f..0bd8538a9e91 100644 --- a/sys/arch/vax/include/asm.h +++ b/sys/arch/vax/include/asm.h @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.6 1998/10/15 06:01:11 matt Exp $ */ +/* $NetBSD: asm.h,v 1.7 1998/12/02 00:58:43 thorpej Exp $ */ /* * Copyright (c) 1982, 1993 * The Regents of the University of California. All rights reserved. @@ -81,4 +81,15 @@ #endif #endif +#ifdef __STDC__ +#define WARN_REFERENCES(sym,msg) \ + .stabs \" ## msg ## \",30,0,0,0 ; \ + .stabs \"_ ## sym ## \",1,0,0,0 +#else +#define WARN_REFERENCES_STRING(x) "x" +#define WARN_REFERENCES(sym,msg) \ + .stabs msg,30,0,0,0 ; \ + .stabs WARN_REFERENCES_STRING(_/**/sym),1,0,0,0 +#endif /* __STDC__ */ + #endif