aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a warningMichael Matz2017-05-081-1/+1
| | | | | | "missing intitializer for field op_type" with gcc -Wextra. It's zero-initialized anyway, and not that much a hassle to explicitely initialize either, so let's be nice and make it not warn.
* more minor fixesgrischka2017-05-079-166/+194
| | | | | | | | | | | | | | | | | | | | | | | | | * tccgen: re-allow long double constants for x87 cross sizeof (long double) may be 12 or 16 depending on host platform (i386/x86_64 on unix/windows). Except that it's 8 if the host is on windows and not gcc was used to compile tcc. * win64: fix builtin_va_start after VT_REF removal See also a8b83ce43a95fa519dacfe7690a3a0098af7909c * tcctest.c: remove outdated limitation for ll-bitfield test It always worked, there is no reason why it should not work in future. * libtcc1.c: exclude long double conversion on ARM * Makefile: remove CFLAGS from link recipes * lib/Makefile: use target DEFINES as passed from main Makefile * lib/armflush.c lib/va_list.c: factor out from libtcc1.c * arm-gen.c: disable "depreciated" warnings for now
* Accept extern initialized file-scope variablesMichael Matz2017-05-072-1/+4
| | | | | | 'extern int i = 42;' at file scope (but not in function scope!) is allowed and is a proper definition, even though questionable style; some compilers warn about this.
* elf: Fix last commitMichael Matz2017-05-071-7/+53
| | | | Forgot to mark tccelf.c as to be committed in last commit :-/
* elf: Support STB_LOCAL dynamic symbolsMichael Matz2017-05-075-0/+5
| | | | | | | | local symbols can be resolved statically, they don't have to be done dynamically, so this is a slight speedup at load time for produced executables and shared libs. The musl libc also rejects any STB_LOCAL symbols for dynamic symbol resolution, so there it also fixes use of shared libs created by tcc.
* elf: Ignore SHF_COMPRESSED sectionsMichael Matz2017-05-062-1/+11
| | | | | | | | | | | | some newer systems have debug sections compressed by default, which includes those in the crt[1in].o startup files. These can't simply be concatenated like all others (which leads to invalid section contents ultimately making gdb fail) but need special handling. Instead of that special handling (decompressing, which in turn requires linking against zlib) let's just ignore such sections, even though that means to also ignore all other debug sections from that particular input file. Our own generated files of course don't have the problem.
* struct-init: Fix zero initialization with multi-level designatorsMichael Matz2017-05-063-67/+96
| | | | | | | See the added testcase. When one used designators like .a.x to initialize sub-members of members, and didn't then initialize all of them the required zero-initialization of the other sub-members wasn't done. The fix also enables tiny code cleanups.
* Fix unsigned enum bit-fieldsMichael Matz2017-05-053-1/+60
| | | | | | See testcase. If an enum has only positive values, fits N bits, and is placed in a N-bit bit-field that bit-fields must be treated as unsigned, not signed.
* Fix segfault with invalid function defMichael Matz2017-05-052-1/+6
| | | | | | | This invalid function definition: int f()[] {} was tried to be handled but there was no testcase if it actually worked. This fixes it and adds a TCC only testcase.
* Rebuild cross compilers when sources changeMichael Matz2017-05-021-1/+1
| | | | | | | | ONE_SOURCE=yes cross-compilers currently only depend on tcc.c, which itself has no further deps. So e.g. changing tccgen.c or tcctok.h don't automatically rebuild cross compilers. Let's go over the intermediate $(X)tcc.o file which automatically depends on LIBTCC_INC, which are all relevant source files.
* Tidy decl_designatorMichael Matz2017-05-021-26/+15
| | | | | Removing the need for the notfirst local variable, and tidy loop structure and error messaging a bit.
* Remove label_or_declMichael Matz2017-05-021-21/+5
| | | | | The only use of this function can be rewritten in terms of is_label (if one other use of that one are a bit amended).
* Cleanups (float consts, sections, symbols)Michael Matz2017-05-023-79/+42
| | | | | | | | introduce common_section (SHN_COMMON), factorize some handling in decl_initializer_alloc, add section_add and use it to factorize some code that allocates stuff in sections (at the same time also fixing harmless bugs re section alignment), use init_putv to emit float consts into .data from gv() (fixing an XXX).
* Merge func_decl_list into decl0Michael Matz2017-05-021-67/+38
| | | | | Removes some code duplication and also implements one feature: checking for duplicate decls for old style parameters.
* Tidy decl_designatorMichael Matz2017-05-021-9/+2
| | | | The fixme therein is long solved.
* Tidy unary() a bitMichael Matz2017-05-023-30/+43
| | | | | | factor code a bit for transforming tokens into SValues. This revealed a bug in TOK_GET (see testcase), which happened to be harmless before. So fix that as well.
* Factor some codeMichael Matz2017-05-021-63/+47
| | | | | Three places that skip (and store) tokens in some fashion can be factored a bit.
* Extend type_to_strMichael Matz2017-05-021-1/+11
| | | | to also print storage-class specifiers.
* Reorganize type parsingMichael Matz2017-05-022-64/+91
| | | | | Various corner cases for declarator parsing were incorrect. This reorganizes and fixes it, and somewhat simplifies it as well.
* Tidy typename parsing a bitMichael Matz2017-05-021-26/+16
|
* Tidy arg parsing for builtinsMichael Matz2017-05-021-76/+52
| | | | Saves some lines of code.
* Clarify that the CIL target code is deadMichael Matz2017-05-021-0/+2
| | | | | This backend doesn't work anymore since a long time. Don't remove it yet, it might be an inspiration.
* Remove VT_REFMichael Matz2017-05-023-12/+3
| | | | | | The canonical way to describe a local variable that actually holds the address of an lvalue is VT_LLOCAL. Remove the last user of VT_REF, and handling of it, thereby freeing a flag for SValue.r.
* Fix bogus check for VT_LLOCAL typesMichael Matz2017-05-021-4/+8
| | | | | | VT_LLOCAL is a flag on .r, not on type.t. Fixing this requires minor surgery for compound literals which accidentally happened to be subsumed by the bogus test.
* elf: Tidy section headersMichael Matz2017-05-021-2/+51
| | | | | | | Don't emit useless section headers and also sort them in allocated order. Doesn't change behaviour except makes the resulting files a tiny bit smaller (though at the expense of some very tiny compile time and code size increase of tcc itself; not 100% it's worth it).
* fix __builtin_expectMichael Matz2017-05-021-25/+2
| | | | | | | | the second argument can be an arbitrary expression (including side-effects), not just a constant. This removes the last user of expr_lor_const and hence also that function (and expr_land_const). Also the argument to __builtin_constant_p can be only a non-comma expression (like all functions arguments).
* Fix more bitfield corner casesMichael Matz2017-05-012-0/+9
| | | | | | | Our code generation assumes that it can load/store with the bit-fields base type, so bit_pos/bit_size must be in range for this. We could change the fields type or adjust offset/bit_pos; we do the latter.
* Fix last changeMichael Matz2017-05-011-1/+1
| | | | | Skipping anonymous bit-fields is correct, but not other anonymous ones like unions or structs.
* Remove a bit-field TODOMichael Matz2017-04-293-1/+9
| | | | | | Checked the lcc testsuite for bitfield stuff (in cq.c and fields.c), fixed one more error in initializing unnamed members (which have to be skipped), removed the TODO.
* Fix char bitfields corner caseMichael Matz2017-04-292-1/+7
| | | | See testcase.
* arm: Fix build_got_entriesThomas Stalder2017-04-271-1/+5
|
* Add -static to be in sync with Windows bat.Christian Jullien2017-04-271-1/+1
|
* configure: fix permissionsgrischka2017-04-261-0/+0
| | | | | There must be something with git on windows that it messes up x permissions sometimes.
* Simple-minded fix for bug #50847Larry Doolittle2017-04-253-1/+4
| | | | | | bug #50847: #line directive corrupts #include search path Keep a second copy of the filename, that isn't changed by the #line directive, and use that on the initial search path for #include files.
* final adjustments for releasegrischka2017-04-2513-159/+158
| | | | | | | | | | | | | | | | | | | | | - configure/Makefiles: minor adjustments - build-tcc.bat: add -static to gcc options (avoids libgcc_s*.dll dependency with some mingw versions) - tccpe.c/tcctools.c: eliminate MAX_PATH (not available for cross compilers) - tccasm.c: use uint64_t/strtoull in unary() (unsigned long sometimes is only uint32_t, as always on windows) - tccgen.c: Revert (f077d16c) "tccgen: gen_cast: cast FLOAT to DOUBLE" Was a rather experimental, tentative commit, not really necessary and somewhat ugly too. - cleanup recent osx support: - Makefile/libtcc.c: cleanup copy&paste code - tccpp.c: restore deleted function
* tcc: report Darwin when building for Mach-O binaries.Andrei Warkentin2017-04-251-0/+2
| | | | | | | Somewhat revert c4c3f50, but key off the config, not host system. Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
* tcc: fixup clang warningsAndrei Warkentin2017-04-2510-45/+17
| | | | | | | | | | | The O(xxx) stuff in i386-asm.c had me scratching my head. Extracting the macro and trying it out in a separate program doesn't give me any warnings, so I'm confused about what could be going on there. Any cast will make things happy. I used a uint64_t to catch actual cases of overflow, which will still cause a -Wconstant-conversion warning. Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
* tcc: early OSX native supportAndrei Warkentin2017-04-254-4/+48
| | | | | | | | | | | | - build scripts - working '-run' mode, e.g.: ./tcc -B. -I./include -I. -I.. -D_ANSI_SOURCE -run examples/ex1.c Note: we don't bother parsing Mach-O/Fat images yet. We blindly dlopen the image. Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
* Add support of musl-libcMarc Vertes2017-04-208-6/+33
| | | | The port is functional. Bound checking is not supported yet.
* tccpp: Fix corner case of fnlike macro invocationMichael Matz2017-04-153-2/+22
| | | | | | | Arg substitution leaves placeholder marker in the stream for empty arguments. Those need to be skipped when searching for a fnlike macro invocation in the replacement list itself. See testcase.
* tccgen/win32: let __declspec(dllimport) imply externgrischka2017-04-047-170/+166
| | | | | | | | | | | | | | | | | | | | | | | Also, retain storage qualifiers in type_decl, in particular also for function pointers. This allows to get rid of this very early hack in decl() type.t |= (btype.t & VT_STATIC); /* Retain "static". */ which was to fix the case of int main() { static int (*foo)(); ... Also: - missing __declspec(dllimport) is an error now - except if the symbol is "_imp__symbol" - demonstrate export/import of data in the dll example (while 'extern' isn't strictly required with dllimport anymore) - new function 'patch_storage()' replaces 'weaken_symbol()' and 'apply_visibility()' - new function 'update_storage()' applies storage attributes to Elf symbols. - put_extern_sym/2 accepts new pseudo section SECTION_COMMON - add -Wl,-export-all-symbols as alias for -rdynamic - add -Wl,-subsystem=windows for mingw compatibility - redefinition of 'sym' error for initialized global data
* Even on Darwin, tcc should display LinuxChristian Jullien2017-02-261-2/+0
|
* win: tests Makefile: fix global pathAvi Halachmi (:avih)2017-02-261-1/+1
| | | | | | | | | | Commit bb93064 changed the path seperator from ':' to ';', which was likely accidental. While path seperator on Windows is generally ';', the Makefile clearly expects a posix-y shell, and in such environments the separator is ':'. This fixes the test run in MSYS2 and MSYS(1) environments, which got broken on bb93064 .
* Linux was incorrectly identified in banner when compiled on macOS DarwinChristian Jullien2017-02-261-0/+2
|
* makefile: unify cross with native buildsgrischka2017-02-2510-293/+318
| | | | | | | | | | | | | supports building cross compilers on the fly without need for configure --enable-cross $ make cross # all compilers $ make cross-TARGET # only TARGET-compiler & its libtcc1.a with TARGET one from i386 x86_64 i386-win32 x86_64-win32 arm arm64 arm-wince c67 Type 'make help' for more information
* Cygwin Makefile was to aggresive to remove entire lib/Christian Jullien2017-02-241-5/+3
|
* Update Cygwin Makefile for new libtcc1-xx.a layoutChristian Jullien2017-02-241-10/+9
|
* cross-compilers: allow individual configurationgrischka2017-02-2315-242/+365
| | | | | | | | | | | | | | | | | | | | | | | | | | | since configure supports only native configuration a file 'cross-tcc.mak' needs to be created manually. It is included in the Makefile if present. # ---------------------------------------------------- # Example config-cross.mak: # # windows -> i386-linux cross-compiler # (it expects the linux files in <prefix>/i386-linux) ROOT-i386 = {B}/i386-linux CRT-i386 = $(ROOT-i386)/usr/lib LIB-i386 = $(ROOT-i386)/lib:$(ROOT-i386)/usr/lib INC-i386 = {B}/lib/include:$(ROOT-i386)/usr/include DEF-i386 += -D__linux__ # ---------------------------------------------------- Also: - use libtcc1-<target>.a instead of directories - add dummy arm assembler - remove include dependencies from armeabi.c/lib-arm64.c - tccelf/ld_add_file: add SYSROOT (when defined) to absolute filenames coming from ld-scripts
* Add note about native Windows bootstrap using Cygwin.Christian Jullien2017-02-232-0/+2
|
* x86-64-asm: Fix mov im64,rax encodingMichael Matz2017-02-233-13/+33
| | | | | | | the avoidance of mov im32->reg64 wasn't working when reg64 was rax. While fixing this also fix instructions which had the REX prefix hardcoded in opcode and so didn't support extended registers which would have added another REX prefix.