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

Alan Modra amodra@gmail.com
Sun May 24 03:55:36 GMT 2026


On Sun, May 24, 2026 at 07:24:46AM +0800, H.J. Lu wrote:
> 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.

Thanks, this is good.  aarch64-linux and ia64-linux fail the pr34165
test, exposing similary problems in those backends.

-- 
Alan Modra


More information about the Binutils mailing list