diff --git a/Makefile.target b/Makefile.target index e8256c0316019b8a9b69276723ba321a3a1ce04d..031ab456ec6b2b80410fc61752c3656c7e163b64 100644 --- a/Makefile.target +++ b/Makefile.target @@ -397,6 +397,12 @@ LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld endif endif +# profiling code +ifdef TARGET_GPROF +LDFLAGS+=-p +CFLAGS+=-p +endif + OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \ elfload.o linuxload.o uaccess.o LIBS+= $(AIOLIBS) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 07652cf163a6acf7b30452c1908f48d4ee5cfb9e..b5cf84cf6e949e33b03e47b0872c6613e2ea31b3 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -54,6 +54,9 @@ #include #include #include +#ifdef HAVE_GPROF +#include +#endif #define termios host_termios #define winsize host_winsize @@ -4864,6 +4867,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #ifdef __NR_exit_group /* new thread calls */ case TARGET_NR_exit_group: +#ifdef HAVE_GPROF + _mcleanup(); +#endif gdb_exit(cpu_env, arg1); ret = get_errno(exit_group(arg1)); break;