Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
Hi, $ find /usr/lib -name crt1.o /usr/lib/crt1.o -Original Message- From: grischka [mailto:gris...@gmx.de] Sent: lundi 17 octobre 2016 18:32 To: Christian JULLIEN; tinycc-devel@nongnu.org Subject: Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues Christian JULLIEN wrote: > tcc: error: file 'crt1.o' not found Can you look where your file is? $ find /usr/lib -name crt1.o -- gr ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
Christian JULLIEN wrote: tcc: error: file 'crt1.o' not found Can you look where your file is? $ find /usr/lib -name crt1.o -- gr ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
This morning, it was on FreeBSD x64, nox testing on i386 gives me a different result with again __aligned issue. ../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") Changing tcc_define_symbol(s, "__GNUC_MINOR__", "7"); <= 7 gives about the same result than with x64 version. i.e. it fails trying to find std lib C. $ grep __GNUC_PREREQ__ sys/* cdefs.h:#define __GNUC_PREREQ__(ma, mi) \ cdefs.h:#define __GNUC_PREREQ__(ma, mi) 0 cdefs.h:#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER) cdefs.h:#if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER) cdefs.h:#if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__) cdefs.h:#if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__) cdefs.h:#if !__GNUC_PREREQ__(2, 95) cdefs.h:#elif __GNUC_PREREQ__(4,6) cdefs.h:#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) cdefs.h:#if __GNUC_PREREQ__(2, 96) cdefs.h:#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) cdefs.h:#if __GNUC_PREREQ__(3, 1) cdefs.h:#if __GNUC_PREREQ__(3, 3) cdefs.h:#if __GNUC_PREREQ__(3, 4) cdefs.h:#if __GNUC_PREREQ__(4, 1) cdefs.h:#if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable) cdefs.h:#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) cdefs.h:#if __GNUC_PREREQ__(2, 96) cdefs.h:#if __GNUC_PREREQ__(4, 0) cdefs.h:#if __GNUC_PREREQ__(4, 1) cdefs.h:#if __GNUC_PREREQ__(3, 1) cdefs.h:#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) cdefs.h:#if __GNUC_PREREQ__(4, 3) || __has_attribute(__artificial__) stdatomic.h:#elif __GNUC_PREREQ__(4, 7) - message d'origine - De : "Christian Jullien" <eli...@orange.fr> date lun. 17/10/2016 06:34 (GMT +02:00) À : "tinycc-devel@nongnu.org" <tinycc-devel@nongnu.org> Objet : Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues Thank you Michael, Trying your latest commit makes me able to compile and run all tests except those below. Even a very simple test fails to find stdlib: $ pwd /usr/home/jullien/tinycc $ cat foo.c #include <stdio.h> int main() { printf("Hello World\n"); return 0; } $ ./tcc -B. foo.c -o hello tcc: error: file 'crt1.o' not found tcc: error: file 'crti.o' not found tcc: error: file 'crtn.o' not found tcc: error: undefined symbol 'printf' $ ./tcc -B. foo.c -o hello tcc: error: file 'crt1.o' not found tcc: error: file 'crti.o' not found tcc: error: file 'crtn.o' not found tcc: error: undefined symbol 'printf' $ find . -name '*.a' ./libtcc.a ./libtcc1.a == FROM TESTS SUITE == $ 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 tcc: error: file 'crt1.o' not found tcc: error: file 'crti.o' not found tcc: error: file 'crtn.o' not found tcc: error: undefined symbol 'printf' tcc version 0.9.26 (x86-64 FreeBSD) install: /usr/local/lib/tcc include: /usr/local/lib/tcc/include /usr/local/include /usr/include libraries: /usr/lib64 /lib64 /usr/local/lib64 crt: /usr/lib64 elfinterp: /libexec/ld-elf.so.1 gmake[1]: *** [Makefile:66: hello-exe] Error 1 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_X86_64 -I.. -I.. -w -O0 -std=gnu99 -fno-omit-frame-pointer ./tcctest.gcc > test.ref test3 -
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
Thank you Michael, Trying your latest commit makes me able to compile and run all tests except those below. Even a very simple test fails to find stdlib: $ pwd /usr/home/jullien/tinycc $ cat foo.c #include int main() { printf("Hello World\n"); return 0; } $ ./tcc -B. foo.c -o hello tcc: error: file 'crt1.o' not found tcc: error: file 'crti.o' not found tcc: error: file 'crtn.o' not found tcc: error: undefined symbol 'printf' $ ./tcc -B. foo.c -o hello tcc: error: file 'crt1.o' not found tcc: error: file 'crti.o' not found tcc: error: file 'crtn.o' not found tcc: error: undefined symbol 'printf' $ find . -name '*.a' ./libtcc.a ./libtcc1.a == FROM TESTS SUITE == $ 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 tcc: error: file 'crt1.o' not found tcc: error: file 'crti.o' not found tcc: error: file 'crtn.o' not found tcc: error: undefined symbol 'printf' tcc version 0.9.26 (x86-64 FreeBSD) install: /usr/local/lib/tcc include: /usr/local/lib/tcc/include /usr/local/include /usr/include libraries: /usr/lib64 /lib64 /usr/local/lib64 crt: /usr/lib64 elfinterp: /libexec/ld-elf.so.1 gmake[1]: *** [Makefile:66: hello-exe] Error 1 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_X86_64 -I.. -I.. -w -O0 -std=gnu99 -fno-omit-frame-pointer ./tcctest.gcc > test.ref test3 ../tcc -B.. -I../include -I.. -I.. -DTCC_TARGET_X86_64 -DONE_SOURCE -run ../tcc. c -B.. -I../include -I.. -I.. -DTCC_TARGET_X86_64 -DONE_SOURCE -run ../tcc.c -B.. -I../include -I.. -I.. -DTCC_TARGET_X86_64 -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:29: ../include/stdarg.h:19: error: incompatible redefinition of 'va_list' 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_X86_64 -DONE_SOURCE -lm tcc: error: file 'crt1.o' not found tcc: error: file 'crti.o' not found In file included from abitest.c:5: ../include/stdarg.h:19: error: incompatible redefinition of 'va_list' gmake[1]: *** [Makefile:191: abitest-tcc] Error 1 ../tcc -B.. -I../include -I.. -I.. -o vla_test vla_test.c tcc: error: file 'crt1.o' not found tcc: error: file 'crti.o' not found tcc: error: file 'crtn.o' not found tcc: error: undefined symbol 'memset' tcc: error: undefined symbol 'strcmp' tcc: error: undefined symbol '__stdoutp' tcc: error: undefined symbol 'fputs' tcc: error: undefined symbol 'fflush' gmake[1]: *** [Makefile:206: vla_test] Error 1 -Original Message- From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of Michael Matz Sent: lundi 17 octobre 2016 01:14 To: tinycc-devel@nongnu.org Subject: Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues Hi, On Mon, 17 Oct 2016, Michael Matz wrote: > Now, I do agree that we'd want to add a work around for this in tcc. > I think a better work-around than defining __GNUC__ is to define the > above macros instead. __GNUC__ simply has quite some side-effects. (E.g. > after the patch you can't compile programs on some versions of glibc > anymore because it then uses facilities of GNU C that tcc simply > doesn't implement). For the time being I've committed http://repo.or.cz/tinycc.git/commitdiff/6fbcc14a5d39ca91228f88a64d68a1f3c2d6 7293 which restricts the hack to FreeBSD only. If it's necessary for OpenBSD or NetBSD as well it could be extended. Better would be to restrict the hack somewhat to only define the necessary macros. FWIW: the error mode when having __GNUC__ with glibc is that won't be found, because glibc include_nexts a limits.h that's supposed to be coming from the compiler, when __GNUC__. TCC doesn't provide one (and doesn't need to). Ciao, Michael. ___ 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
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
Hi, On Mon, 17 Oct 2016, Michael Matz wrote: Now, I do agree that we'd want to add a work around for this in tcc. I think a better work-around than defining __GNUC__ is to define the above macros instead. __GNUC__ simply has quite some side-effects. (E.g. after the patch you can't compile programs on some versions of glibc anymore because it then uses facilities of GNU C that tcc simply doesn't implement). For the time being I've committed http://repo.or.cz/tinycc.git/commitdiff/6fbcc14a5d39ca91228f88a64d68a1f3c2d67293 which restricts the hack to FreeBSD only. If it's necessary for OpenBSD or NetBSD as well it could be extended. Better would be to restrict the hack somewhat to only define the necessary macros. FWIW: the error mode when having __GNUC__ with glibc is that won't be found, because glibc include_nexts a limits.h that's supposed to be coming from the compiler, when __GNUC__. TCC doesn't provide one (and doesn't need to). Ciao, Michael. ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
Hi, On Sun, 16 Oct 2016, Christian Jullien wrote: Ok Michael, It is defined in sys/cdefs.h as: #if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER) #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused__attribute__((__unused__)) #define __used __attribute__((__used__)) #define __packed__attribute__((__packed__)) #define __aligned(x)__attribute__((__aligned__(x))) #define __section(x)__attribute__((__section__(x))) #endif Yeah, we gathered this meanwhile from grischkas research. A bug in FreeBSDs header (the bug being that there's no fallback definition of the macros that are nevertheless used unconditionally in standard headers). Now, I do agree that we'd want to add a work around for this in tcc. I think a better work-around than defining __GNUC__ is to define the above macros instead. __GNUC__ simply has quite some side-effects. (E.g. after the patch you can't compile programs on some versions of glibc anymore because it then uses facilities of GNU C that tcc simply doesn't implement). -tcc_define_symbol(s, "__GNUC_MINOR__", "1"); +tcc_define_symbol(s, "__GNUC_MINOR__", "7"); And it helps a little bit, now I get the same result as if I define __aligned(x) __attribute__((__aligned__(x))) i.e. code compiles (with __aligned defined) but std C library is not found. 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 tcc: error: undefined symbol 'memcpy' ... Yes, I wrote a paragraph about this in my initial answer of how you should start trying to corner this problem. Ciao, Michael. ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
Ok Michael, It is defined in sys/cdefs.h as: #if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER) #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused__attribute__((__unused__)) #define __used __attribute__((__used__)) #define __packed__attribute__((__packed__)) #define __aligned(x)__attribute__((__aligned__(x))) #define __section(x)__attribute__((__section__(x))) #endif So just tried: --- a/libtcc.c +++ b/libtcc.c @@ -903,7 +903,7 @@ LIBTCCAPI TCCState *tcc_new(void) # if 1 /* define __GNUC__ to have some useful stuff from sys/cdefs.h */ tcc_define_symbol(s, "__GNUC__", "2"); -tcc_define_symbol(s, "__GNUC_MINOR__", "1"); +tcc_define_symbol(s, "__GNUC_MINOR__", "7"); tcc_define_symbol(s, "__builtin_alloca", "alloca"); tcc_define_symbol(s, "__builtin_memcpy", "memcpy"); tcc_define_symbol(s, "__USER_LABEL_PREFIX__", ""); And it helps a little bit, now I get the same result as if I define __aligned(x) __attribute__((__aligned__(x))) i.e. code compiles (with __aligned defined) but std C library is not found. 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 tcc: error: undefined symbol 'memcpy' tcc: error: undefined symbol 'strlen' tcc: error: undefined symbol 'memmove' tcc: error: undefined symbol 'memset' tcc: error: undefined symbol 'memcmp' tcc: error: undefined symbol 'sprintf' ... $ ./tcc -vv tcc version 0.9.26 (i386 FreeBSD) install: /usr/local/lib/tcc include: /usr/local/lib/tcc/include /usr/local/include /usr/include libraries: /usr/lib /lib /usr/local/lib crt: /usr/lib elfinterp: /libexec/ld-elf.so.1 $ sudo find /usr -name 'crt*o' /usr/lib/crti.o /usr/lib/crtend.o /usr/lib/crtbeginS.o /usr/lib/crtn.o /usr/lib/crtbegin.o /usr/lib/crtendS.o /usr/lib/crtbeginT.o /usr/lib/crt1.o /usr/local/lib/gcc48/gcc/i386-portbld-freebsd11.0/4.8.5/crtbegin.o /usr/local/lib/gcc48/gcc/i386-portbld-freebsd11.0/4.8.5/crtendS.o /usr/local/lib/gcc48/gcc/i386-portbld-freebsd11.0/4.8.5/crtend.o /usr/local/lib/gcc48/gcc/i386-portbld-freebsd11.0/4.8.5/crtbeginS.o -Original Message----- From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of Michael Matz Sent: dimanche 16 octobre 2016 00:05 To: tinycc-devel@nongnu.org Subject: Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues Hi, On Sat, 15 Oct 2016, grischka wrote: > 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 (Don't miss *Linux* in banner with -v and >> -vv) > > Please! You were clear. Anyway, maybe this helps: > > http://repo.or.cz/tinycc.git/commitdiff/f3c1ea6c2d7dca7883985820e46ec5 > 36e2d7e8cc It is expected that this could break system xyz whatever. Ugh. TCC doesn't support enough of GNU C to be able to sensibly define __GNUC__. I've privately started to support more of it, but it's nowhere complete. I don't think that's going to work very well. Christian: you were completely clear in your initial mail. I was trying to make you look into FreeBSDs headers to find out _where_ the __aligned macro is defined, under which conditions. I wanted to know this so that I can suggest an acceptable and least intrusive way for TCC to work around the problem in FreeBSDs standard headers. > Some background research: > > - obviously FreeBSD headers expect __GNUC__ > http://pcc.ludd.ltu.se/jira/browse/PCC-18 Meeh. > - 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) So, FreeBSDs problem really. Well, we could add work arounds in TCC of course, and possibly defining __GNUC__ is the most sensible work around
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
Hi, On Sat, 15 Oct 2016, grischka wrote: 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 (Don’t miss *Linux* in banner with -v and -vv) Please! You were clear. Anyway, maybe this helps: http://repo.or.cz/tinycc.git/commitdiff/f3c1ea6c2d7dca7883985820e46ec536e2d7e8cc It is expected that this could break system xyz whatever. Ugh. TCC doesn't support enough of GNU C to be able to sensibly define __GNUC__. I've privately started to support more of it, but it's nowhere complete. I don't think that's going to work very well. Christian: you were completely clear in your initial mail. I was trying to make you look into FreeBSDs headers to find out _where_ the __aligned macro is defined, under which conditions. I wanted to know this so that I can suggest an acceptable and least intrusive way for TCC to work around the problem in FreeBSDs standard headers. Some background research: - obviously FreeBSD headers expect __GNUC__ http://pcc.ludd.ltu.se/jira/browse/PCC-18 Meeh. - 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) So, FreeBSDs problem really. Well, we could add work arounds in TCC of course, and possibly defining __GNUC__ is the most sensible work around. But please, then only for the BSDs, not for all the rest. The other possibility is to define __aligned ourself (also only on *BSD), if that's the only missing thing breaking otherwise standard-conforming programs on FreeBSD. The compat define should come from some header IMHO, e.g. stddef.h, not pre-defined by TCC itself. Ciao, Michael.___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
+++ 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-r
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
i... 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 (Don't miss *Linux* in banner with -v and -vv) Please! You were clear. Anyway, maybe this helps: <http://repo.or.cz/tinycc.git/commitdiff/f3c1ea6c2d7dca7883985820e46ec536e2d 7e8cc> 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> 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> 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> 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 <mailto:Tinycc-devel@nongnu.org> Tinycc-devel@nongnu.org <https://lists.nongnu.org/mailman/listinfo/tinycc-devel> https://lists.nongnu.org/mailman/listinfo/tinycc-devel ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
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 (Don’t miss *Linux* in banner with -v and -vv) Please! You were clear. Anyway, maybe this helps: http://repo.or.cz/tinycc.git/commitdiff/f3c1ea6c2d7dca7883985820e46ec536e2d7e8cc 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
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
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 (Don’t miss *Linux* in banner with -v and -vv) == MY ENV $ uname -a FreeBSD freebsd.eligis.com 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 03:40:55 UTC 2016 r...@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC i386 $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc48/gcc/i386-portbld-freebsd11.0/4.8.5/lto-wrapper Target: i386-portbld-freebsd11.0 Configured with: /wrkdirs/usr/ports/lang/gcc/work/gcc-4.8.5/configure --disable-multilib --disable-bootstrap --disable-nls --enable-gnu-indirect-function --libdir=/usr/local/lib/gcc48 --libexecdir=/usr/local/libexec/gcc48 --program-suffix=48 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc48/include/c++/ --with-ld=/usr/local/bin/ld --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --with-ecj-jar=/usr/local/share/java/ecj-4.5.jar --enable-languages=c,c++,objc,fortran,java --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/info/gcc48 --build=i386-portbld-freebsd11.0 Thread model: posix gcc version 4.8.5 (FreeBSD Ports Collection) == GET BRAND NEW VERSION $ rm -r -f tinycc/ $ git clone git://repo.or.cz/tinycc.git Cloning into 'tinycc'... ... == CONFIGURE AND BUILD DEFAULT $ ./configure Binary directory /usr/local/bin TinyCC directory/usr/local/lib/tcc Library directory /usr/local/lib Include directory /usr/local/include Manual directory/usr/local/share/man Info directory /usr/local/share/info Doc directory /usr/local/share/doc Target root prefix Source path /usr/home/jullien/tinycc C compiler gcc Target OS FreeBSD CPU x86 Big Endian no gprof enabled no cross compilers no use libgcc no Creating config.mak and config.h $ gmake gcc -o tcc.o -c tcc.c -DTCC_TARGET_I386 -Wall -g -O2 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing -I. gcc -o libtcc.o -c libtcc.c -DTCC_TARGET_I386 -Wall -g -O2 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing -I. ... == SANITY CHECK $ ./tcc -v tcc version 0.9.26 (i386 Linux) <<= Linux??? It should be FreeBSD $ ./tcc -vv tcc version 0.9.26 (i386 Linux) install: /usr/local/lib/tcc include: /usr/local/lib/tcc/include /usr/local/include /usr/include libraries: /usr/lib /lib /usr/local/lib crt: /usr/lib elfinterp: /libexec/ld-elf.so.1 == FIRST TEST (A pure ISO C program) $ cat foo.c #include int main() { raise(SIGTERM); } $ ./tcc foo.c In file included from foo.c:1: 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") Ditto of course with: $ tcc -run foo.c Needless to say it complies with gcc and no specific options $ gcc foo.c $ It of course prevents me to use tcc to compile tcc and test. -Original Message- From: Michael Matz [mailto:matz@frakked.de] Sent: vendredi 14 octobre 2016 18:17 To: Christian JULLIEN; tinycc-devel@nongnu.org Subject: Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues Hi, On Mon, 10 Oct 2016, Christian JULLIEN wrote: > The problem is perhaps different: > ./tcc -B. -Iinclude -I. -run tests/tcctest.c Compiles and works well. > This one ic compiled with GCC > > I get this issue only with: > ../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 > > If understand well, when tcc is compiled by itself. > > It I add: > tcc_define_symbol(s, "__aligned(n)", > "__attribute__((aligned(n)))"); TCC shouldn't define __aligned, GCC doesn't either. Some FreeBSD headers contain the equivalent of the above define, you need to find out which, and you need to find out why it doesn't get used when using TCC. You could use grep or "gcc -E -dD" on a file
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
Hi, On Mon, 10 Oct 2016, Christian JULLIEN wrote: > The problem is perhaps different: > ./tcc -B. -Iinclude -I. -run tests/tcctest.c > Compiles and works well. This one ic compiled with GCC > > I get this issue only with: > ../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 > > If understand well, when tcc is compiled by itself. > > It I add: > tcc_define_symbol(s, "__aligned(n)", > "__attribute__((aligned(n)))"); TCC shouldn't define __aligned, GCC doesn't either. Some FreeBSD headers contain the equivalent of the above define, you need to find out which, and you need to find out why it doesn't get used when using TCC. You could use grep or "gcc -E -dD" on a file showing the problem. Search for "define.*__aligned" and take it from there. > The issue is different, it compiles fine this time but I get: > 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 > tcc: error: undefined symbol 'memmove' > tcc: error: undefined symbol 'memcpy' > tcc: error: undefined symbol 'strlen' > tcc: error: undefined symbol 'memset' > tcc: error: undefined symbol 'memcmp' > > > i.e. no stdlib function is found. Does this also happen with simpler programs containing a call to e.g. strlen? Does it only happen with -run, or also when compiling to an executable? I.e.: % cat x.c extern long strlen(const char *); int main(int argc, char*argv[]) { return strlen(argv[0]); } % tcc x.c % tcc -run x.c If the first tcc run already fails the output of "gcc -v x.c" would be interesting. Otherwise it's something to do with the dynamic linker or the TCCs link editor itself and would need further investigation. Ciao, Michael.___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
The problem is perhaps different: ./tcc -B. -Iinclude -I. -run tests/tcctest.c Compiles and works well. This one ic compiled with GCC I get this issue only with: ../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 If understand well, when tcc is compiled by itself. It I add: tcc_define_symbol(s, "__aligned(n)", "__attribute__((aligned(n)))"); The issue is different, it compiles fine this time but I get: 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 tcc: error: undefined symbol 'memmove' tcc: error: undefined symbol 'memcpy' tcc: error: undefined symbol 'strlen' tcc: error: undefined symbol 'memset' tcc: error: undefined symbol 'memcmp' i.e. no stdlib function is found. - message d'origine - De : "grischka" <gris...@gmx.de> date lun. 10/10/2016 12:35 (GMT +02:00) À : "Christian JULLIEN" <eli...@orange.fr>, "tinycc-devel@nongnu.org" <tinycc-devel@nongnu.org> Objet : Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues Christian JULLIEN wrote: > Thank you for your reply. > This is of course something I tried. > IMHO, because FreeBSD standard headers are known to use __aligned(x) > and __pure, tcc should define them by default (at least for FreeFBSD) > otherwise everybody will need to define those macros just to include > standard header. > > Wdyt? I'd think 1) try to find out why it works for gcc but doesn't for tcc 2) then you could for example put stuff into tcc's stddef.h (assuming that the system headers will read it): #ifdef __FreeBSD__ ... whatever #endif Btw, please note that I don't (usually) commit other peoples' patches the less ones that I can't test ;) -- grischka ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
Christian JULLIEN wrote: Thank you for your reply. This is of course something I tried. IMHO, because FreeBSD standard headers are known to use __aligned(x) and __pure, tcc should define them by default (at least for FreeFBSD) otherwise everybody will need to define those macros just to include standard header. Wdyt? I'd think 1) try to find out why it works for gcc but doesn't for tcc 2) then you could for example put stuff into tcc's stddef.h (assuming that the system headers will read it): #ifdef __FreeBSD__ ... whatever #endif Btw, please note that I don't (usually) commit other peoples' patches the less ones that I can't test ;) -- grischka ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
Thank you for your reply. This is of course something I tried. IMHO, because FreeBSD standard headers are known to use __aligned(x) and __pure, tcc should define them by default (at least for FreeFBSD) otherwise everybody will need to define those macros just to include standard header. Wdyt? Christian - message d'origine - De : "grischka" <gris...@gmx.de> date lun. 10/10/2016 11:09 (GMT +02:00) À : "tinycc-devel@nongnu.org" <tinycc-devel@nongnu.org> Objet : Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues Christian Jullien wrote: > int sc_fpstate[128] __aligned(16); aligned is an attribute (also in gcc. You need #define __aligned(n) __attribute__((aligned(n))) Should be in the headers but often it is only for __GNUC__. pure also is an attribute, for optimization purposes and ignored by tcc, unless given -Wunsupported. -- 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
Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
Christian Jullien wrote: int sc_fpstate[128] __aligned(16); aligned is an attribute (also in gcc. You need #define __aligned(n) __attribute__((aligned(n))) Should be in the headers but often it is only for __GNUC__. pure also is an attribute, for optimization purposes and ignored by tcc, unless given -Wunsupported. -- gr ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
[Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
Hi, As FreeBSD is supported, I gave a try with FreeBSD 11.0 i386 released yesterday and I'm facing issue with __aligned(n) and _pure directives. ./configure; gmake Correctly produces a working tcc binary. gmake -k test proves that 'most' tests work except two: BUG1: ../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 /usr/include/x86/signal.h contains a struct having unsupported __aligned(n) directive: #if __BSD_VISIBLE struct sigcontext { struct __sigset sc_mask;/* signal mask to restore */ int sc_onstack; /* sigstack state to restore */ . int sc_flags; int sc_fpstate[128] __aligned(16); int sc_fsbase; . }; >From tcctock.h I see DEF(TOK_ALIGNED1, "aligned") DEF(TOK_ALIGNED2, "__aligned__") And tried to add DEF(TOK_ALIGNED1, "aligned") DEF(TOK_ALIGNED2, "__aligned__") DEF(TOK_ALIGNED3, "__aligned") And case TOK_ALIGNED1: case TOK_ALIGNED2: case TOK_ALIGNED3: if (tok == '(') { With no luck!! Btw, I see no regression tests using __aligned. BUG2: Test: 46_grep... --- ../../tests/tests2/46_grep.expect 2016-10-10 06:43:12.865818000 +0200 +++ 46_grep.output 2016-10-10 07:05:03.751155000 +0200 @@ -1,3 +1,3 @@ -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:83: +/usr/include/xlocale/_ctype.h:52: error: ';' expected (got "*") gmake[2]: *** [Makefile:56: 46_grep.test] Error 1 Is not obvious to me. #ifndef _XLOCALE_RUN_FUNCTIONS_DEFINED #define _XLOCALE_RUN_FUNCTIONS_DEFINED 1 unsigned long___runetype_l(__ct_rune_t, locale_t) __pure; __ct_rune_t ___tolower_l(__ct_rune_t, locale_t) __pure; __ct_rune_t ___toupper_l(__ct_rune_t, locale_t) __pure; _RuneLocale *__runes_for_locale(locale_t, int*); // This is line 52 #endif Probably __pure which is not a known token. ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel