This is the mail archive of the binutils@sourceware.org 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: Properly align static TLS segments on Solaris 2


Rainer, my guess is that you could fix this problem by writing an
elf_backend_modify_program_headers function for your solaris targets
that sets the PT_TLS p_memsz from elf_hash_table(info)->tls_size.

I say this because tls_size isn't the "size of PT_TLS segment" as the
comment in elf-bfd.h says (ie. p_memsz), but the size allocated by
glibc's ld.so, which may be larger due to alignment requirements.
Apparently this allows ld.so to make use of the gap for another tls
block if one happens to fit.  I'm guessing that the Solaris ld.so does
something a little different so the thread pointer isn't where ld
expects it to be, but you should be able to force the location by
making p_memsz the same as tls_size.  This assumes that at least one
input section is sufficiently aligned that your ld.so won't further
increase the TLS segment size.  If that isn't the case, then you'll
need to also write a ld before_allocation function that calls
_bfd_elf_tls_setup, tweaking the alignment of the returned section (if
any), then calls the elf32.em before_allocation function.

-- 
Alan Modra
Australia Development Lab, IBM


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