Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-21 Thread Sergey Korshunoff
> ifdef CONFIG_WIN32 > TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir) 
> -I$(top_srcdir)/include -L$(TOP) > endif

And where the case of CONFIG_WIN64?

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


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-21 Thread Sergey Korshunoff
you changed the code to use 'realpath', but realpath is not available
on all systems.

old code can be used for suçh systems. I don't like to use cp on Linux.

PS: I currently on tablet, a notebook must be repaired.


2016-05-20 18:29 GMT+03:00, avih :
> @seyko
> While I appreciate the confidence in me when you take code/patches which I
> wrote and commit them to mob yourself (and also the credit which you gave in
> your commits from today - in the past you did so without giving credit
> IIRC), I'd also appreciate some heads up and possibly some discussion.
> For instance, your commit bab4519 which is based on an issue which I
> detected and fixed (not perfectly, but still) at my drafts branch to allow
> the tests to run at a custom build dir, you changed the code to use
> 'realpath', but realpath is not available on all systems.
> You can use this code instead, which I wrote and I think would be enough for
> this case, here:
> https://github.com/avih/tinycc/blob/drafts/win32/build-tcc-reproducible.sh#L11
>
>
> Also, if you take someone else's commit and push it yourself, you can keep
> the author the same (assuming you didn't make meaningful changes) using git
> format-patch and git am (or cherry-pick etc), such that the original author
> doesn't appear only at the commit message, but actually stays the author of
> the commit.
>
>
>
> On Saturday, May 14, 2016 5:33 PM, avih  wrote:
>
>
>  You can try my branch: https://github.com/avih/tinycc/commits/drafts (note,
> I force-push and keep it rebased on top of mob).
> It includes several build consolidation for windows such that it needs less
> windows-specific checks etc, but also adds some other improvements (like
> getopt working out of the box, and few more, including make it self-hosting
> using the latest official tcc-for-windows-release - 0.26). It shouldn't hard
> to identify the commits which only touch the build system.
>
> I haven't touched tcc for some months, and at the time I was able to use my
> drafts branch to build tcc and cross out of tree with all tests passing and
> the output executables working as expected, either on windows or linux,
> either in msys2-32/64 env using the native (gcc) compiler or msys1 env
> (using tcc0.26-32 for windows as the compiler and tiny_libmaker.exe as AR).
> I've updated it today (pushed to the drafts branch already) and added one
> commit which reverts a win32 specific stuff at the tests/Makefile (my
> earlier consolidations made it unneeded), and it now _seems_ to work again
> as expected (was able to build using msys2 (gcc) or msys[1] (tcc.exe) and
> all the tests pass). But I didn't test it extensively.
>
> If you wish to test the version which got some more testing by me, you can
> try the branch "snapshot-drafts-2015-12-17"
>
> Hope it helps.
> PS.I wanted to push some/all of the commits on my "drafts" branch to mob
> after some cleanups, but never really got to end up doing it. If there's
> enough interest and my current drafts branc ends up usable for many, I'll
> reconsider putting the effort.
>
>
> On Saturday, May 14, 2016 4:57 PM, Chris Marshall
>  wrote:
>
>
>  As someone whose primary development environment is cygwin/win7, I would
> love for tcc to build and run under cygwin.
>
>
> --Chris
>
>
> On 5/14/2016 03:24, Sergey Korshunoff wrote:
>> MSYS2 is current environment for Qt and other software development on
>> Windows. It is a mingw+cygwin with a package manager (pacman), ported
>> from ARCH Linux. MSYS2 allow to build
>> mingw32/mingw64/cygwin32/cygwin64 programs in unix-like environment.
>> Currenly tcc can not be build on this environment (mix of unix and
>> windows). I think a system name (uname output) is needed to
>> select/reject some code in sources of the tcc.
>>
>> ___
>> 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
>
>
>
>
>

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


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-21 Thread Christian Jullien
On windows you can use _fullpath
https://msdn.microsoft.com/en-us/library/506720ff.aspx

C.

-Original Message-
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org]
On Behalf Of Sergey Korshunoff
Sent: samedi 21 mai 2016 11:19
To: avih; tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] tcc compilation on MSYS2

