[PATCH v2 06/13] LD/PE: Remove remains of MIPS target support

Jan Beulich jbeulich@suse.com
Wed Oct 8 06:02:49 GMT 2025


On 07.10.2025 22:33, Maciej W. Rozycki wrote:
> So here we have a 32-bit COFF ARM_32 relocation that's been converted to 
> an IMAGE_REL_BASED_HIGHLOW fixup.  Let's try a 16-bit relocation instead:
> 
> $ cat short.s
> 	.data
> 	.globl	foo
> foo:
> 	.dc.w	0
> 	.dc.w	foo
> $ arm-pe-as -o long.o long.s
> $ arm-pe-objdump -r long.o
> 
> short.o:     file format pe-arm-little
> 
> RELOCATION RECORDS FOR [.data]:
> OFFSET   TYPE              VALUE
> 00000002 ARM_16            foo
> 
> 
> $ arm-pe-ld -o long.exe long.o
> short.o:(.data+0x2): relocation truncated to fit: ARM_16 against symbol `foo' defined in .data section in short.o
> $ echo $?
> 1
> $ 
> 
> So we've got a link failure, which shows that the `BITS_AND_SHIFT (16, 0)' 
> case cannot trigger for ARM.

The link failure is a result of what specific value the target symbol takes.
For a suitably selected symbol no such error would result. Hence ...

>  I have verified analogous link failures result for i386/PE and x86_64/PE; 
> I'm leaving it up to you as an x86 expert to experiment with if you like.
> 
>  In any case this proves my point with the original submission.

... I disagree with this conclusion.

>  FWIW, none of these COFF relocations are in the PE specification[1],
> which has gaps in the definitions, so presumably they're only supposed to 
> be used with some *nix targets or suchlike, perhaps 16-bit ones.
> 
>>>> And then, can you please indicate when (approximately) this is going to be?
>>>
>>>  I'm back now, but I've run out of time this week too.  I'll try to get to 
>>> it Mon-Wed next week.  I'll appreciate your understanding.
>>
>> I appreciate this, yet as I'm going to travel from end of this week, I won't
>> commit my series ahead of that anymore, as I wouldn't be able to deal with
>> eventual fallout in a timely manner. Hence it'll now be delayed by another
>> month ...
> 
>  Apologies to take so long, however I prefer things to be done properly, 
> even if it requires extra effort.  It's just the way I am, and then this 
> approach helps preventing technical debt from accumulating.

I actually appreciate the desire to be thorough.

Jan


More information about the Binutils mailing list