[uClibc-cvs] uClibc/libc/sysdeps/linux/i386 mcount.S,NONE,1.1 Makefile,1.54,1.55 crt0.S,1.18,1.19
Erik Andersen
andersen at codepoet.org
Mon Mar 3 20:58:52 UTC 2003
Update of /var/cvs/uClibc/libc/sysdeps/linux/i386
In directory winder:/tmp/cvs-serv13798/libc/sysdeps/linux/i386
Modified Files:
Makefile crt0.S
Added Files:
mcount.S
Log Message:
Initial effort at adding profiling support.
--- NEW FILE: mcount.S ---
/* i386-specific implemetation of profiling support.
Copyright (C) 1997, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper at cygnus.com>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* We need a special version of the `mcount' function since for ix86 it
must not clobber any register. This has several reasons:
- there is a bug in gcc as of version 2.7.2.2 which prohibits the
use of profiling together with nested functions
- the ELF `fixup' function uses GCC's regparm feature
- some (future) systems might want to pass parameters in registers. */
.globl _mcount
.type _mcount, at function;
.align 1<<4
_mcount:
/* Save the caller-clobbered registers. */
pushl %eax
pushl %ecx
pushl %edx
movl 12(%esp), %edx
movl 4(%ebp), %eax
/* No need to access the PLT or GOT, __mcount_internal is an
internal function and we can make a relative call. */
call __mcount_internal
/* Pop the saved registers. Please note that `mcount' has no
return value. */
popl %edx
popl %ecx
popl %eax
ret
.size _mcount,.-_mcount;
#undef mcount
.weak mcount ; mcount = _mcount
Index: Makefile
===================================================================
RCS file: /var/cvs/uClibc/libc/sysdeps/linux/i386/Makefile,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- Makefile 23 Jan 2003 17:55:21 -0000 1.54
+++ Makefile 3 Mar 2003 20:58:14 -0000 1.55
@@ -21,10 +21,14 @@
ASFLAGS=$(CFLAGS)
CRT0_SRC = crt0.S
-CRT0_OBJ = crt0.o crt1.o
+CRT0_OBJ = crt0.o crt1.o gcrt1.o
+CRT0_DEPS=gmon-start.S
SSRC=__longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S \
bsd-_setjmp.S syscall.S
+ifeq ($(strip $(UCLIBC_PROFILING)),y)
+SSRC+=mcount.S
+endif
SOBJS=$(patsubst %.S,%.o, $(SSRC))
CSRC=brk.c sigaction.c
@@ -52,6 +56,13 @@
$(COBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
+
+ifeq ($(strip $(UCLIBC_PROFILING)),y)
+SAFECFLAGS := $(subst -g,,$(CFLAGS))
+gmon-start.S: ../common/gmon-start.c
+ $(CC) $(SAFECFLAGS) -c $< -S -o $*.S
+gcrt1.o: $(CRT0_DEPS)
+endif
headers:
Index: crt0.S
===================================================================
RCS file: /var/cvs/uClibc/libc/sysdeps/linux/i386/crt0.S,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- crt0.S 23 Jan 2003 17:55:21 -0000 1.18
+++ crt0.S 3 Mar 2003 20:58:14 -0000 1.19
@@ -74,7 +74,7 @@
pushl %ebp /* callers %ebp (frame pointer) */
movl %esp,%ebp /* mark callers stack frame as invalid */
-#if defined L_crt1 && defined __UCLIBC_CTOR_DTOR__
+#if (defined L_crt1 || defined L_gcrt1 ) && defined __UCLIBC_CTOR_DTOR__
/* Push .init and .fini arguments to __uClibc_start_main() on the stack */
pushl $_fini
pushl $_init
@@ -98,4 +98,9 @@
/* Crash if somehow `exit' returns anyways. */
hlt
.size _start,.-_start
+
+
+#if defined L_gcrt1
+# include "./gmon-start.S"
+#endif
More information about the uClibc-cvs
mailing list