diff options
44 files changed, 647 insertions, 646 deletions
@@ -24,13 +24,13 @@ #-------------------------------------------------------------- noconfig_targets := menuconfig config oldconfig randconfig \ defconfig allyesconfig allnoconfig clean distclean \ - release tags TAGS + release tags TOPDIR=./ include Rules.mak -ALL_SUBDIRS = ldso libc libcrypt libresolv libnsl libutil librt libm libpthread libintl test utils # extra - -DIRS = ldso libc libcrypt libresolv libnsl libutil librt +# need to have libc.so built, before we can build the others +PRE_DIRS = ldso libc +DIRS = ldso libcrypt libresolv libnsl libutil librt ifeq ($(strip $(UCLIBC_HAS_FLOATS)),y) DIRS += libm endif @@ -43,25 +43,12 @@ endif ifeq ($(strip $(HAVE_DOT_CONFIG)),y) -all: headers pregen subdirs shared finished +all: finished # In this section, we need .config -include .config.cmd -shared: $(patsubst %, _shared_dir_%, $(DIRS)) -$(patsubst %, _shared_dir_%, $(DIRS)): subdirs -ifeq ($(strip $(HAVE_SHARED)),y) - $(SECHO) - $(SECHO) Building shared libraries ... - $(SECHO) - $(MAKE) -C $(patsubst _shared_dir_%, %, $@) shared -else - $(SECHO) - $(SECHO) Not building shared libraries ... - $(SECHO) -endif - -finished: shared +finished: subdirs $(SECHO) $(SECHO) Finally finished compiling ... $(SECHO) @@ -69,7 +56,7 @@ finished: shared include/bits/uClibc_config.h: .config @if [ ! -x ./extra/config/conf ] ; then \ $(MAKE) -C extra/config conf; \ - fi; + fi $(RM) -r include/bits $(INSTALL) -d include/bits @./extra/config/conf -o extra/Configs/Config.in @@ -134,16 +121,19 @@ ifeq ($(strip $(UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA)),y) (cd extra/locale; \ if [ ! -f $(LOCALE_DATA_FILENAME) ] ; then \ $(WGET) http://www.uclibc.org/downloads/$(LOCALE_DATA_FILENAME) ; \ - fi ); + fi ) endif ifeq ($(strip $(UCLIBC_PREGENERATED_LOCALE_DATA)),y) (cd extra/locale; zcat $(LOCALE_DATA_FILENAME) | tar -xvf -) $(MAKE) -C extra/locale pregen endif +pre_subdirs: $(patsubst %, _pre_dir_%, $(PRE_DIRS)) +$(patsubst %, _pre_dir_%, $(PRE_DIRS)): pregen + $(MAKE) -C $(patsubst _pre_dir_%, %, $@) subdirs: $(patsubst %, _dir_%, $(DIRS)) -$(patsubst %, _dir_%, $(DIRS)): headers +$(patsubst %, _dir_%, $(DIRS)): pre_subdirs $(MAKE) -C $(patsubst _dir_%, %, $@) tags: @@ -154,11 +144,9 @@ install: install_runtime install_dev finished2 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib) -# Installs header files and development library links. -install_dev: - $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib +# Installs header files. +install_headers: $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include - -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/ if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \ extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ else \ @@ -234,15 +222,35 @@ ifneq ($(strip $(UCLIBC_HAS_THREADS)),y) endif -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \ chmod 755 $$i; chmod 644 $$i/*.h > /dev/null 2>&1; \ - done; - -find $(PREFIX)$(DEVEL_PREFIX) -name .svn | xargs $(RM) -r; + done + -find $(PREFIX)$(DEVEL_PREFIX) -name .svn | xargs $(RM) -r -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1:\2/'` $(PREFIX)$(DEVEL_PREFIX) + +# Installs development library links. +install_dev: install_headers + $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib + -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/ ifeq ($(strip $(HAVE_SHARED)),y) for i in `find lib/ -type l -name 'lib[a-zA-Z]*.so' | \ sed -e 's/lib\///'` ; do \ $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \ $(PREFIX)$(DEVEL_PREFIX)lib/$$i; \ - done; + done + if [ -f $(TOPDIR)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \ + $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \ + sed -e '/^GROUP/d' $(TOPDIR)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \ + fi +ifeq ($(strip $(COMPAT_ATEXIT)),y) + if [ -f $(TOPDIR)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \ + echo "GROUP ( $(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME) $(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) )" \ + >> $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \ + fi +else + if [ -f $(TOPDIR)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \ + echo "GROUP ( $(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) $(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME) )" \ + >> $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \ + fi +endif ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y) $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \ $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so @@ -250,18 +258,13 @@ endif # # If we build shared libraries then the static libs are PIC... # # Make _pic.a symlinks to make mklibs.py and similar tools happy. if [ -d lib ] ; then \ - for i in `find lib/ -type f -name '*.a' | sed -e 's/lib\///'` ; do \ - $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \ - | sed -e 's/\.a$$/_pic.a/'`; \ - done ; \ + for i in `find lib/ -type f -name 'lib*.a' | sed -e 's/lib\///'` ; do \ + $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \ + | sed -e 's/\.a$$/_pic.a/'`; \ + done ; \ fi - # Ugh!!! Remember that libdl.a and libdl_pic.a are different. Since - # libdl is pretty small, and not likely to benefit from mklibs.py and - # similar, lets just remove libdl_pic.a and avoid the issue - $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libdl_pic.a endif - # Installs run-time libraries install_runtime: ifeq ($(strip $(HAVE_SHARED)),y) @@ -274,7 +277,7 @@ ifeq ($(strip $(HAVE_SHARED)),y) $(SHELL_SET_X); \ $(INSTALL) -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \ $(PREFIX)$(RUNTIME_PREFIX)lib; \ - fi; + fi endif utils: @@ -343,15 +346,16 @@ defconfig: extra/config/conf $(INSTALL) -d include/bits @./extra/config/conf -d extra/Configs/Config.in -subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) -$(patsubst %, _dirclean_%, $(ALL_SUBDIRS)): dummy - $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean - -clean: subdirs_clean - - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core -o -name .\#\* \) -exec $(RM) {} \; +clean: @$(RM) -r lib include/bits - $(MAKE) -C libc/misc/internals clean + $(RM) */*.so */*.a + $(RM) libc/misc/internals/interp.c + $(RM) include/fpu_control.h $(MAKE) -C extra/locale clean + $(MAKE) -C ldso clean + $(MAKE) -C libpthread clean + $(MAKE) -C test clean + $(MAKE) -C utils clean @set -e; \ for i in `(cd $(TOPDIR)/libc/sysdeps/linux/common/sys; ls *.h)` ; do \ $(RM) include/sys/$$i; \ @@ -360,14 +364,16 @@ clean: subdirs_clean for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \ $(RM) include/sys/$$i; \ done; \ - fi; + fi @$(RM) include/linux include/asm* @if [ -d libc/sysdeps/linux/$(TARGET_ARCH) ]; then \ $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean; \ - fi; + fi + - find . \( -name \*.o -o -name core -o -name .\#\* \) -exec $(RM) {} \; distclean: clean $(RM) .config .config.old .config.cmd + $(RM) extra/locale/*.txt $(MAKE) -C extra clean release: distclean @@ -379,11 +385,11 @@ release: distclean find uClibc-$(VERSION)/ -type d \ -name .svn -exec $(RM) -r {} \; ; \ \ - tar -cvzf uClibc-$(VERSION).tar.gz uClibc-$(VERSION)/; + tar -cvzf uClibc-$(VERSION).tar.gz uClibc-$(VERSION)/ endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y) check: $(MAKE) -C test -.PHONY: dummy subdirs release distclean clean config oldconfig menuconfig +.PHONY: dummy subdirs release distclean clean config oldconfig menuconfig utils diff --git a/extra/Makefile b/extra/Makefile index 9b46ada51..5fabeb9ed 100644 --- a/extra/Makefile +++ b/extra/Makefile @@ -33,7 +33,6 @@ tags: ctags -R clean: subdirs_clean - $(RM) *.[oa] *~ core subdirs: $(patsubst %, _dir_%, $(DIRS)) subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS) $(EXTRA_DIRS_TO_CLEAN)) @@ -45,4 +44,3 @@ $(patsubst %, _dirclean_%, $(DIRS) $(EXTRA_DIRS_TO_CLEAN)) : dummy $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean .PHONY: dummy - diff --git a/extra/locale/Makefile b/extra/locale/Makefile index 2d8a147e8..8fe252875 100644 --- a/extra/locale/Makefile +++ b/extra/locale/Makefile @@ -86,7 +86,7 @@ pregen: cat uClibc_locale_data.h | awk 'BEGIN{i=1}{ if ( /WANT_/ ) i = /endif/ ; else if (i) print $0 }' > ../../include/bits/uClibc_locale_data.h clean: - $(RM) *.[oa] *~ core + $(RM) *.o *~ core $(RM) gen_wc8bit gen_wctype gen_locale gen_ldc gen_collate $(RM) c8tables.h wctables.h locale_tables.h lt_defines.h locale_collate.h $(RM) gen_mmap locale.mmap lmmtolso diff --git a/include/libc-internal.h b/include/libc-internal.h index 349aff750..f5bc9bb0c 100644 --- a/include/libc-internal.h +++ b/include/libc-internal.h @@ -100,6 +100,9 @@ # define attribute_relro #endif +/* Pull in things like __attribute_used__ */ +#include <sys/cdefs.h> + /* --- this is added to integrate linuxthreads */ #define __USE_UNIX98 1 diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile index 210a2eeba..49d739703 100644 --- a/libc/stdlib/Makefile +++ b/libc/stdlib/Makefile @@ -79,7 +79,10 @@ endif # wcstod wcstof wcstold MSRC2 = atexit.c -MOBJ2 = atexit.o on_exit.o __exit_handler.o exit.o +MOBJ2 = on_exit.o __cxa_atexit.o __cxa_finalize.o __exit_handler.o exit.o +ifeq ($(COMPAT_ATEXIT),y) +MOBJ2 += old_atexit.o +endif CSRC = \ abort.c getenv.c mkdtemp.c mktemp.c realpath.c mkstemp.c mkstemp64.c \ @@ -95,13 +98,20 @@ COBJS=$(patsubst %.c,%.o, $(CSRC)) OBJS=$(MOBJ) $(MOBJx) $(MOBJ1) $(MOBJ1x) $(MOBJ2) $(COBJS) +NONSHARED_OBJS=atexit.o + OBJ_LIST=../obj.stdlib -all: $(OBJ_LIST) subdirs +NONSHARED_OBJ_LIST=../nonshared_obj.stdlib + +all: $(OBJ_LIST) $(NONSHARED_OBJ_LIST) subdirs $(OBJ_LIST): $(OBJS) echo $(patsubst %, stdlib/%, $(OBJS)) > $(OBJ_LIST) +$(NONSHARED_OBJ_LIST): $(NONSHARED_OBJS) + echo $(patsubst %, stdlib/%, $(NONSHARED_OBJS)) > $(NONSHARED_OBJ_LIST) + $(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o $(STRIPTOOL) -x -R .note -R .comment $*.o @@ -118,7 +128,7 @@ $(MOBJ1x): $(MSRC1) $(CC) $(CFLAGS) -DL_$* -D__UCLIBC_DO_XLOCALE $< -c -o $*.o $(STRIPTOOL) -x -R .note -R .comment $*.o -$(MOBJ2): $(MSRC2) +$(MOBJ2) atexit.o: $(MSRC2) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o $(STRIPTOOL) -x -R .note -R .comment $*.o diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c index 1962c1b63..e9710b038 100644 --- a/libc/stdlib/atexit.c +++ b/libc/stdlib/atexit.c @@ -32,6 +32,9 @@ * August 2002 Erik Andersen * Added locking so atexit and friends can be thread safe * + * August 2005 Stephen Warren + * Added __cxa_atexit and __cxa_finalize support + * */ #define _GNU_SOURCE @@ -39,7 +42,7 @@ #include <unistd.h> #include <stdlib.h> #include <errno.h> - +#include <atomic.h> #ifdef __UCLIBC_HAS_THREADS__ #include <pthread.h> @@ -54,9 +57,12 @@ extern pthread_mutex_t mylock; typedef void (*aefuncp) (void); /* atexit function pointer */ typedef void (*oefuncp) (int, void *); /* on_exit function pointer */ +typedef void (*cxaefuncp) (void *); /* __cxa_atexit function pointer */ typedef enum { - ef_atexit, - ef_on_exit + ef_free, + ef_in_use, + ef_on_exit, + ef_cxa_atexit } ef_type; /* exit function types */ /* this is in the L_exit object */ @@ -67,13 +73,21 @@ extern int __exit_slots; extern int __exit_count; extern void __exit_handler(int); struct exit_function { - ef_type type; /* ef_atexit or ef_on_exit */ + /* + * 'type' should be of type of the 'enum ef_type' above but since we + * need this element in an atomic operation we have to use 'long int'. + */ + long int type; /* enum ef_type */ union { - aefuncp atexit; - struct { - oefuncp func; - void *arg; - } on_exit; + struct { + oefuncp func; + void *arg; + } on_exit; + struct { + cxaefuncp func; + void *arg; + void* dso_handle; + } cxa_atexit; } funcs; }; #ifdef __UCLIBC_DYNAMIC_ATEXIT__ @@ -81,46 +95,37 @@ extern struct exit_function *__exit_function_table; #else extern struct exit_function __exit_function_table[__UCLIBC_MAX_ATEXIT]; #endif +extern struct exit_function *__new_exitfn (void); -#ifdef L_atexit - /* +/* this is in the L___cxa_atexit object */ +extern int __cxa_atexit (cxaefuncp, void *arg, void *dso_handle); + + +/* remove old_atexit after 0.9.29 */ +#if defined(L_atexit) || defined(L_old_atexit) +extern void *__dso_handle __attribute__ ((__weak__)); + +/* * register a function to be called at normal program termination * (the registered function takes no arguments) - */ -int atexit(aefuncp func) -{ - struct exit_function *efp; - - LOCK; - if (func) { -#ifdef __UCLIBC_DYNAMIC_ATEXIT__ - /* If we are out of function table slots, make some more */ - if (__exit_slots < __exit_count+1) { - efp=realloc(__exit_function_table, - (__exit_slots+20)*sizeof(struct exit_function)); - if (efp==NULL) { - UNLOCK; - __set_errno(ENOMEM); - return -1; - } - __exit_function_table = efp; - __exit_slots+=20; - } + */ +#ifdef L_atexit +int attribute_hidden atexit(aefuncp func) #else - if (__exit_count >= __UCLIBC_MAX_ATEXIT) { - UNLOCK; - __set_errno(ENOMEM); - return -1; - } +int old_atexit(aefuncp func) #endif - __exit_cleanup = __exit_handler; /* enable cleanup */ - efp = &__exit_function_table[__exit_count++]; - efp->type = ef_atexit; - efp->funcs.atexit = func; - } - UNLOCK; - return 0; +{ + /* + * glibc casts aefuncp to cxaefuncp. + * This seems dodgy, but I guess callling a function with more + * parameters than it needs will work everywhere? + */ + return __cxa_atexit((cxaefuncp)func, NULL, + &__dso_handle == NULL ? NULL : __dso_handle); } +#ifndef L_atexit +weak_alias(old_atexit,atexit); +#endif #endif #ifdef L_on_exit @@ -133,41 +138,92 @@ int atexit(aefuncp func) int on_exit(oefuncp func, void *arg) { struct exit_function *efp; + + if (func == NULL) { + return 0; + } - LOCK; - if (func) { -#ifdef __UCLIBC_DYNAMIC_ATEXIT__ - /* If we are out of function table slots, make some more */ - if (__exit_slots < __exit_count+1) { - efp=realloc(__exit_function_table, - (__exit_slots+20)*sizeof(struct exit_function)); - if (efp==NULL) { - UNLOCK; - __set_errno(ENOMEM); - return -1; - } - __exit_function_table=efp; - __exit_slots+=20; - } -#else - if (__exit_count >= __UCLIBC_MAX_ATEXIT) { - UNLOCK; - __set_errno(ENOMEM); - return -1; - } + efp = __new_exitfn(); + if (efp == NULL) { + return -1; + } + + efp->funcs.on_exit.func = func; + efp->funcs.on_exit.arg = arg; + /* assign last for thread safety, since we're now unlocked */ + efp->type = ef_on_exit; + + return 0; +} #endif - __exit_cleanup = __exit_handler; /* enable cleanup */ - efp = &__exit_function_table[__exit_count++]; - efp->type = ef_on_exit; - efp->funcs.on_exit.func = func; - efp->funcs.on_exit.arg = arg; +#ifdef L___cxa_atexit +extern int __cxa_atexit (cxaefuncp func, void *arg, void *dso_handle) +{ + struct exit_function *efp; + + if (func == NULL) { + return 0; } - UNLOCK; + + efp = __new_exitfn(); + if (efp == NULL) { + return -1; + } + + efp->funcs.cxa_atexit.func = func; + efp->funcs.cxa_atexit.arg = arg; + efp->funcs.cxa_atexit.dso_handle = dso_handle; + /* assign last for thread safety, since we're now unlocked */ + efp->type = ef_cxa_atexit; + return 0; } #endif +#ifdef L___cxa_finalize +/* + * If D is non-NULL, call all functions registered with `__cxa_atexit' + * with the same dso handle. Otherwise, if D is NULL, call all of the + * registered handlers. + */ +void __cxa_finalize (void *dso_handle) +{ + struct exit_function *efp; + int exit_count_snapshot = __exit_count; + + /* In reverse order */ + while (exit_count_snapshot) { + efp = &__exit_function_table[--exit_count_snapshot]; + + /* + * We check dso_handle match before we verify the type of the union entry. + * However, the atomic_exchange will validate that we were really "allowed" + * to read dso_handle... + */ + if ((dso_handle == NULL || dso_handle == efp->funcs.cxa_atexit.dso_handle) + /* We don't want to run this cleanup more than once. */ + && !atomic_compare_and_exchange_bool_acq(&efp->type, ef_free, ef_cxa_atexit) + ) { + /* glibc passes status (0) too, but that's not in the prototype */ + (*efp->funcs.cxa_atexit.func)(efp->funcs.cxa_atexit.arg); + } + } + +#if 0 /* haven't looked into this yet... */ + /* + * Remove the registered fork handlers. We do not have to + * unregister anything if the program is going to terminate anyway. + */ +#ifdef UNREGISTER_ATFORK + if (d != NULL) { + UNREGISTER_ATFORK (d); + } +#endif +#endif +} +#endif + #ifdef L___exit_handler int __exit_count = 0; /* Number of registered exit functions */ #ifdef __UCLIBC_DYNAMIC_ATEXIT__ @@ -177,6 +233,45 @@ int __exit_slots = 0; /* Size of __exit_function_table */ struct exit_function __exit_function_table[__UCLIBC_MAX_ATEXIT]; #endif +/* + * Find and return a new exit_function pointer, for atexit, + * onexit and __cxa_atexit to initialize + */ +struct exit_function *__new_exitfn(void) +{ + struct exit_function *efp; + + LOCK; + +#ifdef __UCLIBC_DYNAMIC_ATEXIT__ + /* If we are out of function table slots, make some more */ + if (__exit_slots < __exit_count+1) { + efp=realloc(__exit_function_table, + (__exit_slots+20)*sizeof(struct exit_function)); + if (efp == NULL) { + UNLOCK; + __set_errno(ENOMEM); + return 0; + } + __exit_function_table = efp; + __exit_slots += 20; + } +#else + if (__exit_count >= __UCLIBC_MAX_ATEXIT) { + UNLOCK; + __set_errno(ENOMEM); + return 0; + } +#endif + + __exit_cleanup = __exit_handler; /* enable cleanup */ + efp = &__exit_function_table[__exit_count++]; + efp->type = ef_in_use; + + UNLOCK; + + return efp; +} /* * Handle the work of executing the registered exit functions @@ -196,11 +291,12 @@ void __exit_handler(int status) (efp->funcs.on_exit.func) (status, efp->funcs.on_exit.arg); } break; - case ef_atexit: - if (efp->funcs.atexit) { - (efp->funcs.atexit) (); - } - break; + case ef_cxa_atexit: + if (efp->funcs.cxa_atexit.func) { + /* glibc passes status too, but that's not in the prototype */ + (efp->funcs.cxa_atexit.func) (efp->funcs.cxa_atexit.arg); + } + break; } } #ifdef __UCLIBC_DYNAMIC_ATEXIT__ diff --git a/libc/sysdeps/linux/alpha/Makefile b/libc/sysdeps/linux/alpha/Makefile index ffb075b1a..cee893a3b 100644 --- a/libc/sysdeps/linux/alpha/Makefile +++ b/libc/sysdeps/linux/alpha/Makefile @@ -32,10 +32,6 @@ COBJS=$(patsubst %.c,%.o, $(CSRC)) OBJS=$(SOBJS) $(COBJS) -ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) -COBJS += $(PTDIR)sysdeps/$(TARGET_ARCH)/libc-tls.o -endif - OBJ_LIST=../../../obj.sysdeps.$(TARGET_ARCH) all: $(OBJ_LIST) @@ -59,14 +55,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -80,14 +76,8 @@ $(TOPDIR)lib/crtn.o: $(AR) $(ARFLAGS) $(TOPDIR)lib/crtn.o endif -ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) -$(PTDIR)sysdeps/$(TARGET_ARCH)/libc-tls.o: - $(MAKE) -C $(PTDIR)sysdeps/$(TARGET_ARCH) libc-tls.o -endif - headers: $(LN) -fs ../libc/sysdeps/linux/alpha/fpu_control.h $(TOPDIR)/include/ clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/arm/Makefile b/libc/sysdeps/linux/arm/Makefile index 65df75338..19701e1d9 100644 --- a/libc/sysdeps/linux/arm/Makefile +++ b/libc/sysdeps/linux/arm/Makefile @@ -60,14 +60,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -85,5 +85,4 @@ headers: $(LN) -fs ../libc/sysdeps/linux/arm/fpu_control.h $(TOPDIR)/include/ clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/arm/crt1.S b/libc/sysdeps/linux/arm/crt1.S index 82e1c8c42..987c52936 100644 --- a/libc/sysdeps/linux/arm/crt1.S +++ b/libc/sysdeps/linux/arm/crt1.S @@ -75,9 +75,18 @@ ARM register quick reference: pc r15 program counter */ - .text - .globl _start - .type _start,#function +#include <features.h> + +.text + .globl _start + .type _start,%function + .type _init,%function + .type _fini,%function +#ifndef __UCLIBC_CTOR_DTOR__ + .weak _init + .weak _fini +#endif + _start: /* Clear the frame pointer and link register since this is the outermost frame. */ mov fp, #0 @@ -132,14 +141,6 @@ _start: .word _fini(GOT) .word _init(GOT) .word main(GOT) -#else -# ifdef __UCLIBC_CTOR_DTOR__ - .type _init,%function - .type _fini,%function -# else - .weak _fini - .weak _init -# endif #endif /* Define a symbol for the first piece of initialized data. */ diff --git a/libc/sysdeps/linux/bfin/Makefile b/libc/sysdeps/linux/bfin/Makefile index 8fb05118e..b43209106 100644 --- a/libc/sysdeps/linux/bfin/Makefile +++ b/libc/sysdeps/linux/bfin/Makefile @@ -55,14 +55,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -79,6 +79,4 @@ endif headers: clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h - $(RM) $(TOPDIR)lib/crt0.o + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile index 84b29ac53..87791724a 100644 --- a/libc/sysdeps/linux/common/Makefile +++ b/libc/sysdeps/linux/common/Makefile @@ -25,21 +25,31 @@ ifeq ($(strip $(EXCLUDE_BRK)),y) SRCS := $(filter-out sbrk.c,$(SRCS)) endif +SRCS := $(filter-out ssp-local.c,$(SRCS)) ifneq ($(strip $(UCLIBC_HAS_SSP)),y) SRCS := $(filter-out ssp.c,$(SRCS)) +NONSHARED_OBJ_LIST= +else +NONSHARED_OBJ_LIST=../../../nonshared_obj.sysdeps.common endif ssp.o: CFLAGS += $(SSP_DISABLE_FLAGS) +ssp-local.o: CFLAGS += $(SSP_DISABLE_FLAGS) OBJS = $(patsubst %.c,%.o, $(SRCS)) +NONSHARED_OBJS = ssp-local.o + OBJ_LIST=../../../obj.sysdeps.common -all: $(OBJ_LIST) +all: $(OBJ_LIST) $(NONSHARED_OBJ_LIST) $(OBJ_LIST): $(OBJS) echo $(patsubst %, sysdeps/linux/common/%, $(OBJS)) > $(OBJ_LIST) -$(OBJS): %.o : %.c +$(NONSHARED_OBJ_LIST): $(NONSHARED_OBJS) + echo $(patsubst %, sysdeps/linux/common/%, $(NONSHARED_OBJS)) > $(NONSHARED_OBJ_LIST) + +$(OBJS) $(NONSHARED_OBJS): %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o @@ -47,4 +57,4 @@ headers: $(LN) -fs ../libc/sysdeps/linux/common/fpu_control.h $(TOPDIR)/include/ clean: - $(RM) *.[oa] *~ core + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index 899910c96..7791a0104 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -61,12 +61,43 @@ void __attribute__ ((noreturn)) __stack_smash_handler(char func[], int damaged _ void __attribute__ ((noreturn)) __stack_smash_handler(char func[], int damaged) { extern char *__progname; - const char message[] = ": stack smashing attack in function "; + static const char message[] = ": stack smashing attack in function "; block_signals(); ssp_write(STDERR_FILENO, __progname, message, func); + /* The loop is added only to keep gcc happy. */ + while(1) + terminate(); +} + +void __attribute__ ((noreturn)) __stack_chk_fail(void) +{ + extern char *__progname; + static const char msg1[] = "stack smashing detected: "; + static const char msg3[] = " terminated"; + + block_signals(); + + ssp_write(STDERR_FILENO, msg1, __progname, msg3); + + /* The loop is added only to keep gcc happy. */ + while(1) + terminate(); +} + +void __attribute__ ((noreturn)) __chk_fail(void) +{ + extern char *__progname; + static const char msg1[] = "buffer overflow detected: "; + static const char msg3[] = " terminated"; + + block_signals(); + + ssp_write(STDERR_FILENO, msg1, __progname, msg3); + + /* The loop is added only to keep gcc happy. */ while(1) terminate(); } diff --git a/libc/sysdeps/linux/cris/Makefile b/libc/sysdeps/linux/cris/Makefile index f69db2503..9063ff7cf 100644 --- a/libc/sysdeps/linux/cris/Makefile +++ b/libc/sysdeps/linux/cris/Makefile @@ -57,14 +57,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -81,4 +81,4 @@ endif headers: clean: - $(RM) *.[oa] *~ core + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/e1/Makefile b/libc/sysdeps/linux/e1/Makefile index 60d6ec026..e02888ac4 100644 --- a/libc/sysdeps/linux/e1/Makefile +++ b/libc/sysdeps/linux/e1/Makefile @@ -60,14 +60,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -84,8 +84,4 @@ endif headers: clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h -ifneq ($(strip $(HAVE_ELF)),y) - $(RM) $(TOPDIR)/include/float.h -endif + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/frv/Makefile b/libc/sysdeps/linux/frv/Makefile index dbf78d1c6..bfb127af4 100644 --- a/libc/sysdeps/linux/frv/Makefile +++ b/libc/sysdeps/linux/frv/Makefile @@ -60,7 +60,7 @@ Scrtreloc.o: crtreloc.c $(CC) $(CFLAGS) $(PIEFLAG) -c $< -o $@ $(CTOR_TARGETS): %.o : %.S - $(CC) $(ASFLAGS) -c $< -o $@ + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o $(SOBJS): %.o : %.S @@ -75,6 +75,5 @@ headers: $(LN) -fs ../libc/sysdeps/linux/frv/link.h $(TOPDIR)/include/ clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h + $(RM) *.o *~ core $(RM) $(TOPDIR)/include/link.h diff --git a/libc/sysdeps/linux/h8300/Makefile b/libc/sysdeps/linux/h8300/Makefile index b5d337427..5403feb01 100644 --- a/libc/sysdeps/linux/h8300/Makefile +++ b/libc/sysdeps/linux/h8300/Makefile @@ -60,14 +60,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -84,4 +84,4 @@ endif headers: clean: - $(RM) *.[oa] *~ core + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/i386/Makefile b/libc/sysdeps/linux/i386/Makefile index bde820b2b..e1795e0e5 100644 --- a/libc/sysdeps/linux/i386/Makefile +++ b/libc/sysdeps/linux/i386/Makefile @@ -60,14 +60,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -85,6 +85,4 @@ headers: $(LN) -fs ../libc/sysdeps/linux/i386/fpu_control.h $(TOPDIR)include/ clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h - $(RM) $(TOPDIR)include/fpu_control.h + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/i960/Makefile b/libc/sysdeps/linux/i960/Makefile index 2701e9985..b4997b9db 100644 --- a/libc/sysdeps/linux/i960/Makefile +++ b/libc/sysdeps/linux/i960/Makefile @@ -57,14 +57,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -81,5 +81,4 @@ endif headers: clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/m68k/Makefile b/libc/sysdeps/linux/m68k/Makefile index 7e595229f..00ad88e6c 100644 --- a/libc/sysdeps/linux/m68k/Makefile +++ b/libc/sysdeps/linux/m68k/Makefile @@ -65,14 +65,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -95,8 +95,7 @@ endif $(LN) -fs ../libc/sysdeps/linux/m68k/fpu_control.h $(TOPDIR)/include/ clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h + $(RM) *.o *~ core ifneq ($(strip $(HAVE_ELF)),y) $(RM) $(TOPDIR)/include/float.h endif diff --git a/libc/sysdeps/linux/microblaze/Makefile b/libc/sysdeps/linux/microblaze/Makefile index 269d53eb6..01b91ef71 100644 --- a/libc/sysdeps/linux/microblaze/Makefile +++ b/libc/sysdeps/linux/microblaze/Makefile @@ -63,14 +63,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -87,5 +87,4 @@ endif headers: clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/mips/crt1.S b/libc/sysdeps/linux/mips/crt1.S index d0769e88a..35dc8c42e 100644 --- a/libc/sysdeps/linux/mips/crt1.S +++ b/libc/sysdeps/linux/mips/crt1.S @@ -37,7 +37,7 @@ #include <sys/regdef.h> - +#include <features.h> /* This is the canonical entry point, usually the first thing in the text @@ -70,10 +70,14 @@ */ .text - .globl __start - .type __start,@function - .type _init,@function - .type _fini,@function + .globl __start + .type __start,@function + .type _init,@function + .type _fini,@function +#ifndef __UCLIBC_CTOR_DTOR__ + .weak _init + .weak _fini +#endif .type main,@function .type __uClibc_main,@function diff --git a/libc/sysdeps/linux/nios/Makefile b/libc/sysdeps/linux/nios/Makefile index cdfd9a204..b2b622329 100644 --- a/libc/sysdeps/linux/nios/Makefile +++ b/libc/sysdeps/linux/nios/Makefile @@ -54,14 +54,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -79,6 +79,4 @@ headers: $(LN) -fs ../libc/sysdeps/linux/nios/fpu_control.h $(TOPDIR)/include/ clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h - $(RM) $(TOPDIR)/include/fpu_control.h + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/nios2/Makefile b/libc/sysdeps/linux/nios2/Makefile index 7cb737e36..0292328f4 100644 --- a/libc/sysdeps/linux/nios2/Makefile +++ b/libc/sysdeps/linux/nios2/Makefile @@ -54,14 +54,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -79,6 +79,4 @@ headers: $(LN) -fs ../libc/sysdeps/linux/nios2/fpu_control.h $(TOPDIR)/include/ clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h - $(RM) $(TOPDIR)/include/fpu_control.h + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/powerpc/Makefile b/libc/sysdeps/linux/powerpc/Makefile index 4c345c00f..e0d5dcdd2 100644 --- a/libc/sysdeps/linux/powerpc/Makefile +++ b/libc/sysdeps/linux/powerpc/Makefile @@ -61,14 +61,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -86,5 +86,4 @@ headers: $(LN) -fs ../libc/sysdeps/linux/powerpc/fpu_control.h $(TOPDIR)/include/ clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/sh/Makefile b/libc/sysdeps/linux/sh/Makefile index f224acdbf..d986850ba 100644 --- a/libc/sysdeps/linux/sh/Makefile +++ b/libc/sysdeps/linux/sh/Makefile @@ -60,14 +60,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -85,6 +85,4 @@ headers: $(LN) -fs ../libc/sysdeps/linux/sh/fpu_control.h $(TOPDIR)/include/ clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h - $(RM) gmon-start.S + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/sh64/Makefile b/libc/sysdeps/linux/sh64/Makefile index 3b5e8e9d0..af49f5f1c 100644 --- a/libc/sysdeps/linux/sh64/Makefile +++ b/libc/sysdeps/linux/sh64/Makefile @@ -60,14 +60,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -84,5 +84,4 @@ endif headers: clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/sparc/Makefile b/libc/sysdeps/linux/sparc/Makefile index 8a2549cb2..de2fe0a4e 100644 --- a/libc/sysdeps/linux/sparc/Makefile +++ b/libc/sysdeps/linux/sparc/Makefile @@ -55,14 +55,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -80,5 +80,4 @@ headers: $(LN) -fs ../libc/sysdeps/linux/sparc/fpu_control.h $(TOPDIR)/include/ clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/v850/Makefile b/libc/sysdeps/linux/v850/Makefile index e54925096..d20bc89c6 100644 --- a/libc/sysdeps/linux/v850/Makefile +++ b/libc/sysdeps/linux/v850/Makefile @@ -60,14 +60,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -84,5 +84,4 @@ endif headers: clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h + $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/x86_64/Makefile b/libc/sysdeps/linux/x86_64/Makefile index 3c48d9e0b..c38204e4d 100644 --- a/libc/sysdeps/linux/x86_64/Makefile +++ b/libc/sysdeps/linux/x86_64/Makefile @@ -59,14 +59,14 @@ $(COBJS): %.o : %.c ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S - $(CC) $(ASFLAGS) -c crti.S -o crti.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crti.S -o crti.o $(TOPDIR)lib/crti.o: crti.o $(INSTALL) -d $(TOPDIR)lib/ cp crti.o $(TOPDIR)lib/ crtn.o: crtn.S - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o + $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c crtn.S -o crtn.o $(TOPDIR)lib/crtn.o: crtn.o $(INSTALL) -d $(TOPDIR)lib/ @@ -84,6 +84,4 @@ headers: $(LN) -fs ../libc/sysdeps/linux/x86_64/fpu_control.h $(TOPDIR)/include/ clean: - $(RM) *.[oa] *~ core - $(RM) bits/sysnum.h - $(RM) gmon-start.S + $(RM) *.o *~ core diff --git a/libcrypt/Makefile b/libcrypt/Makefile index d41309f3c..2b129a8e2 100644 --- a/libcrypt/Makefile +++ b/libcrypt/Makefile @@ -26,35 +26,38 @@ include $(TOPDIR)Rules.mak CFLAGS+=$(SSP_ALL_CFLAGS) -LIBCRYPT=libcrypt.a -LIBCRYPT_SHARED=libcrypt.so -LIBCRYPT_SHARED_FULLNAME=libcrypt-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so +LIB_NAME=libcrypt +AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a +SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so +SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so + +CSRC = $(wildcard *.c) -CSRC = crypt.c des.c md5.c OBJS=$(patsubst %.c,%.o, $(CSRC)) -all: $(LIBCRYPT) +ifeq ($(strip $(HAVE_SHARED)),y) +all: $(SO_LIB_NAME) +else +all: $(AR_LIB_NAME) +endif -$(LIBCRYPT) ar-target: $(OBJS) - $(AR) $(ARFLAGS) $(LIBCRYPT) $(OBJS) +$(AR_LIB_NAME): $(OBJS) $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBCRYPT) - $(INSTALL) -m 644 $(LIBCRYPT) $(TOPDIR)lib + $(RM) $(AR_LIB_NAME) + $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS) + +$(SO_LIB_NAME): $(AR_LIB_NAME) + $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME) + $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \ + -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive $(AR_LIB_NAME) \ + --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ + -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME) $(OBJS): %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o -shared: all - $(LD) $(LDFLAGS) -soname=$(LIBCRYPT_SHARED).$(MAJOR_VERSION) \ - -o $(LIBCRYPT_SHARED_FULLNAME) --whole-archive $(LIBCRYPT) \ - --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ - -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) - $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBCRYPT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBCRYPT_SHARED).$(MAJOR_VERSION) - $(INSTALL) -m 644 $(LIBCRYPT_SHARED_FULLNAME) $(TOPDIR)lib - $(LN) -sf $(LIBCRYPT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBCRYPT_SHARED) - $(LN) -sf $(LIBCRYPT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBCRYPT_SHARED).$(MAJOR_VERSION) - -clean: - $(RM) *.[oa] *~ core $(LIBCRYPT) $(LIBCRYPT_SHARED_FULLNAME) +clean: + $(RM) *.o *~ core diff --git a/libintl/Makefile b/libintl/Makefile index 8977b5ba9..86a6b8deb 100644 --- a/libintl/Makefile +++ b/libintl/Makefile @@ -26,9 +26,10 @@ include $(TOPDIR)Rules.mak CFLAGS+=$(SSP_ALL_CFLAGS) -LIBINTL=libintl.a -LIBINTL_SHARED=libintl.so -LIBINTL_SHARED_FULLNAME=libintl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so +LIB_NAME=libintl +AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a +SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so +SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so MSRC= intl.c MOBJ= gettext.o ngettext.o dgettext.o dcgettext.o dngettext.o dcngettext.o \ @@ -37,28 +38,29 @@ MOBJ= gettext.o ngettext.o dgettext.o dcgettext.o dngettext.o dcngettext.o \ OBJS=$(MOBJ) -all: $(LIBINTL) +ifeq ($(strip $(HAVE_SHARED)),y) +all: $(SO_LIB_NAME) +else +all: $(AR_LIB_NAME) +endif -$(LIBINTL) ar-target: $(OBJS) - $(AR) $(ARFLAGS) $(LIBINTL) $(OBJS) +$(AR_LIB_NAME): $(OBJS) $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBINTL) - $(INSTALL) -m 644 $(LIBINTL) $(TOPDIR)lib/ + $(RM) $(AR_LIB_NAME) + $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS) + +$(SO_LIB_NAME): $(AR_LIB_NAME) + $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME) + $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \ + -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive $(AR_LIB_NAME) \ + --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ + -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME) $(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o $(STRIPTOOL) -x -R .note -R .comment $*.o -shared: all - $(LD) $(LDFLAGS) -soname=$(LIBINTL_SHARED).$(MAJOR_VERSION) \ - -o $(LIBINTL_SHARED_FULLNAME) --whole-archive $(LIBINTL) \ - --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ - -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) - $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBINTL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBINTL_SHARED).$(MAJOR_VERSION) - $(INSTALL) -m 644 $(LIBINTL_SHARED_FULLNAME) $(TOPDIR)lib - $(LN) -sf $(LIBINTL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBINTL_SHARED) - $(LN) -sf $(LIBINTL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBINTL_SHARED).$(MAJOR_VERSION) - clean: - $(RM) *.[oa] *~ core $(LIBINTL) $(LIBINTL_SHARED_FULLNAME) + $(RM) *.o *~ core diff --git a/libm/Makefile b/libm/Makefile index d8927a89a..ad080ecde 100644 --- a/libm/Makefile +++ b/libm/Makefile @@ -36,19 +36,13 @@ include $(TOPDIR)Rules.mak CFLAGS+=$(SSP_ALL_CFLAGS) -DIRS = -ifeq ($(strip $(HAS_FPU)),y) -ifeq ($(TARGET_ARCH),$(wildcard $(TARGET_ARCH))) -DIRS = $(TARGET_ARCH) -endif -endif -ALL_SUBDIRS = powerpc +CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE +LIB_NAME=libm +AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a +SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so +SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so -LIBM=libm.a -LIBM_SHARED=libm.so -LIBM_SHARED_FULLNAME=libm-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so -CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE FL_MSRC = float_wrappers.c ifeq ($(strip $(DO_C99_MATH)),y) @@ -89,31 +83,38 @@ CSRC+= s_expm1.c s_scalbn.c s_copysign.c e_acos.c e_asin.c e_atan2.c \ FL_MOBJ = sqrtf.o endif +ifeq ($(strip $(HAS_FPU)),y) +ifeq ($(strip $(DO_C99_MATH)),y) +ARCH_CSRC=$(wildcard $(TARGET_ARCH)/*.c) +ARCH_OBJS=$(patsubst %.c,%.o, $(ARCH_CSRC)) +endif +endif + COBJS=$(patsubst %.c,%.o, $(CSRC)) OBJS=$(COBJS) $(FL_MOBJ) +ifeq ($(strip $(HAVE_SHARED)),y) +all: $(SO_LIB_NAME) +else +all: $(AR_LIB_NAME) +endif -all: $(LIBM) subdirs - -ar-target: $(OBJS) - $(AR) $(ARFLAGS) $(LIBM) $(OBJS) -$(LIBM): ar-target +$(AR_LIB_NAME): $(OBJS) $(ARCH_OBJS) $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBM) - $(INSTALL) -m 644 $(LIBM) $(TOPDIR)lib - -shared: all - $(LD) $(LDFLAGS) -soname=$(LIBM_SHARED).$(MAJOR_VERSION) \ - -o $(LIBM_SHARED_FULLNAME) --whole-archive $(LIBM) \ + $(RM) $(AR_LIB_NAME) + $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS) + $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(ARCH_OBJS) + +$(SO_LIB_NAME): $(AR_LIB_NAME) + $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME) + $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \ + -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive $(AR_LIB_NAME) \ --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) - $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED).$(MAJOR_VERSION) - $(INSTALL) -m 644 $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib - $(LN) -sf $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED) - $(LN) -sf $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED).$(MAJOR_VERSION) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME) -$(COBJS): %.o : %.c +$(COBJS) $(ARCH_OBJS): %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o @@ -124,16 +125,5 @@ $(FL_MOBJ): $(FL_MSRC) tags: ctags -R -clean: subdirs_clean - $(RM) *.[oa] *~ core $(LIBM) $(LIBM_SHARED_FULLNAME) - -subdirs: $(patsubst %, _dir_%, $(DIRS)) -subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) - -$(patsubst %, _dir_%, $(DIRS)): ar-target - $(MAKE) -C $(patsubst _dir_%, %, $@) - -$(patsubst %, _dirclean_%, $(ALL_SUBDIRS)): dummy - $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean - -.PHONY: dummy +clean: + $(RM) *.o */*.o *~ core diff --git a/libm/powerpc/Makefile b/libm/powerpc/Makefile deleted file mode 100644 index 342c182ba..000000000 --- a/libm/powerpc/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# Makefile for uClibc's math library -# -# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> -# -# The routines included in this math library are derived from the -# math library for Apple's MacOS X/Darwin math library, which was -# itself swiped from FreeBSD. The original copyright information -# is as follows: -# -# Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. -# -# Developed at SunPro, a Sun Microsystems, Inc. business. -# Permission to use, copy, modify, and distribute this -# software is freely granted, provided that this notice -# is preserved. -# -# It has been ported to work with uClibc and generally behave -# by Erik Andersen <andersen@codepoet.org> -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program 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 Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -TOPDIR=../../ -include $(TOPDIR)Rules.mak - -LIBM=../libm.a -CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE - -ifeq ($(strip $(DO_C99_MATH)),y) -CSRC = s_ceil.c s_copysign.c s_floor.c s_frexp.c s_ldexp.c s_logb.c s_modf.c \ - s_nearbyint.c s_rint.c s_round.c s_trunc.c w_scalb.c -else -CSRC = -endif -COBJS=$(patsubst %.c,%.o, $(CSRC)) -OBJS=$(COBJS) - - -ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y) -all: clean -else -all: $(OBJS) $(LIBM) -endif - -$(LIBM): ar-target - -ar-target: $(OBJS) - $(AR) $(ARFLAGS) $(LIBM) $(OBJS) - -$(COBJS): %.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - $(STRIPTOOL) -x -R .note -R .comment $*.o - -$(OBJ): Makefile - -tags: - ctags -R - -clean: - $(RM) *.[oa] *~ core - diff --git a/libnsl/Makefile b/libnsl/Makefile index 28cff08dd..d20fe2113 100644 --- a/libnsl/Makefile +++ b/libnsl/Makefile @@ -21,35 +21,38 @@ include $(TOPDIR)Rules.mak CFLAGS+=$(SSP_ALL_CFLAGS) -LIBNSL=libnsl.a -LIBNSL_SHARED=libnsl.so -LIBNSL_SHARED_FULLNAME=libnsl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so +LIB_NAME=libnsl +AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a +SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so +SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so + +CSRC = $(wildcard *.c) -CSRC = nsl.c OBJS=$(patsubst %.c,%.o, $(CSRC)) -all: $(LIBNSL) +ifeq ($(strip $(HAVE_SHARED)),y) +all: $(SO_LIB_NAME) +else +all: $(AR_LIB_NAME) +endif -$(LIBNSL) ar-target: $(OBJS) - $(AR) $(ARFLAGS) $(LIBNSL) $(OBJS) +$(AR_LIB_NAME): $(OBJS) $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBNSL) - $(INSTALL) -m 644 $(LIBNSL) $(TOPDIR)lib + $(RM) $(AR_LIB_NAME) + $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS) + +$(SO_LIB_NAME): $(AR_LIB_NAME) + $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME) + $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \ + -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive $(AR_LIB_NAME) \ + --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ + -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME) $(OBJS): %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o -shared: all - $(LD) $(LDFLAGS) -soname=$(LIBNSL_SHARED).$(MAJOR_VERSION) \ - -o $(LIBNSL_SHARED_FULLNAME) --whole-archive $(LIBNSL) \ - --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ - -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) - $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBNSL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBNSL_SHARED).$(MAJOR_VERSION) - $(INSTALL) -m 644 $(LIBNSL_SHARED_FULLNAME) $(TOPDIR)lib - $(LN) -sf $(LIBNSL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBNSL_SHARED) - $(LN) -sf $(LIBNSL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBNSL_SHARED).$(MAJOR_VERSION) - -clean: - $(RM) *.[oa] *~ core $(LIBNSL) $(LIBNSL_SHARED_FULLNAME) +clean: + $(RM) *.o *~ core diff --git a/libpthread/linuxthreads/Makefile b/libpthread/linuxthreads/Makefile index 08ff8a2d8..4072d660f 100644 --- a/libpthread/linuxthreads/Makefile +++ b/libpthread/linuxthreads/Makefile @@ -16,56 +16,69 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# Makefile for uClibc TOPDIR=../../ include $(TOPDIR)Rules.mak -# As long as there is only one subdir, we don't -# have to worry about race conditions with multiple -# $(AR)'s in subdirs running on linuxthreads.a. -DIRS = sysdeps +CFLAGS+=$(SSP_ALL_CFLAGS) -#Adjust the soname version to avoid namespace collisions with glibc's libpthread -LIBPTHREAD:=../libpthread.a -ifeq ($(strip $(TARGET_ARCH)),sparc) -SYSDEPS_DIR:=$(TARGET_ARCH)/sparc32 -else -SYSDEPS_DIR:=$(TARGET_ARCH) -endif -CFLAGS += $(SSP_ALL_CFLAGS) #This stuff will not compile without at least -O1 CFLAGS :=$(CFLAGS:-O0=-O1) - # set up system dependencies include dirs (NOTE: order matters!) +# psm: don't think that the last include makes sense +# they all should be already linked to $(TOPDIR)include PTDIR = $(TOPDIR)libpthread/linuxthreads/ SYSDEPINC = -I$(PTDIR)sysdeps/pthread \ -I$(PTDIR)sysdeps/$(TARGET_ARCH) \ -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH) CFLAGS += $(SYSDEPINC) -CSRC=attr.c cancel.c condvar.c errno.c events.c join.c lockfile.c manager.c \ - mutex.c oldsemaphore.c pt-machine.c ptfork.c pthread.c \ - ptlongjmp.c rwlock.c semaphore.c signals.c specific.c spinlock.c +ARCH_CFLAGS = $(CFLAGS) -ifeq ($(UCLIBC_HAS_XLOCALE),y) - CSRC += locale.c +ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) + SHARED_START_FILES = $(TOPDIR)lib/crti.o $(LIBGCC_DIR)crtbeginS.o + SHARED_END_FILES = $(LIBGCC_DIR)crtendS.o $(TOPDIR)lib/crtn.o endif -COBJS=$(patsubst %.c,%.o, $(CSRC)) -OBJS=$(COBJS) +LIB_NAME=libpthread +AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a +SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so +SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so + +ARCH_CSRC=$(wildcard sysdeps/$(TARGET_ARCH)/*.c) +ARCH_OBJS=$(patsubst %.c,%.o, $(ARCH_CSRC)) +-include sysdeps/$(TARGET_ARCH)/Makefile.in -# We need to make sure that we put all the top-level $(OBJS) into -# our archive before executing subdirs. That way, when $(AR) is -# run in the subdirs, it'll bump the generic top-level objects -# out of our archive in favor of the machine-specific ones. -all: $(LIBPTHREAD) subdirs +CSRC = $(wildcard *.c) +ifneq ($(strip $(UCLIBC_HAS_XLOCALE)),y) +CSRC := $(filter-out locale.c,$(CSRC)) +endif + +OBJS=$(patsubst %.c,%.o, $(CSRC)) -$(LIBPTHREAD) ar-target: $(OBJS) - $(AR) $(ARFLAGS) $(LIBPTHREAD) $(OBJS) +ifeq ($(strip $(HAVE_SHARED)),y) +all: $(SO_LIB_NAME) +else +all: $(AR_LIB_NAME) +endif -$(COBJS): %.o : %.c +$(AR_LIB_NAME): $(OBJS) $(ARCH_OBJS) + $(INSTALL) -d $(TOPDIR)lib + $(RM) $(AR_LIB_NAME) + $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS) + $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(ARCH_OBJS) + +$(SO_LIB_NAME): $(AR_LIB_NAME) + $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME) + $(LD) $(LDFLAGS_NOSTRIP) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \ + -o $(TOPDIR)lib/$(SO_FULL_NAME) $(SHARED_START_FILES) --whole-archive $(AR_LIB_NAME) \ + --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ + -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) $(SHARED_END_FILES) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME) + +$(OBJS): %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y) $(STRIPTOOL) -X --strip-debug -R .note -R .comment $*.o @@ -73,16 +86,13 @@ else $(STRIPTOOL) -x -R .note -R .comment $*.o endif -clean: subdirs_clean - $(RM) *.[oa] *~ core - -subdirs: $(patsubst %, _dir_%, $(DIRS)) -subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS)) - -$(patsubst %, _dir_%, $(DIRS)): $(LIBPTHREAD) - $(MAKE) -C $(patsubst _dir_%, %, $@) - -$(patsubst %, _dirclean_%, $(DIRS)): - $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean +$(ARCH_OBJS): %.o : %.c + $(CC) $(ARCH_CFLAGS) -c $< -o $@ +ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y) + $(STRIPTOOL) -X --strip-debug -R .note -R .comment $*.o +else + $(STRIPTOOL) -x -R .note -R .comment $*.o +endif -.PHONY: dummy +clean: + $(RM) *.o sysdeps/*/*.o *~ core diff --git a/libpthread/pthread.c b/libpthread/linuxthreads/pthread.c-OLDEXAMPLE index 88b163087..88b163087 100644 --- a/libpthread/pthread.c +++ b/libpthread/linuxthreads/pthread.c-OLDEXAMPLE diff --git a/libpthread/linuxthreads/sysdeps/Makefile b/libpthread/linuxthreads/sysdeps/Makefile deleted file mode 100644 index dff461543..000000000 --- a/libpthread/linuxthreads/sysdeps/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# Makefile for uClibc's pthread library -# -# Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org> -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program 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 Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# Makefile for uClibc - -TOPDIR=../../../ -include $(TOPDIR)Rules.mak - -# Generally most TARGET_ARCHs aren't going to want a make rule here as they -# can generally just inline directly into the upper-level pt-machine.c. As -# such, we offer this capability for platforms that either can't get away -# with the inlining, or need to be able to do builds here for other reasons. - -DIRS = - -ifeq ($(TARGET_ARCH),sh64) - DIRS += $(TARGET_ARCH) -endif - -all: subdirs - -clean: subdirs_clean - $(RM) *~ core - -subdirs: $(patsubst %, _dir_%, $(DIRS)) -subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS)) - -$(patsubst %, _dir_%, $(DIRS)) : dummy - $(MAKE) -C $(patsubst _dir_%, %, $@) - -$(patsubst %, _dirclean_%, $(DIRS)) : dummy - $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean - -.PHONY: dummy subdirs - diff --git a/libpthread/linuxthreads/sysdeps/sh64/Makefile b/libpthread/linuxthreads/sysdeps/sh64/Makefile.in index 11b7cc0b5..fed7a83b7 100644 --- a/libpthread/linuxthreads/sysdeps/sh64/Makefile +++ b/libpthread/linuxthreads/sysdeps/sh64/Makefile.in @@ -16,34 +16,5 @@ # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -TOPDIR=../../../../ -include $(TOPDIR)Rules.mak - -LIBPTHREAD=../../../libpthread.a -SOBJS = $(patsubst %.S,%.o, $(SSRC)) -CSRC = pt-machine.c -COBJS = $(patsubst %.c,%.o, $(CSRC)) - # We need to build as SHcompact for tas.. -CFLAGS := $(subst 32media,compact,$(CFLAGS)) - -OBJS = $(SOBJS) $(COBJS) - -all: $(OBJS) $(LIBC) - -$(LIBC): ar-target - -ar-target: $(OBJS) - $(AR) $(ARFLAGS) $(LIBPTHREAD) $(OBJS) - -$(SOBJS): %.o : %.S - $(CC) $(ASFLAGS) -c $< -o $@ - $(STRIPTOOL) -x -R .note -R .comment $*.o - -$(COBJS): %.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - $(STRIPTOOL) -x -R .note -R .comment $*.o - -clean: - $(RM) *.[oa] *~ core - +ARCH_CFLAGS := $(subst 32media,compact,$(ARCH_CFLAGS)) diff --git a/libpthread/linuxthreads_db/Makefile b/libpthread/linuxthreads_db/Makefile index debfb9bc7..2c27cdccc 100644 --- a/libpthread/linuxthreads_db/Makefile +++ b/libpthread/linuxthreads_db/Makefile @@ -15,56 +15,55 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# Makefile for uClibc TOPDIR=../../ include $(TOPDIR)Rules.mak -#Adjust the soname version to avoid namespace collisions with glibc's libpthread -LIBTHREAD_DB:=../libthread_db.a -ifeq ($(strip $(TARGET_ARCH)),sparc) -SYSDEPS_DIR:=$(TARGET_ARCH)/sparc32 -else -SYSDEPS_DIR:=$(TARGET_ARCH) -endif +#CFLAGS+=$(SSP_ALL_CFLAGS) + +LIB_NAME=libthread_db +AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a +SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so +SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so # set up system dependencies include dirs (NOTE: order matters!) -SYSDEPINC = -I$(PTDIR)sysdeps/unix/sysv/linux \ - -I$(PTDIR)sysdeps/pthread \ - -I$(PTDIR)sysdeps/unix/sysv \ - -I$(PTDIR)sysdeps/unix/unix \ +PTDIR = $(TOPDIR)libpthread/linuxthreads/ +SYSDEPINC = -I$(PTDIR)sysdeps/pthread \ -I$(PTDIR)sysdeps/$(TARGET_ARCH) \ - -I$(PTDIR)sysdeps \ -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH) -#CFLAGS += $(SSP_ALL_CFLAGS) + CFLAGS += $(SYSDEPINC) -DLIBPTHREAD_SO="\"libpthread.so.$(MAJOR_VERSION)\"" -CSRC= td_init.c td_log.c td_ta_delete.c td_ta_get_nthreads.c \ - td_ta_get_ph.c td_ta_map_id2thr.c td_ta_map_lwp2thr.c \ - td_ta_new.c td_ta_thr_iter.c td_ta_tsd_iter.c \ - td_thr_get_info.c td_thr_getfpregs.c td_thr_getgregs.c \ - td_thr_getxregs.c td_thr_getxregsize.c td_thr_setfpregs.c \ - td_thr_setgregs.c td_thr_setprio.c td_thr_setsigpending.c \ - td_thr_setxregs.c td_thr_sigsetmask.c td_thr_tsd.c \ - td_thr_validate.c td_thr_dbsuspend.c td_thr_dbresume.c \ - td_ta_setconcurrency.c td_ta_enable_stats.c \ - td_ta_reset_stats.c td_ta_get_stats.c td_ta_event_addr.c \ - td_thr_event_enable.c td_thr_set_event.c \ - td_thr_clear_event.c td_thr_event_getmsg.c \ - td_ta_set_event.c td_ta_event_getmsg.c \ - td_ta_clear_event.c td_symbol_list.c td_thr_tls_get_addr.c +# Remove any -z defs since this lib will have undefined symbols +LDFLAGS := $(subst -z defs,,$(LDFLAGS)) --warn-unresolved-symbols -COBJS=$(patsubst %.c,%.o, $(CSRC)) -OBJS=$(COBJS) +CSRC=$(wildcard *.c) + +OBJS=$(patsubst %.c,%.o, $(CSRC)) + +ifeq ($(strip $(HAVE_SHARED)),y) +all: $(SO_LIB_NAME) +else +all: $(AR_LIB_NAME) +endif -all: $(LIBTHREAD_DB) +$(AR_LIB_NAME): $(OBJS) + $(INSTALL) -d $(TOPDIR)lib + $(RM) $(AR_LIB_NAME) + $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS) -$(LIBTHREAD_DB) ar-target: $(OBJS) - $(AR) $(ARFLAGS) $(LIBTHREAD_DB) $(OBJS) +$(SO_LIB_NAME): $(AR_LIB_NAME) + $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).1 $(SO_LIB_NAME) + $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.1 \ + -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive $(AR_LIB_NAME) \ + --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ + -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).1 + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME) -$(COBJS): %.o : %.c +$(OBJS): %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o clean: - $(RM) *.[oa] *~ core + $(RM) *.o *~ core diff --git a/libpthread/README.NPTL b/libpthread/nptl/README.NPTL index 7e50984cb..7e50984cb 100644 --- a/libpthread/README.NPTL +++ b/libpthread/nptl/README.NPTL diff --git a/libresolv/Makefile b/libresolv/Makefile index d6270fece..e32f1dd8c 100644 --- a/libresolv/Makefile +++ b/libresolv/Makefile @@ -20,42 +20,44 @@ # Derived in part from the Linux-8086 C library, the GNU C Library, and several # other sundry sources. Files within this library are copyright by their # respective copyright holders. -# Makefile for uClibc TOPDIR=../ include $(TOPDIR)Rules.mak CFLAGS+=$(SSP_ALL_CFLAGS) -LIBRESOLV=libresolv.a -LIBRESOLV_SHARED=libresolv.so -LIBRESOLV_SHARED_FULLNAME=libresolv-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so +LIB_NAME=libresolv +AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a +SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so +SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so + +CSRC = $(wildcard *.c) -CSRC = resolv.c OBJS=$(patsubst %.c,%.o, $(CSRC)) -all: $(LIBRESOLV) +ifeq ($(strip $(HAVE_SHARED)),y) +all: $(SO_LIB_NAME) +else +all: $(AR_LIB_NAME) +endif -$(LIBRESOLV) ar-target: $(OBJS) - $(AR) $(ARFLAGS) $(LIBRESOLV) $(OBJS) +$(AR_LIB_NAME): $(OBJS) $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBRESOLV) - $(INSTALL) -m 644 $(LIBRESOLV) $(TOPDIR)lib + $(RM) $(AR_LIB_NAME) + $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS) + +$(SO_LIB_NAME): $(AR_LIB_NAME) + $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME) + $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \ + -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive $(AR_LIB_NAME) \ + --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ + -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME) $(OBJS): %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o -shared: all - $(LD) $(LDFLAGS) -soname=$(LIBRESOLV_SHARED).$(MAJOR_VERSION) \ - -o $(LIBRESOLV_SHARED_FULLNAME) --whole-archive $(LIBRESOLV) \ - --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ - -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) - $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBRESOLV_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBRESOLV_SHARED).$(MAJOR_VERSION) - $(INSTALL) -m 644 $(LIBRESOLV_SHARED_FULLNAME) $(TOPDIR)lib - $(LN) -sf $(LIBRESOLV_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBRESOLV_SHARED) - $(LN) -sf $(LIBRESOLV_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBRESOLV_SHARED).$(MAJOR_VERSION) - -clean: - $(RM) *.[oa] *~ core $(LIBRESOLV) $(LIBRESOLV_SHARED_FULLNAME) +clean: + $(RM) *.o *~ core diff --git a/librt/Makefile b/librt/Makefile index f820b6786..b17e58057 100644 --- a/librt/Makefile +++ b/librt/Makefile @@ -1,44 +1,60 @@ +# Makefile for uClibc # -# Makefile for librt +# Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org> # +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program 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 Library General Public License for more +# details. +# +# You should have received a copy of the GNU Library General Public License +# along with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA TOPDIR=../ include $(TOPDIR)Rules.mak -LIBRT=librt.a -LIBRT_SHARED=librt.so -LIBRT_SHARED_FULLNAME=librt-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so +CFLAGS+=$(SSP_ALL_CFLAGS) + +LIB_NAME=librt +AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a +SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so +SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so # uClibc's librt lacks all aio routines, all clock routines, # and all shm routines -CSRC=mq_open.c mq_close.c mq_unlink.c mq_getsetattr.c \ - mq_send.c mq_receive.c mq_notify.c \ - timer_create.c timer_delete.c \ - timer_settime.c timer_gettime.c timer_getoverr.c +CSRC=$(wildcard *.c) + OBJS=$(patsubst %.c,%.o, $(CSRC)) -all: $(LIBRT) +ifeq ($(strip $(HAVE_SHARED)),y) +all: $(SO_LIB_NAME) +else +all: $(AR_LIB_NAME) +endif -$(LIBRT) ar-target: $(OBJS) - $(AR) $(ARFLAGS) $(LIBRT) $(OBJS) +$(AR_LIB_NAME): $(OBJS) $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBRT) - $(INSTALL) -m 644 $(LIBRT) $(TOPDIR)lib/ + $(RM) $(AR_LIB_NAME) + $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS) + +$(SO_LIB_NAME): $(AR_LIB_NAME) + $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME) + $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \ + -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive $(AR_LIB_NAME) \ + --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ + -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME) $(OBJS): %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o -shared: all - $(LD) $(LDFLAGS) -soname=$(LIBRT_SHARED).$(MAJOR_VERSION) \ - -o $(LIBRT_SHARED_FULLNAME) --whole-archive $(LIBRT) \ - --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ - -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) - $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBRT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBRT_SHARED).$(MAJOR_VERSION) - $(INSTALL) -m 644 $(LIBRT_SHARED_FULLNAME) $(TOPDIR)lib - $(LN) -sf $(LIBRT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBRT_SHARED) - $(LN) -sf $(LIBRT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBRT_SHARED).$(MAJOR_VERSION) - clean: - $(RM) *.[oa] *~ core $(LIBRT) $(LIBRT_SHARED_FULLNAME) + $(RM) *.o *~ core diff --git a/libutil/Makefile b/libutil/Makefile index 95f879786..6cd07e5e9 100644 --- a/libutil/Makefile +++ b/libutil/Makefile @@ -26,38 +26,41 @@ include $(TOPDIR)Rules.mak CFLAGS+=$(SSP_ALL_CFLAGS) -LIBUTIL=libutil.a -LIBUTIL_SHARED=libutil.so -LIBUTIL_SHARED_FULLNAME=libutil-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so +LIB_NAME=libutil +AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a +SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so +SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so -CSRC=login.c login_tty.c logout.c logwtmp.c openpty.c -ifeq ($(strip $(ARCH_HAS_MMU)),y) - CSRC+=forkpty.c +CSRC=$(wildcard *.c) +ifneq ($(strip $(ARCH_HAS_MMU)),y) +CSRC := $(filter-out forkpty.c,$(CSRC)) endif + OBJS=$(patsubst %.c,%.o, $(CSRC)) -all: $(LIBUTIL) +ifeq ($(strip $(HAVE_SHARED)),y) +all: $(SO_LIB_NAME) +else +all: $(AR_LIB_NAME) +endif -$(LIBUTIL) ar-target: $(OBJS) - $(AR) $(ARFLAGS) $(LIBUTIL) $(OBJS) +$(AR_LIB_NAME): $(OBJS) $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBUTIL) - $(INSTALL) -m 644 $(LIBUTIL) $(TOPDIR)lib/ + $(RM) $(AR_LIB_NAME) + $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS) + +$(SO_LIB_NAME): $(AR_LIB_NAME) + $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME) + $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \ + -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive $(AR_LIB_NAME) \ + --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ + -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) + $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME) $(OBJS): %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o -shared: all - $(LD) $(LDFLAGS) -soname=$(LIBUTIL_SHARED).$(MAJOR_VERSION) \ - -o $(LIBUTIL_SHARED_FULLNAME) --whole-archive $(LIBUTIL) \ - --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \ - -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) - $(INSTALL) -d $(TOPDIR)lib - $(RM) $(TOPDIR)lib/$(LIBUTIL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBUTIL_SHARED).$(MAJOR_VERSION) - $(INSTALL) -m 644 $(LIBUTIL_SHARED_FULLNAME) $(TOPDIR)lib - $(LN) -sf $(LIBUTIL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBUTIL_SHARED) - $(LN) -sf $(LIBUTIL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBUTIL_SHARED).$(MAJOR_VERSION) - clean: - $(RM) *.[oa] *~ core $(LIBUTIL) $(LIBUTIL_SHARED_FULLNAME) + $(RM) *.o *~ core diff --git a/test/Makefile b/test/Makefile index cc54cd25f..ba2b26a50 100644 --- a/test/Makefile +++ b/test/Makefile @@ -42,7 +42,6 @@ tags: ctags -R clean: subdirs_clean - $(RM) *.[oa] *~ core subdirs: $(patsubst %, _dir_%, $(DIRS)) subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) |