<feed xmlns='http://www.w3.org/2005/Atom'>
<title>tinycc/tests/tcctest.c, branch main</title>
<subtitle>Tiny C Compiler by Fabrice Bellard Git mirror of the final release by Bellard, discarding all changes after. The repository at https://repo.or.cz/tinycc.git has become untrustworthy. Also the tcc sources have become tainted with AI slop.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.datenwolf.net/tinycc/'/>
<entry>
<title>final update for 0.9.27</title>
<updated>2017-12-12T16:57:20+00:00</updated>
<author>
<name>grischka</name>
<email>grischka</email>
</author>
<published>2017-12-12T16:57:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.datenwolf.net/tinycc/commit/?id=d348a9a51d32cece842b7885d27a411436d7887b'/>
<id>d348a9a51d32cece842b7885d27a411436d7887b</id>
<content type='text'>
tccgen.c:
- fix ldouble asm hack
- fix a VLA problem on Win64 (also x86_64-gen.c)
- patch_type(): make sure that no symbol ever changes
  from global to static

tcc.c:
- tcc -vv: print libtcc1.a path also on win32

tccpe.c, tcctools.c:
- use unix LF mode to for .def output files (that is for
  creating reproducible output trees)

Makefile:
- suppress some warnings when makeinfo is missing
- call 'which install' only on win32

tests/Makefile:
- change PATH only on WINNT systems (i.e. not if cross-compiling
  on linux for win32)
- asm-c-connect.test: slim output and do diff

tccrun.c tccpe.c *-link.c:
- integrate former 'pe_relocate_rva()' into normal relocation
  This also fixes linkage of the unwind data on WIN64 for -run
  (reported by Janus Lynggaard Thorborg)

tccasm.c, tests/tcctest.c:
- fix dot (sym_index of -1 crashed in put_elf_reloc)
- massage .set a bit (see test)

other:
- #define SECTION_ABS removed
- ST_DATA Section *strtab_section: removed
- put_extern_sym2(): take int section number

Conflicts:
	tccelf.c
	tccpe.c

Conflicts:
	tccelf.c
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
tccgen.c:
- fix ldouble asm hack
- fix a VLA problem on Win64 (also x86_64-gen.c)
- patch_type(): make sure that no symbol ever changes
  from global to static

tcc.c:
- tcc -vv: print libtcc1.a path also on win32

tccpe.c, tcctools.c:
- use unix LF mode to for .def output files (that is for
  creating reproducible output trees)

Makefile:
- suppress some warnings when makeinfo is missing
- call 'which install' only on win32

tests/Makefile:
- change PATH only on WINNT systems (i.e. not if cross-compiling
  on linux for win32)
- asm-c-connect.test: slim output and do diff

tccrun.c tccpe.c *-link.c:
- integrate former 'pe_relocate_rva()' into normal relocation
  This also fixes linkage of the unwind data on WIN64 for -run
  (reported by Janus Lynggaard Thorborg)

tccasm.c, tests/tcctest.c:
- fix dot (sym_index of -1 crashed in put_elf_reloc)
- massage .set a bit (see test)

other:
- #define SECTION_ABS removed
- ST_DATA Section *strtab_section: removed
- put_extern_sym2(): take int section number

Conflicts:
	tccelf.c
	tccpe.c

Conflicts:
	tccelf.c
