Open isanbard opened 2 years ago
@llvm/issue-subscribers-clang-frontend
cc @phoebewang
I googled but didn't find any information other that GCC document. Do we have any special requirment for it?
This was implemented in GCC here:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=45e140193876fab3bfb57779738d49ddc13fe9ed
Thanks @isanbard , my question was are there any projects using these options, so that we can evaluate whether we should implement it or simply ignore it.
The Linux kernel is using it for some backends I believe. This is part of an attempt to get Clang even with GCC with regards to flags used by Linux.
I only see -mfunction-return
being used in arch/s390/Makefile.
Initial support has landed. Small fixups:
cc @uweigand @JonPsson for SystemZ support for the kernel. It might be worth a chat with your kernel team whether they really need (or prefer) CONFIG_EXPOLINE=y CONFIG_EXPOLINE_EXTERN=n
(ie.-mfunction-return=thunk
)? I doubt it, and will keep the impl simple to just support CONFIG_EXPOLINE=y CONFIG_EXPOLINE_EXTERN=y
(ie. -mfunction-return=thunk-extern
).
cc @uweigand @JonPsson for SystemZ support for the kernel. It might be worth a chat with your kernel team whether they really need (or prefer)
CONFIG_EXPOLINE=y CONFIG_EXPOLINE_EXTERN=n
(ie.-mfunction-return=thunk
)? I doubt it, and will keep the impl simple to just supportCONFIG_EXPOLINE=y CONFIG_EXPOLINE_EXTERN=y
(ie.-mfunction-return=thunk-extern
).
Hi @nickdesaulniers, I talked to the kernel team, and they say CONFIG_EXPOLINE_EXTERN=y
(i.e. -mfunction-return=thunk-extern
) is always preferable, and sometimes even required (e.g. to support kpatch). The only reason it is not on by default is that it triggered a bug in some older GCC versions.
Therefore, I agree that if we're thinking about implementing expoline support in LLVM, support for olny -mfunction-return=thunk-extern
would be fine.
GCC supports a
function_return("choice")
function attribute (https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html). This might be something clang should support.