[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] global variables in tcc
From: |
Rob |
Subject: |
Re: [Tinycc-devel] global variables in tcc |
Date: |
Mon, 1 Apr 2013 14:10:35 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Apr 01, 2013 at 01:20:22PM +0200, Lluís Batlle i Rossell wrote:
> Hello,
>
> I'm testing tcc 0.9.26, and I see that for global variables liek this:
> int x;
>
> It generates a 'B' symbols (nm naming). But gcc and clang generate 'C'
> symbols. That makes tcc generate errors (or warnings?) linking. It
> says error, but it links.
>
> Is this a tcc problem?
>
> Regards,
> Lluís.
>
> _______________________________________________
> Tinycc-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Shouldn't be - gcc and clang generate uninitialised globals via .comm,
meaning these can be overridden if the sizes and alignment are the same.
tcc doesn't, which is just as valid.
header.h:
int i;
file1.c:
#include "header.h"
file2.c:
#include "header.h"
GCC and Clang allow these to be merged together at link-time, which
means users who make mistakes such as missing `extern' in header files
still get the multiple definitions merged.
tcc is stricter and perhaps more conformant in disallowing this.
Cheers,
Rob
- [Tinycc-devel] global variables in tcc, Lluís Batlle i Rossell, 2013/04/01
- Re: [Tinycc-devel] global variables in tcc,
Rob <=
- Re: [Tinycc-devel] global variables in tcc, Lluís Batlle i Rossell, 2013/04/01
- Re: [Tinycc-devel] global variables in tcc, Daniel Glöckner, 2013/04/01
- Re: [Tinycc-devel] global variables in tcc, Lluís Batlle i Rossell, 2013/04/01
- Re: [Tinycc-devel] global variables in tcc, Rob, 2013/04/01
- Re: [Tinycc-devel] global variables in tcc, Lluís Batlle i Rossell, 2013/04/02
- Re: [Tinycc-devel] global variables in tcc, Rob, 2013/04/02
- Re: [Tinycc-devel] global variables in tcc, grischka, 2013/04/02
- Re: [Tinycc-devel] global variables in tcc, Lluís Batlle i Rossell, 2013/04/02
- Re: [Tinycc-devel] global variables in tcc, Rob, 2013/04/04