[Bug target/91306] [MSP430] libgcc/crtstuff.c: Alignment of frame_dummy .init_array entry is too big
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91306 Andrew Pinski changed: What|Removed |Added Target||MSP430 CC||pinskia at gcc dot gnu.org Component|libgcc |target --- Comment #1 from Andrew Pinski --- .ctors will have the same issue. My patch was just copying what was already for .ctors IIRC. This patch has been there for over 8 years now so it is interesting people are only seeing this issue now.
[Bug target/91306] [MSP430] libgcc/crtstuff.c: Alignment of frame_dummy .init_array entry is too big
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91306 --- Comment #2 from Andrew Pinski --- Also the patch is still needed. Try with one than one entry and you will see the issue. The patch is not to workaround a GCC bug but rather enforce a smaller alignment than what GCC decides to use. >but the expected alignment of a pointer is 2 bytes. If that is true, then maybe alignof should be used instead of sizeof. Can you try alignof (__alignof__)?
[Bug target/91306] [MSP430] libgcc/crtstuff.c: Alignment of frame_dummy .init_array entry is too big
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91306 --- Comment #3 from Jozef Lawrynowicz --- (In reply to Andrew Pinski from comment #2) > If that is true, then maybe alignof should be used instead of sizeof. > Can you try alignof (__alignof__)? Thanks, __alignof__ works for me. Below change fixed the issue for msp430-elf/-mlarge: > diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c > index 4927a9f8977..bd5c93c194e 100644 > --- a/libgcc/crtstuff.c > +++ b/libgcc/crtstuff.c > @@ -474,7 +474,7 @@ frame_dummy (void) > CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__, frame_dummy) > #else /* defined(__LIBGCC_INIT_SECTION_ASM_OP__) */ > static func_ptr __frame_dummy_init_array_entry[] > - __attribute__ ((__used__, section(".init_array"), > aligned(sizeof(func_ptr > + __attribute__ ((__used__, section(".init_array"), > aligned(__alignof__(func_ptr >= { frame_dummy }; > #endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */ > #endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */ The other structures using "aligned(sizeof(func_ptr))" are unused for msp430, so they aren't causing problems, but alignof does seem like a better keyword to use for those if it works for the other targets as well.
[Bug target/91306] [MSP430] libgcc/crtstuff.c: Alignment of frame_dummy .init_array entry is too big
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91306 --- Comment #4 from Jozef Lawrynowicz --- Should I submit a patch which changes uses of sizeof in alignment attributes to __alignof__? Or are you working on it?
[Bug target/91306] [MSP430] libgcc/crtstuff.c: Alignment of frame_dummy .init_array entry is too big
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91306 --- Comment #5 from jozefl at gcc dot gnu.org --- Author: jozefl Date: Fri Aug 23 09:21:26 2019 New Revision: 274846 URL: https://gcc.gnu.org/viewcvs?rev=274846&root=gcc&view=rev Log: 2019-08-23 Jozef Lawrynowicz PR target/91306 * crtstuff.c (__CTOR_LIST__): Align to the "__alignof__" the array element type, instead of "sizeof" the element type. (__DTOR_LIST__): Likewise. (__TMC_LIST__): Likewise. (__do_global_dtors_aux_fini_array_entry): Likewise. (__frame_dummy_init_array_entry): Likewise. (__CTOR_END__): Likewise. (__DTOR_END__): Likweise. (__FRAME_END__): Likewise. (__TMC_END__): Likewise. Modified: trunk/libgcc/ChangeLog trunk/libgcc/crtstuff.c
[Bug target/91306] [MSP430] libgcc/crtstuff.c: Alignment of frame_dummy .init_array entry is too big
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91306 Jozef Lawrynowicz changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #6 from Jozef Lawrynowicz --- Fixed on trunk.