</pre>
</div>
</content>
</entry>
<entry>
<title>Adjust testcase for PIE compilers</title>
<updated>2017-11-19T14:36:47+00:00</updated>
<author>
<name>Michael Matz</name>
<email>matz@suse.de</email>
</author>
<published>2017-11-19T14:36:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.datenwolf.net/tinycc/commit/?id=330c01bfc6fa6721fd455911a966bce041df31d8'/>
<id>330c01bfc6fa6721fd455911a966bce041df31d8</id>
<content type='text'>
one some systems GCC defaults to PIC/PIE code which is incompatible
with a unannotated asm call to a function (getenv here).  TCC doesn't
support these PIC annotations (yet), so play some pre-processor games.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
one some systems GCC defaults to PIC/PIE code which is incompatible
with a unannotated asm call to a function (getenv here).  TCC doesn't
support these PIC annotations (yet), so play some pre-processor games.
</pre>
</div>
</content>
</entry>
<entry>
<title>Don't make forard asm symbols static by default</title>
<updated>2017-11-16T12:29:59+00:00</updated>
<author>
<name>Michael Matz</name>
<email>matz@suse.de</email>
</author>
<published>2017-11-16T12:29:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.datenwolf.net/tinycc/commit/?id=a8ece0f2ce3d2c2471fc8ddb7109938ecec333f7'/>
<id>a8ece0f2ce3d2c2471fc8ddb7109938ecec333f7</id>
<content type='text'>
fixes the problem in the testcase.  A symbolic reference
from asm, which remains undefined at the end of processing is
always a global reference, not a static (STB_LOCAL) one.
This also affected the linux kernel.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fixes the problem in the testcase.  A symbolic reference
from asm, which remains undefined at the end of processing is
always a global reference, not a static (STB_LOCAL) one.
This also affected the linux kernel.
</pre>
</div>
</content>
</entry>
<entry>
<title>various stuff</title>
<updated>2017-10-11T16:13:43+00:00</updated>
<author>
<name>grischka</name>
<email>grischka</email>
</author>
<published>2017-10-11T16:13:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.datenwolf.net/tinycc/commit/?id=da8c62f75d893449e232944fc62566c020b4d010'/>
<id>da8c62f75d893449e232944fc62566c020b4d010</id>
<content type='text'>
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure &amp;&amp; make can be used with either
  cygwin's "GCC for Win32 Toolchain"
      ./configure --cross-prefix=i686-w64-mingw32-
  or with an existing tcc:
      ./configure --cc=&lt;old-tccdir&gt;/tcc.exe

tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)

tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)

tests:
- remove -I "expr" diff option to allow tests with
  busybox-diff.

libtcc.c, tcc.c:
- removed -iwithprefix option.  It is supposed to be
  combined with -iprefix which we don't have either.

tccgen.c:
- fix assignments and return of 'void', as in
     void f() {
         void *p, *q;
         *p = *q:
         return *p;
     }
  This appears to be allowed but should do nothing.

tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
  This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1.

  The patch was giving tcc's system includes priority over -I which
  is not how it should be.

tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
  used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
  (weak) symbols

tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
  (it was so once except the RX mapping wasn't used at all).

tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.

tccasm.c:
- keep forward asm labels static, otherwise they will endup
  in dynsym eventually.

configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
      make XTCC=&lt;tcc program to use&gt;
- use $(wildcard ...) for install to allow installing just
  a cross compiler for example
      make cross-arm
      make install
- use name &lt;target&gt;-libtcc1.a

build-tcc.bat:
- add  options: -clean, -b bindir
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure &amp;&amp; make can be used with either
  cygwin's "GCC for Win32 Toolchain"
      ./configure --cross-prefix=i686-w64-mingw32-
  or with an existing tcc:
      ./configure --cc=&lt;old-tccdir&gt;/tcc.exe

tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)

tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)

tests:
- remove -I "expr" diff option to allow tests with
  busybox-diff.

libtcc.c, tcc.c:
- removed -iwithprefix option.  It is supposed to be
  combined with -iprefix which we don't have either.

tccgen.c:
- fix assignments and return of 'void', as in
     void f() {
         void *p, *q;
         *p = *q:
         return *p;
     }
  This appears to be allowed but should do nothing.

tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
  This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1.

  The patch was giving tcc's system includes priority over -I which
  is not how it should be.

tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
  used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
  (weak) symbols

tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
  (it was so once except the RX mapping wasn't used at all).

tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.

tccasm.c:
- keep forward asm labels static, otherwise they will endup
  in dynsym eventually.

configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
      make XTCC=&lt;tcc program to use&gt;
- use $(wildcard ...) for install to allow installing just
  a cross compiler for example
      make cross-arm
      make install
- use name &lt;target&gt;-libtcc1.a

build-tcc.bat:
- add  options: -clean, -b bindir
</pre>
</div>
</content>
</entry>
<entry>
<title>Spelling fixes</title>
<updated>2017-09-25T01:03:26+00:00</updated>
<author>
<name>Larry Doolittle</name>
<email>ldoolitt@recycle.lbl.gov</email>
</author>
<published>2017-09-25T01:03:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.datenwolf.net/tinycc/commit/?id=1b6806e5bb39623c75b4aa8d8d6ffe1ef7ea46e7'/>
<id>1b6806e5bb39623c75b4aa8d8d6ffe1ef7ea46e7</id>
<content type='text'>
Comments only, no change to functionality
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Comments only, no change to functionality
</pre>
</div>
</content>
</entry>
<entry>
<title>tccasm: Fix local statics referenced from asms</title>
<updated>2017-07-10T20:29:28+00:00</updated>
<author>
<name>Michael Matz</name>
<email>matz@suse.de</email>
</author>
<published>2017-07-10T20:29:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.datenwolf.net/tinycc/commit/?id=2acb04f7f2077a4cff103421d79ceee48441918a'/>
<id>2acb04f7f2077a4cff103421d79ceee48441918a</id>
<content type='text'>
The assembler uses the -&gt;sym_scope member to walk up the symbols
until finding a non-automatic symbol.  Since reordering the
members of Sym the sym_scope member contains a scope even for local
statics.  Formerly the use of asm_label for statics was implicitely
clearing sym_scope, now we have to do that explicitely.

Add a testcase for that, and one I encountered when moving the
clearing of sym_scope too deep into the call chain (into put_extern_sym).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The assembler uses the -&gt;sym_scope member to walk up the symbols
until finding a non-automatic symbol.  Since reordering the
members of Sym the sym_scope member contains a scope even for local
statics.  Formerly the use of asm_label for statics was implicitely
clearing sym_scope, now we have to do that explicitely.

Add a testcase for that, and one I encountered when moving the
clearing of sym_scope too deep into the call chain (into put_extern_sym).
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix statement exprs returning a local label</title>
<updated>2017-07-10T20:25:11+00:00</updated>
<author>
<name>Michael Matz</name>
<email>matz@suse.de</email>
</author>
<published>2017-07-10T20:25:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.datenwolf.net/tinycc/commit/?id=9bea88d61611dc12eeb211e342461f9157177464'/>
<id>9bea88d61611dc12eeb211e342461f9157177464</id>
<content type='text'>
Like returned local variables also labels local to a statement expression
can be returned, and so their symbols must not be immediately freed
(though they need to be removed from the symbol table).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Like returned local variables also labels local to a statement expression
can be returned, and so their symbols must not be immediately freed
(though they need to be removed from the symbol table).
</pre>
</div>
</content>
</entry>
<entry>
<title>refactor bitfields</title>
<updated>2017-07-09T10:38:59+00:00</updated>
<author>
<name>grischka</name>
<email>grischka</email>
</author>
<published>2017-07-09T10:38:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.datenwolf.net/tinycc/commit/?id=a9e502cc3bae649fe4f9adffcd0715eb0a71d085'/>
<id>a9e502cc3bae649fe4f9adffcd0715eb0a71d085</id>
<content type='text'>
Use 2 level strategy to access packed bitfields cleanly:

1) Allow to override the original declaration type with
   an auxilary "access type".  This solves cases such as

    struct {
        ...
        unsigned f1:1;
    };

    by using VT_BYTE to access f1.

2) Allow byte-wise split accesses using two new functions
   load/store_packed_bf. This solves any cases, also ones
   such as

    struct __attribute((packed)) _s {
        unsigned x : 12;
        unsigned char y : 7;
        unsigned z : 28;
        unsigned a: 3;
        unsigned b: 3;
        unsigned c: 3;
    };

    where for field 'z':
    - VT_INT access from offset 2 would be unaligned
    - VT_LLONG from offset 0 would go past the total
      struct size (7)

    and for field 'a' because it is in two bytes and
    aligned access with VT_SHORT/INT is not possible.

