|
From: | David Mertens |
Subject: | Re: [Tinycc-devel] Trouble on x86-64, not windows, not gcc |
Date: | Sun, 10 Jul 2016 15:06:19 -0400 |
On Sat, 9 Jul 2016, David Mertens wrote:
When run on Mac systems, I get errors about "incompatible redefinition of
'va_list'".
Is that the message from TCC or from some other compiler? The other compiler should use its own <stdarg.h>, not TCCs version. If the message comes from TCC, what are the two definitions of va_list and where does the one not coming from TCCs <stdarg.h> comes from?
(Ultimately the layout of va_list has to be compatible between compilers on the same system anyway; it's dictated by the psABI.)
In file included from test.c:8: In file included from /usr/include/stdio.h:64: /usr/include/sys/cdefs.h:81: warning: #warning "Unsupported compiler detected" In file included from test.c:8: In file included from /usr/include/stdio.h:71: /usr/include/sys/_types/_va_list.h:31: error: incompatible redefinition of 'va_list'I'm assuming that tcc picked up its own va_list definition first. Then when it pulled in stdio.h via the system header files, they pulled in a different va_list as illustrated in the series of include provided by the error message. Probably, then, the problem is that everybody is using preprocessor definitions for va_list, and because the tokens that clang uses (a builtin _expression_) is different from the struct that tcc uses, tcc can't figure out that the two are actually compatible. If that's the case, I'm not entirely sure how to go about fixing the problem.
<snip>
Normal BSDs use the sysv ELF psABI, so better have the same definition of va_list like in TCCs <stdarg.h>. Darwin uses the same layout as sysv as well. What could happen is that there are some (and different) type aliases in between va_list and the real struct type.
<snip>
Solaris as well.
TCC's handling of variable argument lists are spelled out in stdarg.h, with implementation in libtcc1.c. I think that for 64-bit machines, we should also check for clang, and then use clang-compatible definitions. I think I could just check if __llvm__ and/or __clang__ are defined, and then insert the appropriate definitions. Does this sound right?
Not quite. The definition of va_list depends on the system, not on the compiler. clang can be used with different systems. So if anything the appropriate define would be something MacOS/Darwin related.
I'd be happy to work on a solution, but I don't have access to a Mac machine
or a BSD system. I'm not interested in going through a full-on BSD
installation at this time, so if anybody knows where I could find a
pre-canned BSD virtualbox image with working git and cc, I'd be much
obliged.
You need some Darwin system to properly solve this. I wonder how you get the above error message on Mac if you don't have to Macs?
[Prev in Thread] | Current Thread | [Next in Thread] |