TLS data/BSS alignment
Sebastian Huber
sebastian.huber@embedded-brains.de
Mon Mar 23 12:54:08 GMT 2020
More information about the Binutils mailing list
Mon Mar 23 12:54:08 GMT 2020
- Previous message (by thread): TLS data/BSS alignment
- Next message (by thread): i386msdos uninitialised read
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 23/03/2020 13:52, Nick Clifton wrote:
> 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;
> }
Oh, great. Thanks, I focused on the wrong directory (ld instead of bfd).
- Previous message (by thread): TLS data/BSS alignment
- Next message (by thread): i386msdos uninitialised read
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list