2021-08-02 02:04:46 +08:00
|
|
|
/*********************************************************************/
|
2002-11-03 04:46:19 +08:00
|
|
|
/* keywords */
|
|
|
|
DEF(TOK_INT, "int")
|
|
|
|
DEF(TOK_VOID, "void")
|
|
|
|
DEF(TOK_CHAR, "char")
|
|
|
|
DEF(TOK_IF, "if")
|
|
|
|
DEF(TOK_ELSE, "else")
|
|
|
|
DEF(TOK_WHILE, "while")
|
|
|
|
DEF(TOK_BREAK, "break")
|
|
|
|
DEF(TOK_RETURN, "return")
|
|
|
|
DEF(TOK_FOR, "for")
|
|
|
|
DEF(TOK_EXTERN, "extern")
|
|
|
|
DEF(TOK_STATIC, "static")
|
|
|
|
DEF(TOK_UNSIGNED, "unsigned")
|
|
|
|
DEF(TOK_GOTO, "goto")
|
|
|
|
DEF(TOK_DO, "do")
|
|
|
|
DEF(TOK_CONTINUE, "continue")
|
|
|
|
DEF(TOK_SWITCH, "switch")
|
|
|
|
DEF(TOK_CASE, "case")
|
2002-08-30 05:15:05 +08:00
|
|
|
|
2021-01-26 21:29:07 +08:00
|
|
|
DEF(TOK__Atomic, "_Atomic")
|
2003-01-07 04:23:26 +08:00
|
|
|
DEF(TOK_CONST1, "const")
|
|
|
|
DEF(TOK_CONST2, "__const") /* gcc keyword */
|
|
|
|
DEF(TOK_CONST3, "__const__") /* gcc keyword */
|
|
|
|
DEF(TOK_VOLATILE1, "volatile")
|
|
|
|
DEF(TOK_VOLATILE2, "__volatile") /* gcc keyword */
|
|
|
|
DEF(TOK_VOLATILE3, "__volatile__") /* gcc keyword */
|
2002-11-03 04:46:19 +08:00
|
|
|
DEF(TOK_LONG, "long")
|
|
|
|
DEF(TOK_REGISTER, "register")
|
2003-01-07 04:23:26 +08:00
|
|
|
DEF(TOK_SIGNED1, "signed")
|
|
|
|
DEF(TOK_SIGNED2, "__signed") /* gcc keyword */
|
|
|
|
DEF(TOK_SIGNED3, "__signed__") /* gcc keyword */
|
2002-11-03 04:46:19 +08:00
|
|
|
DEF(TOK_AUTO, "auto")
|
2003-01-07 04:23:26 +08:00
|
|
|
DEF(TOK_INLINE1, "inline")
|
|
|
|
DEF(TOK_INLINE2, "__inline") /* gcc keyword */
|
|
|
|
DEF(TOK_INLINE3, "__inline__") /* gcc keyword */
|
|
|
|
DEF(TOK_RESTRICT1, "restrict")
|
|
|
|
DEF(TOK_RESTRICT2, "__restrict")
|
|
|
|
DEF(TOK_RESTRICT3, "__restrict__")
|
|
|
|
DEF(TOK_EXTENSION, "__extension__") /* gcc keyword */
|
2016-12-09 18:42:41 +08:00
|
|
|
|
|
|
|
DEF(TOK_GENERIC, "_Generic")
|
2019-04-28 07:07:01 +08:00
|
|
|
DEF(TOK_STATIC_ASSERT, "_Static_assert")
|
2016-12-09 18:42:41 +08:00
|
|
|
|
2002-11-03 04:46:19 +08:00
|
|
|
DEF(TOK_FLOAT, "float")
|
|
|
|
DEF(TOK_DOUBLE, "double")
|
|
|
|
DEF(TOK_BOOL, "_Bool")
|
|
|
|
DEF(TOK_SHORT, "short")
|
|
|
|
DEF(TOK_STRUCT, "struct")
|
|
|
|
DEF(TOK_UNION, "union")
|
|
|
|
DEF(TOK_TYPEDEF, "typedef")
|
|
|
|
DEF(TOK_DEFAULT, "default")
|
|
|
|
DEF(TOK_ENUM, "enum")
|
|
|
|
DEF(TOK_SIZEOF, "sizeof")
|
2003-01-07 04:23:26 +08:00
|
|
|
DEF(TOK_ATTRIBUTE1, "__attribute")
|
|
|
|
DEF(TOK_ATTRIBUTE2, "__attribute__")
|
|
|
|
DEF(TOK_ALIGNOF1, "__alignof")
|
|
|
|
DEF(TOK_ALIGNOF2, "__alignof__")
|
2018-12-13 02:53:58 +08:00
|
|
|
DEF(TOK_ALIGNOF3, "_Alignof")
|
2019-03-21 03:03:27 +08:00
|
|
|
DEF(TOK_ALIGNAS, "_Alignas")
|
2003-01-07 04:23:26 +08:00
|
|
|
DEF(TOK_TYPEOF1, "typeof")
|
|
|
|
DEF(TOK_TYPEOF2, "__typeof")
|
|
|
|
DEF(TOK_TYPEOF3, "__typeof__")
|
|
|
|
DEF(TOK_LABEL, "__label__")
|
|
|
|
DEF(TOK_ASM1, "asm")
|
|
|
|
DEF(TOK_ASM2, "__asm")
|
|
|
|
DEF(TOK_ASM3, "__asm__")
|
2002-08-30 05:15:05 +08:00
|
|
|
|
2015-02-14 02:58:31 +08:00
|
|
|
#ifdef TCC_TARGET_ARM64
|
|
|
|
DEF(TOK_UINT128, "__uint128_t")
|
|
|
|
#endif
|
|
|
|
|
2002-11-03 04:46:19 +08:00
|
|
|
/*********************************************************************/
|
|
|
|
/* the following are not keywords. They are included to ease parsing */
|
|
|
|
/* preprocessor only */
|
|
|
|
DEF(TOK_DEFINE, "define")
|
|
|
|
DEF(TOK_INCLUDE, "include")
|
2005-04-11 06:18:53 +08:00
|
|
|
DEF(TOK_INCLUDE_NEXT, "include_next")
|
2002-11-03 04:46:19 +08:00
|
|
|
DEF(TOK_IFDEF, "ifdef")
|
|
|
|
DEF(TOK_IFNDEF, "ifndef")
|
|
|
|
DEF(TOK_ELIF, "elif")
|
|
|
|
DEF(TOK_ENDIF, "endif")
|
|
|
|
DEF(TOK_DEFINED, "defined")
|
|
|
|
DEF(TOK_UNDEF, "undef")
|
|
|
|
DEF(TOK_ERROR, "error")
|
2002-11-24 23:58:28 +08:00
|
|
|
DEF(TOK_WARNING, "warning")
|
2002-11-03 04:46:19 +08:00
|
|
|
DEF(TOK_LINE, "line")
|
2002-11-24 23:58:28 +08:00
|
|
|
DEF(TOK_PRAGMA, "pragma")
|
2002-11-03 04:46:19 +08:00
|
|
|
DEF(TOK___LINE__, "__LINE__")
|
|
|
|
DEF(TOK___FILE__, "__FILE__")
|
|
|
|
DEF(TOK___DATE__, "__DATE__")
|
|
|
|
DEF(TOK___TIME__, "__TIME__")
|
|
|
|
DEF(TOK___FUNCTION__, "__FUNCTION__")
|
|
|
|
DEF(TOK___VA_ARGS__, "__VA_ARGS__")
|
2017-07-09 11:30:47 +08:00
|
|
|
DEF(TOK___COUNTER__, "__COUNTER__")
|
2020-05-09 06:39:45 +08:00
|
|
|
DEF(TOK___HAS_INCLUDE, "__has_include")
|
2022-08-14 18:17:31 +08:00
|
|
|
DEF(TOK___HAS_INCLUDE_NEXT, "__has_include_next")
|
2010-05-06 08:19:00 +08:00
|
|
|
|
2002-11-03 04:46:19 +08:00
|
|
|
/* special identifiers */
|
|
|
|
DEF(TOK___FUNC__, "__func__")
|
2010-05-06 08:19:00 +08:00
|
|
|
|
|
|
|
/* special floating point values */
|
|
|
|
DEF(TOK___NAN__, "__nan__")
|
|
|
|
DEF(TOK___SNAN__, "__snan__")
|
|
|
|
DEF(TOK___INF__, "__inf__")
|
2021-01-24 23:20:48 +08:00
|
|
|
#if defined TCC_TARGET_X86_64
|
|
|
|
DEF(TOK___mzerosf, "__mzerosf") /* -0.0 */
|
|
|
|
DEF(TOK___mzerodf, "__mzerodf") /* -0.0 */
|
|
|
|
#endif
|
2010-05-06 08:19:00 +08:00
|
|
|
|
2002-07-23 07:37:39 +08:00
|
|
|
/* attribute identifiers */
|
2003-01-07 04:23:26 +08:00
|
|
|
/* XXX: handle all tokens generically since speed is not critical */
|
|
|
|
DEF(TOK_SECTION1, "section")
|
|
|
|
DEF(TOK_SECTION2, "__section__")
|
|
|
|
DEF(TOK_ALIGNED1, "aligned")
|
|
|
|
DEF(TOK_ALIGNED2, "__aligned__")
|
2004-10-30 07:55:13 +08:00
|
|
|
DEF(TOK_PACKED1, "packed")
|
|
|
|
DEF(TOK_PACKED2, "__packed__")
|
2010-02-28 00:37:59 +08:00
|
|
|
DEF(TOK_WEAK1, "weak")
|
|
|
|
DEF(TOK_WEAK2, "__weak__")
|
2011-03-03 17:58:45 +08:00
|
|
|
DEF(TOK_ALIAS1, "alias")
|
|
|
|
DEF(TOK_ALIAS2, "__alias__")
|
2003-01-07 04:23:26 +08:00
|
|
|
DEF(TOK_UNUSED1, "unused")
|
|
|
|
DEF(TOK_UNUSED2, "__unused__")
|
|
|
|
DEF(TOK_CDECL1, "cdecl")
|
|
|
|
DEF(TOK_CDECL2, "__cdecl")
|
|
|
|
DEF(TOK_CDECL3, "__cdecl__")
|
|
|
|
DEF(TOK_STDCALL1, "stdcall")
|
|
|
|
DEF(TOK_STDCALL2, "__stdcall")
|
|
|
|
DEF(TOK_STDCALL3, "__stdcall__")
|
2005-09-04 17:18:02 +08:00
|
|
|
DEF(TOK_FASTCALL1, "fastcall")
|
|
|
|
DEF(TOK_FASTCALL2, "__fastcall")
|
|
|
|
DEF(TOK_FASTCALL3, "__fastcall__")
|
various stuff
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure && make can be used with either
cygwin's "GCC for Win32 Toolchain"
./configure --cross-prefix=i686-w64-mingw32-
or with an existing tcc:
./configure --cc=<old-tccdir>/tcc.exe
tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)
tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)
tests:
- remove -I "expr" diff option to allow tests with
busybox-diff.
libtcc.c, tcc.c:
- removed -iwithprefix option. It is supposed to be
combined with -iprefix which we don't have either.
tccgen.c:
- fix assignments and return of 'void', as in
void f() {
void *p, *q;
*p = *q:
return *p;
}
This appears to be allowed but should do nothing.
tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1.
The patch was giving tcc's system includes priority over -I which
is not how it should be.
tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
(weak) symbols
tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
(it was so once except the RX mapping wasn't used at all).
tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.
tccasm.c:
- keep forward asm labels static, otherwise they will endup
in dynsym eventually.
configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
make XTCC=<tcc program to use>
- use $(wildcard ...) for install to allow installing just
a cross compiler for example
make cross-arm
make install
- use name <target>-libtcc1.a
build-tcc.bat:
- add options: -clean, -b bindir
2017-10-12 00:13:43 +08:00
|
|
|
DEF(TOK_REGPARM1, "regparm")
|
|
|
|
DEF(TOK_REGPARM2, "__regparm__")
|
2018-12-20 17:55:22 +08:00
|
|
|
DEF(TOK_CLEANUP1, "cleanup")
|
|
|
|
DEF(TOK_CLEANUP2, "__cleanup__")
|
2019-10-29 14:02:58 +08:00
|
|
|
DEF(TOK_CONSTRUCTOR1, "constructor")
|
|
|
|
DEF(TOK_CONSTRUCTOR2, "__constructor__")
|
|
|
|
DEF(TOK_DESTRUCTOR1, "destructor")
|
|
|
|
DEF(TOK_DESTRUCTOR2, "__destructor__")
|
2020-05-22 11:17:02 +08:00
|
|
|
DEF(TOK_ALWAYS_INLINE1, "always_inline")
|
|
|
|
DEF(TOK_ALWAYS_INLINE2, "__always_inline__")
|
2016-10-15 22:01:16 +08:00
|
|
|
|
2010-01-27 05:56:22 +08:00
|
|
|
DEF(TOK_MODE, "__mode__")
|
2016-10-15 22:01:16 +08:00
|
|
|
DEF(TOK_MODE_QI, "__QI__")
|
2010-01-27 05:56:22 +08:00
|
|
|
DEF(TOK_MODE_DI, "__DI__")
|
|
|
|
DEF(TOK_MODE_HI, "__HI__")
|
|
|
|
DEF(TOK_MODE_SI, "__SI__")
|
2016-10-15 22:01:16 +08:00
|
|
|
DEF(TOK_MODE_word, "__word__")
|
|
|
|
|
2005-04-11 05:46:58 +08:00
|
|
|
DEF(TOK_DLLEXPORT, "dllexport")
|
2009-11-14 00:14:05 +08:00
|
|
|
DEF(TOK_DLLIMPORT, "dllimport")
|
2018-07-22 07:54:01 +08:00
|
|
|
DEF(TOK_NODECORATE, "nodecorate")
|
2003-01-07 04:23:26 +08:00
|
|
|
DEF(TOK_NORETURN1, "noreturn")
|
|
|
|
DEF(TOK_NORETURN2, "__noreturn__")
|
2019-03-21 03:03:27 +08:00
|
|
|
DEF(TOK_NORETURN3, "_Noreturn")
|
2014-04-14 08:53:11 +08:00
|
|
|
DEF(TOK_VISIBILITY1, "visibility")
|
|
|
|
DEF(TOK_VISIBILITY2, "__visibility__")
|
various stuff
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure && make can be used with either
cygwin's "GCC for Win32 Toolchain"
./configure --cross-prefix=i686-w64-mingw32-
or with an existing tcc:
./configure --cc=<old-tccdir>/tcc.exe
tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)
tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)
tests:
- remove -I "expr" diff option to allow tests with
busybox-diff.
libtcc.c, tcc.c:
- removed -iwithprefix option. It is supposed to be
combined with -iprefix which we don't have either.
tccgen.c:
- fix assignments and return of 'void', as in
void f() {
void *p, *q;
*p = *q:
return *p;
}
This appears to be allowed but should do nothing.
tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1.
The patch was giving tcc's system includes priority over -I which
is not how it should be.
tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
(weak) symbols
tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
(it was so once except the RX mapping wasn't used at all).
tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.
tccasm.c:
- keep forward asm labels static, otherwise they will endup
in dynsym eventually.
configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
make XTCC=<tcc program to use>
- use $(wildcard ...) for install to allow installing just
a cross compiler for example
make cross-arm
make install
- use name <target>-libtcc1.a
build-tcc.bat:
- add options: -clean, -b bindir
2017-10-12 00:13:43 +08:00
|
|
|
|
2003-04-27 05:28:09 +08:00
|
|
|
DEF(TOK_builtin_types_compatible_p, "__builtin_types_compatible_p")
|
2016-07-13 21:11:40 +08:00
|
|
|
DEF(TOK_builtin_choose_expr, "__builtin_choose_expr")
|
2003-04-27 05:28:09 +08:00
|
|
|
DEF(TOK_builtin_constant_p, "__builtin_constant_p")
|
2008-12-01 00:51:34 +08:00
|
|
|
DEF(TOK_builtin_frame_address, "__builtin_frame_address")
|
2015-03-07 05:01:14 +08:00
|
|
|
DEF(TOK_builtin_return_address, "__builtin_return_address")
|
2016-04-16 17:41:53 +08:00
|
|
|
DEF(TOK_builtin_expect, "__builtin_expect")
|
various stuff
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure && make can be used with either
cygwin's "GCC for Win32 Toolchain"
./configure --cross-prefix=i686-w64-mingw32-
or with an existing tcc:
./configure --cc=<old-tccdir>/tcc.exe
tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)
tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)
tests:
- remove -I "expr" diff option to allow tests with
busybox-diff.
libtcc.c, tcc.c:
- removed -iwithprefix option. It is supposed to be
combined with -iprefix which we don't have either.
tccgen.c:
- fix assignments and return of 'void', as in
void f() {
void *p, *q;
*p = *q:
return *p;
}
This appears to be allowed but should do nothing.
tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1.
The patch was giving tcc's system includes priority over -I which
is not how it should be.
tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
(weak) symbols
tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
(it was so once except the RX mapping wasn't used at all).
tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.
tccasm.c:
- keep forward asm labels static, otherwise they will endup
in dynsym eventually.
configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
make XTCC=<tcc program to use>
- use $(wildcard ...) for install to allow installing just
a cross compiler for example
make cross-arm
make install
- use name <target>-libtcc1.a
build-tcc.bat:
- add options: -clean, -b bindir
2017-10-12 00:13:43 +08:00
|
|
|
/*DEF(TOK_builtin_va_list, "__builtin_va_list")*/
|
|
|
|
#if defined TCC_TARGET_PE && defined TCC_TARGET_X86_64
|
2013-04-24 09:19:15 +08:00
|
|
|
DEF(TOK_builtin_va_start, "__builtin_va_start")
|
various stuff
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure && make can be used with either
cygwin's "GCC for Win32 Toolchain"
./configure --cross-prefix=i686-w64-mingw32-
or with an existing tcc:
./configure --cc=<old-tccdir>/tcc.exe
tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)
tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)
tests:
- remove -I "expr" diff option to allow tests with
busybox-diff.
libtcc.c, tcc.c:
- removed -iwithprefix option. It is supposed to be
combined with -iprefix which we don't have either.
tccgen.c:
- fix assignments and return of 'void', as in
void f() {
void *p, *q;
*p = *q:
return *p;
}
This appears to be allowed but should do nothing.
tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1.
The patch was giving tcc's system includes priority over -I which
is not how it should be.
tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
(weak) symbols
tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
(it was so once except the RX mapping wasn't used at all).
tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.
tccasm.c:
- keep forward asm labels static, otherwise they will endup
in dynsym eventually.
configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
make XTCC=<tcc program to use>
- use $(wildcard ...) for install to allow installing just
a cross compiler for example
make cross-arm
make install
- use name <target>-libtcc1.a
build-tcc.bat:
- add options: -clean, -b bindir
2017-10-12 00:13:43 +08:00
|
|
|
#elif defined TCC_TARGET_X86_64
|
2010-12-28 18:32:40 +08:00
|
|
|
DEF(TOK_builtin_va_arg_types, "__builtin_va_arg_types")
|
various stuff
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure && make can be used with either
cygwin's "GCC for Win32 Toolchain"
./configure --cross-prefix=i686-w64-mingw32-
or with an existing tcc:
./configure --cc=<old-tccdir>/tcc.exe
tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)
tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)
tests:
- remove -I "expr" diff option to allow tests with
busybox-diff.
libtcc.c, tcc.c:
- removed -iwithprefix option. It is supposed to be
combined with -iprefix which we don't have either.
tccgen.c:
- fix assignments and return of 'void', as in
void f() {
void *p, *q;
*p = *q:
return *p;
}
This appears to be allowed but should do nothing.
tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1.
The patch was giving tcc's system includes priority over -I which
is not how it should be.
tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
(weak) symbols
tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
(it was so once except the RX mapping wasn't used at all).
tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.
tccasm.c:
- keep forward asm labels static, otherwise they will endup
in dynsym eventually.
configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
make XTCC=<tcc program to use>
- use $(wildcard ...) for install to allow installing just
a cross compiler for example
make cross-arm
make install
- use name <target>-libtcc1.a
build-tcc.bat:
- add options: -clean, -b bindir
2017-10-12 00:13:43 +08:00
|
|
|
#elif defined TCC_TARGET_ARM64
|
2017-12-26 04:32:27 +08:00
|
|
|
DEF(TOK_builtin_va_start, "__builtin_va_start")
|
|
|
|
DEF(TOK_builtin_va_arg, "__builtin_va_arg")
|
2019-07-21 09:25:12 +08:00
|
|
|
#elif defined TCC_TARGET_RISCV64
|
|
|
|
DEF(TOK_builtin_va_start, "__builtin_va_start")
|
2015-02-14 02:58:31 +08:00
|
|
|
#endif
|
|
|
|
|
2021-01-26 21:29:07 +08:00
|
|
|
/* atomic operations */
|
2021-03-30 15:26:26 +08:00
|
|
|
#define DEF_ATOMIC(ID) DEF(TOK_##__##ID, "__"#ID)
|
2021-02-15 02:41:59 +08:00
|
|
|
DEF_ATOMIC(atomic_store)
|
|
|
|
DEF_ATOMIC(atomic_load)
|
|
|
|
DEF_ATOMIC(atomic_exchange)
|
|
|
|
DEF_ATOMIC(atomic_compare_exchange)
|
|
|
|
DEF_ATOMIC(atomic_fetch_add)
|
|
|
|
DEF_ATOMIC(atomic_fetch_sub)
|
|
|
|
DEF_ATOMIC(atomic_fetch_or)
|
|
|
|
DEF_ATOMIC(atomic_fetch_xor)
|
|
|
|
DEF_ATOMIC(atomic_fetch_and)
|
2021-01-27 02:24:58 +08:00
|
|
|
|
2005-04-14 05:30:51 +08:00
|
|
|
/* pragma */
|
|
|
|
DEF(TOK_pack, "pack")
|
2021-01-03 18:24:37 +08:00
|
|
|
#if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_X86_64) && \
|
|
|
|
!defined(TCC_TARGET_ARM) && !defined(TCC_TARGET_ARM64)
|
2005-04-14 05:30:51 +08:00
|
|
|
/* already defined for assembler */
|
|
|
|
DEF(TOK_ASM_push, "push")
|
|
|
|
DEF(TOK_ASM_pop, "pop")
|
|
|
|
#endif
|
2015-04-16 10:56:21 +08:00
|
|
|
DEF(TOK_comment, "comment")
|
|
|
|
DEF(TOK_lib, "lib")
|
2015-04-24 05:27:36 +08:00
|
|
|
DEF(TOK_push_macro, "push_macro")
|
|
|
|
DEF(TOK_pop_macro, "pop_macro")
|
2015-04-21 20:46:29 +08:00
|
|
|
DEF(TOK_once, "once")
|
2017-07-15 01:26:01 +08:00
|
|
|
DEF(TOK_option, "option")
|
2005-04-14 05:30:51 +08:00
|
|
|
|
2002-07-25 06:12:47 +08:00
|
|
|
/* builtin functions or variables */
|
2014-01-07 02:07:08 +08:00
|
|
|
#ifndef TCC_ARM_EABI
|
2002-11-03 04:46:19 +08:00
|
|
|
DEF(TOK_memcpy, "memcpy")
|
2015-11-06 03:34:58 +08:00
|
|
|
DEF(TOK_memmove, "memmove")
|
2002-11-03 04:46:19 +08:00
|
|
|
DEF(TOK_memset, "memset")
|
|
|
|
DEF(TOK___divdi3, "__divdi3")
|
|
|
|
DEF(TOK___moddi3, "__moddi3")
|
|
|
|
DEF(TOK___udivdi3, "__udivdi3")
|
|
|
|
DEF(TOK___umoddi3, "__umoddi3")
|
2014-01-07 02:07:08 +08:00
|
|
|
DEF(TOK___ashrdi3, "__ashrdi3")
|
|
|
|
DEF(TOK___lshrdi3, "__lshrdi3")
|
|
|
|
DEF(TOK___ashldi3, "__ashldi3")
|
|
|
|
DEF(TOK___floatundisf, "__floatundisf")
|
|
|
|
DEF(TOK___floatundidf, "__floatundidf")
|
|
|
|
# ifndef TCC_ARM_VFP
|
|
|
|
DEF(TOK___floatundixf, "__floatundixf")
|
|
|
|
DEF(TOK___fixunsxfdi, "__fixunsxfdi")
|
|
|
|
# endif
|
|
|
|
DEF(TOK___fixunssfdi, "__fixunssfdi")
|
|
|
|
DEF(TOK___fixunsdfdi, "__fixunsdfdi")
|
2008-09-06 03:07:46 +08:00
|
|
|
#endif
|
2014-01-07 02:07:08 +08:00
|
|
|
|
|
|
|
#if defined TCC_TARGET_ARM
|
|
|
|
# ifdef TCC_ARM_EABI
|
|
|
|
DEF(TOK_memcpy, "__aeabi_memcpy")
|
2015-11-06 03:34:58 +08:00
|
|
|
DEF(TOK_memmove, "__aeabi_memmove")
|
2020-06-16 13:39:48 +08:00
|
|
|
DEF(TOK_memmove4, "__aeabi_memmove4")
|
|
|
|
DEF(TOK_memmove8, "__aeabi_memmove8")
|
2014-01-07 02:07:08 +08:00
|
|
|
DEF(TOK_memset, "__aeabi_memset")
|
|
|
|
DEF(TOK___aeabi_ldivmod, "__aeabi_ldivmod")
|
|
|
|
DEF(TOK___aeabi_uldivmod, "__aeabi_uldivmod")
|
2008-09-06 03:07:46 +08:00
|
|
|
DEF(TOK___aeabi_idivmod, "__aeabi_idivmod")
|
|
|
|
DEF(TOK___aeabi_uidivmod, "__aeabi_uidivmod")
|
2007-12-05 04:38:09 +08:00
|
|
|
DEF(TOK___divsi3, "__aeabi_idiv")
|
|
|
|
DEF(TOK___udivsi3, "__aeabi_uidiv")
|
2008-09-06 03:07:46 +08:00
|
|
|
DEF(TOK___floatdisf, "__aeabi_l2f")
|
|
|
|
DEF(TOK___floatdidf, "__aeabi_l2d")
|
2007-12-05 04:38:09 +08:00
|
|
|
DEF(TOK___fixsfdi, "__aeabi_f2lz")
|
|
|
|
DEF(TOK___fixdfdi, "__aeabi_d2lz")
|
2014-01-07 02:07:08 +08:00
|
|
|
DEF(TOK___ashrdi3, "__aeabi_lasr")
|
|
|
|
DEF(TOK___lshrdi3, "__aeabi_llsr")
|
|
|
|
DEF(TOK___ashldi3, "__aeabi_llsl")
|
|
|
|
DEF(TOK___floatundisf, "__aeabi_ul2f")
|
|
|
|
DEF(TOK___floatundidf, "__aeabi_ul2d")
|
|
|
|
DEF(TOK___fixunssfdi, "__aeabi_f2ulz")
|
|
|
|
DEF(TOK___fixunsdfdi, "__aeabi_d2ulz")
|
|
|
|
# else
|
2008-09-06 03:07:46 +08:00
|
|
|
DEF(TOK___modsi3, "__modsi3")
|
|
|
|
DEF(TOK___umodsi3, "__umodsi3")
|
2007-12-05 04:38:09 +08:00
|
|
|
DEF(TOK___divsi3, "__divsi3")
|
|
|
|
DEF(TOK___udivsi3, "__udivsi3")
|
2008-09-06 03:07:46 +08:00
|
|
|
DEF(TOK___floatdisf, "__floatdisf")
|
|
|
|
DEF(TOK___floatdidf, "__floatdidf")
|
2014-01-07 02:07:08 +08:00
|
|
|
# ifndef TCC_ARM_VFP
|
2008-09-06 03:07:46 +08:00
|
|
|
DEF(TOK___floatdixf, "__floatdixf")
|
2004-10-05 06:19:21 +08:00
|
|
|
DEF(TOK___fixunssfsi, "__fixunssfsi")
|
|
|
|
DEF(TOK___fixunsdfsi, "__fixunsdfsi")
|
|
|
|
DEF(TOK___fixunsxfsi, "__fixunsxfsi")
|
2008-09-06 03:07:46 +08:00
|
|
|
DEF(TOK___fixxfdi, "__fixxfdi")
|
2014-01-07 02:07:08 +08:00
|
|
|
# endif
|
2004-10-05 06:19:21 +08:00
|
|
|
DEF(TOK___fixsfdi, "__fixsfdi")
|
|
|
|
DEF(TOK___fixdfdi, "__fixdfdi")
|
2014-01-07 02:07:08 +08:00
|
|
|
# endif
|
2007-12-05 04:38:09 +08:00
|
|
|
#endif
|
2014-01-07 02:07:08 +08:00
|
|
|
|
|
|
|
#if defined TCC_TARGET_C67
|
2004-10-06 06:33:55 +08:00
|
|
|
DEF(TOK__divi, "_divi")
|
|
|
|
DEF(TOK__divu, "_divu")
|
|
|
|
DEF(TOK__divf, "_divf")
|
|
|
|
DEF(TOK__divd, "_divd")
|
|
|
|
DEF(TOK__remi, "_remi")
|
|
|
|
DEF(TOK__remu, "_remu")
|
2003-10-15 06:15:56 +08:00
|
|
|
#endif
|
2014-01-07 02:07:08 +08:00
|
|
|
|
|
|
|
#if defined TCC_TARGET_I386
|
|
|
|
DEF(TOK___fixsfdi, "__fixsfdi")
|
|
|
|
DEF(TOK___fixdfdi, "__fixdfdi")
|
|
|
|
DEF(TOK___fixxfdi, "__fixxfdi")
|
2008-09-06 03:07:46 +08:00
|
|
|
#endif
|
2014-01-07 02:07:08 +08:00
|
|
|
|
|
|
|
#if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
|
|
|
|
DEF(TOK_alloca, "alloca")
|
2007-12-05 04:38:09 +08:00
|
|
|
#endif
|
2014-01-07 02:07:08 +08:00
|
|
|
|
|
|
|
#if defined TCC_TARGET_PE
|
2005-04-11 06:15:08 +08:00
|
|
|
DEF(TOK___chkstk, "__chkstk")
|
2008-09-06 03:07:46 +08:00
|
|
|
#endif
|
2019-07-18 10:51:52 +08:00
|
|
|
#if defined TCC_TARGET_ARM64 || defined TCC_TARGET_RISCV64
|
2015-03-08 08:10:44 +08:00
|
|
|
DEF(TOK___arm64_clear_cache, "__arm64_clear_cache")
|
2015-02-14 02:58:31 +08:00
|
|
|
DEF(TOK___addtf3, "__addtf3")
|
|
|
|
DEF(TOK___subtf3, "__subtf3")
|
|
|
|
DEF(TOK___multf3, "__multf3")
|
|
|
|
DEF(TOK___divtf3, "__divtf3")
|
|
|
|
DEF(TOK___extendsftf2, "__extendsftf2")
|
|
|
|
DEF(TOK___extenddftf2, "__extenddftf2")
|
|
|
|
DEF(TOK___trunctfsf2, "__trunctfsf2")
|
|
|
|
DEF(TOK___trunctfdf2, "__trunctfdf2")
|
|
|
|
DEF(TOK___fixtfsi, "__fixtfsi")
|
|
|
|
DEF(TOK___fixtfdi, "__fixtfdi")
|
|
|
|
DEF(TOK___fixunstfsi, "__fixunstfsi")
|
|
|
|
DEF(TOK___fixunstfdi, "__fixunstfdi")
|
|
|
|
DEF(TOK___floatsitf, "__floatsitf")
|
|
|
|
DEF(TOK___floatditf, "__floatditf")
|
|
|
|
DEF(TOK___floatunsitf, "__floatunsitf")
|
|
|
|
DEF(TOK___floatunditf, "__floatunditf")
|
|
|
|
DEF(TOK___eqtf2, "__eqtf2")
|
|
|
|
DEF(TOK___netf2, "__netf2")
|
|
|
|
DEF(TOK___lttf2, "__lttf2")
|
|
|
|
DEF(TOK___letf2, "__letf2")
|
|
|
|
DEF(TOK___gttf2, "__gttf2")
|
|
|
|
DEF(TOK___getf2, "__getf2")
|
|
|
|
#endif
|
2002-07-25 06:12:47 +08:00
|
|
|
|
|
|
|
/* bound checking symbols */
|
|
|
|
#ifdef CONFIG_TCC_BCHECK
|
2002-11-03 04:46:19 +08:00
|
|
|
DEF(TOK___bound_ptr_add, "__bound_ptr_add")
|
|
|
|
DEF(TOK___bound_ptr_indir1, "__bound_ptr_indir1")
|
|
|
|
DEF(TOK___bound_ptr_indir2, "__bound_ptr_indir2")
|
|
|
|
DEF(TOK___bound_ptr_indir4, "__bound_ptr_indir4")
|
|
|
|
DEF(TOK___bound_ptr_indir8, "__bound_ptr_indir8")
|
|
|
|
DEF(TOK___bound_ptr_indir12, "__bound_ptr_indir12")
|
|
|
|
DEF(TOK___bound_ptr_indir16, "__bound_ptr_indir16")
|
2014-03-29 14:28:02 +08:00
|
|
|
DEF(TOK___bound_main_arg, "__bound_main_arg")
|
2002-11-03 04:46:19 +08:00
|
|
|
DEF(TOK___bound_local_new, "__bound_local_new")
|
|
|
|
DEF(TOK___bound_local_delete, "__bound_local_delete")
|
2020-05-24 02:02:41 +08:00
|
|
|
DEF(TOK___bound_setjmp, "__bound_setjmp")
|
2020-12-22 14:02:47 +08:00
|
|
|
DEF(TOK___bound_longjmp, "__bound_longjmp")
|
2020-06-17 17:24:17 +08:00
|
|
|
DEF(TOK___bound_new_region, "__bound_new_region")
|
2014-01-07 02:07:08 +08:00
|
|
|
# ifdef TCC_TARGET_PE
|
bcheck cleanup
- revert Makefiles to state before last bcheck additions
Instead, just load bcheck.o explicitly if that is
what is wanted.
- move tcc_add_bcheck() to the <target>-link.c files and
remove revently added arguments. This function is to
support tccelf.c with linking, not for tccgen.c to
support compilation.
- remove -ba option: It said:
"-ba Enable better address checking with bounds checker"
Okay, if it is better then to have it is not an option.
- remove va_copy. It is C99 and we try to stay C89 in tinycc
when possible. For example, MS compilers do not have va_copy.
- win64: revert any 'fixes' to alloca
It was correct as it was before, except for bound_checking
where it was not implemented. This should now work too.
- remove parasitic filename:linenum features
Such feature is already present with rt_printline in
tccrun.c. If it doesn't work it can be fixed.
- revert changes to gen_bounded_ptr_add()
gen_bounded_ptr_add() was working as it should before
(mostly). For the sake of simplicity I switched it to
CDECL. Anyway, FASTCALL means SLOWCALL with tinycc.
In exchange you get one addition which is required for
bounds_cnecking function arguments. The important thing
is to check them *BEFORE* they are loaded into registers.
New function gbound_args() does that.
In any case, code instrumentation with the bounds-check
functions as such now seems to work flawlessly again,
which means when they are inserted as NOPs, any code that
tcc can compile, seems to behave just the same as without
them.
What these functions then do when fully enabled, is a
differnt story. I did not touch this.
2019-12-12 22:45:45 +08:00
|
|
|
# ifdef TCC_TARGET_X86_64
|
|
|
|
DEF(TOK___bound_alloca_nr, "__bound_alloca_nr")
|
|
|
|
# endif
|
2020-05-25 18:26:55 +08:00
|
|
|
# else
|
|
|
|
DEF(TOK_sigsetjmp, "sigsetjmp")
|
|
|
|
DEF(TOK___sigsetjmp, "__sigsetjmp")
|
|
|
|
DEF(TOK_siglongjmp, "siglongjmp")
|
2014-01-07 02:07:08 +08:00
|
|
|
# endif
|
2020-07-05 20:01:50 +08:00
|
|
|
DEF(TOK_setjmp, "setjmp")
|
|
|
|
DEF(TOK__setjmp, "_setjmp")
|
2020-12-22 14:02:47 +08:00
|
|
|
DEF(TOK_longjmp, "longjmp")
|
2011-04-07 00:17:03 +08:00
|
|
|
#endif
|
2003-01-07 04:23:26 +08:00
|
|
|
|
2021-08-02 02:04:46 +08:00
|
|
|
|
|
|
|
/*********************************************************************/
|
2003-04-29 05:23:53 +08:00
|
|
|
/* Tiny Assembler */
|
2021-08-02 02:04:46 +08:00
|
|
|
#define DEF_ASM(x) DEF(TOK_ASM_ ## x, #x)
|
|
|
|
#define DEF_ASMDIR(x) DEF(TOK_ASMDIR_ ## x, "." #x)
|
|
|
|
#define TOK_ASM_int TOK_INT
|
|
|
|
|
|
|
|
#define TOK_ASMDIR_FIRST TOK_ASMDIR_byte
|
|
|
|
#define TOK_ASMDIR_LAST TOK_ASMDIR_section
|
|
|
|
|
|
|
|
DEF_ASMDIR(byte) /* must be first directive */
|
2016-04-13 15:23:46 +08:00
|
|
|
DEF_ASMDIR(word)
|
|
|
|
DEF_ASMDIR(align)
|
2016-06-29 23:22:05 +08:00
|
|
|
DEF_ASMDIR(balign)
|
2016-04-13 15:23:46 +08:00
|
|
|
DEF_ASMDIR(p2align)
|
2016-08-07 10:27:32 +08:00
|
|
|
DEF_ASMDIR(set)
|
2016-04-13 15:23:46 +08:00
|
|
|
DEF_ASMDIR(skip)
|
|
|
|
DEF_ASMDIR(space)
|
|
|
|
DEF_ASMDIR(string)
|
|
|
|
DEF_ASMDIR(asciz)
|
|
|
|
DEF_ASMDIR(ascii)
|
|
|
|
DEF_ASMDIR(file)
|
|
|
|
DEF_ASMDIR(globl)
|
|
|
|
DEF_ASMDIR(global)
|
|
|
|
DEF_ASMDIR(weak)
|
|
|
|
DEF_ASMDIR(hidden)
|
|
|
|
DEF_ASMDIR(ident)
|
|
|
|
DEF_ASMDIR(size)
|
|
|
|
DEF_ASMDIR(type)
|
|
|
|
DEF_ASMDIR(text)
|
|
|
|
DEF_ASMDIR(data)
|
|
|
|
DEF_ASMDIR(bss)
|
|
|
|
DEF_ASMDIR(previous)
|
2016-06-28 21:11:06 +08:00
|
|
|
DEF_ASMDIR(pushsection)
|
|
|
|
DEF_ASMDIR(popsection)
|
2016-04-13 15:23:46 +08:00
|
|
|
DEF_ASMDIR(fill)
|
2016-04-22 23:29:56 +08:00
|
|
|
DEF_ASMDIR(rept)
|
|
|
|
DEF_ASMDIR(endr)
|
2016-04-13 15:23:46 +08:00
|
|
|
DEF_ASMDIR(org)
|
|
|
|
DEF_ASMDIR(quad)
|
2009-08-27 15:34:35 +08:00
|
|
|
#if defined(TCC_TARGET_I386)
|
2016-04-13 15:23:46 +08:00
|
|
|
DEF_ASMDIR(code16)
|
|
|
|
DEF_ASMDIR(code32)
|
2009-08-27 15:53:50 +08:00
|
|
|
#elif defined(TCC_TARGET_X86_64)
|
2016-04-13 15:23:46 +08:00
|
|
|
DEF_ASMDIR(code64)
|
2009-08-27 15:34:35 +08:00
|
|
|
#endif
|
2016-04-13 15:23:46 +08:00
|
|
|
DEF_ASMDIR(short)
|
|
|
|
DEF_ASMDIR(long)
|
|
|
|
DEF_ASMDIR(int)
|
2021-08-02 02:04:46 +08:00
|
|
|
DEF_ASMDIR(section) /* must be last directive */
|
2003-01-07 04:23:26 +08:00
|
|
|
|
2009-12-20 05:08:37 +08:00
|
|
|
#if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
|
2015-07-30 04:53:57 +08:00
|
|
|
#include "i386-tok.h"
|
2003-01-07 04:23:26 +08:00
|
|
|
#endif
|
2021-08-02 02:04:46 +08:00
|
|
|
|
2021-01-03 18:24:37 +08:00
|
|
|
#if defined TCC_TARGET_ARM || defined TCC_TARGET_ARM64
|
2020-12-26 23:21:58 +08:00
|
|
|
#include "arm-tok.h"
|
|
|
|
#endif
|
2021-08-02 02:04:46 +08:00
|
|
|
|
2021-04-06 18:43:21 +08:00
|
|
|
#if defined TCC_TARGET_RISCV64
|
|
|
|
#include "riscv64-tok.h"
|
|
|
|
#endif
|