Re: [Tinycc-devel] Windows test suite, why 24_math_library is removed?

2016-10-11 Thread Christian Jullien
As no one complained, I changed 28_strings.c to use ISO C functions and 
reintroduced 24 and 28 tests in Makefile for Windows.

ð  http://repo.or.cz/tinycc.git/commit/8986bc8af473080bed0efa01cb569f3e25f179a9

 

Christian

 

From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On 
Behalf Of avih
Sent: dimanche 9 octobre 2016 16:35
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] Windows test suite, why 24_math_library is removed?

 

round and several other floating point functions from math.h were not working 
on windows for some years, and around November 2015 I fixed most of those 
issues. However, I wasn't aware that some tests were disabled on windows due to 
the missing functions. Good catch (I'd leave it to you to re-enable them).

 

On Sunday, October 9, 2016 5:20 PM, Christian Jullien  wrote:

 

Hi again,

 

I see from test/test2/Makefile that 24_math_library is removed for Windows 
because of lack of round().

 

ifdef CONFIG_WIN32

SKIP += 24_math_library.test # don't have round()

 

With mob compiled with a recent MinGW gcc compiler.

This test is fully working. Can you reconsider to add it as part of standard 
tests suite.

 

I also note that 28_strings is removed because Windows lacks index/rindex 
(which is true).

Now, if you remove  which was a BSDish include now removed from 
POSIX and replace

   printf("%s\n", index(a, 'o'));

   printf("%s\n", rindex(a, 'l'));

   printf("%d\n", rindex(a, 'x') == NULL);

 

By iso C equivalent functions:

 

   printf("%s\n", strchr(a, 'o'));

   printf("%s\n", strrchr(a, 'l'));

   printf("%d\n", strrchr(a, 'x') == NULL);

 

It works on Windows and should work on any system.


___
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] could tcc -vv display last git commit date?

2016-10-11 Thread Christian Jullien
Configure change proposal :

 

echo "#define TCC_RELEASE_DATE \"`git log -1 --format=%cd`\" >> $TMPH

 

Then extend -vv to display release date. It will help determine if s.o. is
up to date.

 

F:\tinycc>win32\tcc -vv

tcc version 0.9.26 (i386 Windows) - Wed Oct 12 06:18:38 2016 +0200

install: f:/tinycc/win32

include:

  f:/tinycc/win32/include

  f:/tinycc/win32/include/winapi

libraries:

  f:/tinycc/win32/lib

  C:/WINDOWS/system32

 

We probably need to test if git returns something in case we get a tar.gz
having only the source code and choose another string value.

 

C.

 

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


Re: [Tinycc-devel] Use TCC with GSL under Windows

2016-10-11 Thread Chen, Xianwen
Dear Daniel,

Thank you. I have tried to:
x86_64-w64-mingw32-gcc -s -Os hello.c

Interestingly, the generated exe is now 18 KB. Still, that is larger than 2
KB. :-)

Warm regards,
Xianwen


On Wed, Oct 12, 2016 at 12:49 AM, Daniel Glöckner  wrote:

> Hi Xianwen,
>
> On Tue, Oct 11, 2016 at 11:43:40PM +0200, Chen, Xianwen wrote:
> > I have been very impressed by the size of exe's that TCC produces in
> > Windows. For the simple hello_world.c, TCC produces an exe of 2 KB, while
> > mingw-w64 produces an exe of 164 KB. Therefore, I would like to continue
> to
> > learn to use TCC.
>
> I'm pretty sure I've used MinGW to generate executables that small,
> although that was probably 16 years ago.
>
> Try to pass -s to GCC and don't use -g to get rid of symbol tables and
> debugging information. Most of the time TCC generates more code than GCC,
> especially when GCC is called with -Os.
>
> The linker of MinGW might enforce different section alignments than TCC.
> But that should add less than 10 kB of padding, regardless of the code
> size.
>
> Best regards,
>
>   Daniel
>
> ___
> 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] Use TCC with GSL under Windows

2016-10-11 Thread Daniel Glöckner
Hi Xianwen,

On Tue, Oct 11, 2016 at 11:43:40PM +0200, Chen, Xianwen wrote:
> I have been very impressed by the size of exe's that TCC produces in
> Windows. For the simple hello_world.c, TCC produces an exe of 2 KB, while
> mingw-w64 produces an exe of 164 KB. Therefore, I would like to continue to
> learn to use TCC.

I'm pretty sure I've used MinGW to generate executables that small,
although that was probably 16 years ago.

Try to pass -s to GCC and don't use -g to get rid of symbol tables and
debugging information. Most of the time TCC generates more code than GCC,
especially when GCC is called with -Os.

The linker of MinGW might enforce different section alignments than TCC.
But that should add less than 10 kB of padding, regardless of the code
size.

Best regards,

  Daniel

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


Re: [Tinycc-devel] PATCH: Use R_AARCH64_MOVW_UABS_G* instead of R_AARCH64_CALL26.

2016-10-11 Thread Edmund Grimley Evans
Me:

> That's interesting. Perhaps that could be extended to AArch64 instead
> of using the ugly work-around...

I've pushed my work-around as I'm not sure when I'll be able to
investigate the linker...

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


[Tinycc-devel] PATCH: Suggest configuring --with-selinux if mprotect fails.

2016-10-11 Thread Edmund Grimley Evans
Any objections to this?

Suggest configuring --with-selinux if mprotect fails.

diff --git a/tccrun.c b/tccrun.c
index 4903f90..1025500 100644
--- a/tccrun.c
+++ b/tccrun.c
@@ -230,7 +230,8 @@ static void set_pages_executable(void *ptr, unsigned long 
length)
 start = (addr_t)ptr & ~(PAGESIZE - 1);
 end = (addr_t)ptr + length;
 end = (end + PAGESIZE - 1) & ~(PAGESIZE - 1);
-mprotect((void *)start, end - start, PROT_READ | PROT_WRITE | PROT_EXEC);
+if (mprotect((void *)start, end - start, PROT_READ | PROT_WRITE | 
PROT_EXEC))
+tcc_error("mprotect failed: did you mean to configure 
--with-selinux?");
   #ifndef __PCC__
 __clear_cache(ptr, (char *)ptr + length);
   #else

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


[Tinycc-devel] Misleading indentation at tccgen.c:4656-4659

2016-10-11 Thread Edmund Grimley Evans
Could someone please take a look at this warning?

tccgen.c: In function 'expr_cond':
tccgen.c:4656:17: warning: this 'else' clause does not guard... 
[-Wmisleading-indentation]
 else
 ^~~~
tccgen.c:4658:21: note: ...this statement, but the latter is misleadingly 
indented as if it is guarded by the 'else'
 gv(rc);
 ^~

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


Re: [Tinycc-devel] PATCH: Use R_AARCH64_MOVW_UABS_G* instead of R_AARCH64_CALL26.

2016-10-11 Thread Edmund Grimley Evans
> >This is a work-around for TCC's linker not building a PLT when TCC is
> >invoked with "-run".
> 
> Hm, are you sure?  See
> 
> 9750d0b725d65296364c08451a985c717bf1890d
> Author: Michael Matz ... 2014-04-06 00:30:22
> 
> x86_64: Create proper PLT and GOT also for -run
> 
> 01c041923474750a236da02561f0f8835445848b
> Author: Michael Matz ... 2014-04-06 01:02:42
> 
> arm: Use proper PLT/GOT for -run.

That's interesting. Perhaps that could be extended to AArch64 instead
of using the ugly work-around...

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