[V2] GAS fix alignment for aarch64-pe

Message ID f659dfbb-b84b-af86-bd8c-d177900af779@linaro.org
State Unresolved
Headers
Series [V2] GAS fix alignment for aarch64-pe |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

Zac Walker Nov. 14, 2022, 5:24 p.m. UTC
  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(+)
  

Comments

Nick Clifton Nov. 15, 2022, 10:50 a.m. UTC | #1
Hi Zac,

> 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.

Patch approved - please apply.

Cheers
   Nick
  
Zac Walker Nov. 15, 2022, 11:23 a.m. UTC | #2
Thanks Nick.

On 11/15/22 11:50, Nick Clifton wrote:
> Hi Zac,
> 
>> 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.
> 
> Patch approved - please apply.
> 
> Cheers
>    Nick
>
  

Patch

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