[uClibc] build error fix patch

Yoshinori Sato ysato at users.sourceforge.jp
Mon May 3 17:30:16 UTC 2004


- Use to flockfile/funlockfile with UCLIBC_HAS_THREADS=n.
- Use to __PUTC_UNLOCKED_MACRO with UCLIBC_HAS_STDIO_PUTC_MACRO.
- Use to __GETC_UNLOCKED_MACRO with UCLIBC_HAS_STDIO_GETC_MACRO.
- Refer to undefined macro "RETURN_ADDRESS" with MCOUNT in common machine-gmon.h.

Cannot build it by these problems normally.
Attach a patch to correct problems.

-- 
Yoshinori Sato
<ysato at users.sourceforge.jp>

diff -u -r1.1.1.4 -r1.5
Index: libc/misc/ttyent/getttyent.c
===================================================================
RCS file: /cvsroot/uclinux-h8/uClibc/libc/misc/ttyent/getttyent.c,v
retrieving revision 1.1.1.3
retrieving revision 1.1.1.3.2.1
diff -u -r1.1.1.3 -r1.1.1.3.2.1
--- libc/misc/ttyent/getttyent.c	14 Apr 2004 09:30:42 -0000	1.1.1.3
+++ libc/misc/ttyent/getttyent.c	3 May 2004 16:57:28 -0000	1.1.1.3.2.1
@@ -110,11 +110,15 @@
 		    abort();
     }
 
+#ifdef UCLIBC_HAS_THREADS
     flockfile (tf);
+#endif
 
     for (;;) {
 	if (!fgets_unlocked(p = line, sizeof(line), tf)) {
+#ifdef UCLIBC_HAS_THREADS
 	    funlockfile (tf);
+#endif
 	    return (NULL);
 	}
 	/* skip lines that are too big */
@@ -159,7 +163,9 @@
 	    break;
     }
     /* We can release the lock only here since `zapchar' is global.  */
+#ifdef UCLIBC_HAS_THREADS
     funlockfile(tf);
+#endif
 
     if (zapchar == '#' || *p == '#')
 	while ((c = *++p) == ' ' || c == '\t')
Index: libc/stdio/getchar.c
===================================================================
RCS file: /cvsroot/uclinux-h8/uClibc/libc/stdio/getchar.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- libc/stdio/getchar.c	14 Apr 2004 09:30:43 -0000	1.1.1.1
+++ libc/stdio/getchar.c	3 May 2004 16:57:13 -0000	1.1.1.1.2.1
@@ -21,7 +21,11 @@
 {
 	register FILE *stream = stdin;
 
+#ifdef UCLIBC_HAS_STDIO_GETC_MACRO
 	return __GETC_UNLOCKED_MACRO(stream);
+#else
+	return __GETC_UNLOCKED(stream);
+#endif
 }
 
 #elif defined __UCLIBC_HAS_THREADS__
Index: libc/stdio/putchar.c
===================================================================
RCS file: /cvsroot/uclinux-h8/uClibc/libc/stdio/putchar.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- libc/stdio/putchar.c	14 Apr 2004 09:30:43 -0000	1.1.1.1
+++ libc/stdio/putchar.c	3 May 2004 16:57:13 -0000	1.1.1.1.2.1
@@ -21,7 +21,11 @@
 {
 	register FILE *stream = stdout;
 
+#ifdef UCLIBC_HAS_STDIO_PUTC_MACRO
 	return __PUTC_UNLOCKED_MACRO(c, stream);
+#else
+	return __PUTC_UNLOCKED(c, stream);
+#endif
 }
 
 #elif defined __UCLIBC_HAS_THREADS__
Index: libc/sysdeps/linux/common/bits/machine-gmon.h
===================================================================
RCS file: /cvsroot/uclinux-h8/uClibc/libc/sysdeps/linux/common/bits/machine-gmon.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- libc/sysdeps/linux/common/bits/machine-gmon.h	14 Apr 2004 09:30:46 -0000	1.1.1.1
+++ libc/sysdeps/linux/common/bits/machine-gmon.h	3 May 2004 16:58:17 -0000	1.1.1.1.2.1
@@ -47,6 +47,10 @@
 #define _MCOUNT_DECL(frompc, selfpc) \
 static inline void mcount_internal (u_long frompc, u_long selfpc)
 
+#ifndef RETURN_ADDRESS
+#define RETURN_ADDRESS(n) __builtin_return_address(n)
+#endif
+
 #define MCOUNT \
 void _mcount (void)							      \
 {									      \



More information about the uClibc mailing list