Sergey Korshunoff | 27 Jan 12:34 2015
Picon

Is there a some communication policy?

Looking a http://repo.or.cz/w/tinycc.git
A commit  "Fix macro expansion of empty args" has a too short
description. This comment don't explain what was before a patch. I
don't see a post or discussion about this patch. There was a patch for
the same puspose in my set of the patches. And no discussion about  my
patch too.
Why to post a patches if others don't  comminicate?

Mads | 26 Jan 23:04 2015
Picon

/usr/lib/libc.so:3 error: unrecognized file type

I am using tcc for a numerical framework which requires functions to be compiled on execution. 

Setup:
Compiled on Linux Mint using:
./configure (default target x86_64)
make

It compiles and runs as expected (tested for two partitions of Linux Mint). However, an error is produced when testing on another Linux system (Linux students 3.13.6-1 ( x86_64 PLD Linux )):

/usr/lib/libc.so:3 error: unrecognized file type

This error has previously been discussed e.g in:

The origin of the error is:
static int tcc_load_ldscript(TCCState *s1)
inside tccelf.c
which is the function that links libc.so:3

I do not understand the error or why it only occurs for specific systems.
This error seems to be quite common, but I have not found a solution or a satisfying explanation among countless of threads.

An explanation of the error and/or a possible work-around would be greatly appreciated. 

~Mads
<div><div dir="ltr">I am using <span>tcc</span> for a numerical framework which requires functions to be compiled on execution.&nbsp;<div><div><br></div></div>
<div>Setup:</div>
<div>Latest mob branch version (may apply to all): <span></span><a href="http://goog_331809354" target="_blank">http://<span>repo</span>.or.<span>cz</span>/w/≤span>tinycc</span>.</a><a href="http://goog_331809354" target="_blank">git/commit/≤/a><a href="http://goog_331809354" target="_blank">ff783b94c7b973e86b1145e53a4092</a><a href="http://repo.or.cz/w/tinycc.git/commit/ff783b94c7b973e86b1145e53a40926bb87eb47f" target="_blank">6bb87eb47f</a><span></span><br>
</div>
<div>Compiled on Linux Mint using:</div>
<div>./configure (default target x86_64)</div>
<div>make</div>
<div><br></div>
<div>It compiles and runs as expected (tested for two partitions of Linux Mint). However, an error is produced when testing on another Linux system (Linux students 3.13.6-1 ( x86_64 <span>PLD</span> Linux )):</div>
<div><br></div>
<div>/<span>usr</span>/lib/≤span>libc</span>.so:3 error: unrecognized file type<br>
</div>
<br><div>This error has previously been discussed e.g in:</div>
<div>
<a href="https://lists.gnu.org/archive/html/tinycc-devel/2003-05/msg00000.html" target="_blank">https://lists.gnu.org/archive/html/tinycc-devel/2003-05/msg00000.html</a><span><br></span><a href="https://lists.gnu.org/archive/html/tinycc-devel/2003-05/msg00011.html" target="_blank">https://lists.gnu.org/archive/html/tinycc-devel/2003-05/msg00011.html</a><span></span> (suggested solution, tested but didn't work)<br><a href="https://lists.gnu.org/archive/html/tinycc-devel/2014-04/msg00058.html" target="_blank">https://lists.gnu.org/archive/html/tinycc-devel/2014-04/msg00058.html</a><br>...<br>
</div>
<div><br></div>
<div>The origin of the error is:</div>
<div><div>static int <span>tcc</span>_load_≤span>ldscript</span>(<span>TCCState</span> *s1)</div></div>
<div>inside <span>tccelf</span>.c</div>
<div>which is the function that links <span>libc</span>.so:3</div>
<div><br></div>
<div>I do not understand the error or why it only occurs for specific systems.</div>
<div>This error seems to be quite common, but I have not found a solution or a satisfying explanation among countless of threads.</div>
<div><br></div>
<div>An explanation of the error and/or a possible work-around would be greatly appreciated.&nbsp;</div>
<div><br></div>
<div>~Mads</div>
</div></div>
Robert Clausecker | 22 Jan 21:51 2015
Picon

tcc fails to compile the J interpreter

I tried to compile the J interpreter [1] with tcc. This interpreter uses
a metric fucktonne of macros and generally puts a lot of stress on the
compiler and preprocessor. I am using the most recent mob branch version
(release_0_9_26-326-gff783b9). tcc crashes on files vbang.c and vz.c
with the following messages:

vbang.c:
tcc: x86_64-gen.c:495: load: Assertion `(v >= TREG_XMM0) && (v <=
TREG_XMM7)' failed.
Aborted (core dumped)

vz.c
tcc: x86_64-gen.c:495: load: Assertion `(v >= TREG_XMM0) && (v <=
TREG_XMM7)' failed.
Aborted (core dumped)

furthermore, it fails to compile the files p.c and x15.c. gcc and clang
have no problems compiling the project. The error messages are
reproduced below:

