Skip to content

Commit b0ff371

Browse files
Add tcc-pnut step files
1 parent 2057d55 commit b0ff371

16 files changed

+379
-0
lines changed

steps/tcc-pnut/files/config.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// SPDX-FileCopyrightText: 2020 fosslinux <[email protected]>
2+
// SPDX-FileCopyrightText: 2021 Andrius Štikonas <[email protected]>
3+
//
4+
// SPDX-License-Identifier: GPL-3.0-or-later
5+
6+
#undef SYSTEM_LIBC
7+
#define MES_VERSION "0.27"

steps/tcc-pnut/pass1.kaem

Lines changed: 333 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,333 @@
1+
#!/bin/sh
2+
3+
# SPDX-FileCopyrightText: 2025 Laurent Huberdeau [email protected]
4+
#
5+
# SPDX-License-Identifier: GPL-3.0-or-later
6+
7+
set -ex
8+
9+
MES_ARCH=x86
10+
TCC_TARGET_ARCH=I386
11+
PNUT_ARCH=i386_linux
12+
13+
PNUT_TAR=0cc58eeaed008493a3b9e37ed6244fae6d2a4806
14+
PNUT_PKG=pnut-0cc58eeaed008493a3b9e37ed6244fae6d2a4806
15+
TCC_TAR=tcc-0.9.26
16+
TCC_PKG=tcc-0.9.26-1147-gee75a10c
17+
MES_PKG=mes-0.27
18+
19+
# Check tarball checksums
20+
# checksum-transcriber sources
21+
# sha256sum -c sources.SHA256SUM
22+
23+
# Unpack
24+
mkdir build
25+
26+
cd build
27+
# ungz --file ${DISTFILES}/${PNUT_TAR}.tar.gz --output ${PNUT_TAR}.tar
28+
untar --non-strict --file ${DISTFILES}/${PNUT_TAR}.tar
29+
30+
ungz --file ${DISTFILES}/${TCC_TAR}.tar.gz --output ${TCC_TAR}.tar
31+
ungz --file ${DISTFILES}/${MES_PKG}.tar.gz --output ${MES_PKG}.tar
32+
untar --non-strict --file ${TCC_TAR}.tar
33+
simple-patch ${TCC_PKG}/tcctools.c \
34+
../simple-patches/remove-fileopen.before ../simple-patches/remove-fileopen.after
35+
simple-patch ${TCC_PKG}/tcctools.c \
36+
../simple-patches/addback-fileopen.before ../simple-patches/addback-fileopen.after
37+
simple-patch ${TCC_PKG}/tccpp.c \
38+
../simple-patches/array_sizeof.before ../simple-patches/array_sizeof.after
39+
simple-patch ${TCC_PKG}/libtcc.c \
40+
../simple-patches/error_set_jmp_enabled.before ../simple-patches/error_set_jmp_enabled.after
41+
simple-patch ${TCC_PKG}/libtcc.c \
42+
../simple-patches/sscanf_TCC_VERSION.before ../simple-patches/sscanf_TCC_VERSION.after
43+
simple-patch ${TCC_PKG}/tcc.h \
44+
../simple-patches/undefine_TCC_IS_NATIVE.before ../simple-patches/undefine_TCC_IS_NATIVE.after
45+
46+
untar --non-strict --file ${MES_PKG}.tar
47+
48+
# Create config.h
49+
catm ${MES_PKG}/include/mes/config.h
50+
catm ${TCC_PKG}/config.h
51+
52+
# Bootstrap pnut from tcc because bash is not yet available
53+
cd ${PNUT_PKG}
54+
55+
tcc pnut.c \
56+
-D BOOTSTRAP_LONG \
57+
-D target_${PNUT_ARCH} \
58+
-D UNDEFINED_LABELS_ARE_RUNTIME_ERRORS \
59+
-o pnut-exe-by-tcc
60+
61+
cp pnut-exe-by-tcc ${BINDIR}/pnut-exe-by-tcc
62+
chmod 755 ${BINDIR}/pnut-exe-by-tcc
63+
64+
# With pnut-exe-by-tcc we can compile pnut-exe
65+
# We've verified outside of live-bootstrap that rooting pnut on bash gives the
66+
# same result.
67+
pnut-exe-by-tcc pnut.c \
68+
-D BOOTSTRAP_LONG \
69+
-D target_${PNUT_ARCH} \
70+
-D UNDEFINED_LABELS_ARE_RUNTIME_ERRORS \
71+
-D NO_BUILTIN_LIBC \
72+
> pnut-exe
73+
74+
cp pnut-exe ${BINDIR}/pnut-exe
75+
chmod 755 ${BINDIR}/pnut-exe
76+
77+
sha256sum -c ../../pnut.${ARCH}.checksums
78+
79+
# Back to build
80+
cd ..
81+
82+
# We can now compile TCC with pnut-exe
83+
pnut-exe ${TCC_PKG}/tcc.c \
84+
-I ${PNUT_PKG}/portable_libc/include/ \
85+
-D BOOTSTRAP=1 \
86+
-D HAVE_LONG_LONG=0 \
87+
-D TCC_TARGET_${TCC_TARGET_ARCH}=1 \
88+
-D CONFIG_TCCDIR=\"${LIBDIR}/tcc\" \
89+
-D CONFIG_SYSROOT=\"/\" \
90+
-D CONFIG_TCC_CRTPREFIX=\"${LIBDIR}\" \
91+
-D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \
92+
-D CONFIG_TCC_SYSINCLUDEPATHS=\"${PREFIX}/include/mes\" \
93+
-D TCC_LIBGCC=\"${LIBDIR}/libc.a\" \
94+
-D CONFIG_TCC_LIBTCC1_MES=0 \
95+
-D CONFIG_TCCBOOT=1 \
96+
-D CONFIG_TCC_STATIC=1 \
97+
-D CONFIG_USE_LIBGCC=1 \
98+
-D TCC_VERSION=\"0.9.26\" \
99+
-D ONE_SOURCE=1 \
100+
> tcc-pnut
101+
102+
cp tcc-pnut ${BINDIR}/tcc-pnut
103+
chmod 755 ${BINDIR}/tcc-pnut
104+
105+
# The rest looks very similar to tcc-0.9.26's pass1.kaem script after tcc-mes
106+
# is built.
107+
108+
tcc-pnut -version
109+
tcc-pnut -vv
110+
111+
# Recompile the mes C library
112+
cd ${MES_PKG}
113+
114+
# Create unified libc file
115+
cd lib
116+
catm ../unified-libc.c ctype/isalnum.c ctype/isalpha.c ctype/isascii.c ctype/iscntrl.c ctype/isdigit.c ctype/isgraph.c ctype/islower.c ctype/isnumber.c ctype/isprint.c ctype/ispunct.c ctype/isspace.c ctype/isupper.c ctype/isxdigit.c ctype/tolower.c ctype/toupper.c dirent/closedir.c dirent/__getdirentries.c dirent/opendir.c linux/readdir.c linux/access.c linux/brk.c linux/chdir.c linux/chmod.c linux/clock_gettime.c linux/close.c linux/dup2.c linux/dup.c linux/execve.c linux/fcntl.c linux/fork.c linux/fsync.c linux/fstat.c linux/_getcwd.c linux/getdents.c linux/getegid.c linux/geteuid.c linux/getgid.c linux/getpid.c linux/getppid.c linux/getrusage.c linux/gettimeofday.c linux/getuid.c linux/ioctl.c linux/ioctl3.c linux/kill.c linux/link.c linux/lseek.c linux/lstat.c linux/malloc.c linux/mkdir.c linux/mknod.c linux/nanosleep.c linux/_open3.c linux/pipe.c linux/_read.c linux/readlink.c linux/rename.c linux/rmdir.c linux/setgid.c linux/settimer.c linux/setuid.c linux/signal.c linux/sigprogmask.c linux/symlink.c linux/stat.c linux/time.c linux/unlink.c linux/waitpid.c linux/wait4.c linux/${MES_ARCH}-mes-gcc/_exit.c linux/${MES_ARCH}-mes-gcc/syscall.c linux/${MES_ARCH}-mes-gcc/_write.c math/ceil.c math/fabs.c math/floor.c mes/abtod.c mes/abtol.c mes/__assert_fail.c mes/assert_msg.c mes/__buffered_read.c mes/__init_io.c mes/cast.c mes/dtoab.c mes/eputc.c mes/eputs.c mes/fdgetc.c mes/fdgets.c mes/fdputc.c mes/fdputs.c mes/fdungetc.c mes/globals.c mes/itoa.c mes/ltoab.c mes/ltoa.c mes/__mes_debug.c mes/mes_open.c mes/ntoab.c mes/oputc.c mes/oputs.c mes/search-path.c mes/ultoa.c mes/utoa.c posix/alarm.c posix/buffered-read.c posix/execl.c posix/execlp.c posix/execv.c posix/execvp.c posix/getcwd.c posix/getenv.c posix/isatty.c posix/mktemp.c posix/open.c posix/pathconf.c posix/raise.c posix/sbrk.c posix/setenv.c posix/sleep.c posix/unsetenv.c posix/wait.c posix/write.c stdio/clearerr.c stdio/fclose.c stdio/fdopen.c stdio/feof.c stdio/ferror.c stdio/fflush.c stdio/fgetc.c stdio/fgets.c stdio/fileno.c stdio/fopen.c stdio/fprintf.c stdio/fputc.c stdio/fputs.c stdio/fread.c stdio/freopen.c stdio/fscanf.c stdio/fseek.c stdio/ftell.c stdio/fwrite.c stdio/getc.c stdio/getchar.c stdio/perror.c stdio/printf.c stdio/putc.c stdio/putchar.c stdio/remove.c stdio/snprintf.c stdio/sprintf.c stdio/sscanf.c stdio/ungetc.c stdio/vfprintf.c stdio/vfscanf.c stdio/vprintf.c stdio/vsnprintf.c stdio/vsprintf.c stdio/vsscanf.c stdlib/abort.c stdlib/abs.c stdlib/alloca.c stdlib/atexit.c stdlib/atof.c stdlib/atoi.c stdlib/atol.c stdlib/calloc.c stdlib/__exit.c stdlib/exit.c stdlib/free.c stdlib/mbstowcs.c stdlib/puts.c stdlib/qsort.c stdlib/realloc.c stdlib/strtod.c stdlib/strtof.c stdlib/strtol.c stdlib/strtold.c stdlib/strtoll.c stdlib/strtoul.c stdlib/strtoull.c string/bcmp.c string/bcopy.c string/bzero.c string/index.c string/memchr.c string/memcmp.c string/memcpy.c string/memmem.c string/memmove.c string/memset.c string/rindex.c string/strcat.c string/strchr.c string/strcmp.c string/strcpy.c string/strcspn.c string/strdup.c string/strerror.c string/strlen.c string/strlwr.c string/strncat.c string/strncmp.c string/strncpy.c string/strpbrk.c string/strrchr.c string/strspn.c string/strstr.c string/strupr.c stub/atan2.c stub/bsearch.c stub/chown.c stub/__cleanup.c stub/cos.c stub/ctime.c stub/exp.c stub/fpurge.c stub/freadahead.c stub/frexp.c stub/getgrgid.c stub/getgrnam.c stub/getlogin.c stub/getpgid.c stub/getpgrp.c stub/getpwnam.c stub/getpwuid.c stub/gmtime.c stub/ldexp.c stub/localtime.c stub/log.c stub/mktime.c stub/modf.c stub/mprotect.c stub/pclose.c stub/popen.c stub/pow.c stub/putenv.c stub/rand.c stub/realpath.c stub/rewind.c stub/setbuf.c stub/setgrent.c stub/setlocale.c stub/setvbuf.c stub/sigaction.c stub/sigaddset.c stub/sigblock.c stub/sigdelset.c stub/sigemptyset.c stub/sigsetmask.c stub/sin.c stub/sys_siglist.c stub/system.c stub/sqrt.c stub/strftime.c stub/times.c stub/ttyname.c stub/umask.c stub/utime.c ${MES_ARCH}-mes-gcc/setjmp.c
117+
cd ..
118+
119+
# crt1.o
120+
tcc-pnut -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crt1.o lib/linux/${MES_ARCH}-mes-gcc/crt1.c
121+
122+
catm ${LIBDIR}/crtn.o
123+
catm ${LIBDIR}/crti.o
124+
125+
if match ${ARCH} x86; then
126+
# crtn.o
127+
tcc-pnut -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crtn.o lib/linux/${MES_ARCH}-mes-gcc/crtn.c
128+
129+
# crti.o
130+
tcc-pnut -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crti.o lib/linux/${MES_ARCH}-mes-gcc/crti.c
131+
fi
132+
133+
# libc+gcc.a
134+
tcc-pnut -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o unified-libc.o unified-libc.c
135+
tcc-pnut -ar cr ${LIBDIR}/libc.a unified-libc.o
136+
137+
# libtcc1.a
138+
mkdir ${LIBDIR}/tcc
139+
tcc-pnut -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -D HAVE_FLOAT=1 -I include -I include/linux/${MES_ARCH} -o libtcc1.o lib/libtcc1.c
140+
if match ${ARCH} riscv64; then
141+
tcc-pnut -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -D HAVE_FLOAT=1 -I include -I include/linux/${MES_ARCH} -o lib-arm64.o ../${TCC_PKG}/lib/lib-arm64.c
142+
tcc-pnut -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o lib-arm64.o
143+
else
144+
tcc-pnut -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o
145+
fi
146+
147+
# libgetopt.a
148+
tcc-pnut -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} lib/posix/getopt.c
149+
tcc-pnut -ar cr ${LIBDIR}/libgetopt.a getopt.o
150+
151+
cd ../${TCC_PKG}
152+
153+
tcc-pnut \
154+
-g \
155+
-v \
156+
-static \
157+
-o tcc-boot0 \
158+
-D BOOTSTRAP=1 \
159+
-D HAVE_FLOAT=1 \
160+
-D HAVE_BITFIELD=1 \
161+
-D HAVE_LONG_LONG=1 \
162+
-D HAVE_SETJMP=1 \
163+
-I . \
164+
-I ${PREFIX}/include/mes \
165+
-D TCC_TARGET_${TCC_TARGET_ARCH}=1 \
166+
-D CONFIG_TCCDIR=\"${LIBDIR}/tcc\" \
167+
-D CONFIG_TCC_CRTPREFIX=\"${LIBDIR}\" \
168+
-D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \
169+
-D CONFIG_TCC_LIBPATHS=\"${LIBDIR}:${LIBDIR}/tcc\" \
170+
-D CONFIG_TCC_SYSINCLUDEPATHS=\"${PREFIX}/include/mes\" \
171+
-D TCC_LIBGCC=\"${LIBDIR}/libc.a\" \
172+
-D TCC_LIBTCC1=\"libtcc1.a\" \
173+
-D CONFIG_TCCBOOT=1 \
174+
-D CONFIG_TCC_STATIC=1 \
175+
-D CONFIG_USE_LIBGCC=1 \
176+
-D TCC_VERSION=\"0.9.26\" \
177+
-D ONE_SOURCE=1 \
178+
-L . \
179+
-L ${LIBDIR} \
180+
tcc.c
181+
182+
cp tcc-boot0 ${BINDIR}/
183+
chmod 755 ${BINDIR}/tcc-boot0
184+
cd ../${MES_PKG}
185+
# Recompile libc: crt{1,n,i}, libtcc.a, libc.a
186+
tcc-boot0 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crt1.o lib/linux/${MES_ARCH}-mes-gcc/crt1.c
187+
if match ${ARCH} x86; then
188+
tcc-boot0 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crtn.o lib/linux/${MES_ARCH}-mes-gcc/crtn.c
189+
tcc-boot0 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crti.o lib/linux/${MES_ARCH}-mes-gcc/crti.c
190+
fi
191+
192+
tcc-boot0 -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -D HAVE_FLOAT=1 -I include -I include/linux/${MES_ARCH} -o libtcc1.o lib/libtcc1.c
193+
if match ${ARCH} riscv64; then
194+
tcc-boot0 -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -D HAVE_FLOAT=1 -I include -I include/linux/${MES_ARCH} -o lib-arm64.o ../${TCC_PKG}/lib/lib-arm64.c
195+
tcc-boot0 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o lib-arm64.o
196+
else
197+
tcc-boot0 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o
198+
fi
199+
200+
tcc-boot0 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o unified-libc.o unified-libc.c
201+
tcc-boot0 -ar cr ${LIBDIR}/libc.a unified-libc.o
202+
cd ../${TCC_PKG}
203+
204+
# Test boot0
205+
tcc-boot0 -version
206+
207+
tcc-boot0 \
208+
-g \
209+
-v \
210+
-static \
211+
-o tcc-boot1 \
212+
-D BOOTSTRAP=1 \
213+
-D HAVE_FLOAT=1 \
214+
-D HAVE_BITFIELD=1 \
215+
-D HAVE_LONG_LONG=1 \
216+
-D HAVE_SETJMP=1 \
217+
-I . \
218+
-I ${PREFIX}/include/mes \
219+
-D TCC_TARGET_${TCC_TARGET_ARCH}=1 \
220+
-D CONFIG_TCCDIR=\"${LIBDIR}/tcc\" \
221+
-D CONFIG_TCC_CRTPREFIX=\"${LIBDIR}\" \
222+
-D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \
223+
-D CONFIG_TCC_LIBPATHS=\"${LIBDIR}:${LIBDIR}/tcc\" \
224+
-D CONFIG_TCC_SYSINCLUDEPATHS=\"${PREFIX}/include/mes\" \
225+
-D TCC_LIBGCC=\"${LIBDIR}/libc.a\" \
226+
-D TCC_LIBTCC1=\"libtcc1.a\" \
227+
-D CONFIG_TCCBOOT=1 \
228+
-D CONFIG_TCC_STATIC=1 \
229+
-D CONFIG_USE_LIBGCC=1 \
230+
-D TCC_VERSION=\"0.9.26\" \
231+
-D ONE_SOURCE=1 \
232+
-L . \
233+
tcc.c
234+
cp tcc-boot1 ${BINDIR}
235+
chmod 755 ${BINDIR}/tcc-boot1
236+
cd ../${MES_PKG}
237+
tcc-boot1 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crt1.o lib/linux/${MES_ARCH}-mes-gcc/crt1.c
238+
if match ${ARCH} x86; then
239+
tcc-boot1 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crtn.o lib/linux/${MES_ARCH}-mes-gcc/crtn.c
240+
tcc-boot1 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crti.o lib/linux/${MES_ARCH}-mes-gcc/crti.c
241+
fi
242+
243+
tcc-boot1 -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -D HAVE_FLOAT=1 -I include -I include/linux/${MES_ARCH} -o libtcc1.o lib/libtcc1.c
244+
if match ${ARCH} riscv64; then
245+
tcc-boot1 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o lib-arm64.o ../${TCC_PKG}/lib/lib-arm64.c
246+
tcc-boot1 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o lib-arm64.o
247+
else
248+
tcc-boot1 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o
249+
fi
250+
251+
tcc-boot1 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o unified-libc.o unified-libc.c
252+
tcc-boot1 -ar cr ${LIBDIR}/libc.a unified-libc.o
253+
cd ../${TCC_PKG}
254+
255+
# Test boot1
256+
tcc-boot1 -version
257+
258+
# boot2
259+
tcc-boot1 \
260+
-g \
261+
-v \
262+
-static \
263+
-o tcc-boot2 \
264+
-D BOOTSTRAP=1 \
265+
-D HAVE_BITFIELD=1 \
266+
-D HAVE_FLOAT=1 \
267+
-D HAVE_LONG_LONG=1 \
268+
-D HAVE_SETJMP=1 \
269+
-I . \
270+
-I ${PREFIX}/include/mes \
271+
-D TCC_TARGET_${TCC_TARGET_ARCH}=1 \
272+
-D CONFIG_TCCDIR=\"${LIBDIR}/tcc\" \
273+
-D CONFIG_TCC_CRTPREFIX=\"${LIBDIR}\" \
274+
-D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \
275+
-D CONFIG_TCC_LIBPATHS=\"${LIBDIR}:${LIBDIR}/tcc\" \
276+
-D CONFIG_TCC_SYSINCLUDEPATHS=\"${PREFIX}/include/mes\" \
277+
-D TCC_LIBGCC=\"${LIBDIR}/libc.a\" \
278+
-D TCC_LIBTCC1=\"libtcc1.a\" \
279+
-D CONFIG_TCCBOOT=1 \
280+
-D CONFIG_TCC_STATIC=1 \
281+
-D CONFIG_USE_LIBGCC=1 \
282+
-D TCC_VERSION=\"0.9.26\" \
283+
-D ONE_SOURCE=1 \
284+
-L . \
285+
tcc.c
286+
cp tcc-boot2 ${BINDIR}
287+
chmod 755 ${BINDIR}/tcc-boot2
288+
cd ../${MES_PKG}
289+
tcc-boot2 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crt1.o lib/linux/${MES_ARCH}-mes-gcc/crt1.c
290+
if match ${ARCH} x86; then
291+
tcc-boot2 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crtn.o lib/linux/${MES_ARCH}-mes-gcc/crtn.c
292+
tcc-boot2 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crti.o lib/linux/${MES_ARCH}-mes-gcc/crti.c
293+
fi
294+
295+
tcc-boot2 -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -D HAVE_FLOAT=1 -I include -I include/linux/${MES_ARCH} -o libtcc1.o lib/libtcc1.c
296+
if match ${ARCH} riscv64; then
297+
tcc-boot2 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o lib-arm64.o ../${TCC_PKG}/lib/lib-arm64.c
298+
tcc-boot2 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o lib-arm64.o
299+
else
300+
tcc-boot2 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o
301+
fi
302+
303+
tcc-boot2 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o unified-libc.o unified-libc.c
304+
tcc-boot2 -ar cr ${LIBDIR}/libc.a unified-libc.o
305+
cd ../${TCC_PKG}
306+
307+
# Test boot2
308+
tcc-boot2 -version
309+
310+
# We have our final tcc 0.9.26!
311+
cp ${BINDIR}/tcc-boot2 ${BINDIR}/tcc-from-pnut
312+
chmod 755 ${BINDIR}/tcc-from-pnut
313+
314+
# Also recompile getopt, we don't need to do this during the boot* stages
315+
# because nothing is linked against it
316+
cd ../${MES_PKG}
317+
tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} lib/posix/getopt.c
318+
tcc -ar cr ${LIBDIR}/libgetopt.a getopt.o
319+
320+
cd ../..
321+
322+
# Checksums
323+
sha256sum -o ${pkg}.${ARCH}.checksums \
324+
/usr/bin/tcc-mes \
325+
/usr/bin/tcc-boot0 \
326+
/usr/bin/tcc-boot1 \
327+
/usr/bin/tcc \
328+
/usr/lib/mes/libc.a \
329+
/usr/lib/mes/libgetopt.a \
330+
/usr/lib/mes/crt1.o \
331+
/usr/lib/mes/crti.o \
332+
/usr/lib/mes/crtn.o \
333+
/usr/lib/mes/tcc/libtcc1.a

steps/tcc-pnut/pnut.x86.checksums

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bfe64d6ab1b096f95160cd6366c31db9f509616f4252689685637840db69ac78 /usr/bin/pnut-exe
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
if ((fh = fopen(argv[i_lib], "wb")) == NULL)
2+
{
3+
fprintf(stderr, "tcc: ar: can't open file %s \n", argv[i_lib]);
4+
goto the_end;
5+
}
6+
7+
// write header
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// write header
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#ifdef PNUT_CC
2+
char buf1[1024];
3+
#else
4+
char buf1[sizeof file->filename];
5+
#endif
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
char buf1[sizeof file->filename];
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#ifdef PNUT_CC
2+
s1->error_set_jmp_enabled = 0;
3+
#endif
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
s1->error_set_jmp_enabled = 1;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
if (ret == 1)
2+
return ar_usage(ret);

0 commit comments

Comments
 (0)