aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Improve put_got_entry doc and structureThomas Preud'homme2016-12-032-132/+135
|
* Rename add_elf_sym to set_elf_symThomas Preud'homme2016-12-035-29/+29
| | | | | | | | | | add_elf_sym is a confusing name because it is not clear what the function does compared to put_elf_sym. As a matter of fact, put_elf_sym also adds a symbol in a symbol table. Besides, "add_elf_sym" fails to convey that the function can be used to update a symbol (for instance its value). "set_elf_sym" seems like a more appropriate name: it will set a symbol to a given set of properties (value, size, etc.) and create a new one if non exist for that name as one would expect.
* Improve comments for symbol export and bindingThomas Preud'homme2016-12-031-5/+9
|
* Do not add symbol if it is already thereThomas Preud'homme2016-12-031-4/+9
| | | | | | Do not create a new symbol in add_elf_sym if a symbol with same properties (value, size, info, etc.) already exists. This prevents symbols from being exported twice in the dynamic symbol table.
* Fix error logic for undefined reference in libraryThomas Preud'homme2016-12-031-8/+7
| | | | | | | | Prior to this patch, an error would only be given when a library has an unresolved undefined symbol if there is no undefined reference for the same symbol in the executable itself. This patch changes the logic to check both that the executable has the symbol in its static symbol table *and* that it is defined to decide if the error path should be followed.
* Clear SHF_GROUP flag when linkingroot2016-12-031-1/+1
| | | | | | | | | | | | | | | SHF_GROUP flag set on a section indicates that it is part of a section group and that if the section is removed, the other sections in the same group should be removed as well [1]. Since section group are guide for the linking process, they do not have any meaning after linking has occured. TCC rightfully [2] discard such sections (by not recognizing the section type) but keeps the SHF_GROUP flag set on sections that were part of a section group which confuses binutils (objdump and gdb at least). Clearing that bit makes objdump and gdb accept binaries created by TCC. [1] https://docs.oracle.com/cd/E19683-01/816-1386/chapter7-26/index.html [2] GNU ld does the same
* Remove warning when __builtin_frame_address is used with gcc >= 6.Christian Jullien2016-11-301-0/+13
|
* Implement gcc bitfield algorithm; add -mms-bitfieldsDavid Mertens2016-11-286-7/+44
|
* Minor grammar fixes to docsDavid Mertens2016-11-281-4/+4
|
* configure: prefer lib64 on 64-bit platformsgrischka2016-11-281-3/+4
| | | | | | | use lib64 if - "/usr/lib/multi-arch-triplet" does not work and - we are on a 64-bit platform and - lib64 exists and does contain crti.o
* tccelf: introduce add32/64le()grischka2016-11-203-24/+28
|
* x86_64-asm: =m operand fixesgrischka2016-11-206-33/+81
| | | | | | | | | | | | | | | | | | | | | | The problem was with tcctest.c: unsigned set; __asm__("btsl %1,%0" : "=m"(set) : "Ir"(20) : "cc"); when with tcc compiled with the HAVE_SELINUX option, run with tcc -run, it would use large addresses far beyond the 32bits range when tcc did not use the pc-relative mode for accessing 'set' in global data memory. In fact the assembler did not know about %rip at all. Changes: - memory operands use (%rax) not (%eax) - conversion from VT_LLOCAL: use type VT_PTR - support 'k' modifier - support %rip register - support X(%rip) pc-relative addresses The test in tcctest.c is from Michael Matz.
* arm: Fix relocate_section with TCC_OUTPUT_MEMORYThomas Stalder2016-11-131-2/+4
|
* remove warningsThomas Stalder2016-11-132-4/+3
|
* tccgen: fix inline_functions double free fixgrischka2016-11-113-15/+19
|
* tccgen: inline_functions double free fixgrischka2016-11-113-10/+11
| | | | | | Fix double free of the inline function token_string which could happen when an error/longjmp occurred while compiling the inline function.
* bcheck: access fields of local structs w/o bcheckPavlas, Zdenek2016-11-101-3/+3
| | | | Revert previous commit, this is probably a better fix.
* bcheck: add structs to local regionsPavlas, Zdenek2016-11-091-2/+2
| | | | | | | | int test() { struct { int i; } s = { 42 }; return s.i; // bound checked }
* i386 + bcheck: fix __bound_local_newPavlas, Zdenek2016-11-092-7/+9
| | | | | | | | | | | | With -b, this produces garbage. Code to call __bound_local_new is put at wrong place, overwriting the regparam setup code. Fix copied from x86_64-gen.c. void __attribute__((regparm(3))) fun(int unused) { char local[1]; }
* i386-gen: use EBX as 4th registergrischka2016-10-191-4/+13
| | | | | May be enabled/disabled by changing this line: #define USE_EBX 1
* lib/libtcc1.c: cleanupgrischka2016-10-195-62/+25
| | | | | | | - remove #include dependencies from libtcc1.c for easier cross compilation - clear_cache only on ARM - error-message for mprotect failure
* tccrun/win64: cleanup runtime function tablegrischka2016-10-196-48/+100
| | | | | | | | | | | | | | - call RtlDeleteFunctionTable (important for multiple compilations) - the RUNTIME_FUNCTION* is now at the beginning of the runtime memory. Therefor when tcc_relocate is called with user memory, this should be done manually before it is free'd: RtlDeleteFunctionTable(*(void**)user_mem); [ free(user_mem); ] - x86_64-gen.c: expand char/short return values to int
* configure: --triplet= option, Makefile: cleanupgrischka2016-10-174-83/+69
|
* tccpp_new/delete and other cleanupsgrischka2016-10-1710-190/+202
|
* system-hacks: define __GNUC__ for FreeBSDMichael Matz2016-10-171-10/+9
| | | | | | | | | | | | FreeBSDs system headers contain unconditional usage of macros like __aligned(x), which are only conditionally defined in sys/cdefs.h (conditional on __GNUC__ or __INTEL_COMPILER). Bug in FreeBSD, but as work-around we can define __GNUC__ which picks up these defs. [This also moves back the glibc defines we had before into the non-BSD ifdef branch]
* x86-64: Fix long long bugMichael Matz2016-10-171-2/+7
| | | | | | | With the last improvements to lexpand it's now harmful to use on native 64bit platforms when not necessary. For gv_dup it's not necessary there. It can still be used with really transforming a 64bit value into two 32bit ones.
* i386: do not 'lexpand' into registers necessarilygrischka2016-10-162-12/+18
| | | | | | | | | | | | | | Previously, long longs were 'lexpand'ed into two registers always. Now, it expands - constants into two constants (lo-part, hi-part) - variables into two lvalues with offset+4 for the hi-part. This makes long long operations look a bit nicer. Also: don't apply i386 'inc/dec' optimization if carry generation is wanted.
* tccgen/32bits: fix unsigned long long -> int castgrischka2016-10-161-3/+3
| | | | | | | | | | | | | | | | | | | gen_cast() failed to truncate long long's if they were unsigned, which was causing mess on the vstack. There was a similar bug here tccgen: 32bits: fix PTR +/- long long ed15cddacd145c74e4600af50f6616ba59ca0d8d Both were not visible until this patch tccgen: arm/i386: save_reg_upstack b691585785086024549cfb9ac65f3397263965aa I'd still assume that this patch is correct per se. Also: - remove 2x !nocode_wanted (we are already under a general "else if (!nocode_wanted)" clause above).
* Actual complete name for DragonFly is 'DragonFly BSD'.Christian Jullien2016-10-161-1/+1
|
* No 'Thread Storage Local' on FreeBSD with tcc.Christian Jullien2016-10-151-0/+2
|
* Backslash was missing after reindentation to let code be < 80 col.Christian Jullien2016-10-151-1/+1
|
* #define __GNUC__ = 2.1grischka2016-10-153-6/+27
| | | | | | | | | | __GNUC__ nowadays as macro seems to mean the "GNU C dialect" rather than the compiler itself. See also http://gcc.gnu.org/ml/gcc/2008-07/msg00026.html This patch will probably cause problems of various kinds but maybe we should try nonetheless.
* tccgen/tccelf: move code from libtcc.cgrischka2016-10-154-482/+512
|
* Add more OpenBSD support.Christian Jullien2016-10-151-1/+4
|
* OpenBSD does not support -v option in rm command.Christian Jullien2016-10-152-3/+3
|
* Start support of OpenBSD, tcc compiler can be produced from source treeChristian Jullien2016-10-152-1/+7
|
* World is not reduced to either Windows or LinuxChristian Jullien2016-10-151-1/+14
|
* Fix misleading indentationMichael Matz2016-10-141-3/+3
|
* arm64: Fix -runMichael Matz2016-10-142-22/+12
| | | | | | | With -run the call instruction and a defined function can be far away, if the function is defined in the executable itself, not in the to be compiled code. So we always need PLT slots for -run, not just for undefined symbols.
* arm64: Support PREL32 relocationMichael Matz2016-10-141-0/+3
| | | | A PC-relative 32bit value is stored.
* Support archives with 64 bit indicesMichael Matz2016-10-141-7/+20
| | | | | Some systems started using SYM64 .a libraries, so start supporting them.
* tccgen: 32bits: fix PTR +/- long longgrischka2016-10-133-0/+38
| | | | | | | | | | | | | | | | | | | | | | | Previously in order to perform a ll+ll operation tcc was trying to 'lexpand' PTR in gen_opl which did not work well. The case: int printf(const char *, ...); char t[] = "012345678"; int main(void) { char *data = t; unsigned long long r = 4; unsigned a = 5; unsigned long long b = 12; *(unsigned*)(data + r) += a - b; printf("data %s\n", data); return 0; }
* Use ISO C string functions instead of obsolete BSD ones that used to be in ↵Christian Jullien2016-10-122-8/+3
| | | | strings.h. It allows more systems -- i.e. Windows -- to use those tests
* Use R_AARCH64_MOVW_UABS_G* instead of R_AARCH64_CALL26.Edmund Grimley Evans2016-10-111-5/+14
| | | | | | This is a work-around for TCC's linker, on AArch64, not building a PLT when TCC is invoked with "-run". Fixing the linker should be possible: it works on arm and x86_64, apparently.
* gcase() clean upPavlas, Zdenek2016-10-111-33/+32
| | | | remove tail recursion, simplify
* In gen_vla_sp_restore, use X30 rather than get_reg.Edmund Grimley Evans2016-10-101-1/+4
|
* Fix handling of case_reg in switch statement.Edmund Grimley Evans2016-10-101-3/+18
| | | | | | | | | | The back end functions gen_op(comparison) and gtst() might allocate registers so case_reg should be left on the value stack while they are called and set again afterwards. This bug fix was first applied as ff3f9aa (20 Feb 2015), but the fix was reverted by fc0fc6a (21 Sep 2016, "switch: collect case ranges first, then generate code"). Here the fix is updated for the new code.
* build: strip: unify win32 and use the configured $STRIPAvi Halachmi (:avih)2016-10-101-2/+4
| | | | | | | | | | | | | | - There's no need to force STRIP_BINARIES on windows since --enable-strip (at configure) already does exactly that, if one wants to. - Use the contigured $STRIP instead of the native 'strip', useful when cross building tcc. - 'make install-strip' now also strips libtcc.dll on windows (it already does so now with --enable-strip, and previously it always stripped it). Summary of current strip options for all platforms: - configure --enable strip -> 'install -s' for the binaries. - make install-strip: installs and then configured $STRIP the binaries. - Otherwise -> no stripping.
* build: win: detect also mingw64 in msys2 setupAvi Halachmi (:avih)2016-10-101-1/+1
| | | | | | | | | | MSYS2 installs 3 environments, with uname (e.g. on win8.1 64) as follows: - MINGW32_NT-6.3 gcc -> stand-alone native i686 binaries - MINGW64_NT-6.3 gcc -> stand-alone native x86_64 binaries - MSYS_NT-6.3 gcc -> posix-ish binaries which can only run in this env Therefore 'MINGW' is more generic and detects both 32/64 native environments, where previously 'MINGW32' detected only the 32 one.
* build: out-of-tree: fix docsAvi Halachmi (:avih)2016-10-101-1/+1
|