Relocating section at virtual address 0

Daniel Jacobowitz drow@false.org
Tue Jul 26 16:54:00 GMT 2005


On Tue, Jul 26, 2005 at 06:45:06PM +0200, Daniël Mantione wrote:
> > Do you have a reason not to use the same thread-local storage ABI that
> > has already been implemented for C/C++?  If you use .tdata and .tbss,
> > everything will just work.  You can even reuse glibc to handle all of
> > the startup and relocation issues.
> 
> We're trying to design an interface that we can use across all platforms.
> I'm sure Linux does things different than for example, Beos, and it is
> definately the case that things are done differently again on the
> Microsoft platform. (GCC/Linux tries do to something with gs:, Visual
> C++/Win32 does something with fs:).

The way Linux does it is within spitting distance of the standard
interface developed by Sun, FYI.

> Using a C runtime library for a Pascal compiler is definately out of the
> question; GNU Pascal did it, Kylix did it and they both failed. The reason
> is that library maintainers simply don't give anything about Pascal users
> and break compatibility whenever they don't like the weather. This is
> especially true for glibc, which breaks even between minor revisions, but
> we've bad experiences with other projects as well. Free Pascal has its
> own portable runtime library.

I'm sorry you appear to have a different opinion of library and
inter-language compatibility than the entire rest of the world :-) For
instance, you won't be able to map your TLS model to the system TLS
model for inter-language bindings.  In any case, this is now off topic
for binutils@, so I won't respond further.

> Now, the documentation warns that this construction is very fragile as the
> linker's calculation of the program headers size if not very accurate. In
> other words, this causes an error message if I add the section as now 3
> program headers are needed, while the linker guesses 2. This is easy to
> fix by replacing SIZEOF_HEADERS with a hard coded constant, but not nice.
> 
> Can I tweak the linker script so the linker guesses correct that it needs
> to allocate 3 program headers?

See PHDRS in the manual; that should be plenty flexible.  Alternatively,
compute the size of the headers yourself, as suggested by the
SIZEOF_HEADERS documentation.  Or you might be able to use
SIZEOF_HEADERS + [the size of one header].

-- 
Daniel Jacobowitz
CodeSourcery, LLC



More information about the Binutils mailing list