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: [commited,PATCH] Set root.linker_def on _TLS_MODULE_BASE_


On Sun, Feb 15, 2015 at 5:11 PM, Alan Modra <amodra@gmail.com> wrote:
> On Sun, Feb 15, 2015 at 09:57:33AM -0800, H.J. Lu wrote:
>> I checked in this patch to set root.linker_def on _TLS_MODULE_BASE_
>>
>> H.J.
>> ---
>>       * elf32-i386.c (elf_i386_always_size_sections): Set root.linker_def
>>       on _TLS_MODULE_BASE_.
>>       * elf64-x86-64.c (elf_x86_64_always_size_sections): Likewise.
>
> Maybe use _bfd_elf_define_linkage_sym instead?

Unfortunately, we can't since the logic is a little bit different:


 if (tls_sec)
    {
      struct elf_link_hash_entry *tlsbase;

      tlsbase = elf_link_hash_lookup (elf_hash_table (info),
                                      "_TLS_MODULE_BASE_",
                                      FALSE, FALSE, FALSE);

      if (tlsbase && tlsbase->type == STT_TLS)
        {
          struct elf_i386_link_hash_table *htab;
          struct bfd_link_hash_entry *bh = NULL;
          const struct elf_backend_data *bed
            = get_elf_backend_data (output_bfd);

          htab = elf_i386_hash_table (info);
          if (htab == NULL)
            return FALSE;

          if (!(_bfd_generic_link_add_one_symbol
                (info, output_bfd, "_TLS_MODULE_BASE_", BSF_LOCAL,
                 tls_sec, 0, NULL, FALSE,
                 bed->collect, &bh)))
            return FALSE;

          htab->tls_module_base = bh;

          tlsbase = (struct elf_link_hash_entry *)bh;
          tlsbase->def_regular = 1;
          tlsbase->other = STV_HIDDEN;
          tlsbase->root.linker_def = 1;
          (*bed->elf_backend_hide_symbol) (info, tlsbase, TRUE);
        }

Here we check

 if (tlsbase && tlsbase->type == STT_TLS)

instead of

 if (h != NULL)

-- 
H.J.


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