do some stuff i guess

This commit is contained in:
Mid Favila 2022-09-23 07:13:47 -04:00
parent 74acce7243
commit 08bd19a395
45 changed files with 165 additions and 59 deletions

View File

@ -1,8 +1,5 @@
#!/bin/sh -e
CFLAGS="$CFLAGS -static -fPIC"
LDFLAGS="$LDFLAGS -static -fPIC -fno-lto -fno-use-linker-plugin -static -fPIC"
cat > makeinfo <<EOF
#!/bin/sh
printf 'makeinfo (GNU texinfo) 5.2\n'
@ -27,8 +24,6 @@ export PATH=$PATH:$PWD
--disable-gprof \
--with-mmap \
--with-system-zlib \
--disable-lto \
--disable-plugins
make configure-host
make tooldir=/usr

View File

@ -6,7 +6,8 @@
--bindir=/usr/bin \
--mandir=/usr/share/man \
--enable-ksh \
--enable-sh
--enable-sh \
--enable-static
make
make DESTDIR="$1" install

View File

@ -1,5 +1,5 @@
#!/bin/sh -e
make
make CC='tcc -static'
install -Dm755 a.out "$1/usr/bin/awk"
install -Dm 755 awk.1 "$1/usr/share/man/man1/awk.1"

View File

@ -2,8 +2,8 @@
export BUILD_ZLIB=0
export BUILD_BZIP2=0
export LDFLAGS="$LDFLAGS -static -fPIC -fno-lto -fno-use-linker-plugin -pthread"
export CFLAGS="$CFLAGS -DNO_POSIX_2008_LOCALE -D_GNU_SOURCE"
export LDFLAGS="$LDFLAGS -pthread"
export CFLAGS="$CFLAGS -DNO_POSIX_2008_LOCALE "
./Configure \
-des \
@ -15,7 +15,6 @@ export CFLAGS="$CFLAGS -DNO_POSIX_2008_LOCALE -D_GNU_SOURCE"
-Dusethreads \
-Dinc_version_list=none \
-Dd_sockaddr_in6=define \
-Dcccdlflags=-fPIC \
-Dccflags="$CFLAGS" \
-Dlddlflags="-shared $LDFLAGS" \
-Dldflags="$LDFLAGS" \

View File

@ -31,8 +31,7 @@ patch -p1 < posix-ptys.patch
--disable-vt52 \
--enable-luit \
--disable-screen-dumps \
--disable-ziconbeep \
--with-Xaw3dxft
--disable-ziconbeep
make
make DESTDIR="$1" install

View File

@ -17,5 +17,5 @@ libXt
libpng
libxcb
netbsd-curses
libXaw3dXft

View File

@ -1,4 +1,4 @@
libXaw3dXft
autoconf make
automake make
libX11

View File

@ -1,3 +1,3 @@
autoconf make
automake make
editline
editline make

View File

@ -8,6 +8,10 @@ sed -i 's/PREFIX= \/u/PREFIX= \/usr/' Makefile
sed 6a"DESTDIR= $1" Makefile > tmp.m
mv tmp.m Makefile
# Allow for non-gcc compilers. Works with tcc!
sed -i 's/gcc/cc/g' Makefile
sed -i 's/CFLAGS=.*//' Makefile
make all install
#For some reason the generated image doesn't work.

View File

@ -1,5 +1,10 @@
#!/bin/sh -e
for i in *.patch
do
patch -R -p1 < $i
done
./configure \
--prefix=/usr \
--cc="${CC:-cc}" \

View File

@ -1 +1,3 @@
git git+git://repo.or.cz/tinycc.git
ef754d35719c5f28a7882b66d52e669c64ca4b6e0e4a745cdb1e0d61717f8e33
f6c1c1f2f5d12580c8777ec1bd87b5435b81a8d3bb2d8fc4bfd0d0515346c188
7e890dba972ff2666f7dbeea49a61ee2788c68f5cfef996bf92c080bea915e68

View File

@ -0,0 +1,36 @@
diff --git a/tcctools.c b/tcctools.c
index 4567b81..2bcc990 100644
--- a/tcctools.c
+++ b/tcctools.c
@@ -61,7 +61,7 @@ static int contains_any(const char *s, const char *list) {
}
static int ar_usage(int ret) {
- fprintf(stderr, "usage: tcc -ar [rcsv] lib file...\n");
+ fprintf(stderr, "usage: tcc -ar [rcsv] lib [file...]\n");
fprintf(stderr, "create library ([abdioptxN] not supported).\n");
return ret;
}
@@ -115,8 +115,9 @@ ST_FUNC int tcc_tool_ar(TCCState *s1, int argc, char **argv)
}
}
- if (!i_obj) // i_obj implies also i_lib. we require both.
+ if (!i_lib) // i_obj implies also i_lib.
ret = 1;
+ i_obj = i_obj ? i_obj : argc; // An empty archive will be generated if no input file is given
if (ret == 1)
return ar_usage(ret);
@@ -242,6 +243,11 @@ ST_FUNC int tcc_tool_ar(TCCState *s1, int argc, char **argv)
hofs++, fpos = 1;
// write header
fwrite("!<arch>\n", 8, 1, fh);
+ // create an empty archive
+ if (!funccnt) {
+ ret = 0;
+ goto the_end;
+ }
sprintf(stmp, "%-10d", (int)(strpos + (funccnt+1) * sizeof(int)));
memcpy(&arhdr.ar_size, stmp, 10);
fwrite(&arhdr, sizeof(arhdr), 1, fh);

