svn commit: trunk/uClibc: libc/misc/wchar test utils

vda at uclibc.org vda at uclibc.org
Wed Jan 28 01:04:50 UTC 2009


Author: vda
Date: 2009-01-28 01:04:49 +0000 (Wed, 28 Jan 2009)
New Revision: 25083

Log:
"make utils" now successfully makes utils for target



Modified:
   trunk/uClibc/Makefile.in
   trunk/uClibc/Makerules
   trunk/uClibc/Rules.mak
   trunk/uClibc/libc/misc/wchar/wchar.c
   trunk/uClibc/test/Rules.mak
   trunk/uClibc/utils/Makefile.in
   trunk/uClibc/utils/ldconfig.c


Changeset:
Modified: trunk/uClibc/Makefile.in
===================================================================
--- trunk/uClibc/Makefile.in	2009-01-27 18:54:41 UTC (rev 25082)
+++ trunk/uClibc/Makefile.in	2009-01-28 01:04:49 UTC (rev 25083)
@@ -178,14 +178,14 @@
 	fi
 
 $(LOCAL_INSTALL_PATH):
-	$(Q)$(MAKE) PREFIX=$(shell pwd)/ RUNTIME_PREFIX=./ \
-	DEVEL_PREFIX=$(LOCAL_INSTALL_PATH)/usr/ \
+	$(Q)$(MAKE) PREFIX=$(shell pwd)/$(LOCAL_INSTALL_PATH) RUNTIME_PREFIX=/ \
+	DEVEL_PREFIX=/usr/ \
 	HOSTCC="$(HOSTCC)" \
 	install_kernel_headers
-	$(Q)$(MAKE) PREFIX=$(shell pwd)/ RUNTIME_PREFIX=./ \
-	DEVEL_PREFIX=$(LOCAL_INSTALL_PATH)/usr/ \
+	$(Q)$(MAKE) PREFIX=$(shell pwd)/$(LOCAL_INSTALL_PATH) RUNTIME_PREFIX=/ \
+	DEVEL_PREFIX=/usr/ \
 	HOSTCC="$(HOSTCC)" \
-	install_dev
+	install
 
 install: install_runtime install_dev
 

Modified: trunk/uClibc/Makerules
===================================================================
--- trunk/uClibc/Makerules	2009-01-27 18:54:41 UTC (rev 25082)
+++ trunk/uClibc/Makerules	2009-01-28 01:04:49 UTC (rev 25083)
@@ -190,7 +190,9 @@
 	$(CFLAGS_gen.dep)
 cmd_compile.i = $(cmd_compile.c:-c=-E -dD $(EXTRA_CPPFLAGS))
 cmd_compile.s = $(cmd_compile.c:-c=-S)
