aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/cdefs.h
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1998-06-18 18:35:04 +0000
committerPeter Wemm <peter@FreeBSD.org>1998-06-18 18:35:04 +0000
commitcf6961e69688431a72224fdb5089e6cb6dcfaf44 (patch)
tree7a9835e459cf51ec58258831d387a38c62786d1f /sys/sys/cdefs.h
parent5a2ae61fecf7d89d4c66d46f5124b2662f0e59a2 (diff)
downloadsrc-cf6961e69688431a72224fdb5089e6cb6dcfaf44.tar.gz
src-cf6961e69688431a72224fdb5089e6cb6dcfaf44.zip
ELF versions of __warn_references() and __weak_reference(). Note that this
doesn't work with libc/net/res_stubs.c since gas wants the weak reference to take place in the same context as the real definition, presumably so that it can get hold of the symbol typing etc. However, this doesn't matter for libc/elf since we don't have binaries that use the old symbol names.
Notes
Notes: svn path=/head/; revision=37052
Diffstat (limited to 'sys/sys/cdefs.h')
-rw-r--r--sys/sys/cdefs.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 5640fdeb3793..9574779e7d8b 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)cdefs.h 8.8 (Berkeley) 1/9/95
- * $Id: cdefs.h,v 1.16 1998/05/28 18:04:34 dt Exp $
+ * $Id: cdefs.h,v 1.17 1998/06/14 13:40:01 bde Exp $
*/
#ifndef _SYS_CDEFS_H_
@@ -144,6 +143,25 @@
#endif
#ifdef __GNUC__
+#ifdef __ELF__
+#ifdef __STDC__
+#define __weak_reference(sym,alias) \
+ __asm__(".weak " #alias); \
+ __asm__(".set " #alias ", " #sym)
+#define __warn_references(sym,msg) \
+ __asm__(".section .gnu.warning." #sym); \
+ __asm__(".ascii \"" msg "\""); \
+ __asm__(".previous")
+#else
+#define __weak_reference(sym,alias) \
+ __asm__(".weak alias"); \
+ __asm__(".set alias, sym")
+#define __warn_references(sym,msg) \
+ __asm__(".section .gnu.warning.sym"); \
+ __asm__(".ascii \"msg\""); \
+ __asm__(".previous")
+#endif /* __STDC__ */
+#else /* !__ELF__ */
#ifdef __STDC__
#define __weak_reference(sym,alias) \
__asm__(".stabs \"_" #alias "\",11,0,0,0"); \
@@ -158,8 +176,9 @@
#define __warn_references(sym,msg) \
__asm__(".stabs msg,30,0,0,0"); \
__asm__(".stabs \"_/**/sym\",1,0,0,0")
-#endif
-#endif
+#endif /* __STDC__ */
+#endif /* __ELF__ */
+#endif /* __GNUC__ */
#define __IDSTRING(name,string) static const char name[] __unused = string