Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys Add macro to mark a symbol as weak. Use it to mark t...
details: https://anonhg.NetBSD.org/src/rev/8c0bef856822
branches: trunk
changeset: 334828:8c0bef856822
user: joerg <joerg%NetBSD.org@localhost>
date: Mon Dec 08 20:50:11 2014 +0000
description:
Add macro to mark a symbol as weak. Use it to mark the end of a linker
set as empty linker set otherwise violate the aliasing rules of C by
presenting zero sized objects.
diffstat:
sys/sys/cdefs_elf.h | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (31 lines):
diff -r 01088d876361 -r 8c0bef856822 sys/sys/cdefs_elf.h
--- a/sys/sys/cdefs_elf.h Mon Dec 08 20:44:59 2014 +0000
+++ b/sys/sys/cdefs_elf.h Mon Dec 08 20:50:11 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cdefs_elf.h,v 1.46 2014/08/26 09:03:17 christos Exp $ */
+/* $NetBSD: cdefs_elf.h,v 1.47 2014/12/08 20:50:11 joerg Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -65,6 +65,12 @@
__asm(".weak " _C_LABEL_STRING(#sym));
#if __GNUC_PREREQ__(4, 0)
+#define __weak __attribute__((__weak__))
+#else
+#define __weak
+#endif
+
+#if __GNUC_PREREQ__(4, 0)
#define __weak_reference(sym) __attribute__((__weakref__(#sym)))
#else
#define __weak_reference(sym) ; __asm(".weak " _C_LABEL_STRING(#sym))
@@ -169,7 +175,7 @@
#define __link_set_decl(set, ptype) \
extern ptype * const __link_set_start(set)[] __dso_hidden; \
- extern ptype * const __link_set_end(set)[] __dso_hidden
+ extern ptype * const __link_set_end(set)[] __weak __dso_hidden
#define __link_set_count(set) \
(__link_set_end(set) - __link_set_start(set))
Home |
Main Index |
Thread Index |
Old Index