소스 검색

Fix up breakage resulting from flipping the sense of some defines. Change from
defining things to "0" in the disabled case to outright undefining them, lest
code that does an "#ifdef FOO" get inadvertantly triggered. Remove now
unneeded lines from Rules.mak which makes the command line smaller and avoids
redundancy (since this stuff is now pulled in via features.h).
-Erik

Eric Andersen 25 년 전
부모
커밋
e2f6ebd3f2
7개의 변경된 파일38개의 추가작업 그리고 40개의 파일을 삭제
  1. 17 4
      Makefile
  2. 0 17
      Rules.mak
  3. 1 1
      include/stdlib.h
  4. 3 3
      include/unistd.h
  5. 4 3
      libc/stdlib/malloc-simple/alloc.c
  6. 10 9
      libc/stdlib/malloc/malloc.c
  7. 3 3
      libc/sysdeps/linux/common/syscalls.c

+ 17 - 4
Makefile

@@ -150,23 +150,36 @@ uClibc_config.h: Config
 	@if [ "$(HAS_MMU)" = "true" ] ; then \
 	    echo "#define __UCLIBC_HAS_MMU__ 1" >> uClibc_config.h ; \
 	else \
-	    echo "#define __UCLIBC_HAS_MMU__ 0" >> uClibc_config.h ; \
+	    echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
 	fi
 	@if [ "$(HAS_FLOATS)" = "true" ] ; then \
 	    echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
 	else \
-	    echo "#define __UCLIBC_HAS_FLOATS__ 0" >> uClibc_config.h ; \
+	    echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
 	fi
 	@if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
 	    echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
 	else \
-	    echo "#define __UCLIBC_HAS_LONG_LONG__ 0" >> uClibc_config.h ; \
+	    echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
 	fi
 	@if [ "$(HAS_LOCALE)" = "true" ] ; then \
 	    echo "#define __UCLIBC_HAS_LOCALE__ 1" >> uClibc_config.h ; \
 	    echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> uClibc_config.h ; \
 	else \
-	    echo "#define __UCLIBC_HAS_LOCALE__ 0" >> uClibc_config.h ; \
+	    echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
+	fi
+	@if [ "$(TARGET_ARCH)" = "m68k" ] ; then \
+	    echo "#define __VFORK_MACRO__ 1" >> uClibc_config.h ; \
+	    echo "#define const" >> uClibc_config.h ; \
+	    echo "#define __const" >> uClibc_config.h ; \
+	    echo "#define __extension" >> uClibc_config.h ; \
+	else \
+	    echo "#undef __VFORK_MACRO__" >> uClibc_config.h ; \
+	fi
+	@if [ "$(TARGET_ARCH)" = "sh" ] ; then \
+	    echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
+	else \
+	    echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
 	fi
 
 .PHONY: dummy

+ 0 - 17
Rules.mak

@@ -51,23 +51,6 @@ ifndef $(PREFIX)
     PREFIX = `pwd`/_install
 endif
 
-ifneq ($(strip $(HAS_MMU)),true)
-    CFLAGS += -D__HAS_NO_MMU__
-endif
-
-ifneq ($(strip $(HAS_FLOATS)),true)
-    CFLAGS += -D__HAS_NO_FLOATS__
-endif
-
-ifeq ($(strip $(TARGET_ARCH)),m68k)
-    CFLAGS += -D__VFORK_MACRO__ -Dconst= -D__const= -D__extension__= 
-endif
-
-
-ifeq ($(strip $(TARGET_ARCH)),sh)
-    CFLAGS +=  -DNO_UNDERSCORES
-endif
-
 NATIVE_ARCH = $(shell uname -m | sed -e 's/i.86/i386/' -e 's/sparc.*/sparc/' -e 's/arm.*/arm/g' -e 's/m68k.*/m68k/')
 
 # It turns out the currently, function-sections causes ldelf2flt to segfault.

+ 1 - 1
include/stdlib.h

@@ -48,7 +48,7 @@ extern long strtol __P ((const char * nptr, char ** endptr, int base));
 extern unsigned long strtoul __P ((const char * nptr, char ** endptr, int base));
 extern long long strtoll __P ((const char * nptr, char ** endptr, int base));
 extern unsigned long long strtoull __P ((const char * nptr, char ** endptr, int base));
-#ifndef __HAS_NO_FLOATS__
+#ifdef __UCLIBC_HAS_FLOATS__
 /*TODO: extern char * gcvt __P ((double number, size_t ndigit, char * buf)); */
 extern double strtod __P ((const char * nptr, char ** endptr));
 #endif

+ 3 - 3
include/unistd.h

