1
0
Fork 0
Commit Graph

3469 Commits

Author SHA1 Message Date
herman ten brugge c13bbb5cb5 Add type promotion in comma expression and update testcase 94 2024-01-06 07:54:34 +01:00
herman ten brugge 6379f2ee76 Preprocessor fix + new testcase 2023-12-29 09:08:25 +01:00
herman ten brugge 48798969c5 Update riscv64-asm prototypes 2023-12-16 12:28:19 +01:00
noneofyourbusiness ada17a08eb
riscv64-asm.c: add support for calculating addresses of symbols
add some pseudoinstructions
riscv64-tok.h: add pseudoinstructions from tables 25.{2,3}
2023-12-12 09:44:37 +01:00
noneofyourbusiness b390feec6d
riscv64-asm.c: add Zicsr registers 2023-12-10 15:24:25 +01:00
noneofyourbusiness 5dc241fee1
riscv64-tok.h: add Zicsr pseudoinstructions, registers 2023-12-10 15:22:41 +01:00
noneofyourbusiness 3b3c9412ac
riscv64-asm.c: implement Zicsr extension 2023-12-09 14:32:14 +01:00
noneofyourbusiness 279dbb94e2
riscv64-asm.c: correct check for 12-bit immediate
asm_emit_cj: correct check for offset size
2023-12-09 01:00:16 +01:00
noneofyourbusiness 275dfbea20
riscv64-asm.c: implement M extension 2023-12-08 22:48:43 +01:00
noneofyourbusiness c71415b543
riscv64 elf flags should be configurable 2023-12-08 17:08:03 +01:00
noneofyourbusiness d87801bd50
riscv64-asm.c: implement C extension
add nop
fix asm_emit_i immediate check (negative offsets were missing)
fix check for IM12S
remove non-existent instructions (example: slli64 is just slli with imm=0)
2023-12-08 17:07:06 +01:00
noneofyourbusiness 81a32ec305
riscv64-asm.c: asm_emit_j: correct check of immediate 2023-12-02 17:08:05 +01:00
Reimar Döffinger 0655fd9637 configure: enable codesign by default on macOS.
It is useful for the default configuration to just
work out of the box and pass tests instead of crashing
in unexplained ways.
2023-11-27 20:17:52 +01:00
Reimar Döffinger c45cb650fc tcctools.c: reduce duplicated code for -MP option.
Generate list of escaped dependencies as a separate
first step.
2023-11-27 20:17:21 +01:00
noneofyourbusiness 70328621f1
riscv64-asm.c: added asm_emit_j (J-type), changed jal to J-type
additionally added a comment about B-type instruction format
2023-11-27 09:15:32 +01:00
Rob Pilling fb164e0ab4 Error out for incomplete type initialisation 2023-11-26 09:29:06 +00:00
herman ten brugge be8f894710 Check for errors before codesign 2023-11-08 21:08:54 +01:00
herman ten brugge fc8c01861b Fix STT_NOTYPE problem on win32
Since 'make undefined global symbol STT_NOTYPE' change win32 code
did not build any more.
2023-11-08 21:03:10 +01:00
herman ten brugge ded713e90d Ignore as_needed in ld_add_file_list
After the change to DT_NEEDED I get warnings for some functions.
The reason is that libc.so on my machine contains:
GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )

Before the change to DT_NEEDED we solved the symbols because the
/lib64/libc.so.6 file has as DT_NEEDED set for ld-linux-x86-64.so.2
The above AS_NEEDED section was not followed so symbols in this
file gives a warning.
Currently fixed by including AS_NEEDED files.
2023-11-08 19:58:26 +01:00
herman ten brugge 0f29dbcfd5 Update do_debug handling
Make options '-g -b' and '-b -g' set -g2 in both cases.
2023-11-08 19:52:13 +01:00
herman ten brugge bf928f3f4f Allow libtcc1-usegcc in lib/Makefile 2023-11-08 19:48:39 +01:00
herman ten brugge be8cded098 Allow make tcov-test on bsd targets 2023-11-08 19:45:29 +01:00
Steffen Nurpmeso 2c1c20a48c Relicensing TinyCC 2023-10-31 22:59:44 +01:00
Reimar Döffinger 36f53cdc3b Revert "tests: Add support for codesigning command."
This reverts commit ece74ceaaf.