p.c:99: error: ')' expected (got ",")
x15.c:845: error: initializer element is not computable at load time

Please have a look at these issues. If you like, I can try to track them
down on my own but I'm not familiar with the tcc source code.

Yours sincerely,
Robert Clausecker

[1]: https://github.com/openj/core

YX Hao | 18 Jan 07:10 2015

Is this a duplicate ASM operation?

Hi there,
 
I found this while debugging app compliled by tcc (i386).
 
char  *mbc_s;
 
int16_t B2 = *((int16_t*)mbc_s);
 
----------
Use monospaced font please.
CPU Disasm
Address   Hex dump          Command                                  Comments
0040106F  |.  8B45 F8       MOV EAX,DWORD PTR SS:[LOCAL.2]           ; !
00401072  |.  0FBF08        MOVSX ECX,WORD PTR DS:[EAX]
00401075  |.  66:894D F0    MOV WORD PTR SS:[LOCAL.4],CX
00401079  |.  8B45 F8       MOV EAX,DWORD PTR SS:[LOCAL.2]           ; <== dup?
0040107C  |.  0FBF4D F0     MOVSX ECX,WORD PTR SS:[LOCAL.4]
00401080  |.  51            PUSH ECX                                 ; /<%d>
00401081  |.  0FBE08        MOVSX ECX,BYTE PTR DS:[EAX]              ; |
00401084  |.  51            PUSH ECX                                 ; |<%c>
00401085  |.  B8 28204000   MOV EAX,OFFSET 00402028                  ; |ASCII "%c:\t%d\n"
0040108A  |.  50            PUSH EAX                                 ; |format => "%c:\t%d\n"
0040108B  |.  E8 00020000   CALL <JMP.&msvcrt.printf>                ; \MSVCRT.printf
----------
 
I don't know much about ASM and how tcc translates c code into ASM. If the 2nd MOV is not necessary, can we optimize it in tcc?
<div>
<div>Hi there,</div>
<div>&nbsp;</div>
<div>I found this while debugging app compliled by tcc 
(i386).</div>
<div>&nbsp;</div>
<div>char&nbsp; *mbc_s;</div>
<div>&nbsp;</div>
<div>int16_t B2 = *((int16_t*)mbc_s);</div>
<div>&nbsp;</div>
<div>----------</div>
<div>
<div>Use monospaced font 
please.</div>
</div>
<div>CPU Disasm<br>Address&nbsp;&nbsp; Hex 
dump&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Command&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
; \MSVCRT.printf<br>----------</div>
<div>&nbsp;</div>
<div>I don't know much about ASM and how 
tcc translates c code into ASM. If the 2nd MOV is not necessary, can we optimize 
it in tcc?</div>
</div>
Sergey Korshunoff | 14 Jan 13:57 2015
Picon

[PATCH] configure: don't set tcc_lddir="lib64" if cpu="x86"

Subj.

PS: I can compile a i386-win32-tcc using a commands
/configure --enable-cross --extra-cflags="-DTCC_TARGET_PE -UTCC_IS_NATIVE"
make
gcc -o i386-win32-tcc tcc.o libtcc.a -lm -ldl -I.  -DTCC_TARGET_PE
-fno-strict-aliasing tccpe.c tccrun.c

But this is not enougth. Both tcc (native and a cross one) use the
same prefix /usr/local
Question: where to put a files for i386-win32-tcc (how to configure it right)?
Attachment (047-configure-x86.patch): application/octet-stream, 713 bytes
Subj.

PS: I can compile a i386-win32-tcc using a commands
/configure --enable-cross --extra-cflags="-DTCC_TARGET_PE -UTCC_IS_NATIVE"
make
gcc -o i386-win32-tcc tcc.o libtcc.a -lm -ldl -I.  -DTCC_TARGET_PE
-fno-strict-aliasing tccpe.c tccrun.c

But this is not enougth. Both tcc (native and a cross one) use the
same prefix /usr/local
Question: where to put a files for i386-win32-tcc (how to configure it right)?
Christian JULLIEN | 13 Jan 16:25 2015
Picon

RE : [PATCH] tcc target info

Try:


$ ./tcc -v
tcc version 0.9.26 (x86-64 Linux)


$ ./tcc -vv
tcc version 0.9.26 (x86-64 Linux)
install: /usr/local/lib/tcc/
crt:
  /usr/lib64
libraries:
  /usr/lib64
  /lib64
  /usr/local/lib64
include:
  /usr/local/include
  /usr/include
  /usr/local/lib/tcc/include
elfinterp:
  /lib64/ld-linux-x86-64.so.2


----- message d'origine -----
De : "Sergey Korshunoff" <seyko2 <at> gmail.com>
date mar. 13/01/2015 13:48 (GMT +01:00)
À : "tinycc-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.org" <tinycc-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.org>
Objet : [Tinycc-devel] [PATCH] tcc target info

