tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL)


From: Cayle Graumann
Subject: Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL)
Date: Sun, 17 Sep 2006 14:12:39 -0500

Daniel,

     I linked the libgcc_s.so to libtcc1 after I got it compiled.  When I compiled tcc the first time, it complained about the functions that are not defined in the cvs libtcc1.c code, so that's why I added your libtcc1.c code to it. 

As far as the error goes,  I was trying to compile the mk utility (like make) from the plan9 from user space code.

I have narrowed the problem down to how a preprocessor macro is being handled:
  
Inside the strtod code in the libfmt package, there is the following code:

static  Tab     tab1[] =
{
         1,  0, "",
         3,  1, "7",
         6,  2, "63",
         9,  3, "511",
        13,  4, "8191",
        16,  5, "65535",
        19,  6, "524287",
        23,  7, "8388607",
        26,  8, "67108863",
        27,  9, "134217727",
};

/* originally in the plan9.h file - moved here for testing */
#define nelem(x)        (sizeof (x)/sizeof (x)[0])

static void
divascii(char *a, int *na, int *dp, int *bp)
{
        int b;
        int d;
        Tab *t;

        d = *dp;
        /* These two lines compile in gcc and not in tcc */
        /* tcc gives the following error message : pointer expected */
        if(d >= (int)(nelem(tab1)))
                d = (int)(nelem(tab1))-1;
        t = tab1 + d;
        b = t->bp;
        if(memcmp(a, t->cmp, t->siz) > 0)
              d--;
        *dp -= d;
        *bp += b;
        divby(a, na, b);
}



Anyway, it's kind of funny code and it's not code I care to become that familiar with.    I think  it is trying to determine how many elements are in the array in a portable way based on how much memory it takes up on any given architecture.

 I was trying to do a size and functionality comparison between different make utilities. 



Later on in the same package in the nan64.c file there is also code that does not compile.  There is a constant _expression_ that cannot be evaluated by tcc.  This gives an error 16 message from tcc:

static uvlong uvnan    = ((uvlong)0x7FF00000<<32)|0x00000001;
static uvlong uvinf    = ((uvlong)0x7FF00000<<32)|0x00000000;
static uvlong uvneginf = ((uvlong)0xFFF00000<<32)|0x00000000;

I assume this is one of those C standard constructs that tcc does not yet support.  These were easily fixed by switching them to defines and changing the code where needed.

Cayle,
Missouri

 

On 9/16/06, Daniel Glöckner < address@hidden> wrote:
On Fri, Sep 15, 2006 at 08:53:21AM -0500, Cayle Graumann wrote:
> I applied it to the cvs code + your patched libtcc1.c.

The libtcc1 from my website should not be used with the EABI TinyCC.
Most function names are wrong and the floating point functions use FPA
instructions with their different word order in doubles on little-endian
machines. Your N770 would probably throw a SIGILL on FPA instructions.
Link libgcc_s.so to libtcc1.a.

> The couple of times it has not worked have been due to what I think
> must be a parser bug when it is doing a pointer comparison, because the same
> code compiles under gcc.

Testcase?

  Daniel


_______________________________________________
Tinycc-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/tinycc-devel


reply via email to

[Prev in Thread] Current Thread [Next in Thread]