| @@ -1,260 +1,262 @@ | | | @@ -1,260 +1,262 @@ |
1 | # $NetBSD: Makefile.rump,v 1.125 2020/02/20 22:52:10 joerg Exp $ | | 1 | # $NetBSD: Makefile.rump,v 1.126 2020/03/09 00:03:00 kamil Exp $ |
2 | # | | 2 | # |
3 | | | 3 | |
4 | .if !defined(_RUMP_MK) | | 4 | .if !defined(_RUMP_MK) |
5 | _RUMP_MK= #defined | | 5 | _RUMP_MK= #defined |
6 | | | 6 | |
7 | WARNS?= 3 # XXX: src/sys won't compile with -Wsign-compare yet | | 7 | WARNS?= 3 # XXX: src/sys won't compile with -Wsign-compare yet |
8 | NOLINT= # kernel code | | 8 | NOLINT= # kernel code |
9 | | | 9 | |
10 | .include <bsd.own.mk> | | 10 | .include <bsd.own.mk> |
11 | | | 11 | |
12 | # Use NetBSD kernel ABI by default on x86 archs. Performance-related | | 12 | # Use NetBSD kernel ABI by default on x86 archs. Performance-related |
13 | # compile-time options may override this at a later date. | | 13 | # compile-time options may override this at a later date. |
14 | .if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") | | 14 | .if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") |
15 | _RUMP_NATIVEABI= yes | | 15 | _RUMP_NATIVEABI= yes |
16 | .else | | 16 | .else |
17 | _RUMP_NATIVEABI= no | | 17 | _RUMP_NATIVEABI= no |
18 | CPPFLAGS:= -I${RUMPTOP}/include ${CPPFLAGS} | | 18 | CPPFLAGS:= -I${RUMPTOP}/include ${CPPFLAGS} |
19 | CPPFLAGS+= -D_RUMPKERNEL -I${RUMPTOP}/librump/rumpkern | | 19 | CPPFLAGS+= -D_RUMPKERNEL -I${RUMPTOP}/librump/rumpkern |
20 | .endif | | 20 | .endif |
21 | | | 21 | |
22 | # We are compiling the kernel code with no-delete-null-pointer-checks, | | 22 | # We are compiling the kernel code with no-delete-null-pointer-checks, |
23 | # and compiling without it, causes issues at least on sh3 by adding | | 23 | # and compiling without it, causes issues at least on sh3 by adding |
24 | # aborts after kern_assert on NULL pointer checks. | | 24 | # aborts after kern_assert on NULL pointer checks. |
25 | CFLAGS+= ${${ACTIVE_CC} == "gcc":? -fno-delete-null-pointer-checks :} | | 25 | # no-delete-null-pointer-checks is required in Clang/LLVM at least for |
| | | 26 | # NULL + 0 operations that trigger LLVM UBSan and could be miscompiled. |
| | | 27 | CFLAGS+= -fno-delete-null-pointer-checks |
26 | | | 28 | |
27 | # Define baseline cpu for mips ports, required for | | 29 | # Define baseline cpu for mips ports, required for |
28 | # rumpcomp_sync_icache() hypercall. | | 30 | # rumpcomp_sync_icache() hypercall. |
29 | .if !empty(MACHINE_ARCH:Mmips*) | | 31 | .if !empty(MACHINE_ARCH:Mmips*) |
30 | .if !empty(MACHINE_ARCH:Mmips64*) | | 32 | .if !empty(MACHINE_ARCH:Mmips64*) |
31 | CPPFLAGS+= -DMIPS64=1 | | 33 | CPPFLAGS+= -DMIPS64=1 |
32 | .else | | 34 | .else |
33 | CPPFLAGS+= -DMIPS1=1 | | 35 | CPPFLAGS+= -DMIPS1=1 |
34 | .endif | | 36 | .endif |
35 | .endif | | 37 | .endif |
36 | | | 38 | |
37 | # which NetBSD compat to build | | 39 | # which NetBSD compat to build |
38 | RUMP_NBCOMPAT?=default | | 40 | RUMP_NBCOMPAT?=default |
39 | .if ${RUMP_NBCOMPAT} == "all" || ${RUMP_NBCOMPAT} == "default" | | 41 | .if ${RUMP_NBCOMPAT} == "all" || ${RUMP_NBCOMPAT} == "default" |
40 | RUMP_NBCOMPAT= 50 60 70 80 | | 42 | RUMP_NBCOMPAT= 50 60 70 80 |
41 | .endif | | 43 | .endif |
42 | .if ${RUMP_NBCOMPAT} == "none" | | 44 | .if ${RUMP_NBCOMPAT} == "none" |
43 | RUMP_NBCOMPAT= | | 45 | RUMP_NBCOMPAT= |
44 | .endif | | 46 | .endif |
45 | RUMP_NBCOMPAT:= ${RUMP_NBCOMPAT:S/,/ /g} | | 47 | RUMP_NBCOMPAT:= ${RUMP_NBCOMPAT:S/,/ /g} |
46 | CPPFLAGS+= ${RUMP_NBCOMPAT:C/[1-9]0/-DCOMPAT_&/g} | | 48 | CPPFLAGS+= ${RUMP_NBCOMPAT:C/[1-9]0/-DCOMPAT_&/g} |
47 | | | 49 | |
48 | CPPFLAGS+= -nostdinc | | 50 | CPPFLAGS+= -nostdinc |
49 | CFLAGS+= -ffreestanding -fno-strict-aliasing | | 51 | CFLAGS+= -ffreestanding -fno-strict-aliasing |
50 | | | 52 | |
51 | CWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign | | 53 | CWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign |
52 | | | 54 | |
53 | CPPFLAGS+= -imacros ${RUMPTOP}/include/opt/opt_rumpkernel.h | | 55 | CPPFLAGS+= -imacros ${RUMPTOP}/include/opt/opt_rumpkernel.h |
54 | .ifdef BUILDRUMP_IMACROS | | 56 | .ifdef BUILDRUMP_IMACROS |
55 | CPPFLAGS+= -imacros ${BUILDRUMP_IMACROS} | | 57 | CPPFLAGS+= -imacros ${BUILDRUMP_IMACROS} |
56 | .endif | | 58 | .endif |
57 | | | 59 | |
58 | CPPFLAGS+= -I${.CURDIR} -I. | | 60 | CPPFLAGS+= -I${.CURDIR} -I. |
59 | CPPFLAGS+= -I${RUMPTOP}/../../common/include | | 61 | CPPFLAGS+= -I${RUMPTOP}/../../common/include |
60 | CPPFLAGS+= -I${RUMPTOP}/include | | 62 | CPPFLAGS+= -I${RUMPTOP}/include |
61 | CPPFLAGS+= -I${RUMPTOP}/include/opt | | 63 | CPPFLAGS+= -I${RUMPTOP}/include/opt |
62 | | | 64 | |
63 | SHLIB_MAJOR?= 0 | | 65 | SHLIB_MAJOR?= 0 |
64 | SHLIB_MINOR?= 0 | | 66 | SHLIB_MINOR?= 0 |
65 | | | 67 | |
66 | .ifdef NEED_ISYSTEM | | 68 | .ifdef NEED_ISYSTEM |
67 | CPPFLAGS+= -isystem ${RUMPTOP}/../arch | | 69 | CPPFLAGS+= -isystem ${RUMPTOP}/../arch |
68 | CPPFLAGS+= -isystem ${RUMPTOP}/.. | | 70 | CPPFLAGS+= -isystem ${RUMPTOP}/.. |
69 | .else | | 71 | .else |
70 | CPPFLAGS+= -I${RUMPTOP}/../arch | | 72 | CPPFLAGS+= -I${RUMPTOP}/../arch |
71 | CPPFLAGS+= -I${RUMPTOP}/.. | | 73 | CPPFLAGS+= -I${RUMPTOP}/.. |
72 | .endif | | 74 | .endif |
73 | | | 75 | |
74 | RUMP_LDSCRIPT?= GNU | | 76 | RUMP_LDSCRIPT?= GNU |
75 | .if ${RUMP_LDSCRIPT} != "no" | | 77 | .if ${RUMP_LDSCRIPT} != "no" |
76 | # my ld or yours? | | 78 | # my ld or yours? |
77 | .if ${RUMP_LDSCRIPT} == "sun" | | 79 | .if ${RUMP_LDSCRIPT} == "sun" |
78 | LDFLAGS+= -Wl,-M ${RUMPTOP}/ldscript_sun.rump | | 80 | LDFLAGS+= -Wl,-M ${RUMPTOP}/ldscript_sun.rump |
79 | SRCS+= linksyms_sun.c | | 81 | SRCS+= linksyms_sun.c |
80 | .PATH: ${RUMPTOP} | | 82 | .PATH: ${RUMPTOP} |
81 | .elif ${RUMP_LDSCRIPT} == "GNU" | | 83 | .elif ${RUMP_LDSCRIPT} == "GNU" |
82 | LDFLAGS+= -Wl,-T,${RUMPTOP}/ldscript.rump | | 84 | LDFLAGS+= -Wl,-T,${RUMPTOP}/ldscript.rump |
83 | .elif ${RUMP_LDSCRIPT} == "ctor" | | 85 | .elif ${RUMP_LDSCRIPT} == "ctor" |
84 | CPPFLAGS+= -DRUMP_USE_CTOR | | 86 | CPPFLAGS+= -DRUMP_USE_CTOR |
85 | .else | | 87 | .else |
86 | .error Unknown ldscript ${RUMP_LDSCRIPT} | | 88 | .error Unknown ldscript ${RUMP_LDSCRIPT} |
87 | .endif | | 89 | .endif |
88 | .endif | | 90 | .endif |
89 | | | 91 | |
90 | .if defined(RUMP_CURLWP) | | 92 | .if defined(RUMP_CURLWP) |
91 | .if ${RUMP_CURLWP} == "hypercall" | | 93 | .if ${RUMP_CURLWP} == "hypercall" |
92 | CPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP_HYPERCALL | | 94 | CPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP_HYPERCALL |
93 | .elif ${RUMP_CURLWP} == "__thread" | | 95 | .elif ${RUMP_CURLWP} == "__thread" |
94 | CPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP___THREAD | | 96 | CPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP___THREAD |
95 | .elif ${RUMP_CURLWP} == "register" | | 97 | .elif ${RUMP_CURLWP} == "register" |
96 | CPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP_REGISTER | | 98 | CPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP_REGISTER |
97 | .else | | 99 | .else |
98 | .error Unsupported curlwp scheme: ${RUMP_CURLWP} | | 100 | .error Unsupported curlwp scheme: ${RUMP_CURLWP} |
99 | .endif | | 101 | .endif |
100 | .endif | | 102 | .endif |
101 | | | 103 | |
102 | RUMP_DIAGNOSTIC?=yes | | 104 | RUMP_DIAGNOSTIC?=yes |
103 | .if ${RUMP_DIAGNOSTIC} == "yes" | | 105 | .if ${RUMP_DIAGNOSTIC} == "yes" |
104 | CPPFLAGS+= -DDIAGNOSTIC | | 106 | CPPFLAGS+= -DDIAGNOSTIC |
105 | .endif | | 107 | .endif |
106 | | | 108 | |
107 | .ifdef RUMP_DEBUG | | 109 | .ifdef RUMP_DEBUG |
108 | CPPFLAGS+= -DDEBUG | | 110 | CPPFLAGS+= -DDEBUG |
109 | .endif | | 111 | .endif |
110 | | | 112 | |
111 | .ifdef RUMP_LOCKDEBUG | | 113 | .ifdef RUMP_LOCKDEBUG |
112 | CPPFLAGS+= -DLOCKDEBUG | | 114 | CPPFLAGS+= -DLOCKDEBUG |
113 | .endif | | 115 | .endif |
114 | | | 116 | |
115 | RUMP_KTRACE?=yes | | 117 | RUMP_KTRACE?=yes |
116 | .if ${RUMP_KTRACE} == "yes" | | 118 | .if ${RUMP_KTRACE} == "yes" |
117 | CPPFLAGS+= -DKTRACE | | 119 | CPPFLAGS+= -DKTRACE |
118 | .endif | | 120 | .endif |
119 | | | 121 | |
120 | # kernel libs should not get linked against libc | | 122 | # kernel libs should not get linked against libc |
121 | # XXX: actually, we would like to enable this but cannot, since it | | 123 | # XXX: actually, we would like to enable this but cannot, since it |
122 | # also leaves out libgcc, it causes problems on some platforms. | | 124 | # also leaves out libgcc, it causes problems on some platforms. |
123 | # revisit some day. | | 125 | # revisit some day. |
124 | #LDFLAGS+= -nodefaultlibs | | 126 | #LDFLAGS+= -nodefaultlibs |
125 | | | 127 | |
126 | # make sure __NetBSD__ gets defined (for builds on non-NetBSD) | | 128 | # make sure __NetBSD__ gets defined (for builds on non-NetBSD) |
127 | # also, give those builds a way to undef the local compiler's macros | | 129 | # also, give those builds a way to undef the local compiler's macros |
128 | CPPFLAGS+= ${RUMPKERN_UNDEF} | | 130 | CPPFLAGS+= ${RUMPKERN_UNDEF} |
129 | | | 131 | |
130 | RUMPKERNEL= This is NetBSD and I am the rump. Good evening. | | 132 | RUMPKERNEL= This is NetBSD and I am the rump. Good evening. |
131 | | | 133 | |
132 | # workaround: evbppc is not a well-defined arch | | 134 | # workaround: evbppc is not a well-defined arch |
133 | .if (${MACHINE} == "evbppc") | | 135 | .if (${MACHINE} == "evbppc") |
134 | CPPFLAGS+= -DPPC_OEA | | 136 | CPPFLAGS+= -DPPC_OEA |
135 | .endif | | 137 | .endif |
136 | | | 138 | |
137 | # If any of these files change, we need a full rebuild | | 139 | # If any of these files change, we need a full rebuild |
138 | DPSRCS+= ${RUMPTOP}/Makefile.rump | | 140 | DPSRCS+= ${RUMPTOP}/Makefile.rump |
139 | | | 141 | |
140 | # | | 142 | # |
141 | # Support for component-specific hypercalls | | 143 | # Support for component-specific hypercalls |
142 | # | | 144 | # |
143 | | | 145 | |
144 | # no easy way to get WARNS out of bsd.sys.mk | | 146 | # no easy way to get WARNS out of bsd.sys.mk |
145 | RUMPCOMP_USER_WARNFLAGS= -Wall -Wextra -Wno-unused-parameter | | 147 | RUMPCOMP_USER_WARNFLAGS= -Wall -Wextra -Wno-unused-parameter |
146 | RUMPCOMP_USER_WARNFLAGS+= -Wstrict-prototypes -Wmissing-prototypes | | 148 | RUMPCOMP_USER_WARNFLAGS+= -Wstrict-prototypes -Wmissing-prototypes |
147 | | | 149 | |
148 | .ifdef RUMPCOMP_USER_SRCS && !defined(RUMPKERN_ONLY) | | 150 | .ifdef RUMPCOMP_USER_SRCS && !defined(RUMPKERN_ONLY) |
149 | .if empty(DESTDIR) | | 151 | .if empty(DESTDIR) |
150 | DESTDIR=/ | | 152 | DESTDIR=/ |
151 | .endif | | 153 | .endif |
152 | BUILDRUMP_CPPFLAGS ?= -isysroot ${DESTDIR} | | 154 | BUILDRUMP_CPPFLAGS ?= -isysroot ${DESTDIR} |
153 | RUMPCOMP_USER_WERROR = ${${_NOWERROR} == "no" :?-Werror:} | | 155 | RUMPCOMP_USER_WERROR = ${${_NOWERROR} == "no" :?-Werror:} |
154 | .for rcusrc in ${RUMPCOMP_USER_SRCS:R} | | 156 | .for rcusrc in ${RUMPCOMP_USER_SRCS:R} |
155 | ${rcusrc}.d: ${rcusrc}.c | | 157 | ${rcusrc}.d: ${rcusrc}.c |
156 | ${_MKTARGET_CREATE} | | 158 | ${_MKTARGET_CREATE} |
157 | ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${CPUFLAGS} ${REPROFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:O:u:M*${rcusrc}.c} | | 159 | ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${CPUFLAGS} ${REPROFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:O:u:M*${rcusrc}.c} |
158 | | | 160 | |
159 | ${rcusrc}.o: ${rcusrc}.c | | 161 | ${rcusrc}.o: ${rcusrc}.c |
160 | ${_MKTARGET_COMPILE} | | 162 | ${_MKTARGET_COMPILE} |
161 | ${CC} -o ${.TARGET} ${DBG} ${CWARNFLAGS} ${CPUFLAGS} ${REPROFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c} | | 163 | ${CC} -o ${.TARGET} ${DBG} ${CWARNFLAGS} ${CPUFLAGS} ${REPROFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c} |
162 | | | 164 | |
163 | ${rcusrc}.pico: ${rcusrc}.c | | 165 | ${rcusrc}.pico: ${rcusrc}.c |
164 | ${_MKTARGET_COMPILE} | | 166 | ${_MKTARGET_COMPILE} |
165 | ${CC} -o ${.TARGET} -fPIC -DPIC ${DBG} ${CWARNFLAGS} ${CPUFLAGS} ${REPROFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c} | | 167 | ${CC} -o ${.TARGET} -fPIC -DPIC ${DBG} ${CWARNFLAGS} ${CPUFLAGS} ${REPROFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c} |
166 | | | 168 | |
167 | ${rcusrc}.po: ${rcusrc}.c | | 169 | ${rcusrc}.po: ${rcusrc}.c |
168 | ${_MKTARGET_COMPILE} | | 170 | ${_MKTARGET_COMPILE} |
169 | ${CC} -o ${.TARGET} ${PROFFLAGS} -pg ${DBG} ${CWARNFLAGS} ${CPUFLAGS} ${REPROFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c} | | 171 | ${CC} -o ${.TARGET} ${PROFFLAGS} -pg ${DBG} ${CWARNFLAGS} ${CPUFLAGS} ${REPROFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c} |
170 | | | 172 | |
171 | RUMPOBJ_NORENAME+=${rcusrc}.o ${rcusrc}.pico ${rcusrc}.po | | 173 | RUMPOBJ_NORENAME+=${rcusrc}.o ${rcusrc}.pico ${rcusrc}.po |
172 | SRCS+=${rcusrc}.c | | 174 | SRCS+=${rcusrc}.c |
173 | .endfor | | 175 | .endfor |
174 | .endif | | 176 | .endif |
175 | | | 177 | |
176 | # | | 178 | # |
177 | # Rename library symbols before use. If a symbol does not already belong | | 179 | # Rename library symbols before use. If a symbol does not already belong |
178 | # to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This | | 180 | # to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This |
179 | # avoids accidentally linking any kernel symbol against host platform | | 181 | # avoids accidentally linking any kernel symbol against host platform |
180 | # libraries. The only non-renamed symbols are linkset delimiters and | | 182 | # libraries. The only non-renamed symbols are linkset delimiters and |
181 | # the GOT, which are more a property of the compiler than the kernel. | | 183 | # the GOT, which are more a property of the compiler than the kernel. |
182 | # | | 184 | # |
183 | # Some toolchains generate unresolved symbols which are supposed to be | | 185 | # Some toolchains generate unresolved symbols which are supposed to be |
184 | # satisfied by the toolchain itself when the program is linked. | | 186 | # satisfied by the toolchain itself when the program is linked. |
185 | # Unfortunately, we do not know which of the symbols are generated by | | 187 | # Unfortunately, we do not know which of the symbols are generated by |
186 | # the toolchain. Worse, they vary from platform to platform and | | 188 | # the toolchain. Worse, they vary from platform to platform and |
187 | # toolchain to toolchain. The good news, however, is that this will | | 189 | # toolchain to toolchain. The good news, however, is that this will |
188 | # be detected by a compile-time failure, so we can fairly easily manage | | 190 | # be detected by a compile-time failure, so we can fairly easily manage |
189 | # a quirktable here. | | 191 | # a quirktable here. |
190 | # | | 192 | # |
191 | # We also allow calling ourselves externally with e.g.: | | 193 | # We also allow calling ourselves externally with e.g.: |
192 | # make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj | | 194 | # make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj |
193 | # | | 195 | # |
194 | .if ${MACHINE_CPU} == "mips" | | 196 | .if ${MACHINE_CPU} == "mips" |
195 | _SYMQUIRK='|_gp_disp' | | 197 | _SYMQUIRK='|_gp_disp' |
196 | .elif ${MACHINE_CPU} == "hppa" | | 198 | .elif ${MACHINE_CPU} == "hppa" |
197 | _SYMQUIRK='|\$$\$$' | | 199 | _SYMQUIRK='|\$$\$$' |
198 | .elif ${MACHINE_ARCH} == "powerpc64" | | 200 | .elif ${MACHINE_ARCH} == "powerpc64" |
199 | _SYMQUIRK="|PF_funcs" | | 201 | _SYMQUIRK="|PF_funcs" |
200 | .endif | | 202 | .endif |
201 | | | 203 | |
202 | # | | 204 | # |
203 | # Prefix quirks. At least one toolchain generates global | | 205 | # Prefix quirks. At least one toolchain generates global |
204 | # symbols with prefixes which really need to remain as prefixes | | 206 | # symbols with prefixes which really need to remain as prefixes |
205 | # (i.e. the '.' on the front of some ppc64 globals). The | | 207 | # (i.e. the '.' on the front of some ppc64 globals). The |
206 | # way to know if you have the problem is if you get later | | 208 | # way to know if you have the problem is if you get later |
207 | # complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; | | 209 | # complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; |
208 | # the 'X' part was added by the toolchain and will need to | | 210 | # the 'X' part was added by the toolchain and will need to |
209 | # be mentioned here. | | 211 | # be mentioned here. |
210 | # | | 212 | # |
211 | .if ${MACHINE_ARCH} == "powerpc64" | | 213 | .if ${MACHINE_ARCH} == "powerpc64" |
212 | _PQ="\.?" | | 214 | _PQ="\.?" |
213 | .else | | 215 | .else |
214 | _PQ= | | 216 | _PQ= |
215 | .endif | | 217 | .endif |
216 | | | 218 | |
217 | rump_symren: __archivebuild | | 219 | rump_symren: __archivebuild |
218 | .if !defined(RUMP_SYMREN) | | 220 | .if !defined(RUMP_SYMREN) |
219 | @echo "Must supply RUMP_SYMREN for target rump_symren" | | 221 | @echo "Must supply RUMP_SYMREN for target rump_symren" |
220 | @false | | 222 | @false |
221 | .endif | | 223 | .endif |
222 | | | 224 | |
223 | # if we are called from lib build (RUMP_SYMREN is not specified), | | 225 | # if we are called from lib build (RUMP_SYMREN is not specified), |
224 | # build the arrrrchive. otherwise just rename symbols. | | 226 | # build the arrrrchive. otherwise just rename symbols. |
225 | __archivebuild: .USE | | 227 | __archivebuild: .USE |
226 | .if defined(RUMP_SYMREN) && defined(RUMPTOP) | | 228 | .if defined(RUMP_SYMREN) && defined(RUMPTOP) |
227 | @echo "ERROR: RUMP_SYMREN can only be used standalone" | | 229 | @echo "ERROR: RUMP_SYMREN can only be used standalone" |
228 | @false | | 230 | @false |
229 | .endif | | 231 | .endif |
230 | .if defined(RUMP_SYMREN) | | 232 | .if defined(RUMP_SYMREN) |
231 | ${_MKMSG} " symbol rename " ${RUMP_SYMREN} | | 233 | ${_MKMSG} " symbol rename " ${RUMP_SYMREN} |
232 | .else | | 234 | .else |
233 | ${_MKTARGET_BUILD} | | 235 | ${_MKTARGET_BUILD} |
234 | rm -f ${.TARGET} | | 236 | rm -f ${.TARGET} |
235 | .endif | | 237 | .endif |
236 | for renameobj in ${RUMP_SYMREN:U${.ALLSRC:C/(${RUMPOBJ_NORENAME:ts|})//g}}; do \ | | 238 | for renameobj in ${RUMP_SYMREN:U${.ALLSRC:C/(${RUMPOBJ_NORENAME:ts|})//g}}; do \ |
237 | ${NM} -go $${renameobj} | ${TOOL_AWK} ' \ | | 239 | ${NM} -go $${renameobj} | ${TOOL_AWK} ' \ |
238 | $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE|\.TOC\.'${_SYMQUIRK}'${RUMP_SYM_NORENAME:D|${RUMP_SYM_NORENAME}})/ \ | | 240 | $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE|\.TOC\.'${_SYMQUIRK}'${RUMP_SYM_NORENAME:D|${RUMP_SYM_NORENAME}})/ \ |
239 | {s=$$NF;sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}'\ | | 241 | {s=$$NF;sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}'\ |
240 | | sort | uniq > renametab.$${renameobj}; \ | | 242 | | sort | uniq > renametab.$${renameobj}; \ |
241 | ${OBJCOPY} --preserve-dates --redefine-syms \ | | 243 | ${OBJCOPY} --preserve-dates --redefine-syms \ |
242 | renametab.$${renameobj} $${renameobj}; \ | | 244 | renametab.$${renameobj} $${renameobj}; \ |
243 | rm -f renametab.$${renameobj}; \ | | 245 | rm -f renametab.$${renameobj}; \ |
244 | done | | 246 | done |
245 | .if !defined(RUMP_SYMREN) | | 247 | .if !defined(RUMP_SYMREN) |
246 | ${AR} ${_ARFL} ${.TARGET} \ | | 248 | ${AR} ${_ARFL} ${.TARGET} \ |
247 | `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` | | 249 | `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` |
248 | .endif | | 250 | .endif |
249 | | | 251 | |
250 | COMMENT?= (no description) | | 252 | COMMENT?= (no description) |
251 | rumpdescribe: .PHONY | | 253 | rumpdescribe: .PHONY |
252 | @printf '%-24s %s\n' '${LIB}' '${COMMENT}' | | 254 | @printf '%-24s %s\n' '${LIB}' '${COMMENT}' |
253 | | | 255 | |
254 | _BSD_IOCONF_MK_USER_=1 | | 256 | _BSD_IOCONF_MK_USER_=1 |
255 | .include <bsd.ioconf.mk> | | 257 | .include <bsd.ioconf.mk> |
256 | | | 258 | |
257 | .-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" | | 259 | .-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" |
258 | .-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" | | 260 | .-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" |
259 | | | 261 | |
260 | .endif # _RUMP_MK | | 262 | .endif # _RUMP_MK |