[PATCH 1/2] x86: Error out if the TLS relocation section can't be created

Jan Beulich jbeulich@suse.com
Fri Nov 27 10:03:38 GMT 2026


On 25.11.2026 01:17, Pietro Monteiro wrote:
> In _bfd_x86_elf_link_setup_gnu_properties, failing to create or align
> the .rel.tls/.rela.tls section returned false (i.e. NULL).  A null
> return means no relocatable ELF input with GNU properties was found,
> so the link carried on with no diagnostic, htab->rel_tls_desc left
> NULL, and the PLT .eh_frame and .sframe setup skipped.
> 
> Call info->callbacks->fatal instead, as the other section-creation
> failures in this function already do.
> 
> This was found during testing of the autoconf 2.73 upgrade, which uses
> C23 by default if the compiler supports it, and building with GCC 14.2,
> which is affected by
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112556.
> 
> Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
> ---
>  bfd/elfxx-x86.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
> index 792fc1655d9..ac0ec77e96a 100644
> --- a/bfd/elfxx-x86.c
> +++ b/bfd/elfxx-x86.c
> @@ -4833,7 +4833,7 @@ _bfd_x86_elf_link_setup_gnu_properties
>  	 bed->dynamic_sec_flags | SEC_READONLY);
>        if (sec == NULL
>  	  || !bfd_set_section_alignment (sec, bed->s->log_file_align))
> -	return false;
> +	info->callbacks->fatal (_("%P: failed to create TLS relocation section\n"));
>        htab->rel_tls_desc = sec;
>  
>        if (!info->no_ld_generated_unwind_info)

I was meaning to ask whether this really needs to be a fatal error, but I
see that other similar cases in the function raise fatal errors as well.
IOW: Okay.

Btw, the subject is tagged 1/2, but no 2/2 appeared in my inbox. And
https://sourceware.org/pipermail/binutils/2026-November/thread.html
doesn't have one either.

Jan


More information about the Binutils mailing list