From 5682ae1fcf3fc78ab89dd0bad6403cd81502a37c Mon Sep 17 00:00:00 2001
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Date: Tue, 26 Jan 2010 13:54:26 +0100
Subject: convert to foo-y kbuild style

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 libc/signal/Makefile.in | 21 +++++--------
 libc/stdlib/Makefile.in | 81 +++++++++++++++++--------------------------------
 2 files changed, 35 insertions(+), 67 deletions(-)

(limited to 'libc')

diff --git a/libc/signal/Makefile.in b/libc/signal/Makefile.in
index f768b7019..9e234b4ce 100644
--- a/libc/signal/Makefile.in
+++ b/libc/signal/Makefile.in
@@ -7,29 +7,24 @@
 
 subdirs += libc/signal
 
-CSRC :=	allocrtsig.c killpg.c raise.c sigaction.c sigaddset.c sigandset.c \
+CSRC-y := allocrtsig.c killpg.c raise.c sigaction.c sigaddset.c sigandset.c \
 	sigblock.c sigdelset.c sigempty.c sigfillset.c siggetmask.c \
 	sigisempty.c sigismem.c sigjmp.c signal.c \
 	sigorset.c sigpause.c sigsetmask.c sigsetops.c sigwait.c
-ifeq ($(UCLIBC_HAS_OBSOLETE_BSD_SIGNAL),y)
-CSRC += sighold.c sigignore.c sigrelse.c sigset.c
-endif
-ifeq ($(UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL),y)
-CSRC += sysv_signal.c
-endif
-ifeq ($(UCLIBC_SUSV4_LEGACY),y)
-CSRC += sigintr.c
-endif
+CSRC-$(UCLIBC_HAS_OBSOLETE_BSD_SIGNAL) += \
+	sighold.c sigignore.c sigrelse.c sigset.c
+CSRC-$(UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL) += sysv_signal.c
+CSRC-$(UCLIBC_SUSV4_LEGACY) += sigintr.c
 
 ifneq ($(strip $(ARCH_OBJS)),)
-CSRC := $(filter-out $(notdir $(ARCH_OBJS:.o=.c)),$(CSRC))
+CSRC-y := $(filter-out $(notdir $(ARCH_OBJS:.o=.c)),$(CSRC-y))
 endif
 
 SIGNAL_DIR := $(top_srcdir)libc/signal
 SIGNAL_OUT := $(top_builddir)libc/signal
 
-SIGNAL_SRC := $(patsubst %.c,$(SIGNAL_DIR)/%.c,$(CSRC))
-SIGNAL_OBJ := $(patsubst %.c,$(SIGNAL_OUT)/%.o,$(CSRC))
+SIGNAL_SRC := $(patsubst %.c,$(SIGNAL_DIR)/%.c,$(CSRC-y))
+SIGNAL_OBJ := $(patsubst %.c,$(SIGNAL_OUT)/%.o,$(CSRC-y))
 
 libc-y += $(SIGNAL_OBJ)
 
diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in
index 48ee5f227..3d34538fb 100644
--- a/libc/stdlib/Makefile.in
+++ b/libc/stdlib/Makefile.in
@@ -11,85 +11,58 @@ include $(top_srcdir)libc/stdlib/malloc/Makefile.in
 include $(top_srcdir)libc/stdlib/malloc-simple/Makefile.in
 include $(top_srcdir)libc/stdlib/malloc-standard/Makefile.in
 
-CSRC := \
+CSRC-y := \
 	abort.c getenv.c mkdtemp.c realpath.c mkstemp.c \
 	rand.c random.c random_r.c setenv.c system.c div.c ldiv.c lldiv.c \
 	getpt.c drand48-iter.c jrand48.c \
 	jrand48_r.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \
 	nrand48_r.c rand_r.c srand48.c srand48_r.c seed48.c seed48_r.c \
 	valloc.c a64l.c l64a.c __uc_malloc.c
-ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
-CSRC += posix_memalign.c
-endif
-ifeq ($(UCLIBC_HAS_PTY),y)
-CSRC += grantpt.c unlockpt.c ptsname.c
-endif
-ifeq ($(UCLIBC_HAS_ARC4RANDOM),y)
-CSRC += arc4random.c
-endif
-ifeq ($(UCLIBC_HAS_LFS),y)
-CSRC += mkstemp64.c
-endif
-ifeq ($(UCLIBC_HAS_FLOATS),y)
-CSRC += drand48.c drand48_r.c erand48.c erand48_r.c
-ifeq ($(UCLIBC_SUSV3_LEGACY),y)
-CSRC += gcvt.c
-endif
-endif
-ifeq ($(UCLIBC_SUSV3_LEGACY),y)
-CSRC += mktemp.c
-endif
-
+CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_memalign.c
+CSRC-$(UCLIBC_HAS_PTY) += grantpt.c unlockpt.c ptsname.c
+CSRC-$(UCLIBC_HAS_ARC4RANDOM) += arc4random.c
+CSRC-$(UCLIBC_HAS_LFS) += mkstemp64.c
+CSRC-$(UCLIBC_HAS_FLOATS) += drand48.c drand48_r.c erand48.c erand48_r.c
+CSRC-$(if $(findstring yy,$(UCLIBC_HAS_FLOATS)$(UCLIBC_SUSV3_LEGACY)),y) += \
+	gcvt.c
+CSRC-$(UCLIBC_SUSV3_LEGACY) += mktemp.c
 
 # multi source stdlib.c
-CSRC +=	abs.c labs.c atoi.c atol.c strtol.c strtoul.c _stdlib_strto_l.c \
+CSRC-y += abs.c labs.c atoi.c atol.c strtol.c strtoul.c _stdlib_strto_l.c \
 	qsort.c bsearch.c \
 	llabs.c atoll.c strtoll.c strtoull.c _stdlib_strto_ll.c
 # (aliases) strtoq.o strtouq.o
-ifeq ($(UCLIBC_HAS_FLOATS),y)
-CSRC += atof.c
-endif
-ifeq ($(UCLIBC_HAS_XLOCALE),y)
-CSRC += strtol_l.c strtoul_l.c _stdlib_strto_l_l.c \
+CSRC-$(UCLIBC_HAS_FLOATS) += atof.c
+CSRC-$(UCLIBC_HAS_XLOCALE) += strtol_l.c strtoul_l.c _stdlib_strto_l_l.c \
 	strtoll_l.c strtoull_l.c _stdlib_strto_ll_l.c
-endif
-ifeq ($(UCLIBC_HAS_WCHAR),y)
-CSRC +=	mblen.c mbtowc.c wctomb.c mbstowcs.c wcstombs.c \
+
+CSRC-$(UCLIBC_HAS_WCHAR) += mblen.c mbtowc.c wctomb.c mbstowcs.c wcstombs.c \
 	_stdlib_mb_cur_max.c _stdlib_wcsto_l.c _stdlib_wcsto_ll.c \
 	wcstol.c wcstoul.c wcstoll.c wcstoull.c
-ifeq ($(UCLIBC_HAS_XLOCALE),y)
-CSRC +=_stdlib_wcsto_l_l.c _stdlib_wcsto_ll_l.c \
+CSRC-$(if $(findstring yy,$(UCLIBC_HAS_WCHAR)$(UCLIBC_HAS_XLOCALE)),y) += \
+	_stdlib_wcsto_l_l.c _stdlib_wcsto_ll_l.c \
 	wcstol_l.c wcstoul_l.c wcstoll_l.c wcstoull_l.c
-endif
-endif
 
 # multi source _strtod.c