-cmd_compile.u = $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@)) $(CFLAGS_gen.dep)
+#vda
+###_compile.u = $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@)) $(CFLAGS_gen.dep)
+cmd_compile.u = $(CC) $^ $(DEPS-$(notdir $@)) -o $@           $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@)) $(CFLAGS_gen.dep)
 cmd_compile.S = $(filter-out -std=gnu99, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
 cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
 cmd_compile.mi= $(cmd_compile.m:-c=-E -dD $(EXTRA_CPPFLAGS))

Modified: trunk/uClibc/Rules.mak
===================================================================
--- trunk/uClibc/Rules.mak	2009-01-27 18:54:41 UTC (rev 25082)
+++ trunk/uClibc/Rules.mak	2009-01-28 01:04:49 UTC (rev 25083)
@@ -5,6 +5,17 @@
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
 
+# make nano-doc
+# FOO = bar  -- recursively expanded variable. Value is remebered verbatim.
+#               If it contains references to other variables, these references
+#               are expanded whenever this variable is _substituted_.
+# FOO := bar -- simply expanded variable. Right hand is expanded when
+#               the variable is _defined_. Therefore faster than =.
+# FOO ?= bar -- set a value only if it is not already set
+#               (behaves as =, not :=).
+# FOO += bar -- append; if FOO is not defined, acts like = (not :=).
+
+
 # check for proper make version
 ifneq ($(findstring x3.7,x$(MAKE_VERSION)),)
 $(error Your make is too old $(MAKE_VERSION). Go get at least 3.80)
@@ -66,6 +77,7 @@
 # mortals.  Unless you hang out with the gods, you should
 # probably leave all this stuff alone.
 
+
 # Pull in the user's uClibc configuration
 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
 -include $(top_builddir).config
@@ -148,7 +160,9 @@
 
 ARFLAGS:=cr
 
+
 # Flags in OPTIMIZATION are used only for non-debug builds
+
 OPTIMIZATION:=
 # Use '-Os' optimization if available, else use -O2, allow Config to override
 OPTIMIZATION+=$(call check_gcc,-Os,-O2)
@@ -168,6 +182,37 @@
 OPTIMIZATION+=$(call check_gcc,-fno-strength-reduce,)
 endif
 
+
+# CPU_CFLAGS-y contain options which are not warnings,
+# not include or library paths, and not optimizations.
+
+# Why -funsigned-char: I hunted a bug related to incorrect
+# sign extension of 'char' type for 10 hours straight. Not fun.
+CPU_CFLAGS-y := -funsigned-char -fno-builtin
+
+CPU_CFLAGS-y += $(call check_gcc,-fno-asm,)
+
+LDADD_LIBFLOAT=
+ifeq ($(UCLIBC_HAS_SOFT_FLOAT),y)
+# If -msoft-float isn't supported, we want an error anyway.
+# Hmm... might need to revisit this for arm since it has 2 different
+# soft float encodings.
+ifneq ($(TARGET_ARCH),nios)
+ifneq ($(TARGET_ARCH),nios2)
+ifneq ($(TARGET_ARCH),sh)
+CPU_CFLAGS-y += -msoft-float
+endif
+endif
+endif
+ifeq ($(TARGET_ARCH),arm)
+# No longer needed with current toolchains, but leave it here for now.
+# If anyone is actually still using gcc 2.95 (say), they can uncomment it.
+#    LDADD_LIBFLOAT=-lfloat
+endif
+endif
+
+CPU_CFLAGS-y += $(call check_gcc,-std=gnu99,)
+
 CPU_CFLAGS-$(UCLIBC_FORMAT_SHARED_FLAT) += -mid-shared-library
 CPU_CFLAGS-$(UCLIBC_FORMAT_FLAT_SEP_DATA) += -msep-data
 
@@ -468,9 +513,11 @@
 XWARNINGS+=-Wnested-externs -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wformat=2
 XWARNINGS+=-Wmissing-prototypes -Wmissing-declarations
 XWARNINGS+=-Wnonnull -Wundef
-# works only w/ gcc-3.4 and up, can't be checked for gcc-3.x w/ check_gcc()
+# Works only w/ gcc-3.4 and up, can't be checked for gcc-3.x w/ check_gcc()
 #XWARNINGS+=-Wdeclaration-after-statement
 endif
+# Seems to be unused (no ARCH_CFLAGS anywhere), delete?
+# if yes, remove after 0.9.31
 XARCH_CFLAGS=$(subst ",, $(strip $(ARCH_CFLAGS)))
 CPU_CFLAGS=$(subst ",, $(strip $(CPU_CFLAGS-y)))
 
@@ -484,41 +531,18 @@
 endif
 
 NOSTDLIB_CFLAGS:=$(call check_gcc,-nostdlib,)
-# Some nice CFLAGS to work with
-# Why -funsigned-char: I hunted a bug related to incorrect
-# sign extension of 'char' type for 10 hours straight. Not fun.
+
+# Collect all CFLAGS components
 CFLAGS := -include $(top_builddir)include/libc-symbols.h \
 	$(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) \
-	-funsigned-char -fno-builtin -nostdinc -I$(top_builddir)include -I. \
+	-nostdinc -I$(top_builddir)include -I. \
 	-I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)
-
-# Make sure that we can be built with non-C99 compilers, too.
-# Use __\1__ instead.
-CFLAGS += $(call check_gcc,-fno-asm,)
 ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"")
 CFLAGS += $(subst ",, $(UCLIBC_EXTRA_CFLAGS))
 endif
 
-LDADD_LIBFLOAT=
-ifeq ($(UCLIBC_HAS_SOFT_FLOAT),y)
-# If -msoft-float isn't supported, we want an error anyway.
-# Hmm... might need to revisit this for arm since it has 2 different
-# soft float encodings.
-ifneq ($(TARGET_ARCH),nios)
-ifneq ($(TARGET_ARCH),nios2)
-ifneq ($(TARGET_ARCH),sh)
-CFLAGS += -msoft-float
-endif
-endif
-endif
-ifeq ($(TARGET_ARCH),arm)
-# No longer needed with current toolchains, but leave it here for now.
-# If anyone is actually still using gcc 2.95 (say), they can uncomment it.
-#    LDADD_LIBFLOAT=-lfloat
-endif
-endif
-
 # Please let us see private headers' parts
+# Deprecated: _LIBC serves the same purpose
 CFLAGS += -DUCLIBC_INTERNAL
 
 # We need this to be checked within libc-symbols.h
@@ -526,8 +550,6 @@
 CFLAGS += -DSTATIC
 endif
 
-CFLAGS += $(call check_gcc,-std=gnu99,)
-
 LDFLAGS_NOSTRIP:=$(CPU_LDFLAGS-y) -Wl,-shared \
 	-Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc
 # binutils-2.16.1 warns about ignored sections, 2.16.91.0.3 and newer are ok
@@ -638,8 +660,9 @@
 CFLAGS += -I$(KERNEL_HEADERS)
 
 #CFLAGS += -iwithprefix include-fixed -iwithprefix include
-CC_IPREFIX:=$(shell $(CC) --print-file-name=include)
-CFLAGS += -I$(dir $(CC_IPREFIX))/include-fixed -I$(CC_IPREFIX)
+CC_IPREFIX := $(shell $(CC) --print-file-name=include)
+CC_INC := -I$(dir $(CC_IPREFIX))include-fixed -I$(CC_IPREFIX)
+CFLAGS += $(CC_INC)
 
 ifneq ($(DOASSERTS),y)
 CFLAGS+=-DNDEBUG

Modified: trunk/uClibc/libc/misc/wchar/wchar.c
===================================================================
--- trunk/uClibc/libc/misc/wchar/wchar.c	2009-01-27 18:54:41 UTC (rev 25082)
+++ trunk/uClibc/libc/misc/wchar/wchar.c	2009-01-28 01:04:49 UTC (rev 25083)
@@ -1660,7 +1660,7 @@
 
 	if (opts[5]) {				/* -l */
 		fprintf(stderr, "Recognized codesets:\n");
-		for (s = __iconv_codesets ; *s ; s += *s) {
+		for (s = (char *)__iconv_codesets ; *s ; s += *s) {
 			fprintf(stderr,"  %s\n", s+2);
 		}
 		s = __LOCALE_DATA_CODESET_LIST;

Modified: trunk/uClibc/test/Rules.mak
===================================================================
--- trunk/uClibc/test/Rules.mak	2009-01-27 18:54:41 UTC (rev 25082)
+++ trunk/uClibc/test/Rules.mak	2009-01-28 01:04:49 UTC (rev 25083)
@@ -82,8 +82,9 @@
 XCOMMON_CFLAGS := -D_GNU_SOURCE -I$(top_builddir)test
 CFLAGS         := $(XWARNINGS) $(OPTIMIZATION) $(XCOMMON_CFLAGS) $(XARCH_CFLAGS) -nostdinc -I$(top_builddir)$(LOCAL_INSTALL_PATH)/usr/include
 
-CC_IPREFIX:=$(shell $(CC) --print-file-name=include)
-CFLAGS += -I$(dir $(CC_IPREFIX))/include-fixed -I$(CC_IPREFIX)
+CC_IPREFIX := $(shell $(CC) --print-file-name=include)
+CC_INC := -I$(dir $(CC_IPREFIX))include-fixed -I$(CC_IPREFIX)
+CFLAGS += $(CC_INC)
 
 HOST_CFLAGS    += $(XWARNINGS) $(OPTIMIZATION) $(XCOMMON_CFLAGS)
 

Modified: trunk/uClibc/utils/Makefile.in
===================================================================
--- trunk/uClibc/utils/Makefile.in	2009-01-27 18:54:41 UTC (rev 25082)
+++ trunk/uClibc/utils/Makefile.in	2009-01-28 01:04:49 UTC (rev 25083)
@@ -4,11 +4,12 @@
 #
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-
 # "make utils" flags
 
-CFLAGS-utils := -DNOT_IN_libc $(SSP_ALL_CFLAGS) \
-    -B$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib
+# ldconfig,ldd,readelf had also:
+# -Wl,-rpath,/lib
+# -Wl,--dynamic-linker,/lib/ld-uClibc.so.0
+# -Wl,--hash-style=gnu
 
 ifeq ($(UCLIBC_BUILD_PIE),y)
 CFLAGS-utils-shared := $(PIEFLAG) $(LDPIEFLAG)
@@ -16,25 +17,62 @@
 CFLAGS-utils-shared :=
 endif
 
-CFLAGS-ldconfig := -I$(top_srcdir)ldso/include \
-    -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=$(UCLIBC_LDSO)
+CFLAGS-ldconfig := \
+    -I$(top_srcdir)ldso/include \
+    -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
+    -DUCLIBC_LDSO=$(UCLIBC_LDSO)
 ifeq ($(UCLIBC_STATIC_LDCONFIG),y)
 CFLAGS-ldconfig += -static
 else
-CFLAGS-ldconfig += $(CFLAGS-utils-shared)
+CFLAGS-ldconfig += \
+    $(CFLAGS-utils-shared) \
+    -Wl,-rpath-link,$(top_builddir)lib
 endif
+# Can't just pull in $(CFLAGS), there are bad include paths.
+# We want to use "sanitized" headers in LOCAL_INSTALL_PATH.
+CFLAGS-ldconfig += \
+    $(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) $(OPTIMIZATION) \
+    -nostdinc \
+    -I $(top_builddir)/$(LOCAL_INSTALL_PATH)/usr/include \
+    $(CC_INC) \
+    -B$(top_builddir)lib \
 
-CFLAGS-ldd := -I$(top_srcdir)ldso/include \
+CFLAGS-ldd := \
+    $(CFLAGS-utils-shared) \
+    $(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) $(OPTIMIZATION) \
     -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
-    $(CFLAGS-utils-shared)
+    -nostdinc \
+    -I$(top_srcdir)ldso/include \
+    -I$(top_builddir)/$(LOCAL_INSTALL_PATH)/usr/include \
+    $(CC_INC) \
+    -B$(top_builddir)lib \
+    -Wl,-rpath-link,$(top_builddir)lib \
 
-CFLAGS-readelf := $(CFLAGS-utils-shared)
+CFLAGS-readelf := \
+    $(CFLAGS-utils-shared) \
+    $(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) $(OPTIMIZATION) \
+    -nostdinc \
+    -I $(top_builddir)/$(LOCAL_INSTALL_PATH)/usr/include \
+    $(CC_INC) \
+    -B$(top_builddir)lib \
+    -Wl,-rpath-link,$(top_builddir)lib \
 
-# Need CFLAGS-utils explicitly, because the source file is not located in utils
-CFLAGS-iconv := $(CFLAGS-utils) $(CFLAGS-utils-shared) -DL_iconv_main
-CFLAGS-locale := $(CFLAGS-utils)
+# iconv and locale use non-sanitized headers by just pulling in $(CFLAGS)
+CFLAGS-iconv := \
+    $(CFLAGS) $(CFLAGS-utils-shared) \
+    -DNOT_IN_libc \
+    -DL_iconv_main \
+    -I$(top_srcdir)/$(KERNEL_HEADERS) \
+    -B$(top_builddir)lib \
+    -Wl,-rpath-link,$(top_builddir)lib \
 
+CFLAGS-locale := \
+    $(CFLAGS) $(CFLAGS-utils-shared) \
+    -DNOT_IN_libc \
+    -B$(top_builddir)lib \
+    -Wl,-rpath-link,$(top_builddir)lib \
 
+
 # "make hostutils" flags
 
 ifeq ($(LDSO_CACHE_SUPPORT),y)
@@ -44,13 +82,15 @@
 BUILD_CFLAGS-ldconfig.host := -Wl,-s \
     -include $(top_srcdir)include/elf.h \
     -I$(top_srcdir)ldso/include \
-    -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
+    -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
+    -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
     $(LDSO_CACHE_SUPPORT) \
 
 BUILD_CFLAGS-ldd.host := -Wl,-s \
     -include $(top_srcdir)include/elf.h \
     -I$(top_srcdir)ldso/include \
-    -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
+    -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
+    -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
     $(LDSO_CACHE_SUPPORT) \
 
 BUILD_CFLAGS-readelf.host := -Wl,-s \
@@ -70,8 +110,8 @@
 utils_OBJ += ldconfig ldd
 endif
 
-utils_ICONV_OBJ =
-utils_LOCALE_OBJ =
+utils_ICONV_OBJ :=
+utils_LOCALE_OBJ :=
 ifeq ($(UCLIBC_HAS_LOCALE),y)
 utils_ICONV_OBJ := $(utils_OUT)/iconv
 utils_LOCALE_OBJ := $(utils_OUT)/locale
@@ -94,6 +134,14 @@
 $(utils_OUT)/locale: $(top_srcdir)extra/locale/programs/locale.c | $(libc)
 	$(compile.u)
 
+# Instruct make to install uclibc locally before buiding target utils
+$(utils_OBJ): | $(top_builddir)/$(LOCAL_INSTALL_PATH)
+$(utils_OUT)/iconv: | $(top_builddir)/$(LOCAL_INSTALL_PATH)
+$(utils_OUT)/locale: | $(top_builddir)/$(LOCAL_INSTALL_PATH)
+
+$(top_builddir)/$(LOCAL_INSTALL_PATH):
+	$(Q)$(MAKE) -C $(top_builddir) $(LOCAL_INSTALL_PATH)
+
 hostutils: $(hostutils_OBJ)
 
 $(hostutils_OBJ): $(utils_OUT)/%.host : $(utils_DIR)/%.c

Modified: trunk/uClibc/utils/ldconfig.c
===================================================================
--- trunk/uClibc/utils/ldconfig.c	2009-01-27 18:54:41 UTC (rev 25082)
+++ trunk/uClibc/utils/ldconfig.c	2009-01-28 01:04:49 UTC (rev 25083)
@@ -278,12 +278,12 @@
 				if (fread(&exec, sizeof exec, 1, file) < 1)
 					warnx("can't read header from %s, skipping", buff);
 				else if (N_MAGIC(exec) != ZMAGIC
-					 && N_MAGIC(exec) != QMAGIC
-					 && N_MAGIC_SWAP(exec) != ZMAGIC
-					 && N_MAGIC_SWAP(exec) != QMAGIC) {
+				 && N_MAGIC(exec) != QMAGIC
+				 && N_MAGIC_SWAP(exec) != ZMAGIC
+				 && N_MAGIC_SWAP(exec) != QMAGIC) {
 					elf_hdr = (ElfW(Ehdr) *) & exec;
 					if (elf_hdr->e_ident[0] != 0x7f ||
-					    strncmp(elf_hdr->e_ident+1, "ELF", 3) != 0)
+					    strncmp((char *)elf_hdr->e_ident + 1, "ELF", 3) != 0)
 					{
 						/* silently ignore linker scripts */
 						if (strncmp((char *)&exec, "/* GNU ld", 9) != 0)



More information about the uClibc-cvs mailing list