summaryrefslogtreecommitdiff
path: root/extra/gcc-uClibc/gcc-uClibc.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-03-03 20:58:42 +0000
committerEric Andersen <andersen@codepoet.org>2003-03-03 20:58:42 +0000
commit67eff66438688fddebe41f77fd252a3b2b135271 (patch)
tree18dbee3e9afe50d27095140198e2aa34df1de061 /extra/gcc-uClibc/gcc-uClibc.c
parent2229d0fa131387b9b8ad16ac88347350a080aeb5 (diff)
Initial effort at adding profiling support.
Diffstat (limited to 'extra/gcc-uClibc/gcc-uClibc.c')
-rw-r--r--extra/gcc-uClibc/gcc-uClibc.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/extra/gcc-uClibc/gcc-uClibc.c b/extra/gcc-uClibc/gcc-uClibc.c
index 8cb8a8f3c..5b002b9d2 100644
--- a/extra/gcc-uClibc/gcc-uClibc.c
+++ b/extra/gcc-uClibc/gcc-uClibc.c
@@ -149,6 +149,10 @@ int main(int argc, char **argv)
int ctor_dtor = 1, cplusplus = 0, use_nostdinc_plus = 0;
char *GPLUSPLUS_BIN = NULL;
#endif
+#ifdef __UCLIBC_PROFILING__
+ int profile = 0;
+ char *gcrt1_path[2];
+#endif
application_name = basename(argv[0]);
if (application_name[0] == '-')
@@ -208,6 +212,10 @@ int main(int argc, char **argv)
xstrcat(&(crt0_path[0]), devprefix, "/lib/crt0.o", NULL);
xstrcat(&(crt0_path[1]), builddir, "/lib/crt0.o", NULL);
#endif
+#ifdef __UCLIBC_PROFILING__
+ xstrcat(&(gcrt1_path[0]), devprefix, "/lib/gcrt1.o", NULL);
+ xstrcat(&(gcrt1_path[1]), builddir, "/lib/gcrt1.o", NULL);
+#endif
xstrcat(&(our_lib_path[0]), "-L", devprefix, "/lib", NULL);
xstrcat(&(our_lib_path[1]), "-L", builddir, "/lib", NULL);
@@ -312,13 +320,25 @@ int main(int argc, char **argv)
}
}
break;
+#ifdef __UCLIBC_PROFILING__
+ case 'p':
+ if (strcmp("-pg",argv[i]) == 0) {
+ profile = 1;
+ }
+ break;
+#endif
case 'f':
/* Check if we are doing PIC */
if (strcmp("-fPIC",argv[i]) == 0) {
use_pic = 1;
} else if (strcmp("-fpic",argv[i]) == 0) {
use_pic = 1;
+ }
+#ifdef __UCLIBC_PROFILING__
+ else if (strcmp("-fprofile-arcs",argv[i]) == 0) {
+ profile = 1;
}
+#endif
break;
case '-':
@@ -420,6 +440,11 @@ int main(int argc, char **argv)
if (linking && source_count) {
+#ifdef __UCLIBC_PROFILING__
+ if (profile) {
+ gcc_argv[i++] = gcrt1_path[use_build_dir];
+ }
+#endif
#ifdef __UCLIBC_CTOR_DTOR__
if (ctor_dtor) {
gcc_argv[i++] = crti_path[use_build_dir];
@@ -431,7 +456,12 @@ int main(int argc, char **argv)
}
#endif
if (use_start) {
- gcc_argv[i++] = crt0_path[use_build_dir];
+#ifdef __UCLIBC_PROFILING__
+ if (!profile)
+#endif
+ {
+ gcc_argv[i++] = crt0_path[use_build_dir];
+ }
}
for ( l = 0 ; l < k ; l++ ) {
if (gcc_argument[l]) gcc_argv[i++] = gcc_argument[l];