[PATCH v3 1/1] aarch64: mingw: Prevent relocation types from being overwritten
Evgeny Karpov
evgeny.karpov@arm.com
Mon Jul 27 09:00:05 GMT 2026
On Sat, 25 Jul 2026, Alan Modra wrote:
> > for strong evidence by using a similar approach,
> > rel->r_type = IMAGE_REL_ARM64_ABSOLUTE.
> >
> > It might change later, however for now it can stay like this.
> > However as a personal opinion, "rel->r_type = IMAGE_REL_ARM64_ABSOLUTE"
> > looks like a workaround and "rel->r_ignore = 1" looks more clear
> > on what happens.
>
> Changing r_type to a "do-nothing" code is the way x86 did things, and
> in both coff-i386.c and coff-x86_64.c you'll see r_type set to zero
> with the reloc howto_table having entry 0 an EMPTY_HOWTO. The
> coff-aarch64.c howto for IMAGE_REL_ARM64_ABSOLUTE also does nothing.
>
> Well, they are do-nothing except for various checks. Hmm, and
> emitting a reloc address for dlltool to process. In fact, I think
> things go wrong there. When the x86 backend changes an R_SECTION
> to 0, in_reloc_p will return true because howto_table[0].pc_relative
> is false and howto->type is no longer R_SECTION. That will result in
> the address of these relocs being emitted, which is wrong. The value
> is an index that shouldn't be relocated.
>
> aarch64 would have had a similar problem. So I'm going to apply the
> patch I posted plus the following.
Thank you for the quick replies and these patches. The auto-import implementation
for aarch64-w64-mingw32 will be rebased onto the latest change.
Regards,
Evgeny
More information about the Binutils
mailing list