tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues


From: Christian JULLIEN
Subject: Re: [Tinycc-devel] [FreeBSD support] __aligned(n) + __pure issues
Date: Mon, 17 Oct 2016 08:56:34 +0200 (CEST)

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" <address@hidden>
date lun. 17/10/2016 06:34 (GMT +02:00)
À : "address@hidden" <address@hidden>
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 ------------
../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:address@hidden
On Behalf Of Michael Matz
Sent: lundi 17 octobre 2016 01:14
To: address@hidden
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 <limits.h>
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
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]