[PATCH v3] alpha: Don't assert elf_hash_table (info)->tls_sec != NULL

H.J. Lu hjl.tools@gmail.com
Sat May 23 23:24:46 GMT 2026


On Sat, May 23, 2026 at 11:45 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Sat, May 23, 2026 at 7:52 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > Since local weak undefined symbol value is always 0, handle TLS
> > relocations against local weak undefined symbols separately.
> >
> > bfd/
> >
> > PR ld/34165
> > * elf64-alpha.c (elf64_alpha_local_undefweak_p): New function.
> > (elf64_alpha_relocate_section): Handle TLS relocations against
> > local weak undefined symbol value separately.
> >
> > ld/testsuite/
> >
> > PR ld/34165
> > * ld-alpha/alpha.exp: Run $srcdir/$subdir/*.d.
> > * ld-alpha/tlsbin-undef.d: New file.
> > * ld-alpha/tlsbin-undef.s: Likewise.
> > * ld-alpha/tlsbin-weak-undef1.d: Likewise.
> > * ld-alpha/tlsbin-weak-undef1.s: Likewise.
> > * ld-alpha/tlsbin-weak-undef2.d: Likewise.
> > * ld-alpha/tlsbin-weak-undef2.s: Likewise.
> > * ld-alpha/tlspic-undef.d: Likewise.
> > * ld-alpha/tlspic-undef.s: Likewise.
> > * ld-alpha/tlspic-weak-undef1.d: Likewise.
> > * ld-alpha/tlspic-weak-undef1.s: Likewise.
> >
>
> Move elf64_alpha_local_undefweak_p to elf-bfd.h (elf_link_local_undefweak_p)
>
>
> --
> H.J.
> ---
> Since local weak undefined symbol value is always 0, handle TLS
> relocations against local weak undefined symbols separately.
>
> bfd/
>
> PR ld/34165
> * elf-bfd.h (elf_link_local_undefweak_p): New function.
> * elf64-alpha.c (elf64_alpha_relocate_section): Handle TLS
> relocations against local weak undefined symbol value separately.
>
> ld/testsuite/
>
> PR ld/34165
> * ld-alpha/alpha.exp: Run $srcdir/$subdir/*.d.
> * ld-alpha/tlsbin-undef.d: New file.
> * ld-alpha/tlsbin-undef.s: Likewise.
> * ld-alpha/tlsbin-weak-undef1.d: Likewise.
> * ld-alpha/tlsbin-weak-undef1.s: Likewise.
> * ld-alpha/tlsbin-weak-undef2.d: Likewise.
> * ld-alpha/tlsbin-weak-undef2.s: Likewise.
> * ld-alpha/tlspic-undef.d: Likewise.
> * ld-alpha/tlspic-undef.s: Likewise.
> * ld-alpha/tlspic-weak-undef1.d: Likewise.
> * ld-alpha/tlspic-weak-undef1.s: Likewise.

Don't assert elf_hash_table (info)->tls_sec != NULL since the
undefined TLS symbol address isn't usable.

-- 
H.J.
---
When processing TLS relocations, elf_hash_table (info)->tls_sec can be
NULL if all TLS symbols are weak, hidden and undefined.  Don't assert
elf_hash_table (info)->tls_sec != NULL.  Since the undefined TLS symbol
address doesn't map to any TLS storage, it isn't usable.  Also set
dtp_base and tp_base to 0 if elf_hash_table (info)->tls_sec == NULL.

bfd/

PR ld/34165
* elf64-alpha.c (elf64_alpha_relax_got_load): Set dtp_base and
tp_base to 0 if elf_hash_table (info)->tls_sec == NULL.
(elf64_alpha_relocate_section): Don't assert
elf_hash_table (info)->tls_sec != NULL.

ld/

PR ld/34165
* testsuite/ld-alpha/alpha.exp: Run $srcdir/$subdir/*.d.
* testsuite/ld-alpha/tlsbin-undef.d: New file.
* testsuite/ld-alpha/tlsbin-undef.s: Likewise.
* testsuite/ld-alpha/tlsbin-weak-undef1.d: Likewise.
* testsuite/ld-alpha/tlsbin-weak-undef1.s: Likewise.
* testsuite/ld-alpha/tlsbin-weak-undef2.d: Likewise.
* testsuite/ld-alpha/tlsbin-weak-undef2.s: Likewise.
* testsuite/ld-alpha/tlspic-undef.d: Likewise.
* testsuite/ld-alpha/tlspic-undef.s: Likewise.
* testsuite/ld-alpha/tlspic-weak-undef1.d: Likewise.
* testsuite/ld-alpha/tlspic-weak-undef1.s: Likewise.
* testsuite/ld-elf/pr34165.c: Likewise.
* testsuite/ld-elf/tls.exp: Run PR ld/34165 test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v3-0001-alpha-Don-t-assert-elf_hash_table-info-tls_sec-NU.patch
Type: text/x-patch
Size: 10691 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260524/562f7bfc/attachment.bin>


More information about the Binutils mailing list