From 3a14ea8812e8695b5205a70431d513fb905c0daf Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 31 Mar 2015 22:43:52 +0200 Subject: Revert "librt: Use -nodefaultlibs instead of -nostdlib" This reverts commit 534f44d53146457b3ca686c47efb9207543b88e1. I don't think this is wanted. Signed-off-by: Bernhard Reutner-Fischer --- librt/Makefile.in | 3 --- 1 file changed, 3 deletions(-) diff --git a/librt/Makefile.in b/librt/Makefile.in index fbbf5b447..8555e94db 100644 --- a/librt/Makefile.in +++ b/librt/Makefile.in @@ -15,9 +15,6 @@ LIBS-librt.so := $(LIBS) ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) LIBS-librt.so += $(top_builddir)lib/libdl.so $(top_builddir)lib/libpthread.so endif -START_FILE-librt.so := $(SHARED_START_FILES) -END_FILE-librt.so := $(SHARED_END_FILES) - librt_FULL_NAME := librt-$(VERSION).so -- cgit v1.2.3 From 5f374c1fe85a1da95c15a5cac217f8ab762ce6dd Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 31 Mar 2015 22:44:12 +0200 Subject: buildsys: Fix setting LIBGCC We were ending up with multiple entries in LIBGCC for recursive child make instances, avoid that. Signed-off-by: Bernhard Reutner-Fischer --- Rules.mak | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Rules.mak b/Rules.mak index ea254f1a2..cf0c5bc8b 100644 --- a/Rules.mak +++ b/Rules.mak @@ -807,12 +807,12 @@ endif ASFLAGS += $(ASFLAG_--noexecstack) LIBGCC_CFLAGS ?= $(CFLAGS) $(CPU_CFLAGS-y) -$(eval $(call cache-output-var,LIBGCC,$(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)) +$(eval $(call cache-output-var,LIBGCC_A,$(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)) $(eval $(call cache-output-var,LIBGCC_EH,$(CC) $(LIBGCC_CFLAGS) -print-file-name=libgcc_eh.a)) # with -O0 we (e.g. lockf) might end up with references to # _Unwind_Resume, so pull in gcc_eh in this case.. -LIBGCC_DIR:=$(dir $(LIBGCC)) -LIBGCC += $(if $(DODEBUG),$(LIBGCC_EH)) +LIBGCC_DIR := $(dir $(LIBGCC_A)) +LIBGCC := $(LIBGCC_A) $(if $(DODEBUG),$(LIBGCC_EH)) # moved from libpthread/linuxthreads ifeq ($(UCLIBC_CTOR_DTOR),y) -- cgit v1.2.3 From e51d746b4b9ed54ddeed48d9e65ffd0811298c49 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 31 Mar 2015 22:44:19 +0200 Subject: buildsys: tweak ucontext_i.h prerequisites ucontext_i.h too depends on uClibc_config.h. Update it to look like the other MANGLE generated files and tweak prereqs Fixes: make realclean ; make -j libc/misc/internals/__uClibc_main.i Signed-off-by: Bernhard Reutner-Fischer --- Makefile.in | 8 ++++++-- Rules.mak | 3 ++- libc/sysdeps/linux/Makefile.commonarch | 17 +++++++---------- libpthread/nptl/Makefile.in | 2 +- libpthread/nptl/sysdeps/Makefile.commonarch | 2 +- .../nptl/sysdeps/unix/sysv/linux/Makefile.commonarch | 2 +- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Makefile.in b/Makefile.in index 2233be8b2..a9bfbbb81 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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) diff --git a/Rules.mak b/Rules.mak index cf0c5bc8b..c68153e36 100644 --- a/Rules.mak +++ b/Rules.mak @@ -168,7 +168,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 diff --git a/libc/sysdeps/linux/Makefile.commonarch b/libc/sysdeps/linux/Makefile.commonarch index 1bf2dc511..a6842d879 100644 --- a/libc/sysdeps/linux/Makefile.commonarch +++ b/libc/sysdeps/linux/Makefile.commonarch @@ -47,16 +47,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 diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in index 0a981cde3..55eeba2a1 100644 --- a/libpthread/nptl/Makefile.in +++ b/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 $< \ diff --git a/libpthread/nptl/sysdeps/Makefile.commonarch b/libpthread/nptl/sysdeps/Makefile.commonarch index a5952a67b..7f531f542 100644 --- a/libpthread/nptl/sysdeps/Makefile.commonarch +++ b/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 $< \ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch index e4a5fc55d..4e147734c 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch +++ b/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 $< \ -- cgit v1.2.3 From 5fe8fc1ac4b5eb0f9e9bb01295c14b99d80ab41e Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 31 Mar 2015 22:44:22 +0200 Subject: buildsys: Do not build crt upon pregen No need to build crt when just generating headers Signed-off-by: Bernhard Reutner-Fischer --- Makefile.in | 4 +--- Makerules | 17 +++++++++-------- ldso/ldso/Makefile.in | 1 + libc/Makefile.in | 3 +-- libc/sysdeps/linux/Makefile.commonarch | 1 - librt/Makefile.in | 2 +- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Makefile.in b/Makefile.in index a9bfbbb81..2beeb7d01 100644 --- a/Makefile.in +++ b/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 @@ -219,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) diff --git a/Makerules b/Makerules index fd6bb190d..10dc5298f 100644 --- a/Makerules +++ b/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) $@ diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in index e0d0a097d..815264291 100644 --- a/ldso/ldso/Makefile.in +++ b/ldso/ldso/Makefile.in @@ -68,6 +68,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) diff --git a/libc/Makefile.in b/libc/Makefile.in index 9c8152d44..2abc77dce 100644 --- a/libc/Makefile.in +++ b/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) diff --git a/libc/sysdeps/linux/Makefile.commonarch b/libc/sysdeps/linux/Makefile.commonarch index a6842d879..f8dc17d8f 100644 --- a/libc/sysdeps/linux/Makefile.commonarch +++ b/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)) diff --git a/librt/Makefile.in b/librt/Makefile.in index 8555e94db..a246d00ee 100644 --- a/librt/Makefile.in +++ b/librt/Makefile.in @@ -73,7 +73,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) -- cgit v1.2.3 From cf0234de47b019ac24e2d361d6386fdfad48f119 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 31 Mar 2015 22:44:25 +0200 Subject: libc: Fix page-size in getifaddrs() TODO: this could need a cleanup.. Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/ifaddrs.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libc/inet/ifaddrs.c b/libc/inet/ifaddrs.c index 6d9ee8903..0c9310651 100644 --- a/libc/inet/ifaddrs.c +++ b/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 -- cgit v1.2.3 From f820f4ce071ae0985d84e09ea74dc42d55081e86 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Apr 2015 23:58:41 +0200 Subject: buildsys: pass -O to ld unless DODEBUG Signed-off-by: Bernhard Reutner-Fischer --- Rules.mak | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Rules.mak b/Rules.mak index c68153e36..83d78ff28 100644 --- a/Rules.mak +++ b/Rules.mak @@ -687,14 +687,18 @@ LDFLAGS_NOSTRIP += $(CFLAG_-Wl--hash-style=gnu) endif endif -LDFLAGS:=$(LDFLAGS_NOSTRIP) -Wl,-z,defs ifeq ($(DODEBUG),y) CFLAGS += -O0 -g3 -DDEBUG else CFLAGS += $(OPTIMIZATION) CFLAGS += $(OPTIMIZATION-$(GCC_MAJOR_VER)) CFLAGS += $(OPTIMIZATION-$(GCC_MAJOR_VER).$(GCC_MINOR_VER)) +$(eval $(call check-ld-var,-O2)) +LDFLAGS_NOSTRIP += $(CFLAG_-Wl-O2) endif + +LDFLAGS:=$(LDFLAGS_NOSTRIP) -Wl,-z,defs + ifeq ($(DOSTRIP),y) LDFLAGS += -Wl,-s else -- cgit v1.2.3 From 1df50b08dfe4133d306156483a224f5a478f7dff Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Apr 2015 23:58:41 +0200 Subject: prelink: handle _begin in a gold-agnostic way The nostartfiles is redundant but better be safe Signed-off-by: Bernhard Reutner-Fischer --- Makerules | 13 ++----------- Rules.mak | 1 + ldso/ldso/Makefile.in | 13 ++++--------- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/Makerules b/Makerules index 10dc5298f..dd19cea79 100644 --- a/Makerules +++ b/Makerules @@ -326,22 +326,13 @@ endef cmd_hcompile.u = $(HOSTCC) $(filter-out $(PHONY),$^) $(DEPS-$(notdir $@)) -o $@ $(BUILD_LDFLAGS) $(BUILD_LDFLAGS-$(notdir $(^D))) $(BUILD_LDFLAGS-$(notdir $@)) $(BUILD_CFLAGS) $(BUILD_CFLAGS-$(notdir $(^D))) $(BUILD_CFLAGS-$(notdir $@)) cmd_hcompile.o = $(HOSTCC) $(filter-out $(PHONY),$<) $(DEPS-$(notdir $@)) -c -o $@ $(BUILD_CFLAGS) $(BUILD_CFLAGS-$(notdir $(^D))) $(BUILD_CFLAGS-$(notdir $@)) -define create-lds - $(Q)$(RM) $@.lds - $(Q)$(CC) $(LDFLAG-fuse-ld) $(CPU_LDFLAGS-y) \ - -nostdlib -nostartfiles -shared -Wl,-z,combreloc \ - -Wl,-z,relro $(CFLAG_-Wl--hash-style=gnu) -Wl,-z,defs \ - -x c /dev/null -Wl,--verbose 2>&1 | LC_ALL=C \ - $(SED) -e '/^=========/,/^=========/!d;/^=========/d' \ - -e 's/^\([ ]*\)\. = .* + SIZEOF_HEADERS;/&\n\1$(SYMBOL_PREFIX)_begin = . - SIZEOF_HEADERS;/' > $@.lds -endef - define link.so $(Q)$(RM) $@ $@.$(2) $(dir $@)$(1) @$(disp_ld) $(Q)$(CC) $(LDFLAGS-$(notdir $@)) $(LDFLAGS-y-$(@F)) \ -Wl,-soname=$(notdir $@).$(2) \ - $(CFLAG_-nostdlib) -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \ + $(CFLAG_-nostdlib) $(CFLAG_-nostartfiles) \ + -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \ -Wl,--whole-archive $(firstword $^) -Wl,--no-whole-archive \ $(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@)) $(Q)$(LN) -sf $(1) $@.$(2) diff --git a/Rules.mak b/Rules.mak index 83d78ff28..71ceb9022 100644 --- a/Rules.mak +++ b/Rules.mak @@ -255,6 +255,7 @@ ARFLAGS:=cr # Note: The check for -nostdlib has to be before all calls to check_ld $(eval $(call check-gcc-var,-nostdlib)) +$(eval $(call check-gcc-var,-nostartfiles)) # deliberately not named CFLAG-fuse-ld since unchecked and from user LDFLAG-fuse-ld := $(filter -fuse-ld=%,$(call qstrip,$(UCLIBC_EXTRA_CFLAGS))) # failed to merge target specific data of file /dev/null diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in index 815264291..9b04d619f 100644 --- a/ldso/ldso/Makefile.in +++ b/ldso/ldso/Makefile.in @@ -33,10 +33,13 @@ LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS) else LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs endif -LDFLAGS-$(UCLIBC_LDSO_NAME).so += -Wl,-e,$(SYMBOL_PREFIX)_start -Wl,-z,now -Wl,-Bsymbolic \ +LDFLAGS-$(UCLIBC_LDSO_NAME).so += -Wl,-e,$(SYMBOL_PREFIX)_start \ + -Wl,-z,now -Wl,-Bsymbolic \ -Wl,--export-dynamic $(CFLAG_-Wl--sort-common) -Wl,--discard-locals \ $(CFLAG_-Wl--discard-all) -Wl,--no-undefined +LDFLAGS-$(LDSO_PRELINK_SUPPORT)-$(UCLIBC_LDSO_NAME).so += -Wl,-defsym=$(SYMBOL_PREFIX)_begin=0 + ldso_FULL_NAME := $(UCLIBC_LDSO_NAME)-$(VERSION).so $(UCLIBC_LDSO_NAME)_DIR := $(top_srcdir)ldso/ldso @@ -62,17 +65,9 @@ ldso-y := $($(UCLIBC_LDSO_NAME)_OBJS:.o=.oS) lib-so-y += $(ldso) objclean-y += CLEAN_ldso/ldso -ifeq ($(LDSO_PRELINK_SUPPORT),y) -# Use a specific linker script for ld.so -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) -endif $(call link.so,$(ldso_FULL_NAME),$(ABI_VERSION)) $($(UCLIBC_LDSO_NAME)_OUT)/$(UCLIBC_LDSO_NAME)_so.a: $(ldso-y) -- cgit v1.2.3 From 04cd09eb3a4856e9dc31112170290e3baa3bf9fb Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Apr 2015 23:58:41 +0200 Subject: librt: Fix librt.so depends for !NPTL Signed-off-by: Bernhard Reutner-Fischer --- librt/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/librt/Makefile.in b/librt/Makefile.in index a246d00ee..e211bd2e7 100644 --- a/librt/Makefile.in +++ b/librt/Makefile.in @@ -61,8 +61,8 @@ lib-a-y += $(top_builddir)lib/librt.a lib-so-y += $(top_builddir)lib/librt.so endif - -ifeq ($(DOPIC)$(UCLIBC_HAS_THREADS_NATIVE),yn) +# for NPTL we need SHARED regardless of DOPIC +ifeq ($(if $(UCLIBC_HAS_THREADS_NATIVE),,$(DOPIC)),y) $(top_builddir)lib/librt.so: $(top_builddir)lib/librt.a $(libc.depend) else $(top_builddir)lib/librt.so: $(librt_OUT)/librt_so.a $(libc.depend) $(libpthread.depend) $(libdl.depend) -- cgit v1.2.3 From 19c4bf396ead620a84051102e7f0914200fcc5e0 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Apr 2015 23:58:41 +0200 Subject: librt: Rephrase librt.so library dependencies Signed-off-by: Bernhard Reutner-Fischer --- librt/Makefile.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/librt/Makefile.in b/librt/Makefile.in index e211bd2e7..2fde48caa 100644 --- a/librt/Makefile.in +++ b/librt/Makefile.in @@ -61,11 +61,14 @@ lib-a-y += $(top_builddir)lib/librt.a lib-so-y += $(top_builddir)lib/librt.so endif +librt-dep-y := $(libc.depend) +librt-dep-$(UCLIBC_HAS_THREADS_NATIVE) += $(libpthread.depend) $(libdl.depend) + # for NPTL we need SHARED regardless of DOPIC ifeq ($(if $(UCLIBC_HAS_THREADS_NATIVE),,$(DOPIC)),y) -$(top_builddir)lib/librt.so: $(top_builddir)lib/librt.a $(libc.depend) +$(top_builddir)lib/librt.so: $(top_builddir)lib/librt.a $(librt-dep-y) else -$(top_builddir)lib/librt.so: $(librt_OUT)/librt_so.a $(libc.depend) $(libpthread.depend) $(libdl.depend) +$(top_builddir)lib/librt.so: $(librt_OUT)/librt_so.a $(librt-dep-y) endif $(call link.so,$(librt_FULL_NAME),$(ABI_VERSION)) -- cgit v1.2.3 From a68d786f309fa1ac5478b5b60d5b6fa0b5de7b7c Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Apr 2015 23:58:41 +0200 Subject: include/: ignore sys/random.h symlink Signed-off-by: Bernhard Reutner-Fischer --- include/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/include/.gitignore b/include/.gitignore index 636f8eecc..8f86c4c80 100644 --- a/include/.gitignore +++ b/include/.gitignore @@ -38,6 +38,7 @@ /sys/prctl.h /sys/procfs.h /sys/ptrace.h +/sys/random.h /sys/reg.h /sys/regdef.h /sys/signalfd.h -- cgit v1.2.3 From a8cf23486eef67c359c295e8da3cb39cadf87f79 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Apr 2015 23:58:41 +0200 Subject: librt: honour HAS_STUBS in buildsys Signed-off-by: Bernhard Reutner-Fischer --- librt/Makefile.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/librt/Makefile.in b/librt/Makefile.in index 2fde48caa..15ee23e00 100644 --- a/librt/Makefile.in +++ b/librt/Makefile.in @@ -42,6 +42,8 @@ librt_filter_SRC += $(if $(UCLIBC_HAS_ADVANCED_REALTIME),, \ spawn_faction_addopen.c \ spawn_faction_init.c) +librt_filter_SRC += $(if $(UCLIBC_HAS_STUBS),,rt_stubs.c) + librt_SRC := $(filter-out $(librt_filter_SRC),$(librt_SRC)) librt_OBJ := $(patsubst %.c,$(librt_OUT)/%.o,$(librt_SRC)) -- cgit v1.2.3 From efc26521e8c8cda6430efe9a8ed1b73896b655b5 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Apr 2015 23:58:41 +0200 Subject: librt: Refine LIBS Signed-off-by: Bernhard Reutner-Fischer --- librt/Makefile.in | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/librt/Makefile.in b/librt/Makefile.in index 15ee23e00..4e81764b8 100644 --- a/librt/Makefile.in +++ b/librt/Makefile.in @@ -13,7 +13,8 @@ LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-librt.so := -Wl,--dsbt-index=9 LDFLAGS-librt.so := $(LDFLAGS) LIBS-librt.so := $(LIBS) ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) -LIBS-librt.so += $(top_builddir)lib/libdl.so $(top_builddir)lib/libpthread.so +LIBS-librt.so += $(top_builddir)lib/libpthread.so \ + $(CC_FLAG_ASNEEDED) $(top_builddir)lib/libdl.so $(CC_FLAG_NO_ASNEEDED) endif librt_FULL_NAME := librt-$(VERSION).so @@ -21,8 +22,6 @@ librt_FULL_NAME := librt-$(VERSION).so librt_DIR := $(top_srcdir)librt librt_OUT := $(top_builddir)librt -ifeq ($(UCLIBC_HAS_REALTIME),y) - librt_SRC := $(notdir $(wildcard $(librt_DIR)/*.c)) librt_filter_SRC := ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) @@ -45,7 +44,6 @@ librt_filter_SRC += $(if $(UCLIBC_HAS_ADVANCED_REALTIME),, \ librt_filter_SRC += $(if $(UCLIBC_HAS_STUBS),,rt_stubs.c) librt_SRC := $(filter-out $(librt_filter_SRC),$(librt_SRC)) - librt_OBJ := $(patsubst %.c,$(librt_OUT)/%.o,$(librt_SRC)) librt_OBJ += $(patsubst $(librt_DIR)/%.S,$(librt_OUT)/%.o,$(librt_SSRC)) @@ -59,6 +57,7 @@ librt-a-y += $(librt_OBJ) endif librt-so-y += $(librt_OBJ:.o=.oS) +ifeq ($(UCLIBC_HAS_REALTIME),y) lib-a-y += $(top_builddir)lib/librt.a lib-so-y += $(top_builddir)lib/librt.so endif -- cgit v1.2.3 From 03cc2041fc21889ca2256d0f1de76683bed4e94e Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Apr 2015 23:58:41 +0200 Subject: librt: Add missing __dso_handle Signed-off-by: Bernhard Reutner-Fischer --- librt/Makefile.in | 1 + librt/dso_handle.c | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 librt/dso_handle.c diff --git a/librt/Makefile.in b/librt/Makefile.in index 4e81764b8..1536a5cb9 100644 --- a/librt/Makefile.in +++ b/librt/Makefile.in @@ -42,6 +42,7 @@ librt_filter_SRC += $(if $(UCLIBC_HAS_ADVANCED_REALTIME),, \ spawn_faction_init.c) librt_filter_SRC += $(if $(UCLIBC_HAS_STUBS),,rt_stubs.c) +librt_filter_SRC += $(if $(HAS_NO_THREADS),dso_handle.c) librt_SRC := $(filter-out $(librt_filter_SRC),$(librt_SRC)) librt_OBJ := $(patsubst %.c,$(librt_OUT)/%.o,$(librt_SRC)) diff --git a/librt/dso_handle.c b/librt/dso_handle.c new file mode 100644 index 000000000..633907103 --- /dev/null +++ b/librt/dso_handle.c @@ -0,0 +1,5 @@ +/* Copyright (C) 2015 Bernhard Reutner-Fischer + * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball. + */ + +const void *const __dso_handle attribute_hidden = &__dso_handle; -- cgit v1.2.3 From c78cc48514723c9182a4fb5baa35bd59b8485cc7 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Apr 2015 23:58:41 +0200 Subject: arm: thumb1: Fix conflicting types for _v3 In file included from ./include/sys/syscall.h:33:0, from libc/sysdeps/linux/common/sync_file_range.c:10: libc/sysdeps/linux/common/sync_file_range.c: In function '__sync_file_range_nocancel': ./include/bits/syscalls.h:144:16: error: conflicting types for '_v3' register int _v3 __asm__ ("v3") = _v3tmp; ^ ./libc/sysdeps/linux/arm/sysdep.h:281:7: note: in expansion of macro 'LOAD_ARGS_7' LOAD_ARGS_##nr (args) \ ^ ./libc/sysdeps/linux/arm/sysdep.h:324:2: note: in expansion of macro 'INTERNAL_SYSCALL_RAW' INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args) ^ ./libc/sysdeps/linux/arm/sysdep.h:256:40: note: in expansion of macro 'INTERNAL_SYSCALL' ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args); \ ^ libc/sysdeps/linux/common/sync_file_range.c:32:9: note: in expansion of macro 'INLINE_SYSCALL' return INLINE_SYSCALL(sync_file_range, 7, fd, 0, ^ In file included from ./libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h:18:0, from ./include/cancel.h:58, from libc/sysdeps/linux/common/sync_file_range.c:15: ./libc/sysdeps/linux/arm/sysdep.h:280:21: note: previous definition of '_v3' was here register int *_v3 __asm__ ("v3") = _sys_buf; \ ... Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arm/bits/syscalls.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libc/sysdeps/linux/arm/bits/syscalls.h b/libc/sysdeps/linux/arm/bits/syscalls.h index 6b747d91b..5544ca652 100644 --- a/libc/sysdeps/linux/arm/bits/syscalls.h +++ b/libc/sysdeps/linux/arm/bits/syscalls.h @@ -87,15 +87,15 @@ { \ int _sys_buf[2]; \ register int __a1 __asm__ ("a1"); \ - register int *_v3 __asm__ ("v3") = _sys_buf; \ - *_v3 = (int) (name); \ + register int *__v3 __asm__ ("v3") = _sys_buf; \ + *__v3 = (int) (name); \ LOAD_ARGS_##nr (args) \ __asm__ __volatile__ ("str r7, [v3, #4]\n" \ "\tldr r7, [v3]\n" \ "\tswi 0 @ syscall " #name "\n" \ "\tldr r7, [v3, #4]" \ : "=r" (__a1) \ - : "r" (_v3) ASM_ARGS_##nr \ + : "r" (__v3) ASM_ARGS_##nr \ : "memory"); \ __internal_sys_result = __a1; \ } \ @@ -129,20 +129,20 @@ register int __a4 __asm__ ("a4") = __a4tmp; #define ASM_ARGS_4 ASM_ARGS_3, "r" (__a4) #define LOAD_ARGS_5(a1, a2, a3, a4, a5) \ - int _v1tmp = (int) (a5); \ + int __v1tmp = (int) (a5); \ LOAD_ARGS_4 (a1, a2, a3, a4) \ - register int _v1 __asm__ ("v1") = _v1tmp; -#define ASM_ARGS_5 ASM_ARGS_4, "r" (_v1) + register int __v1 __asm__ ("v1") = __v1tmp; +#define ASM_ARGS_5 ASM_ARGS_4, "r" (__v1) #define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \ - int _v2tmp = (int) (a6); \ + int __v2tmp = (int) (a6); \ LOAD_ARGS_5 (a1, a2, a3, a4, a5) \ - register int _v2 __asm__ ("v2") = _v2tmp; -#define ASM_ARGS_6 ASM_ARGS_5, "r" (_v2) + register int __v2 __asm__ ("v2") = __v2tmp; +#define ASM_ARGS_6 ASM_ARGS_5, "r" (__v2) #define LOAD_ARGS_7(a1, a2, a3, a4, a5, a6, a7) \ - int _v3tmp = (int) (a7); \ + int __v3tmp = (int) (a7); \ LOAD_ARGS_6 (a1, a2, a3, a4, a5, a6) \ - register int _v3 __asm__ ("v3") = _v3tmp; -#define ASM_ARGS_7 ASM_ARGS_6, "r" (_v3) + register int __v3 __asm__ ("v3") = __v3tmp; +#define ASM_ARGS_7 ASM_ARGS_6, "r" (__v3) #endif /* __ASSEMBLER__ */ -- cgit v1.2.3