public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libgcc: Align __EH_FRAME_BEGIN__ to pointer size
@ 2022-01-18 17:09 H.J. Lu
  2022-06-01 21:11 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2022-01-18 17:09 UTC (permalink / raw)
  To: gcc-patches

Aligne __EH_FRAME_BEGIN__ to pointer size since gcc/unwind-dw2-fde.h has

/* The first few fields of a CIE.  The CIE_id field is 0 for a CIE,
   to distinguish it from a valid FDE.  FDEs are aligned to an addressing
   unit boundary, but the fields within are unaligned.  */
struct dwarf_cie
{
  uword length;
  sword CIE_id;
  ubyte version;
  unsigned char augmentation[];
} __attribute__ ((packed, aligned (__alignof__ (void *))));

/* The first few fields of an FDE.  */
struct dwarf_fde
{
  uword length;
  sword CIE_delta;
  unsigned char pc_begin[];
} __attribute__ ((packed, aligned (__alignof__ (void *))));

which indicates that CIE/FDE should be aligned at the pointer size.

	PR libgcc/27576
	* crtstuff.c (__EH_FRAME_BEGIN__): Aligned to pointer size.
---
 libgcc/crtstuff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c
index b98b86a5a88..b0d0062ad5b 100644
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -261,7 +261,8 @@ STATIC func_ptr __DTOR_LIST__[1]
 /* Stick a label at the beginning of the frame unwind info so we can register
    and deregister it with the exception handling library code.  */
 STATIC EH_FRAME_SECTION_CONST char __EH_FRAME_BEGIN__[]
-     __attribute__((section(__LIBGCC_EH_FRAME_SECTION_NAME__), aligned(4)))
+     __attribute__((section(__LIBGCC_EH_FRAME_SECTION_NAME__),
+		    aligned(__alignof__ (void *))))
      = { };
 #endif /* USE_EH_FRAME_REGISTRY */
 
-- 
2.34.1


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

* Re: [PATCH] libgcc: Align __EH_FRAME_BEGIN__ to pointer size
  2022-01-18 17:09 [PATCH] libgcc: Align __EH_FRAME_BEGIN__ to pointer size H.J. Lu
@ 2022-06-01 21:11 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2022-06-01 21:11 UTC (permalink / raw)
  To: gcc-patches



On 1/18/2022 10:09 AM, H.J. Lu via Gcc-patches wrote:
> Aligne __EH_FRAME_BEGIN__ to pointer size since gcc/unwind-dw2-fde.h has
>
> /* The first few fields of a CIE.  The CIE_id field is 0 for a CIE,
>     to distinguish it from a valid FDE.  FDEs are aligned to an addressing
>     unit boundary, but the fields within are unaligned.  */
> struct dwarf_cie
> {
>    uword length;
>    sword CIE_id;
>    ubyte version;
>    unsigned char augmentation[];
> } __attribute__ ((packed, aligned (__alignof__ (void *))));
>
> /* The first few fields of an FDE.  */
> struct dwarf_fde
> {
>    uword length;
>    sword CIE_delta;
>    unsigned char pc_begin[];
> } __attribute__ ((packed, aligned (__alignof__ (void *))));
>
> which indicates that CIE/FDE should be aligned at the pointer size.
>
> 	PR libgcc/27576
> 	* crtstuff.c (__EH_FRAME_BEGIN__): Aligned to pointer size.
OK.  Though it's unclear how important this is in practice.

jeff


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

end of thread, other threads:[~2022-06-01 21:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18 17:09 [PATCH] libgcc: Align __EH_FRAME_BEGIN__ to pointer size H.J. Lu
2022-06-01 21:11 ` Jeff Law

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