Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Ensure that symbols are aliased to standard names when



details:   https://anonhg.NetBSD.org/src/rev/dbd004094142
branches:  trunk
changeset: 330847:dbd004094142
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Jul 24 11:58:45 2014 +0000

description:
Ensure that symbols are aliased to standard names when
using RUMP_KERNEL_IS_LIBC.

For example configure scripts do not always include headers, and if select
is visible as a __RENAME'd __select50 instead of select, configure will
not find it.

before:
=== snip ===
checking for gethostbyname... yes
checking for socket... no
checking for socket in -lsocket... no
=== snip ===

after:
=== snip ===
checking for gethostbyname... yes
checking for socket... yes
checking for main in -linet6... no
=== snip ===

Another option would be to enable the libc compat bits, and it probably
will be done at some point, but this is easier and more self-contained
for now.

diffstat:

 sys/kern/makesyscalls.sh |  46 +++++++++++++++++++++++++++++++++++-----------
 1 files changed, 35 insertions(+), 11 deletions(-)

diffs (82 lines):

diff -r 38ec711b4bea -r dbd004094142 sys/kern/makesyscalls.sh
--- a/sys/kern/makesyscalls.sh  Thu Jul 24 09:39:58 2014 +0000
+++ b/sys/kern/makesyscalls.sh  Thu Jul 24 11:58:45 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: makesyscalls.sh,v 1.144 2014/07/23 11:41:34 pooka Exp $
+#      $NetBSD: makesyscalls.sh,v 1.145 2014/07/24 11:58:45 pooka Exp $
 #
 # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
 # All rights reserved.
@@ -254,12 +254,9 @@
            > rumpcalls
        printf "#endif\n\n" > rumpcalls
 
-       printf "#ifdef RUMP_KERNEL_IS_LIBC\n" > rumpcalls
-       printf "#define rsys_aliases(what,where) \\\n" > rumpcalls
-       printf "\t__weak_alias(what,where); \\\n" > rumpcalls
-       printf "\t__weak_alias(_##what,where); \\\n" > rumpcalls
-       printf "\t__strong_alias(_sys_##what,where);\n" > rumpcalls
-       printf "#else\n#define rsys_aliases(a,b)\n#endif\n\n" > rumpcalls
+       printf "#ifndef RUMP_KERNEL_IS_LIBC\n" > rumpcalls
+       printf "#define RUMP_SYS_COMPAT\n" > rumpcalls
+       printf "#endif\n\n" > rumpcalls
 
        printf "#if\tBYTE_ORDER == BIG_ENDIAN\n" > rumpcalls
        printf "#define SPARG(p,k)\t((p)->k.be.datum)\n" > rumpcalls
@@ -795,8 +792,13 @@
 
        printrumpsysmap(syscall, wfn, funcalias, "rump___sysimpl_" rumpfname)
 
+       printf("\n") > rumpcalls
+
+       if (compatwrap)
+               printf("#ifdef RUMP_SYS_COMPAT\n") > rumpcalls
+
        # need a local prototype, we export the re-re-named one in .h
-       printf("\n%s rump___sysimpl_%s(", returntype, rumpfname) \
+       printf("%s rump___sysimpl_%s(", returntype, rumpfname) \
            > rumpcalls
        for (i = 1; i < argc; i++) {
                if (argname[i] != "PAD")
@@ -874,8 +876,26 @@
                printf("\treturn rv;\n") > rumpcalls
        }
        printf("}\n") > rumpcalls
-       printf("rsys_aliases(%s%s,rump___sysimpl_%s);\n", \
-           compatwrap_, funcalias, rumpfname) > rumpcalls
+
+       printf("#ifdef RUMP_KERNEL_IS_LIBC\n") > rumpcalls
+
+       # create the bog-standard, non-renamed public name.
+       # this way we get e.g. select instead of just __select50
+       if (fcompat)
+               printf("__weak_alias(%s,rump___sysimpl_%s);\n", \
+                   fbase, rumpfname) > rumpcalls
+
+       printf("__weak_alias(%s,rump___sysimpl_%s);\n", \
+           funcalias, rumpfname) > rumpcalls
+       printf("__weak_alias(_%s,rump___sysimpl_%s);\n", \
+           funcalias, rumpfname) > rumpcalls
+       printf("__strong_alias(_sys_%s,rump___sysimpl_%s);\n", \
+           funcalias, rumpfname) >rumpcalls
+
+       printf("#endif /* RUMP_KERNEL_IS_LIBC */\n") > rumpcalls
+
+       if (compatwrap)
+               printf("#endif /* RUMP_SYS_COMPAT */\n") > rumpcalls
 
 }
 $2 == "STD" || $2 == "NODEF" || $2 == "NOARGS" || $2 == "INDIR" \
@@ -946,7 +966,11 @@
                printf("\t} else {\n\t\tfd[0] = retval[0];\n") > rumpcalls
                printf("\t\tfd[1] = retval[1];\n\t}\n") > rumpcalls
                printf("\treturn error ? -1 : 0;\n}\n") > rumpcalls
-               printf "rsys_aliases(pipe,rump_sys_pipe);\n" > rumpcalls
+               printf("#ifdef RUMP_KERNEL_IS_LIBC\n") > rumpcalls
+               printf("__weak_alias(pipe,rump_sys_pipe);\n") > rumpcalls
+               printf("__weak_alias(_pipe,rump_sys_pipe);\n") > rumpcalls
+               printf("__strong_alias(_sys_pipe,rump_sys_pipe);\n") > rumpcalls
+               printf("#endif\n") > rumpcalls
        }
 
        # print default rump syscall interfaces



Home | Main Index | Thread Index | Old Index