codesigning is already supported via --config-codesign.
This patch actually broke testing for tcc builds with
that set.
2023-10-30 19:08:57 +01:00
Reimar Döffinger b7c732f01c tcctools: delete created ar file on error.
Leaving 0-sized files around might confuse the build system.
2023-10-29 18:13:19 +01:00
Reimar Döffinger a473473fed stdatomic.h: Add ATOMIC_VAR_INIT macro. 2023-10-29 18:12:31 +01:00
Reimar Döffinger ece74ceaaf tests: Add support for codesigning command.
Allows running the tests out-of-the-box on macOS.
Also delete *.dylib in tests2 dir on "make clean".
One remaining issue on macOS 14.1 is that the
-undefined warning option no longer works,
thus breaking test3 and test1b.
2023-10-29 17:06:59 +01:00
Reimar Döffinger 32ac23656f Add support for -dumpmachine option.
Better compatibility with some build systems assuming gcc.
2023-10-29 15:55:16 +01:00
Reimar Döffinger 7a53029e4d Add -MP option. 2023-10-29 15:31:58 +01:00
Reimar Döffinger 1bfed06c2a Relicensing TinyCC 2023-10-29 14:53:06 +01:00
Reimar Döffinger e9aa113240 tccdefs.h: Apple target requires __has_builtin definition.
Note: I have not been able to create working binaries on
macOS 14.1 so far, but at least tcc compiles and produces
binaries now...
2023-10-29 14:45:19 +01:00
Reimar Döffinger fd775d941d arm64-gen.c: Add __AARCH64EL__ target_machine_defs.
The Python headers require __AARCH64EL__ to be defined.
Also simplify ifdef to avoid duplicating __aarch64__ entry.
2023-10-29 14:36:11 +01:00
Detlef Riekenberg 32c4df1497 tccelf: Do not load all referenced libraries when linking a library
Recursive loading of all references can break linking of libraries
(Example: building of netbsd-curses)

Thanks grischka, Michael and Herman for the comments.

--
Regards ... Detlef
2023-10-26 17:51:30 +02:00
Ben C 6b967b1285 Fix macOS .dylib build when VERSION contains letters.
macOS builds with --disable-static fail to link if the version number
contains letters because of the -current_version and
-compatibility_version arguments (current version is 0.9.28rc).

This commit adds a new MACOS_DYLIB_VERSION variable to config.mak for
builds that target macOS. It has no impact on other targets.
2023-10-25 22:38:07 -04:00
Sylvain BERTRAND f44060f8fc ELF Relocatable: make undefined global symbol STT_NOTYPE
If undefined global symbols in ELF Relocatable files are not of
type STT_NOTYPE, it will confuse binutils bfd and corrupt product
files.
2023-10-24 18:13:39 +00:00
Petr Skocik 08c777053c Support aliasing static global nonfunction objects
Enables code such as:

    #undef NDEBUG
    #include <assert.h>
    #include <stdint.h>
    static int st_x = 42;
    static int st_x_ __attribute((alias("st_x")));
    int main(void){ assert((uintptr_t)&st_x == (uintptr_t)&st_x_); }

which would previously fail with no compiler warnings. The limitation of
this is that the alias must be done (or redone) after an actual definition.
An alias done right after a later overridden tentative declaration won't
work (sufficient for my use case).
2023-10-08 19:08:20 +02:00
Eric Raible b214fb6ed3 Produce better error message on malformed while loop
echo "void bugged() { do {} }" | tcc -run -
now produces the sensible:  -:1: error: 'while' expected (got "}")

I believe (but am far from sure) that the additional use of &tokc is ok.
2023-10-03 22:13:56 -07:00
Detlef Riekenberg 3d128041c3 include/tccdefs: Add function renaming with __REDIRECT_NTHNL (0.9.28rc testing)
Fixes a compilation break in "glob.h"
Detected during tcc 0.9.28rc testing.
Affected project: https://github.com/craigbarnes/dte

