]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgcc: Align __EH_FRAME_BEGIN__ to pointer size
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 18 Jan 2022 00:18:56 +0000 (16:18 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 1 Jun 2022 22:19:59 +0000 (15:19 -0700)
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

index b98b86a5a88b342aa8663abe3935bae97ffc5348..b0d0062ad5b97d7a09c6769ed6c82268b8f18337 100644 (file)
@@ -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 */