[Top][All Lists]

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

Re: [Tinycc-devel] Compiling to Bare Metal and to Unusual Targets ?

From: Patrick
Subject: Re: [Tinycc-devel] Compiling to Bare Metal and to Unusual Targets ?
Date: Tue, 12 Mar 2019 14:15:05 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Icedove/52.9.1

Thanks Michael !

You have another tinycc-disciple now. If I find arm bugs, I will try to study and fix them myself. I will also report back with successes and failures. I work very slowly but I will be back-Patrick

On 2019-03-12 01:14 PM, Michael Matz wrote:

On Mon, 11 Mar 2019, Patrick wrote:

I have a couple of experiments I want to run. I would like to compile a self
hosted executable to run on a BeagleBone or Raspberry Pi without an OS.

I built with --enable-cross so I have a Linux to Arm tcc compiler installed.

Could I confirm,  I use:

-Wl,--oformat,binary, but yes, that will give you a binary blob without 
any file headers.  You might need to set -Wl,-Ttext to the correct address 
as well, and you need to remember to use -static for linking.

I haven't heard of anyone trying this on arm, so you might run into bugs.

I also like Minix3. I haven't used it in quite a while but one thing I 
didn't like was the complex build.sh, borrowed from NetBSD. You can 
build the kernel and userland all in one go but it's hard to modify as 
it's so huge and complex.

I was thinking that I would use the tcc compiler on Linux but I would 
use the C libraries/system libraries from Minix. Both are i386 so I am 
hoping that I will be able to build a cross compiler by simply adding 
the right libraries and everything will just work. I realize that I will 
have to build them before I link them.
Minix3 seems to use ELF as basic executable and library format, so that's 
one thing already.  But probably there are details that are different 
between Linux and Minix3 executables that need to be cared for, for 
instance the dynamic linker (if minix3 supports shared libraries) will be 
in a different place.

So most likely it won't be as simple as just pointing to the right headers 
and libraries to get a working result.

I am a little mixed up, ./configure --help offers these options:

Is this how I include a path to an alternative set of headers?

"--sysincludepaths=...    specify system include paths, colon separated"

Is this how I add a path to an alternative set of shared objects or static
archives? ?

"--libpaths=...           specify system library paths, colon separated"
Yes, but before doing that I'd try some experiments: when you add 
'-nostdinc -nostdlib' to you compile/link cmd lines TCC won't look into 
any standard paths for includes and link with no standard libraries, so 
you have everything under your control via -I<path> and -L<path> -lfoo 
options.  If you build a hello world with that you most probably will find 
that you can't just call the so produced executable under minix3.  That 
would need to be fixed first before using the above options makes sense.

The following is for libraries already included in the tcc tarball right? If
we wanted to compile to Minix or BSD, this is not going to help right?

"--config-uClibc,-musl,-mingw32... enable system specific configurations"
No, it's rather about how to integrate with different runtime 
environments like the dynamic linker and which features the C library 
provides.  Minix3 would be another such set, but depending on circumstance 
it's more like a new operating system, or more like a new runtime 
environment (the border is blurry between them).


Tinycc-devel mailing list

reply via email to

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