Browse Source

Merge branch '1.0' of git+ssh://uclibc-ng.org/git/uclibc-ng into 1.0

Waldemar Brodkorb 10 years ago
parent
commit
dd64f5afc1

+ 7 - 5
Makefile.in

@@ -13,7 +13,7 @@ sub_headers := headers
 
 ifeq ($(HAVE_DOT_CONFIG),y)
 
-all: pregen libs
+all: pregen libs startfiles
 libs: pregen
 
 # In this section, we need .config
@@ -57,8 +57,9 @@ ifeq ($(HAVE_DOT_CONFIG),y)
 $(top_builddir)include/bits/uClibc_config.h: $(conf) $(KCONFIG_CONFIG) $(top_srcdir)extra/scripts/conf-header.sh | $(top_builddir)include/bits
 	@$(disp_gen)
 	$(Q)$< -s $(Kconfig)
-	$(Q)$(top_srcdir)extra/scripts/conf-header.sh $(KCONFIG_CONFIG) > $@
+	$(Q)$(top_srcdir)extra/scripts/conf-header.sh $(KCONFIG_CONFIG) > $@.tmp
 	$(Q)$(MAKE) headers-y
+	$(Q)mv $@.tmp $@
 
 # The above doesn't work for threads, though. Just using check-symlinks for now.
 # XXX: FIXME: this is ugly
@@ -183,7 +184,10 @@ headers-y += $(target-headers-sysdep)
 
 headers: $(top_builddir)include/bits/uClibc_config.h | subdirs
 subdirs: $(addprefix $(top_builddir),$(subdirs))
-pregen-headers: $(top_builddir)include/bits/sysnum.h $(pregen-headers-y)
+
+$(pregen-headers-y): $(headers_dep)
+
+pregen-headers: $(pregen-headers-y)
 pregen: headers pregen-headers
 	$(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers)
 
@@ -215,8 +219,6 @@ install: install_runtime install_dev
 
 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)$(MULTILIB_DIR) $(RUNTIME_PREFIX)$(MULTILIB_DIR))
 
-startfiles: $(crt-y)
-
 $(top_builddir)extra/scripts/unifdef: |$(top_builddir)extra/scripts
 $(top_builddir)extra/scripts/unifdef: $(top_srcdir)extra/scripts/unifdef.c
 	$(hcompile.u)

+ 9 - 8
Makerules

@@ -22,9 +22,9 @@ ifeq ($(UCLIBC_FORMAT_SHARED_FLAT),y)
 libs: $(lib-gdb-y)
 endif
 libs: $(lib-a-y)
-$(lib-a-y): | $(top_builddir)lib
 endif
 objs: all_objs
+$(lib-so-y) $(lib-a-y): | $(top_builddir)lib
 
 # apply unconditional per-directory flags
 define add_IS_IN_lib
@@ -451,18 +451,18 @@ CFLAGS-initfini.s := -S -g0 $(PICFLAG) -fno-inline-functions -finhibit-size-dire
 $(top_builddir)lib/initfini.s: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/initfini.c | $(top_builddir)lib
 	$(compile.c)
 
-$(top_builddir)lib/defs.h: $(top_builddir)lib/initfini.s | $(top_builddir)lib
-	$(Q)sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
-		gawk -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
+$(top_builddir)lib/defs.h: $(top_builddir)lib/initfini.s
+	$(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
+		$(AWK) -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
 	$(Q)mv $@.tmp $@
 
 $(top_builddir)lib/crti.S: $(top_builddir)lib/initfini.s $(top_builddir)lib/defs.h
-	$(Q)sed -n -e '1,/@HEADER_ENDS/p' \
+	$(do_sed) -n -e '1,/@HEADER_ENDS/p' \
 		-e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
 		-e '/@TRAILER_BEGINS/,$$p' $< > $@
 
 $(top_builddir)lib/crtn.S: $(top_builddir)lib/initfini.s
-	$(Q)sed -n -e '1,/@HEADER_ENDS/p' \
+	$(do_sed) -n -e '1,/@HEADER_ENDS/p' \
 		-e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
 		-e '/@TRAILER_BEGINS/,$$p' $< > $@
 
@@ -482,9 +482,10 @@ CRTS_COMPAT :=
 #endif
 
 startfiles = $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC)
-$(crt-y): $(startfiles)
+startfiles: $(startfiles)
 $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC): | headers
