[PATCH 5/5] ix86: restrict use of GOT32X relocs

Jan Beulich jbeulich@suse.com
Tue Feb 4 07:24:44 GMT 2025


On 03.02.2025 23:41, H.J. Lu wrote:
> On Mon, Feb 3, 2025 at 7:42 PM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> The linker rejects use of this reloc type without a base register for
>> PIC code. Suppress its use by gas in such cases.
>> ---
>> The linker also rejects use of GOT32, but that's an issue the programmer
>> has to deal with. In the assembler we need to avoid doing something
>> wrong that the programmer has not explicitly asked for.
>>
>> --- a/gas/config/tc-i386.c
>> +++ b/gas/config/tc-i386.c
>> @@ -12990,7 +12990,8 @@ output_disp (fragS *insn_start_frag, off
>>                         }
>>                     }
>>                   else if (generate_relax_relocations
>> -                          || (i.rm.mode == 0 && i.rm.regmem == 5))
>> +                          ? (!shared || i.rm.mode != 0 || i.rm.regmem != 5)
>> +                          : (!shared && i.rm.mode == 0 && i.rm.regmem == 5))
>>                     fixP->fx_tcbit2 = 1;
>>                 }
>>             }
> 
> Please add a testcase to show it makes a difference.

Such a testcase wouldn't fit my quality criteria, I'm afraid: It would
likely need to look for the specific diagnostic text, and that's what
I'm pretty sure you know I argue against when others try to add such
tests.

It'll also be in the linker testsuite, despite testing gas behavior.

All this said, I guess I'll think about making a testcase nevertheless.

Jan


More information about the Binutils mailing list