Source-Changes-HG archive

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

[src/trunk]: src/sys/rump Use linker script to make __start/stop_link_set_mod...



details:   https://anonhg.NetBSD.org/src/rev/22b43d84b6c1
branches:  trunk
changeset: 749913:22b43d84b6c1
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sat Dec 12 17:10:19 2009 +0000

description:
Use linker script to make __start/stop_link_set_modules be present
in libs built with binutils >=2.19.  This is a less error-prone
method than the previous where components had to be tagged in the
Makefile as modules (and if they weren't, things broke.  and vice
versa).

diffstat:

 sys/rump/Makefile.rump              |  12 ++----------
 sys/rump/fs/lib/Makefile.inc        |   3 +--
 sys/rump/ldscript.rump              |  28 ++++++++++++++++++++++++++++
 sys/rump/librump/rump_domain.c      |  14 --------------
 sys/rump/librump/rump_module.c      |  14 --------------
 sys/rump/net/lib/liblocal/Makefile  |   4 +---
 sys/rump/net/lib/libnet/Makefile    |   4 +---
 sys/rump/net/lib/libsockin/Makefile |   4 +---
 8 files changed, 34 insertions(+), 49 deletions(-)

diffs (165 lines):

diff -r 1e59fcd06d42 -r 22b43d84b6c1 sys/rump/Makefile.rump
--- a/sys/rump/Makefile.rump    Sat Dec 12 17:03:19 2009 +0000
+++ b/sys/rump/Makefile.rump    Sat Dec 12 17:10:19 2009 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.rump,v 1.44 2009/11/27 13:36:30 pooka Exp $
+#      $NetBSD: Makefile.rump,v 1.45 2009/12/12 17:10:19 pooka Exp $
 #
 
 WARNS?=                3       # XXX: src/sys won't compile with -Wsign-compare yet
@@ -24,6 +24,7 @@
 CPPFLAGS+=     -I${RUMPTOP}/include
 CPPFLAGS+=     -I${RUMPTOP}/librump/rumpkern/opt
 CPPFLAGS+=     -nostdinc -I${RUMPTOP}/..
+LDFLAGS+=      -T ${RUMPTOP}/ldscript.rump
 #CPPFLAGS+=    -DDEBUG
 
 # kernel libs should not get linked against libc
@@ -45,15 +46,6 @@
 # If this file changes, we need a full rebuild
 DPSRCS+=       ${RUMPTOP}/Makefile.rump
 
-.ifdef RUMP_ISMODULE
-.PATH:         ${RUMPTOP}/librump
-SRCS+=         rump_module.c
-.endif
-.ifdef RUMP_ISDOMAIN
-.PATH:         ${RUMPTOP}/librump
-SRCS+=         rump_domain.c
-.endif
-
 #
 # Rename library symbols before use.  If a symbol does not already belong
 # to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns".  This
diff -r 1e59fcd06d42 -r 22b43d84b6c1 sys/rump/fs/lib/Makefile.inc
--- a/sys/rump/fs/lib/Makefile.inc      Sat Dec 12 17:03:19 2009 +0000
+++ b/sys/rump/fs/lib/Makefile.inc      Sat Dec 12 17:10:19 2009 +0000
@@ -1,7 +1,6 @@
-#      $NetBSD: Makefile.inc,v 1.13 2009/09/13 22:51:41 pooka Exp $
+#      $NetBSD: Makefile.inc,v 1.14 2009/12/12 17:10:19 pooka Exp $
 #
 
 RUMPTOP=       ${.CURDIR}/../../..
-RUMP_ISMODULE= # defined
 
 .include "${RUMPTOP}/Makefile.rump"