@@ -646,10 +646,10 @@ extern int setegid __P ((__gid_t __gid));
 /* Clone the calling process, creating an exact copy.
    Return -1 for errors, 0 to the new process,
    and the process ID of the new process to the old process.  */
-#ifdef __HAS_NO_MMU__
-#define fork fork_not_available_on_mmuless_systems
-#else
+#ifdef __UCLIBC_HAS_MMU__
 extern __pid_t fork __P ((void));
+#else
+#define fork fork_not_available_on_mmuless_systems
 #endif
 
 #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED

+ 4 - 3
libc/stdlib/malloc-simple/alloc.c

@@ -1,3 +1,4 @@
+#include <features.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -67,10 +68,10 @@ void *calloc(size_t num, size_t size)
 void *malloc(size_t len)
 {
 	void *result = mmap((void *) 0, len, PROT_READ | PROT_WRITE,
-#ifdef __HAS_NO_MMU__
-						MAP_SHARED | MAP_ANONYMOUS, 0, 0
-#else
+#ifdef __UCLIBC_HAS_MMU__
 						MAP_PRIVATE | MAP_ANONYMOUS, 0, 0
+#else
+						MAP_SHARED | MAP_ANONYMOUS, 0, 0
 #endif
 						    );
 

+ 10 - 9
libc/stdlib/malloc/malloc.c

@@ -55,6 +55,7 @@
 
 #define _POSIX_SOURCE
 #define _XOPEN_SOURCE
+#include <features.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <limits.h>
@@ -177,10 +178,10 @@ void *__hunk_alloc(int size)
 			(p =
 			 (Hunk_t *) mmap(HUNK_MSTART, HUNK_MSIZE,
 							 PROT_READ | PROT_WRITE,
-#ifdef __HAS_NO_MMU__
-							 MAP_SHARED | MAP_ANONYMOUS
-#else
+#ifdef __UCLIBC_HAS_MMU__
 							 MAP_PRIVATE | MAP_ANONYMOUS
+#else
+							 MAP_SHARED | MAP_ANONYMOUS
 #endif
 							 , 0, 0)) == (Hunk_t *) MAP_FAILED)
 		  // {
@@ -483,10 +484,10 @@ static Block_t *bl_mapnew(size_t size)
 
 	map_size = PAGE_ALIGN(size);
 	pt = mmap(LARGE_MSTART, map_size, PROT_READ | PROT_WRITE | PROT_EXEC,
-#ifdef __HAS_NO_MMU__
-							 MAP_SHARED | MAP_ANONYMOUS
-#else
+#ifdef __UCLIBC_HAS_MMU__
 							 MAP_PRIVATE | MAP_ANONYMOUS
+#else
+							 MAP_SHARED | MAP_ANONYMOUS
 #endif
 							 , 0, 0);
 
@@ -511,10 +512,10 @@ void __bl_uncommit(Block_t * b)
 
 #if M_DOTRIMMING
 	mmap(u_start, u_end - u_start, PROT_READ | PROT_WRITE | PROT_EXEC,
-#ifdef __HAS_NO_MMU__
-							 MAP_SHARED | MAP_ANONYMOUS |MAP_FIXED
-#else
+#ifdef __UCLIBC_HAS_MMU__
 							 MAP_PRIVATE | MAP_ANONYMOUS |MAP_FIXED
+#else
+							 MAP_SHARED | MAP_ANONYMOUS |MAP_FIXED
 #endif
 							 , 0, 0);
 #endif

+ 3 - 3
libc/sysdeps/linux/common/syscalls.c

@@ -38,7 +38,7 @@ _syscall1(void, _exit, int, status);
 
 //#define __NR_fork             2
 #ifdef L_fork
-#ifndef __HAS_NO_MMU__
+#ifdef __UCLIBC_HAS_MMU__
 #include <unistd.h>
 _syscall0(pid_t, fork);
 #endif
@@ -683,7 +683,7 @@ _syscall2(int, statfs, const char *, path, struct statfs *, buf);
 _syscall2(int, fstatfs, int, fd, struct statfs *, buf);
 #endif
 
-#ifndef __HAS_NO_MMU__
+#ifdef __UCLIBC_HAS_MMU__
 //#define __NR_ioperm           101
 #ifdef L_ioperm
 #include <sys/io.h>
@@ -802,7 +802,7 @@ int fstat(int filedes, struct libc_stat *buf)
 
 //#define __NR_olduname         109
 
-#ifndef __HAS_NO_MMU__
+#ifdef __UCLIBC_HAS_MMU__
 //#define __NR_iopl             110
 #ifdef L_iopl
 #include <sys/io.h>