The script was expecting gcc-3.2 in a specific directory,
works only, when building tcc in the source directory
and creates >3200 files in /tmp (probably a SSD).
Now gcctestsuite.sh works much better.
* use TESTSUITE_PATH, to tell the script the location, where the actual
gcc.c-torture directory is
* work also, when tcc was build in a separate build directory.
use TCC_SOURCE_PATH, when guessing the tcc source directory does not work
* use RUNTIME_DIR to redirect compiler output
(default: XDG_RUNTIME_DIR, then /tmp)
* skip tests for features not implemented in tcc ( *_builtin_*, _Complex )
--
Regards, Detlef
(As long as it is in the default install location and was not
moved elsewhere into the library search path manually)
Also:
- libtcc.c:
- error1(): show correct line with "In file included from ..."
- support "tcc -Bxxx -vv"
- tcc_new()/tcc_compile(): Don't create elf sections for tcc -E
- tccdbg.c:
- tcc -E -g : revert 1de025c13a
Let's keep things simple, everybody understands 'do_debug'
and dState is set by tcov too (but no debug sections).
- tccgen.c:
- avoid the extra parameter for gind()
(from c3e3a07ed4)
- vla func params: use skip_or_save_block() and enable
VT_LVAL (see 313855c232)
- cleanup nocode_wanted a bit
- tccelf.c:
- tccelf_end_file(): don't try to translate zero-sym relocs
(seems to happen with asm "jmp 0x1000")
- version_add(): do not make "ld-linux.so" DT_NEEDED
1) recursive types have no storage anymore, so a
static int (*p)[x];
declaration is just fine
2) since somewhen VT_VLA doesn't imply VT_ARRAY anymore, so we
now need to check VLA in at least one place before checking
test_lvalue.
((2) should probably be cleaned up again so that VLA does again imply
ARRAY)
- also simplify parse(_line)_comment() and parse_pp_string()
- fixes a continuation problem in strings (see tcctest.c)
- no differences in performance could be observed
161 insertions(+), 246 deletions(-), less 85 lines
an expression like 'i*0', even though it's value is constant and
can be evaluated at compile time is not an integer constant expression,
and hence no null pointer constant, and therefore the conditional
operator doesn't select the other type.
if a switch is unreachable then so are the case labels.
Unlike normal labels they can't possibly be reached from not-yet
parsed code, so there's no reason to enable codegen again for those.
see testcase. We have to "empty" the macro-stack string on
end_macro, as it may be 'tokstr_buf' which is going to be used
twice in recursive invocations of macro_subst_tok. The uses aren't
overlapping but the first one needs to be properly finalized.
The no-operand vm* instructions can be interpreted as having a
funny modrm byte, but unlike no-operand OPC_MODRM it's also the
r/m field which selects the insn, not (only) the reg field (aka group),
so we need another insn type.
as this is the first opcode TCC supports that has a 0xf3 prefix
and uses integer registers (not SSE ones) this also needs some shuffling
of the prefix code to not generate invalid instructions (the REX prefix
_must_ come directly before the main opcode (including 0f prefix), and
hence needs to come after the 0xf3 prefix). Also disable some mnemonics
in asmtest.S that new GAS doesn't support anymore. The only difference
to GAS (in asmtest.S) is now the 'lock negl' instruction which TCC
emits as 'lock; negl'. That's fine.
they look similar to labels 'foobar : 32' (when foobar is a typedef),
but cannot be handled as such in parse_btype, the context is important
(labels can only happen when called from within 'block', aka decl0 in
VT_LOCAL context). This got broken back in 2019 (1b57560).
On an armeabi-v7a device (phone) in the termux app with
clang & make installed this passes all the tests.
Can be used as a cross compiler to create "native apps" as well.
Example 'config-extra.mak' for the cross arm-eabi-tcc:
SYSROOT = <path_to_android_ndk...>/sysroot/usr
TRIPLET = arm-linux-androideabi
ANDRVER = 32
ROOT-arm-eabi = $(SYSROOT)
CRT-arm-eabi = {R}/lib/$(TRIPLET)/$(ANDRVER)
LIB-arm-eabi = {B};{R}/lib/$(TRIPLET)/$(ANDRVER);{R}/lib/$(TRIPLET)
INC-arm-eabi = {B}/lib/include;{R}/include/$(TRIPLET);{R}/include
DEF-arm-eabi = -DTCC_TARGET_ARM -DTCC_ARM_VFP -DTCC_ARM_EABI
DEF-arm-eabi += -DTARGETOS_ANDROID -DCONFIG_TCC_PIE -DCONFIG_NEW_DTAGS
DEF-arm-eabi += -DCONFIG_TCC_ELFINTERP=\"/system/bin/linker\"
# on unix replace ';' by ':'.
$ ./configure && make cross-arm-eabi && make install
See commit e588b65390.
Was not "wrong" really, just different. But appears to be outdated.
Now disabled by default (top of tccpp.c: ACCEPT_LF_IN_STRINGS)
Also, in skipped code, just warn.
Also: cleanup "Optimize small structure copying on x86_64"
(commit 3715f1d7ee)
- remove some copy&paste coding (tccgen.c)
- RSI/RDI need to be preserved on windows
- simply don't use under bcheck (this is tinycc)
it.Commit 3715f1d makes the error message of bound check on x86_64
different from other platforms,which breaks the test process.But that
commit exactly works well.
commit ec5d94291 made is to that the nocode_wanted state from
inside a statement expression is retained after it. That is wrong
if the statement expression can't be entered to start with. In the
latter case the state from before the stmt-expr is the one we need.
/* Use "-g" as alias for "-g1". Use "-g0" to disable debug */
So not using -g is now the alias for -g0 ?!?
This reverts commit 8759b2581d.
This reverts commit 3ce7bc6efc.
This reverts commit 5fb582ab7f.
This reverts commit aea68dbb40.
This reverts commit fa9c31c3db.
This reverts commit b3bebdb20a.
This reverts commit ecf8e5a00e.
This reverts commit fe6b5c08dc.
This reverts commit e2e5377e7b.
This reverts commit 1cd7998905.
This if for clang (pre)release 15.0.0.
tccrun.c:
- update directory/filename read. clang has extra md5 section
- start with filename 0 instead of 1. clang starts at 0
- change dwarf_read_32/dwarf_read_64 into macros
x86_64-link.c:
- Add support for R_X86_64_DTPOFF64/R_X86_64_TPOFF64. Needed by clang
tests/tcctest.c:
- add prototypes for puts/alloca. clang fails with error
- disable other_constraints_test for clang. clang prints 1 instead of 0
The new gcc12 release does not support stabs any more.
This was a good reason to add support for dwarf.
The stabs code still works and is used if configure option --dwarf
is not used.
Tested on x86_64, i386, arm, arm64, riscv64 with dwarf-5.
Some debuggers may not support dwarf-5. Try using older dwarf versions
i that case.
The tccmacho.c code probably need some support for dwarf.
arm-gen.c, arm64-gen.c, i386-gen.c, riscv64-gen.c, x86_64-gen.
- fix get_sym_ref symbol size
arm-link.c, arm64-link.c, i386-link.c, riscv64-link.c, x86_64-link.c
- add R_DATA_32U
libtcc.c:
- parse -gdwarf option
tcc.c:
- add dwarf option
tcc.h:
- add dwarf option and sections
tccelf.c:
- init dwarf sections
- avoid adding sh_addr for dwarf sections
- remove dwarf relocs for output dll
- add dwarf sections for tccrun
tccgen.c:
- add dwarf defines + global data
- add dwarf_* functions
- mix dwarf code with stabs code
- a trick is used to emit function name in .debug_line section so
only this section has to be parsed instead of .debug_info and
.debug_abbrev.
- fix init debug_modes
tccrun.c:
- add dwarf sections in rt_context
- init them in tcc_run
- add new dwarf code rt_printline_dwarf to find file/function
dwarf.h:
- New file
tcc-doc.texi:
- document dwarf
configure:
- add dwarf option
lib/Makefile
- change -gstabs into -gdwarf
lib/bt-exe.c, tests/tests2/Makefile, tests/tests2/126_bound_global:
- Add __bound_init call
- Add new testcase to test it
There is no code generation in post_type for vla arrays. This code
generation has to be delayed until gen_function.
- post_type save code in type info.
- gen_function use this code to generate vla code.
- enable testcode for vla arrays.
Modify function parameter parser such that symbols are
put into token-table temporarily. Benefits are:
- detects redefinitions, as with
int foo(int a, int a);
- detects reserved symbols, as with
int foo(int if);
- can parse expressions like
int main(int argc, char *argv[argc + 1]);
- doesn't fix this one
int main(int argc, char *argv[++argc]);
Also: fix unexpected "function might return no value"
with statement expression
int f() { ({ return 0; }); }
Currently used only with 'tcc_compile_sem' to protect
tcc_compile(), but can be used with other semaphores
Also fix deadlock when tcc_enter_state() is called
recursively for the same state, for example with
tcc_warning() from #pragma comment(option,"...")
Also:
- libtcc.c: error1(): use cstr_[v]printf()
- tcc.h: set TCC_USING_DOUBLE_FOR_LDOUBLE for macho-arm64
(rather than for macho-X86_64)
- tcc.h: define TCC_TARGET_MACHO on __APPLE__ by default
- tcc.h: cleanup TCCState, move DEFASM token stuff to tcctok.h
- tccgen.c: more static
- Makefile/tcc.c: review githash
- tccpe/tcctools: use read() instead of fgets() in pe_load_def()
(all files opened by tcc for reading are now read via 'int fd')
- configure/win32: don't preset CONFIG_TCCDIR (to allow to override it)
- tcc.c -bench: do not include output/run-time
136 insertions(+), 226 deletions(-), less 90 lines (except tests)
only one set_flag() function required
* can now turn off specific errors: -Werror -Wno-error=option
* new interface: tcc_warning_c(warn_option)("format", args...);
* new warning: -Wdiscarded-qualifiers (on by default)
* new variable 'warn_all' for conditional warnings with -Wall
see also the tests
configure:
- re-enable apple M1-arm64
- however, with --cpu=x86_64, set -arch in CFLAGS/LDFLAGS too
(assume rosetta)
Makefile:
- re-enable osx cross-test (Please do not disable tests)
tcc.h
- set TCC_IS_NATIVE for TCC_TARGET_MACHO on __APPLE__
- apply TCC_USING_DOUBLE_FOR_LDOUBLE for x86_64-osx
libtcc.c:
- cleanup tcc_add_file_internal()
- new function char *tcc_load_text(int fd); and use it for tbd files
- remove any error messages that were just for debugging the
templates really
- don't use c99 in tcc (array designators etc.)
- remove memory model type (cannot be an own type really)
and move memory model defines from built-in to stdatomics.h
- apply normal casts to non-pointer atomic_function arguments
- tidy the library support
- add some tests for errors/warnings
Also:
- Makefile: move GIT_HASH stuff from CFLAGS to DEFINES and into
main section (away from what is included by tests for example)
- tccelf.c/tccgen.c: avoid some warnings with newer GCC
libtcc.c: add -Wwrite-strings to -Wall
tccgen.c: ro float-consts, string-consts, ro arrays if base type is
tccpe.c: merge IAT with rodata
tccrun.c: mprotect rodata accordingly. free section data after copy
x86_64.c: do not use got for static data.
tcc -bench: show data.rw/ro
Probably STB_LOCAL should never get to put_got_entry(), and currently
it doesn't seem to happen (See "Hack Alarm" there)
Other files: use more ro-data in tinycc
when used with string initialization the size of nested struct flex
array member was tested too late for < 0.
GCC accepts but discards such initializers (the flex array member will
become zero sized). TCC supports flex arrays members only in
top-level structs and gives an error in this case.