View File

@ -0,0 +1,50 @@
diff --git a/libtcc.c b/libtcc.c
index e00c776..1feb741 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1335,6 +1335,8 @@ static int tcc_set_linker(TCCState *s, const char *option)
s->symbolic = 1;
} else if (link_option(option, "nostdlib", &p)) {
s->nostdlib = 1;
+ } else if (link_option(option, "e=", &p)) {
+ copy_linker_arg(&s->elf_entryname, p, 0);
} else if (link_option(option, "fini=", &p)) {
copy_linker_arg(&s->fini_symbol, p, 0);
ignoring = 1;
diff --git a/tcc.h b/tcc.h
index 8a46210..1ea1856 100644
--- a/tcc.h
+++ b/tcc.h
@@ -961,6 +961,8 @@ struct TCCState {
Section *verneed_section;
#endif
+ char *elf_entryname;
+
#ifdef TCC_IS_NATIVE
const char *runtime_main;
void **runtime_mem;
diff --git a/tccelf.c b/tccelf.c
index 1dcbc38..9e860b5 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -2322,11 +2322,17 @@ static void tcc_output_elf(TCCState *s1, FILE *f, int phnum, ElfW(Phdr) *phdr,
default:
case TCC_OUTPUT_EXE:
ehdr.e_type = ET_EXEC;
- ehdr.e_entry = get_sym_addr(s1, "_start", 1, 0);
+ ehdr.e_entry = get_sym_addr(s1,
+ s1->elf_entryname ?
+ s1->elf_entryname : "_start",
+ 1, 0);
break;
case TCC_OUTPUT_DLL:
ehdr.e_type = ET_DYN;
- ehdr.e_entry = text_section->sh_addr; /* XXX: is it correct ? */
+ ehdr.e_entry = s1->elf_entryname ?
+ get_sym_addr(s1,s1->elf_entryname,1,0) :
+ text_section->sh_addr;
+ /* XXX: is it correct ? */
break;
case TCC_OUTPUT_OBJ:
ehdr.e_type = ET_REL;

View File

@ -0,0 +1,26 @@
diff --git a/i386-asm.h b/i386-asm.h
index 65d5179..dfc5183 100644
--- a/i386-asm.h
+++ b/i386-asm.h
@@ -447,6 +447,8 @@ ALT(DEF_ASM_OP2(psrlq, 0x0f73, 2, OPC_MODRM, OPT_IM8, OPT_MMXSSE ))
DEF_ASM_OP2(pxor, 0x0fef, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE )
/* sse */
+ DEF_ASM_OP1(ldmxcsr, 0x0fae, 2, OPC_MODRM, OPT_EA)
+ DEF_ASM_OP1(stmxcsr, 0x0fae, 3, OPC_MODRM, OPT_EA)
DEF_ASM_OP2(movups, 0x0f10, 0, OPC_MODRM, OPT_EA | OPT_REG32, OPT_SSE )
ALT(DEF_ASM_OP2(movups, 0x0f11, 0, OPC_MODRM, OPT_SSE, OPT_EA | OPT_REG32 ))
DEF_ASM_OP2(movaps, 0x0f28, 0, OPC_MODRM, OPT_EA | OPT_REG32, OPT_SSE )
diff --git a/x86_64-asm.h b/x86_64-asm.h
index cb9eb16..4e03773 100644
--- a/x86_64-asm.h
+++ b/x86_64-asm.h
@@ -483,6 +483,8 @@ ALT(DEF_ASM_OP2(psrlq, 0x0f73, 2, OPC_MODRM, OPT_IM8, OPT_MMXSSE ))
DEF_ASM_OP2(pxor, 0x0fef, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE )
/* sse */
+ DEF_ASM_OP1(ldmxcsr, 0x0fae, 2, OPC_MODRM, OPT_EA)
+ DEF_ASM_OP1(stmxcsr, 0x0fae, 3, OPC_MODRM, OPT_EA)
DEF_ASM_OP2(movups, 0x0f10, 0, OPC_MODRM, OPT_EA | OPT_REG32, OPT_SSE )
ALT(DEF_ASM_OP2(movups, 0x0f11, 0, OPC_MODRM, OPT_SSE, OPT_EA | OPT_REG32 ))
DEF_ASM_OP2(movaps, 0x0f28, 0, OPC_MODRM, OPT_EA | OPT_REG32, OPT_SSE )

View File

@ -1 +1,4 @@
git+git://repo.or.cz/tinycc.git
patches/empty_archive.patch
patches/linker_option_entry.patch
patches/mxcsr.patch

View File

@ -1,4 +1,4 @@
libXaw3dXft
autoconf make
automake make
xorg-util-macros make

View File

@ -1,6 +1,5 @@
#!/bin/sh -e
patch -p1 < ttf.patch
./autogen.sh \
--prefix=/usr

View File

@ -1,4 +1,4 @@
libXaw3dXft
autoconf make
automake make
libX11

View File

@ -1 +1 @@
libXaw3dXft

View File

@ -1,4 +1,4 @@
libXaw3dXft
autoconf make
automake make
libX11

View File

@ -1,4 +1,4 @@
libXaw3dXft
autoconf make
automake make
libX11

View File

@ -1,7 +1,5 @@
#!/bin/sh -e
patch -p1 < ttf.patch
./autogen.sh \
--prefix=/usr

View File

@ -1,4 +1,4 @@
libXaw3dXft
autoconf make
automake make
libX11

View File

@ -1,2 +1,2 @@
libXaw3dXft

View File

@ -1,7 +1,5 @@
#!/bin/sh -e
patch -p1 < ttf.patch
for autojunk in aclocal.m4 Makefile.am Makefile.in
do
touch $autojunk

View File

@ -1 +1 @@
libXaw3dXft

View File

@ -1,4 +1,4 @@
libXaw3dXft
autoconf make
automake make
libICE

View File

@ -1,7 +1,8 @@
#!/bin/sh -e
./configure \
--prefix=/usr
--prefix=/usr \
--enable-static
make DESTDIR="$1" install
make DESTDIR="$1" CFLAGS="$CFLAGS -static" install
ln -s /usr/bin/dash "$1/usr/bin/sh"

View File

@ -1 +1 @@
2c65b01747580bca01d42ea23d2ec662b1fa6bc1419e5a9e256e22cf42907f86
a1e8d0a09c01e9054b36ef7625e3cb562e54b25a5aab817e3b3e2e6e65f39911

View File

@ -1,4 +1,4 @@
libXaw3dXft
ghostscript
freetype-harfbuzz
libICE

View File

@ -1 +1 @@
98b1bd46d6792925ad2dfe9a87452ea2adebf69dcb9919ffd55bf926a7f93f7f
01b2278b2426c4de0ee7ddc6e6352b050b6d4f05c2f385c93d58357a67818e3e

View File

@ -1 +1 @@
https://fossies.org/linux/www/libxslt-1.1.34.tar.gz
https://fossies.org/linux/www/libxslt-1.1.37.tar.bz2

View File

@ -1 +1 @@
1.1.34 1
1.1.37 1

View File

@ -1,12 +0,0 @@
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Xaw
Description: X Athena Widgets Library, version 7
Version: 1.0.13
Requires: xproto xt
Requires.private: x11 xext xt xmu xpm
Cflags: -I${includedir}
Libs: -L${libdir} -lneXtaw

View File

@ -1,4 +1,4 @@
libXaw3dXft
libICE
libSM
libX11

View File

@ -6,5 +6,8 @@ CFLAGS='-O2 -w -pipe'
--prefix=/usr \
--enable-native
ln -s /bin/true ./strip
export PATH="$PWD:$PATH"
make
make DESTDIR="$1" install

View File

@ -1 +1 @@
b2025588421ff26f92548cb4ead3ecec73347b7a17ff4da7352a7c00ba1e1308
9960c25138fec5eebe3529f3acb466b35c06397e5e07cf67a0958727fe3153b3

View File

@ -17,4 +17,4 @@ libfontenc
libxcb
libxkbfile
mesa
libXaw3dXft

View File

@ -1,4 +1,4 @@
libXaw3dXft
gccmakedep-git make
imake-git make
xorg-cf-git make

View File

@ -1,4 +1,4 @@
libXaw3dXft
libICE
libSM
libX11

View File

@ -1,4 +1,4 @@
libXaw3dXft
libXdmcp
libXpm
xrdb

View File

@ -3,7 +3,6 @@
chmod +rw *
patch -p1 < errors.patch
chmod +rw *
patch -p1 < ttf.patch
make
make DESTDIR="$1" install

View File

@ -1,7 +1,7 @@
fontconfig
freetype-harfbuzz
libX11
libXaw3dXft
libXft
libXmu
libXt

View File

@ -1,2 +1,2 @@
libXaw3dXft
xbitmaps make

View File

@ -1,2 +1,2 @@
libXtst
libXaw3dXft