+++ 46_grep.output 2016-10-15 18:14:30.387382000 +0200 Was easy to fix in http://repo.or.cz/tinycc.git/commitdiff/06db384f8a557c05f68e6a4d465031d051ab 1d45 --- a/libtcc.c +++ b/libtcc.c @@ -847,6 +847,8 @@ LIBTCCAPI TCCState *tcc_new(void) # endif # if defined(__FreeBSD__) tcc_define_symbol(s, "__FreeBSD__", "__FreeBSD__"); + /* No 'Thread Storage Local' on FreeBSD with tcc */ + tcc_define_symbol(s, "__NO_TLS", NULL); # endif # if defined(__FreeBSD_kernel__) tcc_define_symbol(s, "__FreeBSD_kernel__", NULL);
Now, only tcc compiled by itself fails. If I define __aligned(n), it compiles but linker does not find any std C library function (strcpy, malloc ) From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of Christian Jullien Sent: samedi 15 octobre 2016 18:26 To: tinycc-devel@nongnu.org Subject: Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues Grischka, Except the fix I've made http://repo.or.cz/tinycc.git/commitdiff/f7bfa0970e63c9290569eddf5e8aa14f614e 4d5e :o)) It is *MUCH* better! Many tests now pass but few still fail, see below in bold. The const error at the end is on: extern _Thread_local const _RuneLocale *_ThreadRuneLocale; It appears that TLS (Thread Local Storage) is defined and tcc does not process this directive. Also, tcc has issues when compiled by itself. gmake -C tests gmake[1]: Entering directory '/usr/home/jullien/tinycc/tests' ------------ hello-exe ------------ ../tcc -B.. -I../include -I.. -I.. ../examples/ex1.c -o hello || (../tcc -vv; ex it 1) && ./hello Hello World ------------ hello-run ------------ ../tcc -B.. -I../include -I.. -I.. -run ../examples/ex1.c Hello World gcc -o libtcc_test libtcc_test.c ../libtcc.a -I.. -I.. -lm ------------ libtest ------------ ./libtcc_test -B.. -I../include -I.. -I.. Hello World! fib(32) = 2178309 add(32, 64) = 96 gcc -o tcctest.gcc tcctest.c -DTCC_TARGET_I386 -I.. -I.. -w -O0 -std=gnu99 -fno- omit-frame-pointer ./tcctest.gcc > test.ref ------------ test3 ------------ ../tcc -B.. -I../include -I.. -I.. -DTCC_TARGET_I386 -DONE_SOURCE -run ../tcc.c -B.. -I../include -I.. -I.. -DTCC_TARGET_I386 -DONE_SOURCE -run ../tcc.c -B.. -I ../include -I.. -I.. -DTCC_TARGET_I386 -DONE_SOURCE -run ../tcc.c -B.. -I../incl ude -I.. -I.. -run tcctest.c > test.out3 In file included from ../tcc.c:22: In file included from ../libtcc.c:21: In file included from ../tcc.h:33: In file included from /usr/include/signal.h:38: In file included from /usr/include/sys/signal.h:46: In file included from /usr/include/machine/signal.h:36: /usr/include/x86/signal.h:82: error: ',' expected (got "__aligned") gmake[1]: *** [Makefile:103: test3] Error 1 gmake[1]: Leaving directory '/usr/home/jullien/tinycc/tests' gmake: *** [Makefile:315: test] Error 2 $ $ gmake -k test gmake -C tests gmake[1]: Entering directory '/usr/home/jullien/tinycc/tests' ------------ hello-exe ------------ ../tcc -B.. -I../include -I.. -I.. ../examples/ex1.c -o hello || (../tcc -vv; exit 1) && ./hello Hello World ------------ hello-run ------------ ../tcc -B.. -I../include -I.. -I.. -run ../examples/ex1.c Hello World gcc -o libtcc_test libtcc_test.c ../libtcc.a -I.. -I.. -lm ------------ libtest ------------ ./libtcc_test -B.. -I../include -I.. -I.. Hello World! fib(32) = 2178309 add(32, 64) = 96 gcc -o tcctest.gcc tcctest.c -DTCC_TARGET_I386 -I.. -I.. -w -O0 -std=gnu99 -fno-omit-frame-pointer ./tcctest.gcc > test.ref ------------ test3 ------------ ../tcc -B.. -I../include -I.. -I.. -DTCC_TARGET_I386 -DONE_SOURCE -run ../tcc.c -B.. -I../include -I.. -I.. -DTCC_TARGET_I386 -DONE_SOURCE -run ../tcc.c -B.. -I../include -I.. -I.. -DTCC_TARGET_I386 -DONE_SOURCE -run ../tcc.c -B.. -I../include -I.. -I.. -run tcctest.c > test.out3 In file included from ../tcc.c:22: In file included from ../libtcc.c:21: In file included from ../tcc.h:33: In file included from /usr/include/signal.h:38: In file included from /usr/include/sys/signal.h:46: In file included from /usr/include/machine/signal.h:36: /usr/include/x86/signal.h:82: error: ',' expected (got "__aligned") gmake[1]: *** [Makefile:103: test3] Error 1 gcc -o abitest-cc abitest.c ../libtcc.a -I.. -I.. -lm -w ../tcc -B.. -I../include -I.. -I.. -o abitest-tcc abitest.c ../libtcc.c -DTCC_TARGET_I386 -DONE_SOURCE -lm In file included from ../libtcc.c:21: In file included from ../tcc.h:33: In file included from /usr/include/signal.h:38: In file included from /usr/include/sys/signal.h:46: In file included from /usr/include/machine/signal.h:36: /usr/include/x86/signal.h:82: error: ',' expected (got "__aligned") gmake[1]: *** [Makefile:191: abitest-tcc] Error 1 ../tcc -B.. -I../include -I.. -I.. -o vla_test vla_test.c ------------ vla_test-run ------------ ./vla_test test1... success test2... success test3... success ------------ tests2-dir ------------ gmake -k -C tests2 gmake[2]: Entering directory '/usr/home/jullien/tinycc/tests/tests2' Test: 00_assignment... Test: 01_comment... Test: 02_printf... Test: 03_struct... Test: 04_for... Test: 05_array... Test: 06_case... Test: 07_function... Test: 08_while... Test: 09_do_while... Test: 10_pointer... Test: 11_precedence... Test: 12_hashdefine... Test: 13_integer_literals... Test: 14_if... Test: 15_recursion... Test: 16_nesting... Test: 17_enum... Test: 18_include... Test: 19_pointer_arithmetic... Test: 20_pointer_comparison... Test: 21_char_array... Test: 22_floating_point... Test: 23_type_coercion... Test: 24_math_library... Test: 25_quicksort... Test: 26_character_constants... Test: 27_sizeof... Test: 28_strings... Test: 29_array_address... Test: 30_hanoi... Test: 31_args... Test: 32_led... Test: 33_ternary_op... Test: 35_sizeof... Test: 36_array_initialisers... Test: 37_sprintf... Test: 38_multiple_array_index... Test: 39_typedef... Test: 40_stdio... Test: 41_hashif... Test: 42_function_pointer... Test: 43_void_param... Test: 44_scoped_declarations... Test: 45_empty_for... Test: 46_grep... --- ../../tests/tests2/46_grep.expect 2016-10-15 06:30:48.624755000 +0200 +++ 46_grep.output 2016-10-15 18:14:30.387382000 +0200 @@ -1,3 +1,4 @@ -File 46_grep.c: -/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ - +In file included from 46_grep.c:19: +In file included from /usr/include/ctype.h:46: +In file included from /usr/include/_ctype.h:95: +/usr/include/runetype.h:92: error: ';' expected (got "const") gmake[2]: *** [Makefile:52: 46_grep.test] Error 1 Test: 47_switch_return... Test: 48_nested_break... Test: 49_bracket_evaluation... Test: 50_logical_second_arg... Test: 51_static... Test: 52_unnamed_enum... Test: 54_goto... Test: 55_lshift_type... Test: 56_btype_excess-1... Test: 57_btype_excess-2... Test: 58_function_redefinition... Test: 59_function_array... Test: 60_enum_redefinition... Test: 61_undefined_enum... Test: 62_enumerator_redefinition... Test: 63_local_enumerator_redefinition... Test: 64_macro_nesting... Test: 67_macro_concat... Test: 70_floating_point_literals... Test: 71_macro_empty_arg... Test: 72_long_long_constant... Test: 73_arm64... Test: 74_nocode_wanted... Test: 75_array_in_struct_init... Test: 76_dollars_in_identifiers... Test: 77_push_pop_macro... Test: 78_vla_label... Test: 79_vla_continue... Test: 80_flexarray... Test: 81_types... Test: 82_attribs_position... Test: 82_nocode_wanted... Test: 83_utf8_in_identifiers... Test: 84-hex-float... Test: 85-asm-outside-function... Test: 86-memory-model... Test: 87_ptr_longlong_arith32... gmake[2]: Target 'all' not remade because of errors. gmake[2]: Leaving directory '/usr/home/jullien/tinycc/tests/tests2' gmake[1]: *** [Makefile:81: tests2-dir] Error 2 ------------ pp-dir ------------ gmake -k -C pp gmake[2]: Entering directory '/usr/home/jullien/tinycc/tests/pp' PPTest 01 ... PPTest 02 ... PPTest 03 ... PPTest 04 ... PPTest 05 ... PPTest 06 ... PPTest 07 ... PPTest 08 ... PPTest 09 ... PPTest 10 ... PPTest 11 ... PPTest 12 ... PPTest 13 ... PPTest 14 ... PPTest 15 ... gmake[2]: Leaving directory '/usr/home/jullien/tinycc/tests/pp' gmake[1]: Target 'all' not remade because of errors. gmake[1]: Leaving directory '/usr/home/jullien/tinycc/tests' gmake: *** [Makefile:315: test] Error 2 -----Original Message----- From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of grischka Sent: samedi 15 octobre 2016 16:06 To: tinycc-devel@nongnu.org Subject: Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues Christian Jullien wrote: > Ok, > The point is that it compiles ROOTB but then a single line program using only ISO include and std C library fails because of __aligned in a **system** header. > I agree that __aligned is a probably a macro or a gcc FreeBSD specific > extension, but no one wants to change it source file (or Makefile) > when he the switch from gcc to tcc To be more clear, let me start > again from scratch (Dont miss *Linux* in banner with -v and -vv) Please! You were clear. Anyway, maybe this helps: http://repo.or.cz/tinycc.git/commitdiff/f3c1ea6c2d7dca7883985820e46ec536e2d7 e8cc It is expected that this could break system xyz whatever. Some background research: - obviously FreeBSD headers expect __GNUC__ http://pcc.ludd.ltu.se/jira/browse/PCC-18 - patch for sys/cdefs.h suggested by PCC http://pcc.ludd.ltu.se/ftp/pub/patches/openbsd-include-sys-081220.diff - __GNUC__ nowadays seems to mean the C dialect rather than the compiler https://gcc.gnu.org/ml/gcc/2008-07/msg00026.html Not sure whether we really want to define __GNUC__. This might cause all kind of problems. However if we don't then sys/cdefs.h does #define __attribute__(xyz) -- gr _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel