-
Notifications
You must be signed in to change notification settings - Fork 16
/
mkremote.sh
executable file
·43 lines (29 loc) · 1.37 KB
/
mkremote.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
set -e
. ./config.sh
NAME=$1
shift
LINK=$*
BINDIR="bin"
OBJDIR="obj-rr"
mkdir -p ${BINDIR} ${OBJDIR}
UNAME=$(uname -s)
# -lrt not always needed
[ ${UNAME} = Linux ] && DLFLAG="-ldl -lrt"
RUMPCLIENT="-L${LIBRARY_PATH} -Wl,-R${LIBRARY_PATH} -lrumpclient"
CC=${CC-cc}
${CC} ${LDFLAGS} -Wl,-r -nostdlib $LINK -o ${OBJDIR}/${NAME}.o
objcopy --redefine-syms=host.map ${OBJDIR}/${NAME}.o ${OBJDIR}/tmp0_${NAME}.o
${CC} ${LDFLAGS} -Wl,-r ${OBJDIR}/tmp0_${NAME}.o netbsd_init.o -nostdlib rump/lib/libc.a -o ${OBJDIR}/tmp1_${NAME}.o 2>/dev/null
objcopy --redefine-syms=namespace.map ${OBJDIR}/tmp1_${NAME}.o
objcopy --redefine-syms=extra.map ${OBJDIR}/tmp1_${NAME}.o
objcopy --redefine-syms=rump.map ${OBJDIR}/tmp1_${NAME}.o
objcopy --redefine-syms=weakasm.map ${OBJDIR}/tmp1_${NAME}.o
objcopy --redefine-syms=readwrite.map ${OBJDIR}/tmp1_${NAME}.o
objcopy --redefine-syms=emul.map ${OBJDIR}/tmp1_${NAME}.o
objcopy --redefine-syms=netbsd.map ${OBJDIR}/tmp1_${NAME}.o
${CC} ${LDFLAGS} -Wl,-r -nostdlib -Wl,-dc ${OBJDIR}/tmp1_${NAME}.o readwrite.o -o ${OBJDIR}/tmp2_${NAME}.o 2>/dev/null
objcopy --redefine-syms=errno.map ${OBJDIR}/tmp2_${NAME}.o
objcopy -w --localize-symbol='*' ${OBJDIR}/tmp2_${NAME}.o
objcopy -w --globalize-symbol='_netbsd_*' ${OBJDIR}/tmp2_${NAME}.o
${CC} ${CFLAGS} ${OBJDIR}/tmp2_${NAME}.o emul.o rumpclient.o remoteinit.o ${RUMPCLIENT} ${DLFLAG} -o ${BINDIR}/${NAME}