Output a tcc target info after tcc version:
tcc version 0.9.26 - Tiny C Compiler - Copyright (C) 2001-2006
Fabrice Bellard
target is x86, elf, Linux

Any suggestions?
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
<div>
<p>Try:<br><br><br>$ ./tcc -v<br>tcc version 0.9.26 (x86-64 Linux)<br><br><br>$ ./tcc -vv<br>tcc version 0.9.26 (x86-64 Linux)<br>install: /usr/local/lib/tcc/≤br>crt:<br>&nbsp; /usr/lib64<br>libraries:<br>&nbsp; /usr/lib64<br>&nbsp; /lib64<br>&nbsp; /usr/local/lib64<br>include:<br>&nbsp; /usr/local/include<br>&nbsp; /usr/include<br>&nbsp; /usr/local/lib/tcc/include<br>elfinterp:<br>&nbsp; /lib64/ld-linux-x86-64.so.2<br><br><br></p>
<blockquote>----- message d'origine -----<br>De : <span dir="ltr">"Sergey Korshunoff"</span> <span dir="lrt">&lt;seyko2 <at> gmail.com&gt;</span><br>date mar. 13/01/2015 13:48 (GMT +01:00)<br>&Agrave; : <span dir="ltr">"tinycc-devel@..."</span> <span dir="lrt">&lt;tinycc-devel@...&gt;</span><br>Objet : [Tinycc-devel] [PATCH] tcc target info<br><br>Output a tcc target info after tcc version:<br>    tcc version 0.9.26 - Tiny C Compiler - Copyright (C) 2001-2006<br>Fabrice Bellard<br>    target is x86, elf, Linux<br><br>Any suggestions?<br>_______________________________________________<br>Tinycc-devel mailing list<br>Tinycc-devel@...<br>https://lists.nongnu.org/mailman/listinfo/tinycc-devel<br>
</blockquote>
</div>
Sergey Korshunoff | 13 Jan 13:48 2015
Picon

[PATCH] tcc target info

Output a tcc target info after tcc version:
    tcc version 0.9.26 - Tiny C Compiler - Copyright (C) 2001-2006
Fabrice Bellard
    target is x86, elf, Linux

Any suggestions?
Attachment (045-target-info.patch): application/octet-stream, 5706 bytes
Output a tcc target info after tcc version:
    tcc version 0.9.26 - Tiny C Compiler - Copyright (C) 2001-2006
Fabrice Bellard
    target is x86, elf, Linux

Any suggestions?
Sergey Korshunoff | 10 Jan 06:38 2015
Picon

no-code-wanted problem

Hello! There is a test program which fails after a patch: tccgen:
nocode_wanted: do not output constants (Aug 1 10:59:38 2014) I don't
know how to fix it.
Attachment (tcc-no-code-wanted.tgz): application/x-gzip, 2881 bytes
Hello! There is a test program which fails after a patch: tccgen:
nocode_wanted: do not output constants (Aug 1 10:59:38 2014) I don't
know how to fix it.
John Smith | 9 Jan 12:05 2015
Picon

Are there any OS X users?

Hi people...

I can't compile tinyCC on OS X.

Are there any OS X users here? If so... could you let me know (you can private email if you prefer, I don't mind
either) so I can ask you some questions about how well tinycc works...

I'm getting compile errors but I can't find any solutions.

I don't even know if tinycc is supported for OS X anymore.

Please help.
John Smith | 9 Jan 12:00 2015
Picon

README needs fixing?

Hi...

In the README... I see this:

"
	Note: For OSX and FreeBSD, gmake should be used instead of make.
"

So... I tried using gmake, and it failed. "gmake not found".

I tried "make --version", and I see this:

	GNU Make 3.81

So... basically that is ALREADY GMAKE.

We can change the READ ME to this:

	Note: For FreeBSD, gmake should be used instead of make.

Or even better:

	Note: if "make --version" does not say "GNU Make" then use gmake instead.

...

It would have saved me a few hours of precious wasted time.

Sergey Korshunoff | 9 Jan 09:08 2015
Picon

tinycc pp concat problem

Hello! There was a patch
    patch 6e56bb387db8af055ff6de71a23b270de55c3dc8
    Author: Thomas Preud'homme <robotux@...>
    Date:   Sat Apr 12 12:00:13 2014 +0800
        Fix preprocessor concat with empty arg

After this patch there is a char '\xC1' in the output insteed of the
empty string.
Something needs to be corrected.
Attachment (tinyc-pp-concat-problem.tgz): application/x-gzip, 1989 bytes
Hello! There was a patch
    patch 6e56bb387db8af055ff6de71a23b270de55c3dc8
    Author: Thomas Preud'homme <robotux@...>
    Date:   Sat Apr 12 12:00:13 2014 +0800
        Fix preprocessor concat with empty arg

After this patch there is a char '\xC1' in the output insteed of the
empty string.
Something needs to be corrected.

Gmane