[Tinycc-devel] Request code review, and merge

2014-06-17 Thread jiang

Hello everyone, I request a code review
Do not know what to write is not a problem, ask everybody to criticize!
I hope I commit to give us some help.
I am ready to give tcc increase uninitialized variable warning

jiang



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


Re: [Tinycc-devel] Is static linking functional?

2014-06-17 Thread Wendell P
On Mon, Jun 16, 2014, at 09:52 PM, lifenjoi...@163.com wrote:
> > I have been using TCC 0.9.26 32-bit on Windows to compile with dynamic
> > linking. No problems. I can't figure out static linking, though.
> 
> For static linking, TCC needs *.a library or *.c files directly.
> *.a files should be made by tiny_libmaker.

What kind of file does tiny_libmaker operate on and what is the syntax?
The docs don't say.

I found the libraries I want as static lib.a compiled with MinGW. When I
try to build with something like

tcc -static app.c lib.a

TCC complains that it can't find lib MSVCRT. For one thing, I've looked
and I can't find a source for a msvcrt.a. For another thing, I made a
dummy msvcrt.a to see what would happen, but TCC doesn't find it no
matter where I put it. I have noticed that after I build something with
dynamic linking, if I add the "-static" option, the error I get is that
TCC can't find the libs.

It shouldn't be asking for a MSVCRT lib anyway. What is it doing?

-- 
http://www.fastmail.fm - Choose from over 50 domains or use your own


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


Re: [Tinycc-devel] Sugggestion: Add lib type *.c for tcc_add_library() on windows ('-l' option parse)

2014-06-17 Thread Thomas Preud'homme
Le dimanche 15 juin 2014, 23:16:14 lifenjoi...@163.com a écrit :
> Hi there,

Hi,

> 
> I work on win platform.
> 
> As tcc can't use gcc's library (*.a) file, tcc can use *.def file (ONLY) for
> dynamic link avoid making the library files.
> 
> For many libraries small or simple, I think tcc also should can use *.c file
> (ONLY) as library.

I don't know Windows very well but this looks very strange. A .c file is a 
source file and must be compiled first.

> 
> For complicated case, library contains *.def and *.c files (BOTH), I think
> tcc can try "*.def + *.c" instead of *.a as library.

And what should it do in this case? Compile it and link it?

> 
> So tcc can use all files as scripts. I used shell scripts for this purpose
> before. :p

Sorry I don't understand this sentence.

> 
> My changes on "libtcc.c" are bellow:

Have you tried your patch on a real example? Can you give us a concrete 
example/scenario with what files are present and what would happen with and 
without your patch?

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Is static linking functional?

2014-06-17 Thread Roy Tam
Hello,

2014-06-18 7:56 GMT+08:00 Wendell P :
> On Mon, Jun 16, 2014, at 09:52 PM, lifenjoi...@163.com wrote:
>> > I have been using TCC 0.9.26 32-bit on Windows to compile with dynamic
>> > linking. No problems. I can't figure out static linking, though.
>>
>> For static linking, TCC needs *.a library or *.c files directly.
>> *.a files should be made by tiny_libmaker.
>
> What kind of file does tiny_libmaker operate on and what is the syntax?
> The docs don't say.

It is the same as GNU binutils ar(1) utility.

>
> I found the libraries I want as static lib.a compiled with MinGW. When I
> try to build with something like
>
> tcc -static app.c lib.a
>
> TCC complains that it can't find lib MSVCRT. For one thing, I've looked
> and I can't find a source for a msvcrt.a. For another thing, I made a
> dummy msvcrt.a to see what would happen, but TCC doesn't find it no
> matter where I put it. I have noticed that after I build something with
> dynamic linking, if I add the "-static" option, the error I get is that
> TCC can't find the libs.

First of all, tcc supports ELF-style object files and COFF resource files.
And MinGW gcc produces COFF object files, which tcc doesn't understand.
So you have to recompile the library with tcc or create def file with
DLL compiled with gcc.

Second, tcc reads msvcrt.def for exports and -static option will clear
all default library path, so don't do that unless you know what
library that is mandatory when linking.

>
> It shouldn't be asking for a MSVCRT lib anyway. What is it doing?
>

In tcc-win32, linking to msvcrt is mandatory unless you rewrite
lib/crt1.c *NOT* to use CRT functions and write+compile a static CRT
for tcc.


HTH,
Roy

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