-ifeq ($(UCLIBC_HAS_FLOATS),y)
-CSRC += strtod.c strtof.c strtold.c __strtofpmax.c __fp_range_check.c
-ifeq ($(UCLIBC_HAS_XLOCALE),y)
-CSRC += strtod_l.c strtof_l.c strtold_l.c __strtofpmax_l.c
-endif
-ifeq ($(UCLIBC_HAS_WCHAR),y)
-CSRC += wcstod.c wcstof.c wcstold.c __wcstofpmax.c
-ifeq ($(UCLIBC_HAS_XLOCALE),y)
-CSRC += wcstod_l.c wcstof_l.c wcstold_l.c __wcstofpmax_l.c
-endif
-endif
-endif
+CSRC-$(UCLIBC_HAS_FLOATS) += strtod.c strtof.c strtold.c __strtofpmax.c __fp_range_check.c
+CSRC-$(if $(findstring yy,$(UCLIBC_HAS_FLOATS)$(UCLIBC_HAS_XLOCALE)),y) += \
+	strtod_l.c strtof_l.c strtold_l.c __strtofpmax_l.c
+CSRC-$(if $(findstring yy,$(UCLIBC_HAS_FLOATS)$(UCLIBC_HAS_WCHAR)),y) += \
+	wcstod.c wcstof.c wcstold.c __wcstofpmax.c
+CSRC-$(if $(findstring yyy,$(UCLIBC_HAS_FLOATS)$(UCLIBC_HAS_WCHAR)$(UCLIBC_HAS_XLOCALE)),y) += \
+	wcstod_l.c wcstof_l.c wcstold_l.c __wcstofpmax_l.c
 # (aliases) wcstoq.o wcstouq.o
 # wcstod wcstof wcstold
 
 # multi source _atexit.c
-CSRC += __cxa_atexit.c __cxa_finalize.c __exit_handler.c exit.c on_exit.c
-ifeq ($(COMPAT_ATEXIT),y)
-CSRC += old_atexit.c
-endif
+CSRC-y += __cxa_atexit.c __cxa_finalize.c __exit_handler.c exit.c on_exit.c
+CSRC-$(COMPAT_ATEXIT) += old_atexit.c
 
 STDLIB_DIR := $(top_srcdir)libc/stdlib
 STDLIB_OUT := $(top_builddir)libc/stdlib
 
-STDLIB_SRC := $(patsubst %.c,$(STDLIB_DIR)/%.c,$(CSRC))
-STDLIB_OBJ := $(patsubst %.c,$(STDLIB_OUT)/%.o,$(CSRC))
+STDLIB_SRC := $(patsubst %.c,$(STDLIB_DIR)/%.c,$(CSRC-y))
+STDLIB_OBJ := $(patsubst %.c,$(STDLIB_OUT)/%.o,$(CSRC-y))
 
 libc-y += $(STDLIB_OBJ)
 libc-static-y += $(STDLIB_OUT)/atexit.o
-- 
cgit v1.2.3


From 22de495da40d7649eb28fdfc70ce1d5f3b6572ea Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 25 Jan 2010 15:11:05 -0800
Subject: errno: hide __libc_resp, __libc_errno, and __libc_h_errno

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 libc/inet/resolv.c          | 2 +-
 libc/misc/internals/errno.c | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

(limited to 'libc')

diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 4087f8db8..ee1323e76 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -3018,7 +3018,7 @@ __thread struct __res_state *__resp = &_res;
  *        relocations.
  */
 extern __thread struct __res_state *__libc_resp
-       __attribute__ ((alias ("__resp")));
+       __attribute__ ((alias ("__resp"))) attribute_hidden;
 # else
 #  undef __resp
 struct __res_state *__resp = &_res;
diff --git a/libc/misc/internals/errno.c b/libc/misc/internals/errno.c
index e1b5d7e84..11d19eeef 100644
--- a/libc/misc/internals/errno.c
+++ b/libc/misc/internals/errno.c
@@ -4,15 +4,14 @@
 __thread int errno;
 __thread int h_errno;
 
-extern __thread int __libc_errno __attribute__ ((alias ("errno")));
-extern __thread int __libc_h_errno __attribute__ ((alias ("h_errno")));
+extern __thread int __libc_errno __attribute__ ((alias ("errno"))) attribute_hidden;
+extern __thread int __libc_h_errno __attribute__ ((alias ("h_errno"))) attribute_hidden;
 #define h_errno __libc_h_errno
 
 #else
 #include "internal_errno.h"
 int errno = 0;
 int h_errno = 0;
-
 #ifdef __UCLIBC_HAS_THREADS__
 libc_hidden_def(errno)
 weak_alias(errno, _errno)
-- 
cgit v1.2.3