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

Pietro Monteiro pietro@sociotechnical.xyz
Mon Nov 30 02:41:05 GMT 2026



On 2026-11-27 05:03, Jan Beulich wrote:
> 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.

Thanks. I just pushed that.

> 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.

Sorry, there was another issue with C 27 and GCC 14.2 and I was going to 
send both patches as one series, but decided against do it. This is the 
other patch: 
https://sourceware.org/pipermail/binutils/2026-November/152889.html

pietro



> Jan



More information about the Binutils mailing list