[Top][All Lists]

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

Re: [Tinycc-devel] Compiling tcc for use in a static environment

From: Michael Matz
Subject: Re: [Tinycc-devel] Compiling tcc for use in a static environment
Date: Wed, 9 Apr 2014 19:24:54 +0200 (CEST)
User-agent: Alpine 2.00 (LNX 1167 2008-08-23)


On Tue, 8 Apr 2014, Steve Kemp wrote:

 Using musl I got as far as compiling tcc, but the generated
binaries themselves fail to link:

$ /opt/tcc/bin/tcc t.c
tcc: error: file 'crt1.o' not found
tcc: error: file 'crti.o' not found

That's the runtime startup files (coming with and from the respective libc). If you have space for the compiler itself, you surely have also a little more space for those object files (5Kb for glibc, I'm sure the uclibc variants are even smaller). In one way or annother you do need those startup files (to be linked into the produced executables), so you'd either have to put them literally into the tcc binary (so it doesn't depend on external files), or put them into the file system. The size will hence be mostly the same (minus inode space and file system block alignment per file), making the inclusion into tcc's data segment merely a useless hack. IOW, just add those files to your minimal system (whereever they're are searched in your configuration for tcc).

At this point I'm taking a step back and asking if there
are any existing recipes for building a static compiler
that can be used in a static-only environment (with no ldd
or linker present).

Modulo bugs with the -static support you seem to have already a static compiler. The above crt*.o files are necessary also for static builds. They are _object_ files, not libraries.


reply via email to

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