Add patches for TinyCC
This commit is contained in:
parent
5013f777b5
commit
79593d5689
10
README
10
README
@ -8,7 +8,7 @@ still missing,including:
|
|||||||
- Full GNU-style inline assembly support.
|
- Full GNU-style inline assembly support.
|
||||||
The original versions of __syscall4(),__syscall5() and __syscall6()
|
The original versions of __syscall4(),__syscall5() and __syscall6()
|
||||||
don't work.They are replaced by assembly implemention in
|
don't work.They are replaced by assembly implemention in
|
||||||
/src/unistd/x86_64/syscall.S
|
/src/internal/x86_64/syscall.S
|
||||||
- math library is removed momently.
|
- math library is removed momently.
|
||||||
Because some missing floating-point features of TinyCC.I am working
|
Because some missing floating-point features of TinyCC.I am working
|
||||||
on completing.
|
on completing.
|
||||||
@ -25,6 +25,12 @@ To compile,simply run
|
|||||||
./configure --target=x86_64 # The script cannot detect the
|
./configure --target=x86_64 # The script cannot detect the
|
||||||
# platform with tcc because of
|
# platform with tcc because of
|
||||||
# missing option "-dumpmachine"
|
# missing option "-dumpmachine"
|
||||||
make
|
make # I finish my compiling in 10s with
|
||||||
|
two threads on i7-720QM @ 1.60GHz
|
||||||
|
|
||||||
All modified and addtional files are under MIT License as well.
|
All modified and addtional files are under MIT License as well.
|
||||||
|
Some changes are made to my TinyCC (This means I may have a different
|
||||||
|
version from yours,so if you fail to compile,try to apply the patches
|
||||||
|
listed in /tcc-patch/,including:
|
||||||
|
- empty_archive.patch
|
||||||
|
Enables TinyCC to generate empty ar archive
|
||||||
|
34
tcc-patch/empty_archive.patch
Normal file
34
tcc-patch/empty_archive.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
diff --git a/tcctools.c b/tcctools.c
|
||||||
|
index 4567b81..7c643dc 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,9 @@ 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)
|
||||||
|
+ goto the_end;
|
||||||
|
sprintf(stmp, "%-10d", (int)(strpos + (funccnt+1) * sizeof(int)));
|
||||||
|
memcpy(&arhdr.ar_size, stmp, 10);
|
||||||
|
fwrite(&arhdr, sizeof(arhdr), 1, fh);
|
Loading…
Reference in New Issue
Block a user