tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Using tcc for C development on Android tablet


From: Mason
Subject: Re: [Tinycc-devel] Using tcc for C development on Android tablet
Date: Thu, 20 Sep 2012 16:47:32 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20120909 Firefox/15.0.1 SeaMonkey/2.12.1

Thomas Preud'homme wrote:

> Mason wrote:
>
>> For a while, I've been looking for a way to write (and test)
>> small programs in C on an Android tablet. Recently, I found
>> an app (based on tcc) which allows exactly that, and I started
>> wondering how it is done.
>>
>> Android platforms are mostly based on ARM or MIPS CPUs (though
>> Intel has now ported Android to x86). I don't think tcc has ARM
>> and MIPS code generators, right? So I assume that the C code is
>> not actually compiled into machine code, but instead interpreted
>> "on the fly" using tcc's script mode. Would that seem like a
>> reasonable guess?
> 
> Tinycc does support arm CPUs. Right now it support 2 calling convention : the 
> old ABIS and the base EABI calling convention. It should also support 
> soon(ish) the standard variant EABI calling convention. To be more precise, 
> it 
> already supports this calling convention but there is some relocation missing 
> for the linkage to work. I'm actually working on it though, and I hope to 
> provide a patch in 1-2 weeks if everything goes well.
> 
> Since android uses the base EABI calling convention, it should work fully on 
> android/ARM.

IIUC, it is possible to use tcc on an ARM-based Android system,
to produce ARM machine code which can be run locally?

So you'd guess the Android application (C4droid) is simply generating
native ARM code, and running the resulting binary?

In that case, the app would not work on MIPS-based Android systems.
(Because tcc cannot output MIPS machine code.)

>> On to the app itself. Since it runs on Android, then either tcc
>> has been ported to Java so it can run on any Android system as
>> byte code, OR it has been compiled as a C++ app using the native
>> SDK (but then there would have to be one for ARM and one for MIPS).
>> Which is more likely? And did I miss other possibilities?
> 
> I doubt it was ported to java so it's most probably compiled natively. By the 
> way, it seems you are confused between the HOST architecture (the 
> architecture 
> tcc runs on) and the target architecture (the architecture for which tcc 
> generates code). For instance, although tcc doesn't support MIPS, it can run 
> on MIPS and create program for x86, x86-64 and arm.

In my example, tcc is not a cross-compiler, it would generate binaries
for the same architecture it was compiled for. Thus for ARM-based systems,
it would be compiled for ARM and generate ARM binaries.

Even though I could compile tcc for MIPS, it is pointless if it cannot
generate MIPS machine code to run my compiled programs.

-- 
Regards.




reply via email to

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