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: A new feature I want to add to ld, I need someone to point me in the right direction


On Mon, Oct 13, 2003 at 08:07:20AM +0800, Jonathan Wilson wrote:
> Basicly, the Visual C++ linker supports a feature that I want to implement 
> in GNU LD (more specificly win32 PE builds of GNU LD).
> The feature works like so:
> Firstly, the linker will interperate any segnemt names containing a $ 
> (where ? is anything) as being named as though the $ and any text after it 
> didnt exist (i.e. .tls$ becomes .tls and .tls$ZZZ becomes .tls).
> The information after the $ is then used to controll the order that the 
> sections get written out. First comes anything with no $ (i.e. all the 
> sections named .tls) then anything with a $ but no text after the $ (i.e. 
> all the sections named .tls$) then comes all the sections with a $ and text 
> (so .tls$AAA comes after .tls$ but before .tls$ZZZ)
> 
> Example of how sections would be output:
> .tls
> .tls$
> .tls$ABC
> .tls$DEF
> .tls$ZZZ
> The above sections would be output in the above order and would be combined 
> into one segment named .tls
> 
> I want to implement this because it is necessary to support win32 Thread 
> Local Storage (as implemented by Microsoft in Visual C++ and in the windows 
> kernel)

Do you really need the generic feature?  Otherwise you should just do
this with a linker script.  I think it's something like:
  .tls : {
	*(.tls)
	*(.tls$)
	*(.tls$*)
  }

But I'm not sure what that will do to .tls$.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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