Update bound checking code.
commit387761878500df5a5f883139ec1013bb3696dad2
authorherman ten brugge <hermantenbrugge@home.nl>
Wed, 15 Jan 2020 07:53:19 +0000 (15 08:53 +0100)
committerherman ten brugge <hermantenbrugge@home.nl>
Wed, 15 Jan 2020 07:53:19 +0000 (15 08:53 +0100)
tree867c943a02e0af6252c8a07ad4deadb933190b3e
parent0d6801b130dfba8f73f07c05bc02b2dc787270fd
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.
13 files changed:
i386-gen.c
i386-link.c
lib/bcheck.c
tcc-doc.texi
tcc.h
tccelf.c
tccgen.c
tccpe.c
tccrun.c
tests/Makefile
tests/boundtest.c
x86_64-gen.c
x86_64-link.c