--
Regards ... Detlef
2023-09-17 12:15:28 +02:00
Sergey Sushilin 7f39b4f573 Fix typo in atomic_compare_exchange_weak() 2023-09-09 23:28:45 +03:00
herman ten brugge 31206a5bb8 Fix tests/tests2/Makefile for win32 2023-09-07 20:19:42 +02:00
herman ten brugge 9bb9a04b5f Small fixes
The testcases 22_floating_point and 24_math_library did not work with
make tcov-test
Add -lm for these in tests/tests2/Makefile

gcc -fanalyzer complains about tcc_malloc and tcc_realloc because
malloc(0) and realloc(ptr, 0) is not tested correctly.
2023-09-07 20:05:51 +02:00
grischka 086870addd configury update & bump VERSION to 0.9.28rc
configure:
- option --targetos=... for cross build
- cleanup

win32/build-tcc.bat:
- option -b <bindir>
- make 'libtcc1.a' and cross-prefix-libtcc1.a
  (same convention as with makefile)

Makefile:
- streamline tcov-tests, help, etc.

workflow/build.xml: simplify
- using "windows-2019" runner (instead of windows-latest)
  because its msys seems more complete and has no problems
  with the 96_nodata_wanted.test either.

Changelog,TODO,USES,tcc-doc.texi: update
2023-09-06 22:42:52 +02:00
grischka 8c5fe87665 tcc -g1 : small debug info (lines/functions only) 2023-09-06 22:42:47 +02:00
grischka 452045422b win32: pe dwarf sections & option -g.pdb
On windows, create a .pdb file with option "-g.pdb"
Such executables created by tcc can be debugged with
"ollydbg" or "x64dbg"

This currently relies on the 3rd party tool cv2pdb from
    https://github.com/rainers/cv2pdb
which again relies on
    mspdbsrv.exe mspdbcore.dll msobj80.dll mspdb80.dll
from a MSVC installation.

cv2pdb.exe + the ms* files may be put in the path or in the
same directory as tcc.exe.
2023-09-06 22:42:44 +02:00
grischka cd75ca692a stuff & fixes
libtcc.c:
- revert "Small patch to allow..." (someone's personal easteregg)
  (see da3a763e97)
- check return value from macho_load_tbd/dylib

tcc.c:
- remove help for "not yet implemented" option

tccelf.c:
- check PIE's for "unresolved symbols"

tccgen.c:
- avoid int->double->int cast
  (see a46372e910)
- fix constant propagation with pseudo long doubles
  (must mask out VT_LONG from type)
- cleanup find_field() (again)

tccpp.c:
- disallow strings and double constants in #if expressions

win32/include/uchar.h:
- change file mode
2023-09-06 22:42:30 +02:00
grischka 3f3cbb51ed bcheck: remove "tcc_location()" & x86_64 double fix
using (modified) tcc_backtrace() instead.
Also

Also fix the original bug with doubles on x86_64.
(which was not caused by incr_offset() actually).
See 598134fff6

Also cleanup on_exit() stuff
From fef701b57f
2023-09-06 22:42:21 +02:00
herman ten brugge ff2a372a9a Add tcov support in Makefile
The following targets are added:
testc / testc2.all / testc2.37 / testc2.37+ / testc2.37-
testcpp.all / make testcpp.17
This allows to check that the testcase(s) test the code modified.
See Makefile tests/pp/Makefile tests/tests2/Makefile

lib/tcov.c: Fix while loops with fgets.

tcc.h: Fix tcc_p compilation with latest gcc

tests/tests2/22_floating_point.*: Better test floating point
2023-08-31 11:09:49 +02:00
herman ten brugge b50a0bdf31 Add bound checking for test 132 2023-08-30 16:44:44 +02:00
herman ten brugge 598134fff6 Undo part of incr_offset patch.
The incr_offset offset code was not working with bounds checking.
So I reverted part of tccgen.c.
See new test code 132.

Also added some debugging code that prints location of
bounds checking calls. Needed this to find the problem.
See lib/bcheck.c, lib/bt-dll.c, lib/bt-exe.c, lib/bt-log.c, tccrun.c
2023-08-30 16:10:39 +02:00
noneofyourbusiness d1c107738b
riscv64-asm.c: add jal/jalr
this implements the base instructions, not the pseudoinstructions

examples
 jal ra, 0
 jalr x0, ra, 0
2023-08-11 10:08:41 +02:00