Commit Graph

3007 Commits

Author SHA1 Message Date
Danny Milosavljevic
b82e52a497 arm-asm: Add vmla, vmls, vnmls, vnmla, vmul, vnmul, vadd, vsub, vdiv, vneg, vabs, vsqrt, vcmp, vcmpe 2021-01-25 21:56:52 +01:00
Danny Milosavljevic
104037a4c5
arm-asm: Raise error if user tries to use a shift instruction with an immediate source operand 2021-01-25 00:54:01 +01:00
grischka
1ed4b6ba1a debug_modes, re-unalign, cleanups
tccgen.c: debug_modes
- don't waste debug function calls during normal execution.
libtcc.c:
- mem_debug: no C99 features in tcc please, for example
  ({compound expressions}): do not use.
tccgen.c: struct_layout:
- unaligned access is completely ok for most targets.
- Moreover the patch was triggering single byte mode even
  for normal aligned access (as with tcc's SymAttr)

static Sym label: don't do this

arm-gen.c:
- use some #ifdefs to explain some code
tccpp.c:
- cleanup UCN chars
libtcc.c:
- replace openbsd library search
configure:
- cleanup strip fallouts
tccgen.c:
- expr_cond(): remove an exotic optimization that eventually
  got fixed to do the contrary by a gv(RC_InT)
- pop_local_syms(): remove some args
- init_putv() : use write##le functions to avoid cross-compiler
  unaligned access
- __bt_init(): remove unused param 'mode'
2021-01-24 18:00:33 +01:00
herman ten brugge
5043268cb1 Fix unaligned access arm (openbsd)
libtcc.c:
Fix unaligned load/store from magic3

tccgen.c:
For packed struct allways use single byte code
If field does not start at at align check it
Align stack correctly with vla
2021-01-24 11:28:26 +01:00
herman ten brugge
38eaf9b3a7 Fix compiler warnings utf8 code 2021-01-23 19:21:33 +01:00
herman ten brugge
b40a88ea46 Use arm assembler in lib dir 2021-01-23 19:08:59 +01:00
herman ten brugge
bc6c0c34c1 implement test coverage
I have implemented the -ftest-coverage option. It works a bit different
from the gcc version. It output .tcov text file which looks almost the
same as a gcov file after a executable/so file is run.

Add lib/tcov.c file
Modify Makefiles to compile/install it
Add -ftest-coverage option in tcc.c/tcc.h/tcc-doc.texi
Add code to tccelf.c/tccgen.c/tccpe.c
Add gen_increment_tcov to tcc.h/*gen.c

unrelated changes:
Add sigemptyset in tccrun.c
Fix riscv64-gen.c tok_alloc label size
2021-01-23 18:17:38 +01:00
Danny Milosavljevic
66de1550ab
arm-asm: Add vpush, vpop, vldm, vldmia, vldmdb, vstm, vstmia, vstmdb 2021-01-23 14:57:33 +01:00
Danny Milosavljevic
e350058532
arm-asm: Add svc 2021-01-23 14:20:06 +01:00
Danny Milosavljevic
2e87eb18ab
arm-asm: Improve build with MSVC 2021-01-21 21:56:10 +01:00
Danny Milosavljevic
3fc55e15e8
arm-asm: Enable VFP when invoking GNU as for testing VFP instructions 2021-01-21 20:33:04 +01:00
Danny Milosavljevic
cdbb55396c
arm-asm: Add vldr, vstr
Also add s0...s31, d0...d15
2021-01-21 18:15:19 +01:00
Danny Milosavljevic
31dde11ad5
arm-asm: Add ldc2, ldc2l, stc2, stc2l 2021-01-21 16:42:31 +01:00
Danny Milosavljevic
7900a6bb61
arm-asm: Add ldc, ldcl, stc, stcl 2021-01-21 16:42:28 +01:00
Danny Milosavljevic
d1a6c4aefa
arm-asm: Add mcr, mrc 2021-01-21 16:42:23 +01:00
Danny Milosavljevic
a1dad7a9f7
arm-asm: Add cdp2
Also allow instructions without condition code in the first place
2021-01-21 16:42:20 +01:00
Danny Milosavljevic
036a7fe7d4
arm-asm: Add cdp
Also add p0...p15 (coprocessors), c0...c15 (coprocessor register aliases)
2021-01-21 16:42:16 +01:00
Christian Jullien
593bed9b52 Fix arm NetBSD cross compilation 2021-01-19 08:58:24 +01:00
Danny Milosavljevic
d60d2bb60e
arm-asm: Make "!" optional in asm_block_data_transfer_opcode 2021-01-18 18:58:08 +01:00
Petr Skocik
704c8163fd re-add accidentally deleted printf("\n"); to tests2/97*.c 2021-01-18 08:32:50 +01:00
Petr Skocik
ffb95c2e0c Better handling of UCNs in strings
As the standard requires, take 4 hex digits after the \u opener of a
Universal Character Name, or take 8 hex digits after \U, but reject
smaller counts and don't consume more (https://port70.net/~nsz/c/c11/n1570.html#6.4.3,
https://port70.net/~nsz/c/c99/n1256.html#6.4.3).

The unicode codepoint used to get truncated to 1 byte. Now it gets expanded into UTF-8,
matching gcc & clang behavior on Linux.

TODO: Universal character names should also be supported in identifiers,
as in, e.g., char \u010dau_sv\u011bte[]="čau_světe";
2021-01-18 00:49:24 +01:00
herman ten brugge
6b614c4deb OpenBSD: arm fix
Disable warning softfloat. OpenBSD works fine.
save/restore s0-s15 during memcpy call for structs
update configure script. Works now on raspberry pi/All BSD
Add eabi_mem.. functions in armeabi.c for OpenBSD
Fix fp register in tccrun.c for OpenBSD
2021-01-17 20:43:15 +01:00
Christian Jullien
debe8d013d Use $targetos instead of a second call to uname 2021-01-17 11:45:23 +01:00
Christian Jullien
a2987fef19 configure automatically detects correct arm configuration on NetBSD 2021-01-17 09:02:00 +00:00
Christian Jullien
53f7d8baf4 conftest correctly detects NetBSD and OpenBSD for TRIPLET_OS 2021-01-17 08:49:37 +01:00
Christian Jullien
f5f8326531 FreeBSD: arm port is fully supported and added to cross list 2021-01-16 16:25:22 +01:00
herman ten brugge
5aba20f270 BSD: arm support
Support OpenBSD/FreeBSD/NetBSD on asm.

move PAGESIZE to tcc.h and use _SC_PAGESIZE (netbsd/arm has 8192 pagesize)

arm:
- fix cmp instruction for qemu (raspberry pi works without patch?)
- increase start address/size
- use large plt size
- add return R_ARM_PREL31
- add R_ARM_TARGET1 to prepare_dynamic_rel
- add gcc_s to FreeBSD (unwind code)
- do not use __clear_cache on bsd (sometimes bad system call)
- do stack unwinding on bsd
- test/tcctest.c: use %lld %llu on bsd
2021-01-16 07:01:59 +01:00
Danny Milosavljevic
757eccd1d2
arm-asm: Raise error if user tries to use PC for offset register of single data transfer 2021-01-14 23:16:38 +01:00
Danny Milosavljevic
007839597f
arm-asm: Implement ldr and str with shifted register offset
Factor out asm_parse_optional_shift
2021-01-14 23:16:31 +01:00
Christian Jullien
1d7b233562 Remove strip logic form configure script, keep a deprecated warning message when --strip-binaries is still used. 2021-01-14 07:10:41 +01:00
herman ten brugge
13f6e8a866 OpenBSD: arm support typo (WIP) 2021-01-13 19:58:19 +01:00
herman ten brugge
96e3923239 OpenBSD: arm support update (WIP) 2021-01-13 19:41:04 +01:00
Christian Jullien
20dbfe99b8 --strip-binaries is deprecates, build never strips, use 'make install-strip' to install stripped binaries 2021-01-13 18:51:23 +01:00
herman ten brugge
23989cbcf3 OpenBSD: arm support (WIP) 2021-01-13 13:20:36 +01:00
Christian Jullien
d5c78ce655 Add more supported systems for cross test 2021-01-13 09:34:37 +01:00
Christian Jullien
c35f61b958 Fix ./configure strip test 2021-01-13 07:56:05 +01:00
Christian Jullien
d7d470b357 ./configure always stripped binaries even if --strip-binaries was unset 2021-01-13 07:27:46 +01:00
herman ten brugge
56f74f2eeb Add shstrtab name in tccelf.c
Last commit removed shstrtab which make gdb/readelf unhappy.
2021-01-12 21:41:41 +01:00
grischka
62c0c4c77a tccelf.c: factor out elf_output_obj()
The small common parts within elf_output_file() aren't
worth the many #ifdefs.  Also, set section sizes and
allocate section names in 2 separate functions.
2021-01-12 18:39:35 +01:00
herman ten brugge
c74c6ed61a Serveral updates
arm-gen.c:
- remove fr parameter from load_value

tccelf.c:
- update comment and remove check for sh_size

tests/boundtest.c:
- fix testcase 16/17
2021-01-12 18:06:23 +01:00
herman ten brugge
28646b559d fix cross compiling on openbsd 2021-01-12 09:59:52 +01:00
herman ten brugge
ecdee4a697 arm64: Fix loading from constant address 2021-01-12 08:46:05 +01:00
Christian Jullien
00d467d44c OpenBSD: use portable strtoll instead of strtonum to allow cross-compilation test 2021-01-12 08:12:40 +01:00
herman ten brugge
4d254312be Remove gaps between RELX sections update
Update file_offset as well
2021-01-12 07:40:45 +01:00
Christian Jullien
64d5db7635 *BSD: fix broken Makefile on all BSD systems. 2021-01-12 07:08:39 +01:00
herman ten brugge
c9bdfcedb4 Remove gaps between RELX sections
These gaps are a result of final_sections_reloc. Here some relocs are removed.
The gaps are then filled with 0 in tcc_output_elf. The 0 is intepreted as
R_...NONE reloc. This does work on most targets but on OpenBSD/arm64 this
is illegal.
2021-01-12 06:59:51 +01:00
herman ten brugge
cd91ea658a OpenBSD: x86 update 2021-01-11 19:26:10 +01:00
grischka
bbc7070c82 make test: run cross-test always
To see inconsistencies when they happen.
2021-01-11 15:17:26 +01:00
Christian Jullien
42220676d7 OpenBSD: x86 use few clang compatible C types 2021-01-11 12:19:09 +01:00
Christian Jullien
db6dd66047 OpenBSD: -arm- Add more R_ARM* constants in elf.h. 2021-01-11 07:21:57 +01:00