[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] -fPIC anyone?
From: |
Michael Matz |
Subject: |
Re: [Tinycc-devel] -fPIC anyone? |
Date: |
Wed, 28 Sep 2016 15:25:56 +0200 (CEST) |
User-agent: |
Alpine 2.20 (LSU 67 2015-01-07) |
Hi,
On Tue, 27 Sep 2016, Jean-Claude Beaudoin wrote:
> Hello TCC devs,
>
> I am starting an effort to implement -fPIC support for real in TCC.
> The target is to have TCC generate full fledged shared libraries
> on ELF platforms.
For which architectures? For x86_64 that's already implemented. On i386
you can produce shared libraries but they contain .text relocations (i.e.
are unshared at runtime). Dunno about arm64.
> Any objection? Any advice?
>
> I noticed also that "constructors" have been at the top of the TODO list
> for ages now. If we are talking here of "__attribute__ ((constructor))"
> then I am definitely interested in knowing what is up with that too?
I'm guessing as well it's about the ctor and dtor attributes. That's
relatively easy to add: for all functions so marked you need to put
addresses of them into a .init_array (.fini_array) section. (Or rather
into ELF sections of type SHT_INIT_ARRAY or SHT_FINI_ARRAY, the name isn't
relevant, but this one is customary).
The linker part of tcc also needs two additions: when the input objects
contain sections of type SHT_INIT_ARRAY or SHT_FINI_ARRAY it needs to add
{INIT,FINI}_ARRAY{,SZ} dynamic tags covering those.
Ciao,
Michael.