https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122516
--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #8)
> (In reply to Andrew Pinski from comment #7)
> > (In reply to Andrew Pinski from comment #6)
> > > . I dont understand the commit messages either.
> >
> > Plus we should fix call___do_global_dtors_aux generation.
>
> Since that is an invalid use of inline-asm.
Ok, I finally figured out where this inline-asm is coming from `crtstuff.c`:
```
#ifndef CRT_CALL_STATIC_FUNCTION
# define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
static void __attribute__((__used__)) \
call_ ## FUNC (void) \
{ \
asm (SECTION_OP); \
FUNC (); \
FORCE_CODE_SECTION_ALIGN \
asm (__LIBGCC_TEXT_SECTION_ASM_OP__); \
}
#endif
```
So part of the broken-ness here is the use of __LIBGCC_TEXT_SECTION_ASM_OP__ .
For most targets ".previous" will fix it by going back into the correct
section. The only thing is how can we detect if ".previous" is ok for here and
then it is ok with defining SUPPORTS_SHF_GNU_RETAIN in GCC's check.