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]

TLS tpoff alignment question


Hi all,

Lots of bfd beckends have code similar to this, from aarch64, to
handle TLS relocations:

static bfd_vma
tpoff_base (struct bfd_link_info *info)
{
  struct elf_link_hash_table *htab = elf_hash_table (info);

  /* If tls_sec is NULL, we should have signalled an error already.  */
  if (htab->tls_sec == NULL)
    return 0;

  bfd_vma base = align_power ((bfd_vma) TCB_SIZE,
                  htab->tls_sec->alignment_power);
  return htab->tls_sec->vma - base;
}

I am not sure what the align_power function is doing. For example, in
the general case the .tdata section has no alignment applied and base
is TCB_SIZE.

If .tdata is aligned to say 64 bytes, then base becomes 64 bytes. Why
would the alignment of the TLS section need to be subtracted from the
base like this? Isn't the alignment factored into the vma?

Thanks,

-- 
Will Newton
Toolchain Working Group, Linaro


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