[PATCH] Fix IAT (Import Address Table) alignment on AArch64

Evgeny Karpov evgeny.karpov@arm.com
Fri Apr 10 14:37:51 GMT 2026


On Fri, Apr 10, 2026, Jan Beulich wrote:
> Hmm, isn't it then a/the problem that make_head() doesn't consult the secdata
> variant in use at all? Shouldn't it emit an alignment directive in all cases
> (for 32-bit targets 4-byte alignment ought to also be needed)? And aren't
> other .idata$<N> (except .idata$7) having the same issue then? The 4-byte
> alignment presently looks to merely be an effect of gas / libbfd (for COFF)
> giving all sections at least that alignment (specifically
> COFF_DEFAULT_SECTION_ALIGNMENT_POWER, which some targets also set to less
> than 2).
> 
> Further .idata$4 looks to also want 8-byte alignment for PE32+, judging from
> the data that is being put there.

The main point here is that the first chunk in IAT should be aligned on AArch64
because of the relocation requirement for ldr.

The alignment for other architectures and other sections is optional.
It means the alignment is only required for the first chunk in IAT for AArch64
to resolve the relocation issues, and the rest is optional.
The change in make_head is sufficient.

v2 might stay as it is only for AArch64, or wider for PE32+.

Regards,
Evgeny


More information about the Binutils mailing list