This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Relocating section at virtual address 0


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]