History log of /tinycc/tccelf.c (Results 1 - 25 of 342)
Revision Date Author Comments
# 29ba50da 05-May-2020 herman ten brugge <hermantenbrugge@home.nl>

Fix some printf like functions


# fdeeb62e 19-Jan-2020 Michael Matz <matz@suse.de>

Fix symbol versions with shared libs

ELF files that refer to shared libs containing sym-versions, but
don't refer to any dynamic symbols with symbol versions (should happen
only with

Fix symbol versions with shared libs

ELF files that refer to shared libs containing sym-versions, but
don't refer to any dynamic symbols with symbol versions (should happen
only with very simple shared libs) would generate an empty .gnu.version_r
section. Some dynamic linker contain bugs in that they don't check
the section size or DT_VERNEEDNUM (which are both zero for such files
we generate) before accessing the first entry, and then bail out with
a message like

./a.exe: error while loading shared libraries: ./a1.so: unsupported
version 25960 of Verneed record

(where the "version number" actually comes from neighboring bytes
from different sections).

So, there's not much choice, we simply must not generate such section.

show more ...


# d79e1dee 19-Jan-2020 grischka <grischka>

backtrace: test with DLLs

- tests2/113_btdll.c: test handling multiple stabs infos
Also:
- libtcc.c: remove _ISOC99_SOURCE pre-defines. It is causing
strange warnings such as

backtrace: test with DLLs

- tests2/113_btdll.c: test handling multiple stabs infos
Also:
- libtcc.c: remove _ISOC99_SOURCE pre-defines. It is causing
strange warnings such as 'strdup not declared'

- i386/x86_64-gen.c cleanup bounds_pro/epilog. This discards
the extra code for main's argv. If needed, __argv might be
processed instead.

- tccgen.c:block(): reduce stackspace usage. For example with
code like "if (..) ... else if (..) ... else if (..)... "
considerable numbers of nested block() calls may occur.

Before that most stack space used when compiling itself was
for libtcc.c:tcc_set_linker().

Now it's rather this construct at tccpp.c:2765: in next_nomacro1():

