Since mcount_internal is called from mcount/__fentry__ which preserve
only RAX, RCX, RDX, RSI, RDI, R8 and R9, compile mcount.c with
-fno-tree-loop-distribute-patterns -mgeneral-regs-only -mno-apxf
to void vector/r16-r31 registers and memcpy/memset in mcount_internal.
This fixes BZ #33134.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
endif
endif
-# The mcount code won't work without a frame pointer.
-CFLAGS-mcount.c := -fno-omit-frame-pointer
+# The mcount code won't work without a frame pointer nor when memcpy or
+# memset are called.
+CFLAGS-mcount.c := -fno-omit-frame-pointer -fno-tree-loop-distribute-patterns
CFLAGS-tst-gmon.c := -fno-omit-frame-pointer -pg
tst-gmon-no-pie = yes
$(objpfx)tst-tls23-mod.so: $(libsupport)
endif
+ifeq ($(subdir),gmon)
+CFLAGS-mcount.c += -mgeneral-regs-only
+endif
+
ifeq ($(subdir),math)
tests += \
tst-ldbl-nonnormal-printf \
# recursive calls when ENTRY is used. Just copy the normal static
# object.
sysdep_noprof += _mcount
+
+ifeq (yes,$(have-x86-apx))
+CFLAGS-mcount.c += -mno-apxf
+endif
endif
ifeq ($(subdir),string)