Mips, -fpie and TLS management

2008-11-20 Thread Joel Porquet
Hi, I'm trying to compile a Position Independent Executable with a TLS but gcc doesn't generate the expected code (at least, what i expect). Here's an example: __thread int test_loc; void func() { test_loc = 2; } I compile the object with: CFLAGS=-nostdinc -nostdlib -fno-builtin \

Fwd: Mips, -fpie and TLS management

2008-11-21 Thread Joel Porquet
2008/11/20 Daniel Jacobowitz <[EMAIL PROTECTED]>: > On Thu, Nov 20, 2008 at 05:28:16PM +0100, Joel Porquet wrote: >> Gcc is using local-exec tls model instead of global-dynamic. The >> option -fpie is supposed to act as -fpic though (dixit the manual). >> Here is the fir

Re: Fwd: Mips, -fpie and TLS management

2008-11-21 Thread Joel Porquet
> This is one of the reasons that the generated code can only be used > in executables. Okay, I abdicate on this point. Nevertheless, how could i have a coherent compilation concerning the TLS management, if my executable needs dynamically libraries ? Aren't the exec and dynamic models completely

Re: Fwd: Mips, -fpie and TLS management

2008-11-24 Thread Joel Porquet
2008/11/21 Daniel Jacobowitz <[EMAIL PROTECTED]>: > No, there's nothing wrong with this. You can even use multiple models > in the same executable for the same symbol. The linker will take care > of everything necessary. > > For instance, the executable's TLS block is at a fixed offset from the >

Re: Fwd: Mips, -fpie and TLS management

2009-03-11 Thread Joel Porquet
Dear GCC-list and Daniel, Lately, I continued working on TLS for mips and a few things bother me. Firstly, it seems the "-ftls-model" option for gcc is not completely respected when compiling Position-Independent Executable ("-fpie"). Here is a sample of code for "app.c": __thread int a = 0; ext

Re: Fwd: Mips, -fpie and TLS management

2009-03-12 Thread Joel Porquet
> Check what symbol is at, or near, 0x4003 + 22368.  It's probably > the GOT plus a constant bias. It seems there is nothing at this address. Here is the program header: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x34 0x5ffe

Re: Fwd: Mips, -fpie and TLS management

2009-03-16 Thread Joel Porquet
2009/3/12 Daniel Jacobowitz : > On Thu, Mar 12, 2009 at 02:02:36PM +0100, Joel Porquet wrote: >> > Check what symbol is at, or near, 0x4003 + 22368.  It's probably >> > the GOT plus a constant bias. >> >> It seems there is nothing at this address. Here

Re: Fwd: Mips, -fpie and TLS management

2009-03-17 Thread Joel Porquet
2009/3/16 Daniel Jacobowitz : > On Mon, Mar 16, 2009 at 06:19:01PM +0100, Joel Porquet wrote: >> 2009/3/12 Daniel Jacobowitz : >> > On Thu, Mar 12, 2009 at 02:02:36PM +0100, Joel Porquet wrote: >> >> > Check what symbol is at, or near, 0x4003 + 22368.  It&

Re: Fwd: Mips, -fpie and TLS management

2009-03-17 Thread Joel Porquet
2009/3/17 Daniel Jacobowitz : > On Tue, Mar 17, 2009 at 10:26:05AM +0100, Joel Porquet wrote: >> I don't understand how the runtime loader could know that! As far as I >> know, the tls model is not embedded in reloc information. > > Sure it is.  I suggest you go back to

Re: Fwd: Mips, -fpie and TLS management

2009-03-17 Thread Joel Porquet
2009/3/17 Daniel Jacobowitz : > On Tue, Mar 17, 2009 at 04:03:45PM +0100, Joel Porquet wrote: >> 2009/3/17 Daniel Jacobowitz : >> > On Tue, Mar 17, 2009 at 10:26:05AM +0100, Joel Porquet wrote: >> >> I don't understand how the runtime loader could know that! As