This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Relocating section at virtual address 0
- From: Daniel Jacobowitz <drow at false dot org>
- To: Daniël Mantione <daniel dot mantione at freepascal dot org>
- Cc: binutils at sourceware dot org
- Date: Tue, 26 Jul 2005 10:04:19 -0400
- Subject: Re: Relocating section at virtual address 0
- References: <Pine.LNX.4.44.0507250856010.6562-100000@deadlock.et.tudelft.nl>
On Mon, Jul 25, 2005 at 09:12:23AM +0200, Daniël Mantione wrote:
> Hi,
>
> I'm coding a more efficient way of threadvar handling for Free Pascal
> compiler. To do that I'm using the gs: register, which I make point to the
> threadvar area of the current thread by means of the modify_ldt syscall of
> the Linux kernel.
>
> So, to access a threadvar, the compiler only needs to issue an instruction
> like 'mov eax,[gs:variableoffset]'.
>
> I have modified the compiler to put all threadvars into their own section,
> .threadvars, now I need to make sure the linker relocates addresses inside
> that section from the virtual address 0.
I'm not sure if the linker can do what you are trying to make it do,
but I'm absolutely sure that you shouldn't be accomplishing your goal
this way.
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.
--
Daniel Jacobowitz
CodeSourcery, LLC