Also, static bitfield initializers are stored byte-wise always.
Also, cleanup the struct_layout function a bit.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use 2 level strategy to access packed bitfields cleanly:

1) Allow to override the original declaration type with
   an auxilary "access type".  This solves cases such as

    struct {
        ...
        unsigned f1:1;
    };

    by using VT_BYTE to access f1.

2) Allow byte-wise split accesses using two new functions
   load/store_packed_bf. This solves any cases, also ones
   such as

    struct __attribute((packed)) _s {
        unsigned x : 12;
        unsigned char y : 7;
        unsigned z : 28;
        unsigned a: 3;
        unsigned b: 3;
        unsigned c: 3;
    };

    where for field 'z':
    - VT_INT access from offset 2 would be unaligned
    - VT_LLONG from offset 0 would go past the total
      struct size (7)

    and for field 'a' because it is in two bytes and
    aligned access with VT_SHORT/INT is not possible.

Also, static bitfield initializers are stored byte-wise always.
Also, cleanup the struct_layout function a bit.
</pre>
</div>
</content>
</entry>
<entry>
<title>more minor fixes</title>
<updated>2017-05-07T10:41:29+00:00</updated>
<author>
<name>grischka</name>
<email>grischka</email>
</author>
<published>2017-05-07T10:41:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.datenwolf.net/tinycc/commit/?id=44abffe33a10ee2bdc0d66f87ffa5e178182d6e6'/>
<id>44abffe33a10ee2bdc0d66f87ffa5e178182d6e6</id>
<content type='text'>
* tccgen: re-allow long double constants for x87 cross
  sizeof (long double) may be 12 or 16 depending on host platform
  (i386/x86_64 on unix/windows).
  Except that it's 8 if the host is on windows and not gcc
  was used to compile tcc.

* win64: fix builtin_va_start after VT_REF removal
  See also a8b83ce43a95fa519dacfe7690a3a0098af7909c

* tcctest.c: remove outdated limitation for ll-bitfield test
  It always worked, there is no reason why it should not work
  in future.

* libtcc1.c: exclude long double conversion on ARM

* Makefile: remove CFLAGS from link recipes

* lib/Makefile: use target DEFINES as passed from main Makefile

* lib/armflush.c lib/va_list.c: factor out from libtcc1.c

* arm-gen.c: disable "depreciated" warnings for now
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* tccgen: re-allow long double constants for x87 cross
  sizeof (long double) may be 12 or 16 depending on host platform
  (i386/x86_64 on unix/windows).
  Except that it's 8 if the host is on windows and not gcc
  was used to compile tcc.

* win64: fix builtin_va_start after VT_REF removal
  See also a8b83ce43a95fa519dacfe7690a3a0098af7909c

* tcctest.c: remove outdated limitation for ll-bitfield test
  It always worked, there is no reason why it should not work
  in future.

* libtcc1.c: exclude long double conversion on ARM

* Makefile: remove CFLAGS from link recipes

* lib/Makefile: use target DEFINES as passed from main Makefile

* lib/armflush.c lib/va_list.c: factor out from libtcc1.c

* arm-gen.c: disable "depreciated" warnings for now
</pre>
</div>
</content>
</entry>
<entry>
<title>Accept extern initialized file-scope variables</title>
<updated>2017-05-07T06:10:06+00:00</updated>
<author>
<name>Michael Matz</name>
<email>matz@suse.de</email>
</author>
<published>2017-05-07T06:10:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.datenwolf.net/tinycc/commit/?id=94ac9f2b4952fbd77bfdf39e753fcbca3e472883'/>
<id>94ac9f2b4952fbd77bfdf39e753fcbca3e472883</id>
<content type='text'>
'extern int i = 42;' at file scope (but not in function scope!) is
allowed and is a proper definition, even though questionable style;
some compilers warn about this.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
'extern int i = 42;' at file scope (but not in function scope!) is
allowed and is a proper definition, even though questionable style;
some compilers warn about this.
</pre>
</div>
</content>
</entry>
</feed>
