Index: Makefile.target =================================================================== --- Makefile.target (revision 5545) +++ Makefile.target (working copy) @@ -394,6 +394,12 @@ 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) Index: linux-user/syscall.c =================================================================== --- linux-user/syscall.c (revision 5566) +++ linux-user/syscall.c (working copy) @@ -54,6 +54,9 @@ #include #include #include +#ifdef HAVE_GPROF +#include +#endif #define termios host_termios #define winsize host_winsize @@ -4864,6 +4867,9 @@ #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;