2017-07-16 13:10:00 +03:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* test 'nodata_wanted' data output suppression */
|
|
|
|
|
2017-07-20 23:21:27 +03:00
|
|
|
#if defined test_static_data_error
|
2017-07-16 13:10:00 +03:00
|
|
|
void foo() {
|
|
|
|
if (1) {
|
2017-07-20 23:21:27 +03:00
|
|
|
static short w = (int)&foo; /* initializer not computable */
|
2017-07-16 13:10:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-20 23:21:27 +03:00
|
|
|
#elif defined test_static_nodata_error
|
2017-07-16 13:10:00 +03:00
|
|
|
void foo() {
|
|
|
|
if (0) {
|
2017-07-20 23:21:27 +03:00
|
|
|
static short w = (int)&foo; /* initializer not computable */
|
2017-07-16 13:10:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-20 23:21:27 +03:00
|
|
|
#elif defined test_global_data_error
|
2017-07-16 13:10:00 +03:00
|
|
|
void foo();
|
2017-07-20 23:21:27 +03:00
|
|
|
static short w = (int)&foo; /* initializer not computable */
|
2017-07-16 13:10:00 +03:00
|
|
|
|
|
|
|
|
2017-07-20 23:21:27 +03:00
|
|
|
#elif defined test_local_data_noerror
|
2017-07-16 13:10:00 +03:00
|
|
|
void foo() {
|
2017-07-20 23:21:27 +03:00
|
|
|
short w = &foo; /* 2 cast warnings */
|
2017-07-16 13:10:00 +03:00
|
|
|
}
|
|
|
|
|
2017-07-23 22:24:11 +03:00
|
|
|
#elif defined test_data_suppression_off || defined test_data_suppression_on
|
2017-07-16 13:10:00 +03:00
|
|
|
|
2017-07-23 22:24:11 +03:00
|
|
|
#if defined test_data_suppression_on
|
|
|
|
# define SKIP 1
|
|
|
|
#else
|
|
|
|
# define SKIP 0
|
|
|
|
#endif
|
2017-07-16 13:10:00 +03:00
|
|
|
|
2017-07-23 22:24:11 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
/* some gcc headers #define __attribute__ to empty if it's not gcc */
|
|
|
|
#undef __attribute__
|
2017-07-16 13:10:00 +03:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2017-07-23 22:24:11 +03:00
|
|
|
__label__ ts0, te0, ts1, te1;
|
|
|
|
int tl, dl;
|
2017-07-20 23:21:27 +03:00
|
|
|
|
2017-07-23 22:24:11 +03:00
|
|
|
static char ds0 = 0;
|
|
|
|
static char de0 = 0;
|
|
|
|
/* get reference size of empty jmp */
|
|
|
|
ts0:;
|
|
|
|
if (!SKIP) {}
|
|
|
|
te0:;
|
|
|
|
dl = -(&de0 - &ds0);
|
|
|
|
tl = -(&&te0 - &&ts0);
|
2017-07-16 13:10:00 +03:00
|
|
|
|
2017-07-23 22:24:11 +03:00
|
|
|
/* test data and code suppression */
|
|
|
|
static char ds1 = 0;
|
|
|
|
ts1:;
|
|
|
|
if (!SKIP) {
|
2018-06-01 00:51:51 +03:00
|
|
|
void *p = (void*)&main;
|
|
|
|
char cc[] = "static string";
|
|
|
|
double d = 8.0;
|
|
|
|
struct __attribute__((packed)) {
|
2017-07-23 22:24:11 +03:00
|
|
|
unsigned x : 12;
|
|
|
|
unsigned char y : 7;
|
|
|
|
unsigned z : 28, a: 4, b: 5;
|
|
|
|
} s = { 0x333,0x44,0x555555,6,7 };
|
|
|
|
|
|
|
|
printf("data:\n");
|
|
|
|
printf(" %d - %.1f - %.1f - %s - %s\n",
|
|
|
|
sizeof 8.0, 8.0, d, __FUNCTION__, cc);
|
|
|
|
printf(" %x %x %x %x %x\n",
|
|
|
|
s.x, s.y, s.z, s.a, s.b);
|
2017-07-16 13:10:00 +03:00
|
|
|
}
|
2017-07-23 22:24:11 +03:00
|
|
|
te1:;
|
|
|
|
static char de1 = 0;
|
|
|
|
|
|
|
|
dl += &de1 - &ds1;
|
|
|
|
tl += &&te1 - &&ts1;
|
|
|
|
printf("size of data/text:\n %s/%s\n",
|
|
|
|
dl ? "non-zero":"zero", tl ? "non-zero":"zero");
|
various stuff
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure && 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=<old-tccdir>/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=<tcc program to use>
- use $(wildcard ...) for install to allow installing just
a cross compiler for example
make cross-arm
make install
- use name <target>-libtcc1.a
build-tcc.bat:
- add options: -clean, -b bindir
2017-10-11 19:13:43 +03:00
|
|
|
/*printf("# %d/%d\n", dl, tl);*/
|
2017-07-16 13:10:00 +03:00
|
|
|
}
|
|
|
|
|
2018-06-01 00:51:51 +03:00
|
|
|
#elif defined test_static_data
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
goto there;
|
|
|
|
if (0) {
|
|
|
|
static int a = 1;
|
|
|
|
printf("hello\n"); /* the "hello\n" string is still suppressed */
|
|
|
|
there:
|
|
|
|
printf("a = %d\n", a);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-07-20 23:21:27 +03:00
|
|
|
#endif
|