[PATCH 17/39] And defines to __attribute__ (__noclone__) iff compiler supports it.
H.J. Lu
hjl.tools@gmail.com
Sun Dec 22 20:42:59 GMT 2024
On Sun, Dec 22, 2024 at 1:23 PM Sam James <sam@gentoo.org> wrote:
>
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
> > On Sun, Dec 22, 2024 at 12:35 PM Sam James <sam@gentoo.org> wrote:
> >>
> >> "H.J. Lu" <hjl.tools@gmail.com> writes:
> >>
> >> > From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> >> >
> >> > Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> >> > ---
> >> > benchtests/bench-hash-funcs-kernel.h | 4 ++--
> >> > benchtests/bench-hash-funcs.c | 2 +-
> >> > benchtests/bench-strchr.c | 4 ++--
> >> > debug/tst-backtrace.h | 2 +-
> >> > debug/tst-ssp-1.c | 2 +-
> >> > elf/tst-p_alignmod-base.c | 2 +-
> >> > gmon/tst-gmon.c | 8 +++++---
> >> > gmon/tst-mcount-overflow.c | 10 ++++++----
> >> > malloc/tst-malloc-thread-exit.c | 2 +-
> >> > malloc/tst-malloc-thread-fail.c | 2 +-
> >> > malloc/tst-mallocstate.c | 2 +-
> >> > misc/sys/cdefs.h | 7 +++++++
> >> > misc/tst-syscalls.c | 14 ++++++-------
> >> > nptl/tst-minstack-throw.cc | 8 ++++----
> >> > nptl/tst-thread-exit-clobber.cc | 12 +++++------
> >> > nptl/tst-thread_local1.cc | 12 +++++------
> >> > stdlib/tst-makecontext-align.c | 20 +++++++++----------
> >> > stdlib/tst-quick_exit.cc | 2 +-
> >> > stdlib/tst-setcontext10.c | 6 +++---
> >> > stdlib/tst-setcontext11.c | 2 +-
> >> > stdlib/tst-setcontext5.c | 4 ++--
> >> > stdlib/tst-setcontext8.c | 2 +-
> >> > stdlib/tst-setcontext9.c | 2 +-
> >> > stdlib/tst-swapcontext1.c | 8 ++++----
> >> > stdlib/tst-swapcontext2.c | 8 ++++----
> >> > stdlib/tst-thread-quick_exit.cc | 2 +-
> >> > string/tst-xbzero-opt.c | 3 ++-
> >> > sysdeps/generic/tst-stack-align.h | 2 +-
> >> > .../sysv/linux/x86_64/tst-cet-property-2.c | 2 +-
> >> > .../sysv/linux/x86_64/tst-cet-setcontext-1.c | 2 +-
> >> > .../unix/sysv/linux/x86_64/tst-cet-vfork-1.c | 2 +-
> >> > .../sysv/linux/x86_64/tst-gnu2-tls2-amx.c | 2 +-
> >> > sysdeps/x86/tst-ldbl-nonnormal-printf.c | 2 +-
> >> > sysdeps/x86/tst-memchr-rtm.c | 4 ++--
> >> > sysdeps/x86/tst-memcmp-rtm.c | 4 ++--
> >> > sysdeps/x86/tst-memmove-rtm.c | 4 ++--
> >> > sysdeps/x86/tst-memrchr-rtm.c | 4 ++--
> >> > sysdeps/x86/tst-memset-rtm.c | 4 ++--
> >> > sysdeps/x86/tst-strchr-rtm.c | 4 ++--
> >> > sysdeps/x86/tst-strcmp-rtm.c | 4 ++--
> >> > sysdeps/x86/tst-strcpy-rtm.c | 4 ++--
> >> > sysdeps/x86/tst-strlen-rtm.c | 4 ++--
> >> > sysdeps/x86/tst-strncmp-rtm.c | 8 ++++----
> >> > sysdeps/x86/tst-strrchr-rtm.c | 4 ++--
> >> > sysdeps/x86_64/tst-rsi-strlen.c | 2 +-
> >> > 45 files changed, 113 insertions(+), 101 deletions(-)
> >>
> >> I'm suspicious of how many of these noinline+noclone uses should
> >> actually be noipa but I'd need to check which GCC version it was added
> >> to (maybe 7?) and it's not a blocker.
> >
> > Should
> >
> > __attribute__ ((optnone))
> >
> > be used for Clang instead?
>
> Yes, let's do that instead. It's better than trying to estimate what the
> equivalents are in Clang.
>
I will send out the v2 with
/* Prevents a function from being considered for inlining and cloning. */
#ifdef __clang__
# define __attribute_noinline_noclone__ __attribute__ ((optnone))
#else
# define __attribute_noinline_noclone__ __attribute__ ((noinline, noclone))
#endif
and replace every
__attribute__ ((noinline, noclone))
with
__attribute_noinline_noclone__
H.J.
More information about the Libc-alpha
mailing list