On Fri, 6 Sep 2024, Evgeny Karpov wrote:

Friday, September 6, 2024
Martin Storsjö <mar...@martin.st> wrote:

Sorry, but no.

You can't just redefine how relocations in your object file format works,
just because you feel like it.

This patch changes how symbol with offset will be emitted.

It will change:
adrp x0, symbol + offset

to:
adrp  x0, symbol
add x0, x0, offset

I presume more precisely, it changes

    adrp x0, symbol + offset
    add x0, x0, :lo12:symbol + offset

into

    adrp x0, symbol
    add x0, x0, :lo12:symbol
    add x0, x0, offset

It is not optimal, however, it is not critical, and both relocation approaches
work with it.

Indeed, it's not optimal, and this other form is totally acceptable. And using it to work around an issue somewhere is also quite ok.

But don't make claims that "'symbol + offset' cannot be used in relocations for aarch64-w64-mingw32 due to relocation requirements." - because that is just misleading.

Only in the case if the offset is more than +/- 1 MB, you would need to change the form of the generated code.

And if the reason for this is the binutils patch that changes how the relocation is handled, that reason will go away, because I believe that patch is demonstrably wrong and that patch should be dropped (or reworked).

// Martin

Reply via email to