From 4b3c6e74aba07d61e91b2e0ba7190483a0f9f000 Mon Sep 17 00:00:00 2001 From: grischka Date: Sun, 23 Jul 2017 21:24:11 +0200 Subject: tccgen: nodata_wanted fix, default ONE_SOURCE, etc... tccgen.c: doubles need to be aligned, on ARM. The section_reserve() in init_putv does not do that. -D ONE_SOURCE: is now the default and not longer needed. Also, tcc.h now sets the default native target. These both make compiling tcc simple as "gcc tcc.c -o tcc -ldl" again. arm-asm.c: enable pseudo asm also for inline asm tests/tests2/Makefile: disable bitfield tests except on windows and x86_64 and don't generate-always tcc.c: fix a loop with -dt on errors configure: print compiler version (as recognized) tccpp.c: actually define symbols for tcc -dt clear static variables (needed for -dt or libtcc usage) 96_nodata_wanted.c: use __label__ instead of asm lib/files: use native symbols (__i386__ etc.) instead of TCC_TARGET_... --- tests/tests2/96_nodata_wanted.c | 82 +++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 36 deletions(-) (limited to 'tests/tests2/96_nodata_wanted.c') diff --git a/tests/tests2/96_nodata_wanted.c b/tests/tests2/96_nodata_wanted.c index 1f022c9..b594938 100644 --- a/tests/tests2/96_nodata_wanted.c +++ b/tests/tests2/96_nodata_wanted.c @@ -25,50 +25,60 @@ void foo() { short w = &foo; /* 2 cast warnings */ } -#elif defined test_data_suppression -#include +#elif defined test_data_suppression_off || defined test_data_suppression_on -#define ASMLABELS(s) \ - __asm__(".global d"#s",t"#s"\n.data\nd"#s":\n.text\nt"#s":\n") +#if defined test_data_suppression_on +# define SKIP 1 +#else +# define SKIP 0 +#endif -#define PROG \ - static void *p = (void*)&main;\ - static char cc[] = "static string";\ - static double d = 8.0;\ - static struct __attribute__((packed)) {\ - unsigned x : 12;\ - unsigned char y : 7;\ - unsigned z : 28, a: 4, b: 5;\ - } s = { 0x333,0x44,0x555555,6,7 };\ - printf(" static data: %d - %.1f - %.1f - %s - %s\n",\ - sizeof 8.0, 8.0, d, __FUNCTION__, cc);\ - printf(" static bitfields: %x %x %x %x %x\n", s.x, s.y, s.z, s.a, s.b); +#include +/* some gcc headers #define __attribute__ to empty if it's not gcc */ +#undef __attribute__ int main() { - extern char ds1[],ts1[]; - extern char ds2[],ts2[]; - extern char de1[],te1[]; - extern char de2[],te2[]; + __label__ ts0, te0, ts1, te1; + int tl, dl; - printf("suppression off\n"); - if (1) { - ASMLABELS(s1); - PROG - ASMLABELS(e1); - } - printf(" data length is %s\n", de1 - ds1 ? "not 0":"0"); - printf(" text length is %s\n", te1 - ts1 ? "not 0":"0"); + static char ds0 = 0; + static char de0 = 0; + /* get reference size of empty jmp */ +ts0:; + if (!SKIP) {} +te0:; + dl = -(&de0 - &ds0); + tl = -(&&te0 - &&ts0); - printf("suppression on\n"); - if (0) { - ASMLABELS(s2); - PROG - ASMLABELS(e2); + /* test data and code suppression */ + static char ds1 = 0; +ts1:; + if (!SKIP) { + static void *p = (void*)&main; + static char cc[] = "static string"; + static double d = 8.0; + + static struct __attribute__((packed)) { + 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); } - printf(" data length is %x\n", de2 - ds2); - printf(" text length is %X\n", te2 - ts2); - return 0; +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"); + printf("# %d/%d\n", dl, tl); } #endif -- cgit v1.3.1