if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM))
|| c == '.'
|| ((c == '+' || c == '-')
...

show more ...


# 2b7cffac 17-Jan-2020 grischka <grischka>

fixes for previous commit


# ef42295f 17-Jan-2020 gr <gr@gr-laptop.(none)>

tccrun.c: standalone backtraces with -bt[N] or -b

This makes it possible to get backtraces with executables
(including DLLs/SOs) like we had it already with -g -run.

Option -b i

tccrun.c: standalone backtraces with -bt[N] or -b

This makes it possible to get backtraces with executables
(including DLLs/SOs) like we had it already with -g -run.

Option -b includes -bt, and -bt includes -g.

- new file lib/bt-exe.c: used to link rt_printline and the
exception handler from tccrun.c into executables/DLLs.

- new file lib/bt-log.c: provides a function that may be
called from user code to print out a backtrace with a
message (currently for i386/x86_64 only):

int (*tcc_backtrace)(const char *fmt, ...);

As an extra hack, if 'fmt' is prefixed like "^file.c^..."
then the backtrace will skip calls from within 'file.c'.

- new file lib/bt-dll.c: used on win32 to link the backtrace
and bcheck functions with the main module at runtime

- bcheck.c: now uses the tcc_backtrace function from above

- tccgen.c: minor cleanups

- tccelf.c: stab sections get SHF_ALLOC for easy access.
Also in relocate_section(): 64bit relocations for stabs
in DLLs cannot work. To find DLL addresses, the DLL base
is added manually in tccrun.c via rc.prog_base instead.

- tccpe.c: there are some changes to allow merging sections,
used to merge .finit_array into .data in the first place.

- tccpp.c: tcc -run now #defines __TCC_RUN__
also: refactor a line in tal_realloc that was incompatible
with bcheck

- tcctest.c: fixed a problem with r12 which tcc cannot preserve
as well as gcc does.

- tests2/112_backtrace.c: test the feature and the bcheck test18
that previously was in boundtest.c

show more ...


# 38776187 15-Jan-2020 herman ten brugge <hermantenbrugge@home.nl>

Update bound checking code.

Add __attribute__((constructor)) to __bounds_init.
- remove tcc_add_bcheck from i386-link.c and x86_64-link.c
- add simplified tcc_add_bcheck to tccelf.c

Update bound checking code.

Add __attribute__((constructor)) to __bounds_init.
- remove tcc_add_bcheck from i386-link.c and x86_64-link.c
- add simplified tcc_add_bcheck to tccelf.c
- Update tccrun.c to call constructor/destructor.
Set dynsym sh_info to number of local symbols in tccelf.c
Reduce stack size when bounds checking is enabled.
Added variable TCC_LIBBCHECK for windows support.
Add signal stack to detect stack overflow.
Add all & parameters in lbound_section and remove them if not used.
Close fd in tcc_relocate in tccrun.c
Fix section type constructor/destructor in tccelf.c
Add check code in tests/boundtest.c for mem/str functions.
Remove -ba from documentation.
Add bounds check signal info in documentation.

bcheck.c:
- Fix initial_pool alignment.
. Fix printf statements.
. Add prototypes for all external interface functions.
- Add TCC_BOUNDS_WARN_POINTER_ADD environment variable.
. Add ctype and errno data.
- Fix alloca when multithreading is used.
- Add lock for __bound_checking and __bound_never_fatal.
- Catch pthread_create and use locks when called.
- Detect in loaded in shared lib and use locks when found
- Use spin locks instead of semaphore locks.
- Make spin locked code as small as possible.
- Fix mem/str functions checking.
- Fix overlap checking mem/str functions.

show more ...


# ff3b5ee9 14-Dec-2019 grischka <grischka>

-bench fix

Put total_lines etc. into TCCState. Also, initialize
the predefined compiler types for the preprocessor too.
tccpe.c: fix BaseOfCode if .init section present (with tcc -b)


# 65f74a4d 14-Dec-2019 grischka <grischka>

tccrun.c: better stab debug support

* a major revision of the rt_printline() feature in
tccrun.c to report file:linenumber more correctly.

* minor changes to the stab info pro

tccrun.c: better stab debug support

* a major revision of the rt_printline() feature in
tccrun.c to report file:linenumber more correctly.

* minor changes to the stab info produced by the
compiler in tccgen.c

However stab addresses are limited to 32 bits. I added
a work around:

if (sizeof pc == 8)
pc |= wanted_pc & 0xffffffff00000000ULL;

However GDB has problems with that too.

show more ...


# 56db092a 12-Dec-2019 grischka <grischka>

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

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.

show more ...


# 4a2e33d1 12-Dec-2019 herman ten brugge <hermantenbrugge@home.nl>

Update bounds checking.

The bounds checking code has now enabled gen_bounded_ptr_add tests.
This makes the code slower but finds more errors.
I had to correct some things in tcc to m

Update bounds checking.

The bounds checking code has now enabled gen_bounded_ptr_add tests.
This makes the code slower but finds more errors.
I had to correct some things in tcc to make it work.
- Fixed off by one in lib/bcheck.c
- Corrected tccelf.c sym_versions.
- Disabled USE_TAL when using bounds checking.
- Fixed cstr_printf va_start.
- Fixed tests/tests2/46_grep.c off by one error.
- Updated gen_bounded_ptr_add in x86_64-gen.c
- Fixed x86_64-link.c pointer diff.
For gen_vla_alloc now always use alloca call when bounds checking.
Added line/filename in %rax before bound calls to find location of error.

show more ...


# a0bc149b 11-Dec-2019 herman ten brugge <hermantenbrugge@home.nl>

Fix bounds checking after concurrently commit


# 72729d8e 10-Dec-2019 grischka <grischka>

allow libtcc states to be used concurrently

This allows creation of TCCStates and operation with API
calls independently from each other, even from threads.

Frontend (option par

allow libtcc states to be used concurrently

This allows creation of TCCStates and operation with API
calls independently from each other, even from threads.

Frontend (option parsing/libtcc.c) and backend (linker/tccelf.c)
now depend only on the TCCState (s1) argument.

Compilation per se (tccpp.c, tccgen.c) is still using
globals for convenience. There is only one entry point
to this section which is tcc_compile() which is protected
by a semaphore.

There are some hacks involved to avoid too many changes,
as well as some changes in order to avoid too many hacks ;)

The test libtcc_test_mt.c shows the feature. Except this
new file the patch adds 87 lines overall.

show more ...


# 6082dd62 10-Dec-2019 grischka <grischka>

tcc -vv ... : show objects loaded from archives


# df349ddc 09-Dec-2019 grischka <grischka>

versym cleanup

get rid of some globals, in the first place. Also, for the
PE target, ifdef out ELF executable creation.


# 4461f38a 10-Dec-2019 herman ten brugge <hermantenbrugge@home.nl>

Fix bounds checking for linux/windows


# df72b8d4 27-Nov-2019 herman ten brugge <hermantenbrugge@home.nl>

Add windows constructor/destructor support


# 4e9ce59f 27-Nov-2019 Michael Matz <matz@suse.de>

Workaround false positive warning


# 8a93ce10 25-Nov-2019 Michael Matz <matz@suse.de>

elf: rewrite version support

so it isn't quadratic in number of symbols. It's still quadratic
in number of lib/version combinations (at library load time the
sym versions are intern

elf: rewrite version support

so it isn't quadratic in number of symbols. It's still quadratic
in number of lib/version combinations (at library load time the
sym versions are internalized), but that's much less a problem as
in practice only glibc uses sym versioning.

show more ...


# 800c3a5e 29-Oct-2019 herman ten brugge <hermantenbrugge@home.nl>

Add constructor/destructor support


# 588dd682 24-Oct-2019 herman ten brugge <hermantenbrugge@home.nl>

Fix elf version info


# 7268fe72 22-Oct-2019 herman ten brugge <hermantenbrugge@home.nl>

Add elf version support


# 944c4003 16-Sep-2019 Jan Boon <jan.boon@kaetemi.be>

Add function to list all symbols, for purpose of linking separate in-memory compilations


# 31ecaa7c 15-Jul-2019 Michael Matz <matz@suse.de>

riscv: GOT loads, signed remainder, ELF flags

* support loading sym addresses from GOT: important for weak syms,
fixes 104_inline. This is still incomplete, it only works
for ta

riscv: GOT loads, signed remainder, ELF flags

* support loading sym addresses from GOT: important for weak syms,
fixes 104_inline. This is still incomplete, it only works
for taking the sym address, not for directly loading/storing into
such symbols (i.e. not for VT_LVAL)
* another op: '%'
* ELF flags: add EF_RISCV_FLOAT_ABI_DOUBLE, which is our ABI.

show more ...


# 1353ccd9 22-Jun-2019 Michael Matz <matz@suse.de>

riscv: Handle some usual relocs

this is enough to let me link a tcctest.c compiled by GCC
using some current debian sid riscv64 system. It needs
linking against libgcc.a for various

riscv: Handle some usual relocs

this is enough to let me link a tcctest.c compiled by GCC
using some current debian sid riscv64 system. It needs
linking against libgcc.a for various floating point TFmode
routines. The result runs.

show more ...


# ce1ef5b8 08-Jun-2018 grischka <grischka>

some smaller fixes

- libtcc.c/tccpp.c: fix -U option for multiple input files
- libtcc: remove decl of tcc_add_crt() for PE
- tcc.h: define __i386__ and __x86_64__ for msvc
- tcc

some smaller fixes

- libtcc.c/tccpp.c: fix -U option for multiple input files
- libtcc: remove decl of tcc_add_crt() for PE
- tcc.h: define __i386__ and __x86_64__ for msvc
- tcc.h: undef __attribute__ for __TINYC__ on gnu/linux platforms
- tccelf.c: disable prepare_dynamic_rel unless x86/x64
- tccpe.c: construct rather than predefine PE section flags
- tccpp.c: (alt.) fix access of dead stack variable after error/longjmp
- x86_64-gen.c: fix func_alloca chain for nocode_wanted
- tccpp.c/tccgen.c: improve file:line info for inline functions
- winapi/winnt.h: correct position for DECLSPEC_ALIGN attribute
- win32/lib/crt: simplify top exception handler (needed for signal)
- arm64-gen.c: remove dprintf left from VT_CMP commit
- tccgen.c: limit binary scan with gcase to > 8 (= smaller code)
- tccgen.c: call save_regs(4) in gen_opl for cmp-ops (see test in tcctest.c)

show more ...


12345678910>>...14