-$(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC) $(LINK_FLAT_CRTS) $(SHARED_START_FILES) $(SHARED_END_FILES) : | $(top_builddir)lib
+$(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC) \
+	$(LINK_FLAT_CRTS) $(SHARED_START_FILES) $(SHARED_END_FILES): | $(top_builddir)lib
 
 $(top_builddir)lib/$(NONSHARED_LIBNAME): $(libc-nonshared-y)
 	$(Q)$(RM) $@

+ 2 - 1
Rules.mak

@@ -165,7 +165,8 @@ libpthread.depend := $(top_builddir)lib/libpthread.so
 endif
 interp := $(top_builddir)lib/interp.os
 ldso := $(top_builddir)lib/$(UCLIBC_LDSO)
-headers_dep := $(top_builddir)include/bits/sysnum.h
+headers_dep := $(top_builddir)include/bits/sysnum.h \
+	$(top_builddir)include/bits/uClibc_config.h
 sub_headers := $(headers_dep)
 
 #LIBS :=$(interp) -L$(top_builddir)lib -lc

+ 1 - 1
ldso/include/dl-syscall.h

@@ -51,7 +51,7 @@ extern int _dl_errno;
 static __always_inline attribute_noreturn __cold void _dl_exit(int status)
 {
 	INLINE_SYSCALL(_dl_exit, 1, status);
-#if defined __GNUC__
+#if defined __GNUC__ && !__GNUC_PREREQ (4, 4)
 	__builtin_unreachable(); /* shut up warning: 'noreturn' function does return*/
 #else
 	while (1);

+ 1 - 3
ldso/ldso/Makefile.in

@@ -31,9 +31,6 @@ CFLAGS-ldso.c := -DLDSO_ELFINTERP=\"$(TARGET_ARCH)/elfinterp.c\"
 ifeq ($(TARGET_ARCH),xtensa)
 CFLAGS-ldso.c += -fno-delete-null-pointer-checks
 endif
-ifeq ($(TARGET_ARCH),sh)
-CFLAGS-ldso.c += -fno-delete-null-pointer-checks
-endif
 
 LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-$(UCLIBC_LDSO_NAME).so := -Wl,--dsbt-index=1
 ifneq ($(SUPPORT_LD_DEBUG),y)
@@ -76,6 +73,7 @@ LDFLAGS-$(UCLIBC_LDSO_NAME).so += -T $(ldso:.$(ABI_VERSION)=).lds
 endif
 
 $(ldso): $(ldso:.$(ABI_VERSION)=)
+$(ldso:.$(ABI_VERSION)=): | $(top_builddir)lib
 $(ldso:.$(ABI_VERSION)=): $($(UCLIBC_LDSO_NAME)_OUT)/$(UCLIBC_LDSO_NAME)_so.a
 ifeq ($(LDSO_PRELINK_SUPPORT),y)
 	$(call create-lds)

+ 1 - 2
libc/Makefile.in

@@ -87,8 +87,7 @@ $(libc_OUT)/libc.oS: $(libc-multi-y) | $(top_builddir)lib/libc.a $(top_builddir)
 	$(Q)$(RM) $@
 	$(compile-m)
 
-$(top_builddir)lib/libc.a: $(libc-a-y) | $(crt-y)
-	$(Q)$(INSTALL) -d $(dir $@)
+$(top_builddir)lib/libc.a: $(libc-a-y)
 	$(Q)$(RM) $@
 	$(do_ar)
 

+ 11 - 2
libc/inet/ifaddrs.c

@@ -115,7 +115,8 @@ __netlink_request (struct netlink_handle *h, int type)
 {
   struct netlink_res *nlm_next;
   struct netlink_res **new_nlm_list;
-  static volatile size_t buf_size = 4096;
+  static volatile size_t buf_size = 0;
+  size_t this_buf_size;
   char *buf;
   struct sockaddr_nl nladdr;
   struct nlmsghdr *nlmh;
@@ -126,7 +127,15 @@ __netlink_request (struct netlink_handle *h, int type)
   if (__netlink_sendreq (h, type) < 0)
     return -1;
 
-  size_t this_buf_size = buf_size;
+  if (buf_size)
+	  this_buf_size = buf_size;
+  else {
+#ifdef PAGE_SIZE
+	  this_buf_size = PAGE_SIZE;
+#else
+	  this_buf_size = __pagesize;
+#endif
+  }
   if (__libc_use_alloca (this_buf_size))
     buf = alloca (this_buf_size);
   else

+ 1 - 1
libc/stdlib/malloc/realloc.c

@@ -30,7 +30,7 @@ realloc (void *mem, size_t new_size)
   if (! new_size)
     {
       free (mem);
-      return malloc (new_size);
+      return NULL;
     }
   if (! mem)
     return malloc (new_size);

+ 7 - 11
libc/sysdeps/linux/Makefile.commonarch

@@ -15,7 +15,6 @@ ARCH_SOBJ = $(patsubst %.s,%.o,$(patsubst %.S,%.o,$(addprefix $(ARCH_OUT)/,$(SSR
 
 ARCH_OBJS-y = $(ARCH_COBJ) $(ARCH_SOBJ)
 
-crt-y          := FORCE
 libc-y         += $(ARCH_OBJS-y)
 libc-nomulti-y += $(ARCH_SOBJ)
 objclean-y     += CLEAN_$(subst $(top_builddir),,$(ARCH_OUT))
@@ -47,16 +46,13 @@ HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)):
 	$(do_rm) $(ARCH_HEADERS_OUT)
 endif
 
-CFLAGS-ucontext_i.c = -S
-
-$(ARCH_OUT)/ucontext_i.c: $(ARCH_DIR)/ucontext_i.sym
-	$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-
-$(ARCH_OUT)/ucontext_i.s: $(ARCH_OUT)/ucontext_i.c
-	$(compile.c)
-
-$(ARCH_OUT)/ucontext_i.h: $(ARCH_OUT)/ucontext_i.s
-	$(do_sed) $(PTHREAD_GENERATE_MANGLE) $< > $@
+$(ARCH_OUT)/ucontext_i.h: $(top_srcdir)extra/scripts/gen-as-const.awk
+$(ARCH_OUT)/ucontext_i.h: $(ARCH_OUT)/ucontext_i.sym
+	@$(disp_gen)
+	$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< \
+	| $(CC) $(CFLAGS) -x c - -S -o - \
+	| $(SED) $(PTHREAD_GENERATE_MANGLE) > $@
+	@if test ! -s $@ ; then rm -f $@ ; false ; fi
 
 pregen-headers-$(UCLIBC_HAS_CONTEXT_FUNCS) += $(ARCH_OUT)/ucontext_i.h
 

+ 1 - 1
libpthread/nptl/Makefile.in

@@ -92,7 +92,7 @@ $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
 	$(Q)$(RM) $@
 	$(do_ar)
 
-$(libpthread_OUT)/pthread-errnos.h: $(top_srcdir)extra/scripts/gen-as-const.awk | headers
+$(libpthread_OUT)/pthread-errnos.h: $(top_srcdir)extra/scripts/gen-as-const.awk
 $(libpthread_OUT)/pthread-errnos.h: $(libpthread_DIR)/pthread-errnos.sym
 	@$(disp_gen)
 	$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< \

+ 1 - 1
libpthread/nptl/sysdeps/Makefile.commonarch

@@ -40,7 +40,7 @@ librt_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(librt_arch_CSRC))
 librt_arch_SOBJ = $(patsubst %.S,$(libpthread_arch_OUT)/%.o,$(librt_arch_SSRC))
 librt_arch_OBJS = $(librt_arch_COBJ) $(librt_arch_SOBJ)
 
-$(libpthread_arch_OUT)/tcb-offsets.h: $(top_srcdir)extra/scripts/gen-as-const.awk | headers
+$(libpthread_arch_OUT)/tcb-offsets.h: $(top_srcdir)extra/scripts/gen-as-const.awk
 $(libpthread_arch_OUT)/tcb-offsets.h: $(libpthread_arch_DIR)/tcb-offsets.sym
 	@$(disp_gen)
 	$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< \

+ 1 - 1
libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch

@@ -137,7 +137,7 @@ endif
 PTHREAD_LINUX_SYM   := $(notdir $(wildcard $(libpthread_linux_DIR)/*.sym))
 PTHREAD_LINUX_SYM_H := $(addprefix $(libpthread_linux_OUT)/,$(PTHREAD_LINUX_SYM:.sym=.h))
 
-$(PTHREAD_LINUX_SYM_H): $(top_srcdir)extra/scripts/gen-as-const.awk | headers
+$(PTHREAD_LINUX_SYM_H): $(top_srcdir)extra/scripts/gen-as-const.awk
 $(PTHREAD_LINUX_SYM_H): $(libpthread_linux_OUT)/%.h: $(libpthread_linux_DIR)/%.sym
 	@$(disp_gen)
 	$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< \

+ 1 - 1
librt/Makefile.in

@@ -76,7 +76,7 @@ $(librt_OUT)/librt_so.a: $(librt-so-y)
 	$(Q)$(RM) $@
 	$(do_ar)
 
-$(top_builddir)lib/librt.a: $(librt-a-y) | $(top_builddir)lib
+$(top_builddir)lib/librt.a: $(librt-a-y)
 	$(Q)$(RM) $@
 	$(do_ar)
 

+ 2 - 1
test/inet/Makefile.in

@@ -3,7 +3,7 @@
 #
 ifeq ($(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),)
 TESTS_DISABLED := bug-if1 gethost_r-align gethostid if_nameindex tst-aton \
-	tst-network tst-ntoa
+	tst-network tst-ntoa test-ifaddrs
 endif
 
 ifeq ($(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),)
@@ -18,3 +18,4 @@ endif
 
 CFLAGS_bug-if1 = -fPIC
 CFLAGS_tst-sock-nonblock = -fPIC
+CFLAGS_tst-ifaddrs = -fPIC

+ 99 - 0
test/inet/tst-ifaddrs.c

@@ -0,0 +1,99 @@
+/* Test listing of network interface addresses.
+   Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ifaddrs.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+static int failures;
+
+static const char *
+addr_string (struct sockaddr *sa, char *buf, size_t size)
+{
+  if (sa == NULL)
+    return "<none>";
+
+  switch (sa->sa_family)
+    {
+    case AF_INET:
+      return inet_ntop (AF_INET, &((struct sockaddr_in *) sa)->sin_addr,
+			buf, size);
+    case AF_INET6:
+      return inet_ntop (AF_INET6, &((struct sockaddr_in6 *) sa)->sin6_addr,
+			buf, size);
+#ifdef AF_LINK
+    case AF_LINK:
+      return "<link>";
+#endif
+    case AF_UNSPEC:
+      return "---";
+
+#ifdef AF_PACKET
+    case AF_PACKET:
+      return "<packet>";
+#endif
+
+    default:
+      ++failures;
+      printf ("sa_family=%d %08x\n", sa->sa_family,
+	      *(int*)&((struct sockaddr_in *) sa)->sin_addr.s_addr);
+      return "<unexpected sockaddr family>";
+    }
+}
+
+
+static int
+do_test (void)
+{
+  struct ifaddrs *ifaces, *ifa;
+
+  if (getifaddrs (&ifaces) < 0)
+    {
+      if (errno != ENOSYS)
+	{
+	  printf ("Couldn't get any interfaces: %s.\n", strerror (errno));
+	  exit (1);
+	}
+      /* The function is simply not implemented.  */
+      exit (0);
+    }
+
+  puts ("\
+Name           Flags   Address         Netmask         Broadcast/Destination");
+
+  for (ifa = ifaces; ifa != NULL; ifa = ifa->ifa_next)
+    {
+      char abuf[64], mbuf[64], dbuf[64];
+      printf ("%-15s%#.4x  %-15s %-15s %-15s\n",
+	      ifa->ifa_name, ifa->ifa_flags,
+	      addr_string (ifa->ifa_addr, abuf, sizeof (abuf)),
+	      addr_string (ifa->ifa_netmask, mbuf, sizeof (mbuf)),
+	      addr_string (ifa->ifa_broadaddr, dbuf, sizeof (dbuf)));
+    }
+
+  freeifaddrs (ifaces);
+
+  return failures ? 1 : 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

+ 1 - 0
test/misc/Makefile.in

@@ -45,3 +45,4 @@ CFLAGS_bug-glob2 = -fPIC
 CFLAGS_opendir-tst1 = -fPIC
 CFLAGS_tst-inotify = -fPIC
 CFLAGS_tst-utmp = -fPIC
+CFLAGS_tst-utmpx = -fPIC

+ 1 - 1
test/silly/Makefile.in

@@ -5,4 +5,4 @@ RET_hello := 42
 RET_tiny  := 42
 
 # missing internal headers, disable these
-GLIBC_TESTS_DISABLED := tst-atomic_glibc tst-atomic-long_glibc
+TESTS_DISABLED := tst-atomic tst-atomic-long