> The mob branch does not have tests/exsymtab/* which your updated configure
tries to use.
my fault. please fix it (I can't now)

> You didn't take my change at tests/Makefile, and without this change it
won't work on windows (It needs -I$(TOP) because the configured config.h is
there and there only).

a patch was only for Linux part . A Windows part is planed. Why it works on
inux?


you changed the code to use 'realpath', but realpath is not available on all
systems.

___
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] tcc compilation on MSYS2

2016-05-21 Thread Sergey Korshunoff
> The mob branch does not have tests/exsymtab/* which your updated configure 
> tries to use.
my fault. please fix it (I can't now)

> You didn't take my change at tests/Makefile, and without this change it won't 
> work on windows (It needs -I$(TOP) because the configured config.h is there 
> and there only).

a patch was only for Linux part . A Windows part is planed. Why it
works on inux?

you changed the code to use 'realpath', but realpath is not available
on all systems.

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


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-21 Thread Sergey Korshunoff
> The mob branch does not have tests/exsymtab/* which your updated configure 
> tries to use.
my fault. please fix it (I can't now)

> You didn't take my change at tests/Makefile, and without this change it won't 
> work on windows (It needs -I$(TOP) because the configured config.h is there 
> and there only).

a patch was only for Linux part . A Windows part is planed. Why it
works on inux?


you changed the code to use 'realpath', but realpath is not available
on all systems.

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


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-20 Thread avih
@seyko
While I appreciate the confidence in me when you take code/patches which I 
wrote and commit them to mob yourself (and also the credit which you gave in 
your commits from today - in the past you did so without giving credit IIRC), 
I'd also appreciate some heads up and possibly some discussion.
For instance, your commit bab4519 which is based on an issue which I detected 
and fixed (not perfectly, but still) at my drafts branch to allow the tests to 
run at a custom build dir, you changed the code to use 'realpath', but realpath 
is not available on all systems.
You can use this code instead, which I wrote and I think would be enough for 
this case, here:  
https://github.com/avih/tinycc/blob/drafts/win32/build-tcc-reproducible.sh#L11 

Also, if you take someone else's commit and push it yourself, you can keep the 
author the same (assuming you didn't make meaningful changes) using git 
format-patch and git am (or cherry-pick etc), such that the original author 
doesn't appear only at the commit message, but actually stays the author of the 
commit.



On Saturday, May 14, 2016 5:33 PM, avih  wrote:
 

 You can try my branch: https://github.com/avih/tinycc/commits/drafts (note, I 
force-push and keep it rebased on top of mob).
It includes several build consolidation for windows such that it needs less 
windows-specific checks etc, but also adds some other improvements (like getopt 
working out of the box, and few more, including make it self-hosting using the 
latest official tcc-for-windows-release - 0.26). It shouldn't hard to identify 
the commits which only touch the build system.

I haven't touched tcc for some months, and at the time I was able to use my 
drafts branch to build tcc and cross out of tree with all tests passing and the 
output executables working as expected, either on windows or linux, either in 
msys2-32/64 env using the native (gcc) compiler or msys1 env (using tcc0.26-32 
for windows as the compiler and tiny_libmaker.exe as AR).
I've updated it today (pushed to the drafts branch already) and added one 
commit which reverts a win32 specific stuff at the tests/Makefile (my earlier 
consolidations made it unneeded), and it now _seems_ to work again as expected 
(was able to build using msys2 (gcc) or msys[1] (tcc.exe) and all the tests 
pass). But I didn't test it extensively.

If you wish to test the version which got some more testing by me, you can try 
the branch "snapshot-drafts-2015-12-17"

Hope it helps.
PS.I wanted to push some/all of the commits on my "drafts" branch to mob after 
some cleanups, but never really got to end up doing it. If there's enough 
interest and my current drafts branc ends up usable for many, I'll reconsider 
putting the effort.


On Saturday, May 14, 2016 4:57 PM, Chris Marshall  
wrote:
 

 As someone whose primary development environment is cygwin/win7, I would 
love for tcc to build and run under cygwin.


--Chris


On 5/14/2016 03:24, Sergey Korshunoff wrote:
> MSYS2 is current environment for Qt and other software development on
> Windows. It is a mingw+cygwin with a package manager (pacman), ported
> from ARCH Linux. MSYS2 allow to build
> mingw32/mingw64/cygwin32/cygwin64 programs in unix-like environment.
> Currenly tcc can not be build on this environment (mix of unix and
> windows). I think a system name (uname output) is needed to
> select/reject some code in sources of the tcc.
>
> ___
> 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


   

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


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-19 Thread David Mertens
Hey Chris,

The latest tcc work is in the mob branch, and there have been preprocessor
fixes in there recently. You should definitely work off of that branch.

David

On Thu, May 19, 2016 at 2:10 PM, Chris Marshall 
wrote:

> It looks like this is definitely a bug in the version of tcc git I have.
> At least the error message I'm getting in the code does not appear
> to be possible since the error call is from skip() but there are no
> calls to skip() that could have the ')' as reported in the error so
> something is off-by-one or something.
>
> Will try the current git mob next.
>
> --Chris
>
> On Thu, May 19, 2016 at 1:49 PM, Chris Marshall 
> wrote:
>
>> Is it possible that this could be a bug in the tcc preprocessing?
>>
>> On Thu, May 19, 2016 at 10:33 AM, Chris Marshall 
>> wrote:
>>
>>> Thanks for the help.
>>>
>>> I've got tcc building but the bcheck.c compile is failing
>>> when the stdlib.h is pulled in.  My next step is to try
>>> the same with the latest tcc git.  I'm not sure what the
>>> best way to proceed woud be.  The top level gcc build
>>> can correctly (for cygwin) process the various system
>>> include files.  It is only when tcc tries to process those
>>> same files that the problems start.  Maybe there is a
>>> wayto use the gcc step to generate a tcc version of the
>>> include files.
>>>
>>>
>>>
>>>
>>
>
> ___
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
>


-- 
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-19 Thread Chris Marshall
It looks like this is definitely a bug in the version of tcc git I have.
At least the error message I'm getting in the code does not appear
to be possible since the error call is from skip() but there are no
calls to skip() that could have the ')' as reported in the error so
something is off-by-one or something.

Will try the current git mob next.

--Chris

On Thu, May 19, 2016 at 1:49 PM, Chris Marshall 
wrote:

> Is it possible that this could be a bug in the tcc preprocessing?
>
> On Thu, May 19, 2016 at 10:33 AM, Chris Marshall 
> wrote:
>
>> Thanks for the help.
>>
>> I've got tcc building but the bcheck.c compile is failing
>> when the stdlib.h is pulled in.  My next step is to try
>> the same with the latest tcc git.  I'm not sure what the
>> best way to proceed woud be.  The top level gcc build
>> can correctly (for cygwin) process the various system
>> include files.  It is only when tcc tries to process those
>> same files that the problems start.  Maybe there is a
>> wayto use the gcc step to generate a tcc version of the
>> include files.
>>
>>
>>
>>
>
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-19 Thread Chris Marshall
Is it possible that this could be a bug in the tcc preprocessing?

On Thu, May 19, 2016 at 10:33 AM, Chris Marshall 
wrote:

> Thanks for the help.
>
> I've got tcc building but the bcheck.c compile is failing
> when the stdlib.h is pulled in.  My next step is to try
> the same with the latest tcc git.  I'm not sure what the
> best way to proceed woud be.  The top level gcc build
> can correctly (for cygwin) process the various system
> include files.  It is only when tcc tries to process those
> same files that the problems start.  Maybe there is a
> wayto use the gcc step to generate a tcc version of the
> include files.
>
>
>
>
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-19 Thread Chris Marshall
Thanks for the help.

I've got tcc building but the bcheck.c compile is failing
when the stdlib.h is pulled in.  My next step is to try
the same with the latest tcc git.  I'm not sure what the
best way to proceed woud be.  The top level gcc build
can correctly (for cygwin) process the various system
include files.  It is only when tcc tries to process those
same files that the problems start.  Maybe there is a
wayto use the gcc step to generate a tcc version of the
include files.


--Chris

On Wed, May 18, 2016 at 1:55 AM, avih  wrote:

> Also, with this patch, I believe that it will prevent enabling bcheck when
> creating a cross compiler tcc from cygwin for a platform which does support
> bcheck, since I _think_ this will set tcc to define __CYGWIN__ when
> compiling [cross] tcc itself.
>
> I might be wrong here though, I didn't check much of the surrounding code.
>
>
> On Wednesday, May 18, 2016 7:31 AM, Sergey Korshunoff 
> wrote:
>
>
> > However, since the
> > preprocessing is being done by tcc the __CYGWIN__ macro is not defined
> > and I can't figure out where that would go.
> iff --git a/libtcc.c b/libtcc.c
> index 7d9a058..a5ec7f3 100644
>
> --- a/libtcc.c
> +++ b/libtcc.c
> @@ -1170,6 +1170,8 @@ LIBTCCAPI TCCState *tcc_new(void)
> # ifdef TCC_TARGET_X86_64
> tcc_define_symbol(s, "_WIN64", NULL);
> # endif
> +#elif defined(__CYGWIN__)
>
> +tcc_define_symbol(s, "__CYGWIN__", NULL);
> #else
> tcc_define_symbol(s, "__unix__", NULL);
> tcc_define_symbol(s, "__unix", NULL);
>
>
> ___
> 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
>
>
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-17 Thread avih
Maybe it would be better to have tcc define (or not) TCC_BCHECK, and then this 
file, and possibly elsewhere too, check only this instead of all these tests? 

On Wednesday, May 18, 2016 7:31 AM, Sergey Korshunoff  
wrote:
 

 > However, since the
> preprocessing is being done by tcc the __CYGWIN__ macro is not defined
> and I can't figure out where that would go.
iff --git a/libtcc.c b/libtcc.c
index 7d9a058..a5ec7f3 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1170,6 +1170,8 @@ LIBTCCAPI TCCState *tcc_new(void)
 # ifdef TCC_TARGET_X86_64
    tcc_define_symbol(s, "_WIN64", NULL);
 # endif
+#elif defined(__CYGWIN__)
+    tcc_define_symbol(s, "__CYGWIN__", NULL);
 #else
    tcc_define_symbol(s, "__unix__", NULL);
    tcc_define_symbol(s, "__unix", NULL);

___
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] tcc compilation on MSYS2

2016-05-17 Thread Sergey Korshunoff
> However, since the
> preprocessing is being done by tcc the __CYGWIN__ macro is not defined
> and I can't figure out where that would go.
iff --git a/libtcc.c b/libtcc.c
index 7d9a058..a5ec7f3 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1170,6 +1170,8 @@ LIBTCCAPI TCCState *tcc_new(void)
 # ifdef TCC_TARGET_X86_64
 tcc_define_symbol(s, "_WIN64", NULL);
 # endif
+#elif defined(__CYGWIN__)
+tcc_define_symbol(s, "__CYGWIN__", NULL);
 #else
 tcc_define_symbol(s, "__unix__", NULL);
 tcc_define_symbol(s, "__unix", NULL);
diff --git a/include/stddef.h b/include/stddef.h
index 791ba31..31b60dd 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -8,8 +8,9 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
 typedef __PTRDIFF_TYPE__ intptr_t;
 typedef __SIZE_TYPE__ uintptr_t;
 
-#ifndef __int8_t_defined
+#if !defined(__int8_t_defined) && !defined(___int8_t_defined)
 #define __int8_t_defined
+#define ___int8_t_defined
 typedef signed char int8_t;
 typedef signed short int int16_t;
 typedef signed int int32_t;
diff --git a/lib/bcheck.c b/lib/bcheck.c
index 18415cd..e3a8ef2 100644
--- a/lib/bcheck.c
+++ b/lib/bcheck.c
@@ -17,10 +17,10 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#include 
 #include 
 #include 
 #include 
+#include 
 #if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) \
 && !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
 #include 
@@ -47,7 +47,7 @@ extern void *sbrk (intptr_t __delta);
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
 || defined(__DragonFly__) || defined(__dietlibc__) \
 || defined(__UCLIBC__) || defined(__OpenBSD__) || defined(__NetBSD__) \
-|| defined(_WIN32) || defined(TCC_UCLIBC)
+|| defined(_WIN32) || defined(TCC_UCLIBC) || defined(__CYGWIN__)
 #warning Bound checking does not support malloc (etc.) in this environment.
 #undef CONFIG_TCC_MALLOC_HOOKS
 #undef HAVE_MEMALIGN
diff --git a/libtcc.c b/libtcc.c
index 7d9a058..a5ec7f3 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1170,6 +1170,8 @@ LIBTCCAPI TCCState *tcc_new(void)
 # ifdef TCC_TARGET_X86_64
 tcc_define_symbol(s, "_WIN64", NULL);
 # endif
+#elif defined(__CYGWIN__)
+tcc_define_symbol(s, "__CYGWIN__", NULL);
 #else
 tcc_define_symbol(s, "__unix__", NULL);
 tcc_define_symbol(s, "__unix", NULL);
diff --git a/tccrun.c b/tccrun.c
index 52d3015..72c62e9 100644
--- a/tccrun.c
+++ b/tccrun.c
@@ -502,7 +502,7 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, 
int level)
 *paddr = uc->uc_mcontext->__ss.__eip;
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || 
defined(__DragonFly__)
 *paddr = uc->uc_mcontext.mc_eip;
-#elif defined(__dietlibc__)
+#elif defined(__dietlibc__) || defined(__CYGWIN__)
 *paddr = uc->uc_mcontext.eip;
 #elif defined(__NetBSD__)
 *paddr = uc->uc_mcontext.__gregs[_REG_EIP];
@@ -515,7 +515,7 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, 
int level)
 fp = uc->uc_mcontext->__ss.__ebp;
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || 
defined(__DragonFly__)
 fp = uc->uc_mcontext.mc_ebp;
-#elif defined(__dietlibc__)
+#elif defined(__dietlibc__) || defined(__CYGWIN__)
 fp = uc->uc_mcontext.ebp;
 #elif defined(__NetBSD__)
 fp = uc->uc_mcontext.__gregs[_REG_EBP];
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-17 Thread Chris Marshall
I don't mean exactly the same code but since cygwin is a flavor of posix
system,
it should be possible to support it the way that MacOSX, linux, and *bsd
are.

@David: ./configure works out of the box.
make goes well until it hits tccrun.c where there is no appropriate version
of rt_get_caller_pc() defined.  I think an #ifdef for cygwin with the values
eip/ebp and rip/rbp could work:

 make
gcc -o tccrun.o -c tccrun.c -DTCC_TARGET_X86_64 -I.  -Wall -g -O0
-Wdeclaration-after-statement -Wno-deprecated-declarations
-Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result
-Wno-uninitialized -fno-strict-aliasing
tccrun.c: In function 'rt_get_caller_pc':
tccrun.c:544:33: error: 'mcontext_t {aka struct __mcontext}' has no member
named 'gregs'
 *paddr = uc->uc_mcontext.gregs[REG_RIP];
 ^
tccrun.c:544:40: error: 'REG_RIP' undeclared (first use in this function)
 *paddr = uc->uc_mcontext.gregs[REG_RIP];
^
tccrun.c:544:40: note: each undeclared identifier is reported only once for
each function it appears in
tccrun.c:555:29: error: 'mcontext_t {aka struct __mcontext}' has no member
named 'gregs'
 fp = uc->uc_mcontext.gregs[REG_RBP];
 ^
tccrun.c:555:36: error: 'REG_RBP' undeclared (first use in this function)
 fp = uc->uc_mcontext.gregs[REG_RBP];


Here is a link to the work done in cygwin to overlay the ucontext structure
so it refers to the underlying windows locations:
https://cygwin.com/ml/cygwin-cvs/2015-q2/msg00141.html

--Chris


On Mon, May 16, 2016 at 10:44 PM, David Mertens 
wrote:

> On Sat, May 14, 2016 at 3:27 PM, grischka  wrote:
>
>> Chris Marshall wrote: ---
>>
>>> To be more specific, it should be possible to build the mingw version of
>>> tcc on cygwin (I don't know, haven't had time to try) but what I would like
>>> is the linux/unix version---if it builds on unix, it should be buildable on
>>> cygwin---as long as you don't look under the covers to find windows.
>>>
>>
>> Probably you could do that.  It is just that you'll find that
>> such (almost true) linux/unix version of tcc will produce
>> (entirely) true linux/unix programs.  And these will not
>> run on windows, not even under cygwin.
>>
>> -- gr
>>
>
> This is already the case on Macs, but we still go to some lengths to
> support it anyway. And, just as with Macs, even if the compiled executables
> cannot be run on Windows, the memory output can be run. Knowing Chris, I'm
> pretty sure this is what he is most interested in. :-)
>
> Chris, what happens if you run ./configure on Cygwin?
>
> David
>
> ___
> 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] tcc compilation on MSYS2

2016-05-17 Thread Chris Marshall
Adding in a case in the re_get_caller_pc() code for defined(__CYGWIN__)
like:

  #elif defined(__CYGWIN__)
*paddr = uc->uc_mcontext.eip;

for each of the 4 cases allowed this to compile.  Then there were some
issues
with stdint.h failing in the libtcc.c compile because on cygwin, the
stdint.h relies
on some _intsup.h and others that require the macro definitions from gcc.
If I hack those in then I can build that.

The next problem is with lib/bcheck.c where since this is not supported, we
need CONFIG_TCC_MALLOC_HOOKS to be #undefed.  However, since the
preprocessing is being done by tcc the __CYGWIN__ macro is not defined
and I can't figure out where that would go.

At that point things build but the tests fail because crt1.o, crti.o and
crtn.o
are not correctly located.

--Chris


On Tue, May 17, 2016 at 3:42 PM, Chris Marshall 
wrote:

> I don't mean exactly the same code but since cygwin is a flavor of posix
> system,
> it should be possible to support it the way that MacOSX, linux, and *bsd
> are.
>
> @David: ./configure works out of the box.
> make goes well until it hits tccrun.c where there is no appropriate version
> of rt_get_caller_pc() defined.  I think an #ifdef for cygwin with the
> values
> eip/ebp and rip/rbp could work:
>
>  make
> gcc -o tccrun.o -c tccrun.c -DTCC_TARGET_X86_64 -I.  -Wall -g -O0
> -Wdeclaration-after-statement -Wno-deprecated-declarations
> -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result
> -Wno-uninitialized -fno-strict-aliasing
> tccrun.c: In function 'rt_get_caller_pc':
> tccrun.c:544:33: error: 'mcontext_t {aka struct __mcontext}' has no member
> named 'gregs'
>  *paddr = uc->uc_mcontext.gregs[REG_RIP];
>  ^
> tccrun.c:544:40: error: 'REG_RIP' undeclared (first use in this function)
>  *paddr = uc->uc_mcontext.gregs[REG_RIP];
> ^
> tccrun.c:544:40: note: each undeclared identifier is reported only once
> for each function it appears in
> tccrun.c:555:29: error: 'mcontext_t {aka struct __mcontext}' has no member
> named 'gregs'
>  fp = uc->uc_mcontext.gregs[REG_RBP];
>  ^
> tccrun.c:555:36: error: 'REG_RBP' undeclared (first use in this function)
>  fp = uc->uc_mcontext.gregs[REG_RBP];
>
>
> Here is a link to the work done in cygwin to overlay the ucontext structure
> so it refers to the underlying windows locations:
> https://cygwin.com/ml/cygwin-cvs/2015-q2/msg00141.html
>
> --Chris
>
>
> On Mon, May 16, 2016 at 10:44 PM, David Mertens 
> wrote:
>
>> On Sat, May 14, 2016 at 3:27 PM, grischka  wrote:
>>
>>> Chris Marshall wrote: ---
>>>
 To be more specific, it should be possible to build the mingw version
 of tcc on cygwin (I don't know, haven't had time to try) but what I would
 like is the linux/unix version---if it builds on unix, it should be
 buildable on cygwin---as long as you don't look under the covers to find
 windows.

>>>
>>> Probably you could do that.  It is just that you'll find that
>>> such (almost true) linux/unix version of tcc will produce
>>> (entirely) true linux/unix programs.  And these will not
>>> run on windows, not even under cygwin.
>>>
>>> -- gr
>>>
>>
>> This is already the case on Macs, but we still go to some lengths to
>> support it anyway. And, just as with Macs, even if the compiled executables
>> cannot be run on Windows, the memory output can be run. Knowing Chris, I'm
>> pretty sure this is what he is most interested in. :-)
>>
>> Chris, what happens if you run ./configure on Cygwin?
>>
>> David
>>
>> ___
>> 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] tcc compilation on MSYS2

2016-05-17 Thread Sergey Korshunoff
> I'm trying to do that, i.e MSYS2 unix.
Fixed a mingw64 build on Linux with --enable-tcc64-mingw
https://github.com/seyko2/tinycc/commit/47f80bd7f70904711a046c4ca98de2657ad298a7

Problem: a name of the libtcc.a and libtcc1.a libraries is the same
for 32 and 64 builds. And all files go to the C:\Program FIles\tcc.
May be there must be lib32 and lib64 dirs with thise libraries as it
is done on Linux?

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


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-17 Thread Sergey Korshunoff
@avih
> apparently there have been some build system changed between December and now

yes, the same is on my branch. A problem is exposed after my commit
  commit 7ed43415380ec6270e53c0ed3f42e5cb99df1f6e
  Author: seyko   bad
  Date:   Wed Mar 4 10:57:13 2015 +0300
   a libraries paths
* x86_64-tcc: use /usr/lib64,.. instead of /usr/lib,..
* don't set tcc_lddir="lib64" if cpu="x86"

--- a/configure
+++ b/configure
 if test x"$bindir" = x""; then
 bindir="${execprefix}/bin"
 fi
-if test x"$tccdir" = x""; then
-tccdir="tcc"
-fi
 if test x"$docdir" = x""; then
 docdir="${sharedir}/doc/${tccdir}"
 fi

Then the right fix must be
- docdir="${sharedir}/doc/${tccdir}"
+docdir="${sharedir}/doc/tcc"

> Chris Marshall wrote: ---
> To be more specific, it should be possible to build the mingw version of tcc 
> on cygwin (I don't > know, haven't had time to try) but what I would like is 
> the linux/unix version---if it builds on
> unix, it should be buildable on cygwin---as long as you don't look under the 
> covers to find
> windows.

> gr
> Probably you could do that.  It is just that you'll find that
> such (almost true) linux/unix version of tcc will produce
> (entirely) true linux/unix programs.  And these will not
> run on windows, not even under cygwin.

I'm trying to do that, i.e MSYS2 unix. A big issue is not to define
_WIN32 which assume standalone mingw (tcc headers/libraries in
C:\Program Files\tcc) w/o MSYS2. mingw on MSYS2 can be different too
because there is all headers and libraries already present.

Executable names:
MSYS2:
  i386-tcc.exe
  x86_64-tcc.exe

Mingw on MSYS2 or standalone tcc installation:
  i386-win-tcc.exe
  x86_64-win-tcc.exe

By default target will be selected depending on msys2 shell
environment (MSYS2 or Mingw on MSYS2).

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


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-16 Thread David Mertens
On Sat, May 14, 2016 at 3:27 PM, grischka  wrote:

> Chris Marshall wrote: ---
>
>> To be more specific, it should be possible to build the mingw version of
>> tcc on cygwin (I don't know, haven't had time to try) but what I would like
>> is the linux/unix version---if it builds on unix, it should be buildable on
>> cygwin---as long as you don't look under the covers to find windows.
>>
>
> Probably you could do that.  It is just that you'll find that
> such (almost true) linux/unix version of tcc will produce
> (entirely) true linux/unix programs.  And these will not
> run on windows, not even under cygwin.
>
> -- gr
>

This is already the case on Macs, but we still go to some lengths to
support it anyway. And, just as with Macs, even if the compiled executables
cannot be run on Windows, the memory output can be run. Knowing Chris, I'm
pretty sure this is what he is most interested in. :-)

Chris, what happens if you run ./configure on Cygwin?

David
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-16 Thread grischka

Chris Marshall wrote: ---
To be more specific, it should be possible to build the mingw version of 
tcc on cygwin (I don't know, haven't had time to try) but what I would 
like is the linux/unix version---if it builds on unix, it should be 
buildable on cygwin---as long as you don't look under the covers to find 
windows.  


Probably you could do that.  It is just that you'll find that
such (almost true) linux/unix version of tcc will produce
(entirely) true linux/unix programs.  And these will not
run on windows, not even under cygwin.

-- gr

In my experience, the problem is when you do something like
check for windows somewhere and then assume it is windows.  If you check 
for and use unix capabilities, you should find them on cygwin.  NOTE: if 
you then check at the end for something windows specific---everything 
breaks again.



--Chris


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


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-16 Thread Sergey Korshunoff
> You can try my branch: https://github.com/avih/tinycc/commits/drafts (note, I 
> force-push and keep it rebased on top of mob).

First impression with this branch on Linux:
1)
fantoo tinycc # ./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//usr/local/lib/tcc ??

2) there is no i386-tcc on i386 Linux even when "./configure --enable-cross"
But I need a i386-tcc to compile a tccboot kernel. Not a general tcc
wiich target is unknown.

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


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-15 Thread Sergey Korshunoff
> You can try my branch: https://github.com/avih/tinycc/commits/drafts (note, I 
> force-push and keep it rebased on top of mob).

>I wanted to push some/all of the commits on my "drafts" branch to mob after 
>some cleanups, but never really got to end up doing it. If there's enough 
>interest and my current drafts branc ends up usable for many, I'll reconsider 
>putting the effort.

Big thanks! I will try to test your branch. It is good to know any
usefull branch of the tcc.

PS: It was my first attempt to build tcc on Windows.. I think it is a
./configure error, which say OK for the unknown environment. Looking
like Unix, I expected tcc build in the Unix way.

PPS: For me Windows is foreign environment and configuring a PATH for
the compiler/utilities is a problem. MSYS2 with a package manager
looks like a primary target for the Unix man.

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


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-14 Thread Chris Marshall
To be more specific, it should be possible to build the mingw version of 
tcc on cygwin (I don't know, haven't had time to try) but what I would 
like is the linux/unix version---if it builds on unix, it should be 
buildable on cygwin---as long as you don't look under the covers to find 
windows.  In my experience, the problem is when you do something like 
check for windows somewhere and then assume it is windows.  If you check 
for and use unix capabilities, you should find them on cygwin.  NOTE: if 
you then check at the end for something windows specific---everything 
breaks again.



--Chris


On 5/14/2016 11:47, David Mertens wrote:

Hello Sergey,

Is this an issue with the standard Makefile, or with the 
Windows-specific build batch (.BAT) file? FWIW, the batch file 
build-process works in at least some of the mingw setups provided by 
Strawberry Perl.


David

On Sat, May 14, 2016 at 3:24 AM, Sergey Korshunoff > wrote:


MSYS2 is current environment for Qt and other software development on
Windows. It is a mingw+cygwin with a package manager (pacman), ported
from ARCH Linux. MSYS2 allow to build
mingw32/mingw64/cygwin32/cygwin64 programs in unix-like environment.
Currenly tcc can not be build on this environment (mix of unix and
windows). I think a system name (uname output) is needed to
select/reject some code in sources of the tcc.

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




--
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan


___
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] tcc compilation on MSYS2

2016-05-14 Thread David Mertens
Hello Sergey,

Is this an issue with the standard Makefile, or with the Windows-specific
build batch (.BAT) file? FWIW, the batch file build-process works in at
least some of the mingw setups provided by Strawberry Perl.

David

On Sat, May 14, 2016 at 3:24 AM, Sergey Korshunoff  wrote:

> MSYS2 is current environment for Qt and other software development on
> Windows. It is a mingw+cygwin with a package manager (pacman), ported
> from ARCH Linux. MSYS2 allow to build
> mingw32/mingw64/cygwin32/cygwin64 programs in unix-like environment.
> Currenly tcc can not be build on this environment (mix of unix and
> windows). I think a system name (uname output) is needed to
> select/reject some code in sources of the tcc.
>
> ___
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>



-- 
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] tcc compilation on MSYS2

2016-05-14 Thread Chris Marshall
As someone whose primary development environment is cygwin/win7, I would 
love for tcc to build and run under cygwin.



--Chris


On 5/14/2016 03:24, Sergey Korshunoff wrote:

MSYS2 is current environment for Qt and other software development on
Windows. It is a mingw+cygwin with a package manager (pacman), ported
from ARCH Linux. MSYS2 allow to build
mingw32/mingw64/cygwin32/cygwin64 programs in unix-like environment.
Currenly tcc can not be build on this environment (mix of unix and
windows). I think a system name (uname output) is needed to
select/reject some code in sources of the tcc.

___
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


[Tinycc-devel] tcc compilation on MSYS2

2016-05-14 Thread Sergey Korshunoff
MSYS2 is current environment for Qt and other software development on
Windows. It is a mingw+cygwin with a package manager (pacman), ported
from ARCH Linux. MSYS2 allow to build
mingw32/mingw64/cygwin32/cygwin64 programs in unix-like environment.
Currenly tcc can not be build on this environment (mix of unix and
windows). I think a system name (uname output) is needed to
select/reject some code in sources of the tcc.

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