[PATCH v2 1/1] Fix IAT (Import Address Table) alignment on AArch64
Jan Beulich
jbeulich@suse.com
Fri Apr 17 06:29:03 GMT 2026
On 15.04.2026 10:05, Evgeny Karpov wrote:
> --- a/binutils/dlltool.c
> +++ b/binutils/dlltool.c
> @@ -2735,6 +2735,12 @@ make_head (void)
> if (!no_idata5)
> {
> fprintf (f, "\t.section\t.idata$5\n");
> +
> + /* Align IAT (Import Address Table) to 8 bytes on AArch64.
> + https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#import-address-table. */
> + if (machine == MAARCH64)
> + fprintf (f, "\t.p2align 3\n");
Hmm, so we're back to square 1 as far as the actual code change is concerned.
Further, I don't see how the link is related here. As you said yourself in a
reply on the v1 thread, there's no talk of alignment there. Neither your text
nor what is said there really addresses what I asked for in [1].
I also continue to be unhappy about the adhoc, hard-coded 3 in here. As
indicated, imo the function would better consult secdata_plain[], with that
in turn getting edited suitably (either at runtime, or by splitting the
"align" field into a pair of fields, one for PE32 and the other for PE32+).
The tool as a whole really wants to be self-consistent.
Yet further, as also indicated already, I don't follow why .idata$4 wouldn't
need (or at least want) treating the same. It also contains 8-byte elements
in PE32+.
Finally you still leave make_delay_head() entirely alone, when - as
indicated before as well - it clearly has the same issue.
IOW - I, for one, am not going to approve the change in its present shape.
I could make a patch (or perhaps rather a pair of patches) myself along the
lines of the above, if need be.
Jan
[1] https://sourceware.org/pipermail/binutils/2026-April/148874.html
More information about the Binutils
mailing list