summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-06-18 18:35:04 +0000
committerpeter <peter@FreeBSD.org>1998-06-18 18:35:04 +0000
commit1ae078b0a3c081ef8dd3be3fda4723d7df1f700e (patch)
treec72d84d8ad85ab40359ec773fa34ee0e40c7dd39 /sys
parent3c6f0bafac37c5eba6dcd3fe8bf43d77e6a83bae (diff)
downloadFreeBSD-src-1ae078b0a3c081ef8dd3be3fda4723d7df1f700e.zip
FreeBSD-src-1ae078b0a3c081ef8dd3be3fda4723d7df1f700e.tar.gz
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.
Diffstat (limited to 'sys')
-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 5640fde..9574779 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
OpenPOWER on IntegriCloud