PR 34165 aarch64 assertion fail and segv
Checks
Commit Message
I'm going to apply this as a fix for pr34165. It fixes the segv and
results in a zero .got entry for the weak undefined tls syms, the same
as x86.
It seems to me that weak undefined and tls don't work together very
well, as the address of such a sym includes the thread pointer. So
I don't think there is a reliable machine independent way to test
whether the sym is defined.
* elfnn-aarch64.c (dtpoff_base, tpoff_base): Don't assert that
tls_sec is non-NULL, return zero instead.
@@ -5396,8 +5396,8 @@ aarch64_tls_transition (bfd *input_bfd,
static bfd_vma
dtpoff_base (struct bfd_link_info *info)
{
- /* If tls_sec is NULL, we should have signalled an error already. */
- BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
+ if (elf_hash_table (info)->tls_sec == NULL)
+ return 0;
return elf_hash_table (info)->tls_sec->vma;
}
@@ -5409,8 +5409,8 @@ 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. */
- BFD_ASSERT (htab->tls_sec != NULL);
+ if (htab->tls_sec == NULL)
+ return 0;
bfd_vma base = align_power ((bfd_vma) TCB_SIZE,
htab->tls_sec->alignment_power);