ld 2.36 regression linking EFI binary from ELF input with debug info

Jan Beulich jbeulich@suse.com
Wed Feb 17 08:50:27 GMT 2021


On 17.02.2021 06:56, Jeremy Drake wrote:
> On Tue, 16 Feb 2021, Jan Beulich wrote:
> 
>> On 04.02.2021 14:21, Jan Beulich via Binutils wrote:
>>> the Xen project hypervisor build system includes building the
>>> hypervisor binary as an EFI application, as an option (i.e.
>>> as long as the tool chain supports this). Already when probing
>>> the linker we now suddenly get several "relocation truncated
>>> to fit:R_X86_64_32 against `.debug_...'" errors. I have not
>>> had  the time to figure out what exactly broke this, and I'm
>>> sending this mail in the hope that it may ring a bell for
>>> someone.
>>>
>>
>> The problem is the larger default image base, introduced by
>> 514b4e191d5f ("Change the default characteristics of DLLs built
>> by the linker to more secure settings"). The default linker
>> script already before this didn't work when specifying a large
>> enough image base; now it doesn't even work with the default
>> base address.
>>
> 
> I don't think this issue is exclusive to EFI.

And indeed I didn't mean to imply anything like this. It's just
the case where we've run into the issue, and where we need it
fixed.

>  I have seen one or two
> reports of this on the msys2 project, the only one I can remember/track
> down at the moment is
> https://github.com/msys2/MINGW-packages/issues/7023#issuecomment-774672411

This looks different - IMAGE_REL_AMD64_SECREL overflowing would
either imply huge debug info (more than 2Gb / 4Gb depending on
whether the relocated item is considered signed or unsigned) or
a bug in the processing of the relocation itself. Generally the
ability to use section-relative relocations is specifically a
"luxury" most architectures don't have when using ELF objects.

> A similar unsolved issue happens with undefined weak symbols, reported as
> https://sourceware.org/bugzilla/show_bug.cgi?id=26659

Yes, I'm aware of this, but I expect this to be more difficult
to address, because it affects the actual code/data of an image,
not just its debug info (i.e. getting it wrong has more severe
consequences).

Jan


More information about the Binutils mailing list