public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gas: update csect alignment for PPC prefixed instructions on XCOFF
@ 2021-06-22 11:19 CHIGOT, CLEMENT
  2021-06-23  1:11 ` Alan Modra
  0 siblings, 1 reply; 5+ messages in thread
From: CHIGOT, CLEMENT @ 2021-06-22 11:19 UTC (permalink / raw)
  To: binutils

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

Power10 prefixed instructions must not cross 64-byte boundaries.
This is already handled.
However, on XCOFF, the csect must be updated to match the new
alignment.

gas/ChangeLog:
2021-06-22  Clément Chigot  <clement.chigot@atos.net>

        * config/tc-ppc.c (md_assemble): Update ppc_current_csect
        alignment when finding prefixed instructions.




[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gas-update-csect-alignment-for-PPC-prefixed-instruct.patch --]
[-- Type: text/x-patch; name="0001-gas-update-csect-alignment-for-PPC-prefixed-instruct.patch", Size: 1324 bytes --]

From d4b4c74e9794dfc77d62f39ca16b6f8d1076c7c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= <clement.chigot@atos.net>
Date: Tue, 22 Jun 2021 10:15:06 +0200
Subject: [PATCH] gas: update csect alignment for PPC prefixed instructions on
 XCOFF
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Power10 prefixed instructions must not cross 64-byte boundaries.
This is already handled.
However, on XCOFF, the csect must be updated to match the new
alignment.

gas/ChangeLog:
2021-06-22  Clément Chigot  <clement.chigot@atos.net>

	* config/tc-ppc.c (md_assemble): Update ppc_current_csect
	alignment when finding prefixed instructions.
---
 gas/config/tc-ppc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index ad85d3863b0..1f49db34659 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -4039,6 +4039,10 @@ md_assemble (char *str)
 	 boundaries.  */
       frag_align_code (6, 4);
       record_alignment (now_seg, 6);
+#ifdef OBJ_XCOFF
+      /* Update alignment of the containing csect.  */
+      symbol_get_tc (ppc_current_csect)->align = 6;
+#endif
 
       /* Update "dot" in any expressions used by this instruction, and
 	 a label attached to the instruction.  By "attached" we mean
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH] gas: update csect alignment for PPC prefixed instructions on XCOFF
@ 2021-06-23 17:00 David Edelsohn
  0 siblings, 0 replies; 5+ messages in thread
From: David Edelsohn @ 2021-06-23 17:00 UTC (permalink / raw)
  To: CHIGOT, CLEMENT; +Cc: Binutils Development

>>> +++ b/gas/config/tc-ppc.c
>>> @@ -4039,6 +4039,10 @@ md_assemble (char *str)
>>>         boundaries.  */
>>>        frag_align_code (6, 4);
>>>        record_alignment (now_seg, 6);
>>> +#ifdef OBJ_XCOFF
>>> +      /* Update alignment of the containing csect.  */
>>> +      symbol_get_tc (ppc_current_csect)->align = 6;
>>> +#endif
>>
>> Is there a possibility that this might decrease alignment?  If so, you
>> should write:
>>
>>     if (symbol_get_tc (ppc_current_csect)->align < 6)
>>        symbol_get_tc (ppc_current_csect)->align = 6;
>
> Any value can be passed for the alignment of csect. Thus, it might be
> possible but I doubt it will ever happen.
> Anyway I've updated the patch.

IBM XLC aligns code CSECTs to cache line boundary (128 bytes).  I plan
to update GCC similarly, so the patch does need to ensure that it is
not reducing the alignment of the code CSECT.

Thanks, David

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-24  1:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 11:19 [PATCH] gas: update csect alignment for PPC prefixed instructions on XCOFF CHIGOT, CLEMENT
2021-06-23  1:11 ` Alan Modra
2021-06-23  6:49   ` CHIGOT, CLEMENT
2021-06-24  1:23     ` Alan Modra
2021-06-23 17:00 David Edelsohn

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