public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Zac Walker <zac.walker@linaro.org>
To: binutils@sourceware.org
Subject: [PATCH V2] GAS fix alignment for aarch64-pe
Date: Mon, 14 Nov 2022 18:24:23 +0100	[thread overview]
Message-ID: <f659dfbb-b84b-af86-bd8c-d177900af779@linaro.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 933 bytes --]

For the aarch64-pe target various values of '.align' causes writing of COFF files to fail.

This version of the patch differs from the first by using the write.c implementation of SUB_SEGMENT_ALIGN. This means there was no need to modify md_section_align or aarch64_handle_align. The change is specific to the aarch64-pe target.

In my testing generated aligned code was correctly padded with nop.

Thanks,

Zac


---
  gas/config/tc-aarch64.h | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h
index 2d514ff610..0ea73021f2 100644
--- a/gas/config/tc-aarch64.h
+++ b/gas/config/tc-aarch64.h
@@ -191,7 +191,10 @@ struct aarch64_frag_type
        goto LABEL;								\
      }

+/* COFF sub section alignment calculated using the write.c implementation.  */
+#ifndef OBJ_COFF
  #define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0
+#endif

  #define DWARF2_LINE_MIN_INSN_LENGTH 	4

-- 
2.25.1

[-- Attachment #2: 0001-GAS-fix-alignment-for-aarch64-pe.patch --]
[-- Type: text/x-diff, Size: 719 bytes --]

From 392e919f35ad790b21185ab1ce387bb0694cddd9 Mon Sep 17 00:00:00 2001
From: Zac Walker <zac.walker@linaro.org>
Date: Mon, 14 Nov 2022 17:48:58 +0100
Subject: [PATCH] GAS fix alignment for aarch64-pe

---
 gas/config/tc-aarch64.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h
index 2d514ff610..0ea73021f2 100644
--- a/gas/config/tc-aarch64.h
+++ b/gas/config/tc-aarch64.h
@@ -191,7 +191,10 @@ struct aarch64_frag_type
       goto LABEL;								\
     }
 
+/* COFF sub section alignment calculated using the write.c implementation.  */
+#ifndef OBJ_COFF
 #define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0
+#endif
 
 #define DWARF2_LINE_MIN_INSN_LENGTH 	4
 
-- 
2.25.1


             reply	other threads:[~2022-11-14 17:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 17:24 Zac Walker [this message]
2022-11-15 10:50 ` Nick Clifton
2022-11-15 11:23   ` Zac Walker
2022-11-15 21:53     ` aarch64-pe can't fill 16 bytes in section .text Alan Modra
2022-11-16 17:03       ` Zac Walker
2022-11-17  3:01         ` Alan Modra
2022-11-18  8:52           ` zac.walker
2022-11-18  9:08             ` Jan Beulich
2022-11-18  9:35               ` zac.walker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f659dfbb-b84b-af86-bd8c-d177900af779@linaro.org \
    --to=zac.walker@linaro.org \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).