https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122516

--- Comment #12 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #11)
> 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.

.previous is supported since Binutils 2.12, which was released in 2002

https://sourceware.org/binutils/docs-2.12/as.info/Previous.html

So maybe HAVE_GNU_AS && HAVE_GNU_LD && TARGET_ASM_NAMED_SECTION is a reasonable
proxy?  Or rolling own test, similar to
gcc/configure.ac::HAVE_GAS_SUBSECTION_ORDERING.

Reply via email to