diff -r 1e59fcd06d42 -r 22b43d84b6c1 sys/rump/ldscript.rump
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/ldscript.rump    Sat Dec 12 17:10:19 2009 +0000
@@ -0,0 +1,28 @@
+/*     $NetBSD: ldscript.rump,v 1.1 2009/12/12 17:10:19 pooka Exp $    */
+
+/*
+ * From binutils 2.19 onwards (in NetBSD) binutils ld PROVIDEs
+ * __start/__stop for orphaned sections.  This means that
+ * __start_link_set_modules/__stop_link_set_modules will no
+ * longer automatically be present in shared libraries.  This
+ * ldscript forces those symbols to be present for all rump
+ * shared lib components.
+ */
+
+SECTIONS
+{
+       link_set_modules :
+       {
+               __start_link_set_modules = .;
+               *(link_set_modules);
+               __stop_link_set_modules = .;
+       }
+
+       link_set_domains :
+       {
+               __start_link_set_domains = .;
+               *(link_set_domains);
+               __stop_link_set_domains = .;
+       }
+}
+INSERT AFTER .data;
diff -r 1e59fcd06d42 -r 22b43d84b6c1 sys/rump/librump/rump_domain.c
--- a/sys/rump/librump/rump_domain.c    Sat Dec 12 17:03:19 2009 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-/*     $NetBSD: rump_domain.c,v 1.1 2009/09/13 22:51:42 pooka Exp $    */
-
-/*
- * Force reference to __start_link_set_domains, so that the
- * binutils 2.19 linker does not lose the symbol due to it being
- * PROVIDEd in 2.19 as opposed to earlier versions where it was
- * defined.
- *
- * Note: look into this again when all platforms use 2.19
- */
-extern void *__start_link_set_domains;
-void *rump_start_domains = &__start_link_set_domains;
-extern void *__stop_link_set_domains;
-void *rump_stop_domains = &__stop_link_set_domains;
diff -r 1e59fcd06d42 -r 22b43d84b6c1 sys/rump/librump/rump_module.c
--- a/sys/rump/librump/rump_module.c    Sat Dec 12 17:03:19 2009 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-/*     $NetBSD: rump_module.c,v 1.1 2009/09/13 22:51:42 pooka Exp $    */
-
-/*
- * Force reference to __start_link_set_modules, so that the
- * binutils 2.19 linker does not lose the symbol due to it being
- * PROVIDEd in 2.19 as opposed to earlier versions where it was
- * defined.
- *
- * Note: look into this again when all platforms use 2.19
- */
-extern void *__start_link_set_modules;
-void *rump_start_modules = &__start_link_set_modules;
-extern void *__stop_link_set_modules;
-void *rump_stop_modules = &__stop_link_set_modules;
diff -r 1e59fcd06d42 -r 22b43d84b6c1 sys/rump/net/lib/liblocal/Makefile
--- a/sys/rump/net/lib/liblocal/Makefile        Sat Dec 12 17:03:19 2009 +0000
+++ b/sys/rump/net/lib/liblocal/Makefile        Sat Dec 12 17:10:19 2009 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.3 2009/09/13 22:51:42 pooka Exp $
+#      $NetBSD: Makefile,v 1.4 2009/12/12 17:10:19 pooka Exp $
 #
 
 .PATH: ${.CURDIR}/../../../../kern
@@ -10,7 +10,5 @@
 
 CFLAGS+= -Wno-pointer-sign
 
-RUMP_ISDOMAIN=
-
 .include <bsd.lib.mk>
 .include <bsd.klinks.mk>
diff -r 1e59fcd06d42 -r 22b43d84b6c1 sys/rump/net/lib/libnet/Makefile
--- a/sys/rump/net/lib/libnet/Makefile  Sat Dec 12 17:03:19 2009 +0000
+++ b/sys/rump/net/lib/libnet/Makefile  Sat Dec 12 17:10:19 2009 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.6 2009/09/13 22:51:42 pooka Exp $
+#      $NetBSD: Makefile,v 1.7 2009/12/12 17:10:19 pooka Exp $
 #
 
 .PATH: ${.CURDIR}/../../../../net
@@ -12,8 +12,6 @@
 
 CPPFLAGS+=     -I${.CURDIR}/opt -I${.CURDIR}/../libnetinet/opt
 
-RUMP_ISDOMAIN=
-
 .include "${.CURDIR}/../libnetinet/Makefile.inc"
 
 .include <bsd.lib.mk>
diff -r 1e59fcd06d42 -r 22b43d84b6c1 sys/rump/net/lib/libsockin/Makefile
--- a/sys/rump/net/lib/libsockin/Makefile       Sat Dec 12 17:03:19 2009 +0000
+++ b/sys/rump/net/lib/libsockin/Makefile       Sat Dec 12 17:10:19 2009 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.4 2009/09/13 22:51:42 pooka Exp $
+#      $NetBSD: Makefile,v 1.5 2009/12/12 17:10:20 pooka Exp $
 #
 
 LIB=   rumpnet_sockin
@@ -8,7 +8,5 @@
 
 CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern
 
-RUMP_ISDOMAIN=
-
 .include <bsd.lib.mk>
 .include <bsd.klinks.mk>



Home | Main Index | Thread Index | Old Index