TLS data/BSS alignment
Nick Clifton
nickc@redhat.com
Mon Mar 23 12:52:33 GMT 2020
More information about the Binutils mailing list
Mon Mar 23 12:52:33 GMT 2020
- Previous message (by thread): TLS data/BSS alignment
- Next message (by thread): TLS data/BSS alignment
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Sebastian,
> Thanks for the hint. I found this code also, but I didn't understand how the different output sections in the ELF file are generated. I guess I have to dig a bit deeper.
Alright, how about this from bfd/elflink.c:
struct bfd_section *
_bfd_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
{
struct bfd_section *sec, *tls;
unsigned int align = 0;
for (sec = obfd->sections; sec != NULL; sec = sec->next)
if ((sec->flags & SEC_THREAD_LOCAL) != 0)
break;
tls = sec;
for (; sec != NULL && (sec->flags & SEC_THREAD_LOCAL) != 0; sec = sec->next)
if (sec->alignment_power > align)
align = sec->alignment_power;
elf_hash_table (info)->tls_sec = tls;
/* Ensure the alignment of the first section is the largest alignment,
so that the tls segment starts aligned. */
if (tls != NULL)
tls->alignment_power = align;
return tls;
}
Cheers
Nick
- Previous message (by thread): TLS data/BSS alignment
- Next message (by thread): TLS data/BSS alignment
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list