summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2015-04-15 12:43:14 -0500
committerWaldemar Brodkorb <wbx@openadk.org>2015-04-15 12:43:14 -0500
commit003946e5f5ad775ef64b72176018bf918899c5d3 (patch)
tree94404f0abac8db76d2fe68f2573977be88c9d1db
parentdd64f5afc19274f4e92afde3d13d1e8f0d2ee2d5 (diff)
parentc78cc48514723c9182a4fb5baa35bd59b8485cc7 (diff)
merge uClibc master
-rw-r--r--Makerules13
-rw-r--r--Rules.mak15
-rw-r--r--include/.gitignore1
-rw-r--r--ldso/ldso/Makefile.in13
-rw-r--r--libc/sysdeps/linux/arm/bits/syscalls.h25
-rw-r--r--librt/Makefile.in22
-rw-r--r--librt/dso_handle.c5
7 files changed, 48 insertions, 46 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 77ca3cc43..a27929e6a 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -252,6 +252,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
@@ -663,14 +664,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
@@ -784,8 +789,12 @@ endif
ASFLAGS += $(ASFLAG_--noexecstack)
LIBGCC_CFLAGS ?= $(CFLAGS) $(CPU_CFLAGS-y)
-$(eval $(call cache-output-var,LIBGCC,$(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name))
-LIBGCC_DIR:=$(dir $(LIBGCC))
+$(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_A))
+LIBGCC := $(LIBGCC_A) $(if $(DODEBUG),$(LIBGCC_EH))
# moved from libpthread/linuxthreads
ifeq ($(UCLIBC_CTOR_DTOR),y)
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
diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in
index a0ae7b3cd..424131ccb 100644
--- a/ldso/ldso/Makefile.in
+++ b/ldso/ldso/Makefile.in
@@ -38,10 +38,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
@@ -67,17 +70,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)
diff --git a/libc/sysdeps/linux/arm/bits/syscalls.h b/libc/sysdeps/linux/arm/bits/syscalls.h
index 778cc3453..e447a7b2d 100644
--- a/libc/sysdeps/linux/arm/bits/syscalls.h
+++ b/libc/sysdeps/linux/arm/bits/syscalls.h
@@ -53,15 +53,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; \
} \
@@ -111,23 +111,22 @@
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)
#ifndef __thumb__
#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
-
#endif /* __ASSEMBLER__ */
#endif /* _BITS_SYSCALLS_H */
diff --git a/librt/Makefile.in b/librt/Makefile.in
index 1c1559c4a..1536a5cb9 100644
--- a/librt/Makefile.in
+++ b/librt/Makefile.in
@@ -13,19 +13,15 @@ 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
-START_FILE-librt.so := $(SHARED_START_FILES)
-END_FILE-librt.so := $(SHARED_END_FILES)
-
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,8 +41,10 @@ librt_filter_SRC += $(if $(UCLIBC_HAS_ADVANCED_REALTIME),, \
spawn_faction_addopen.c \
spawn_faction_init.c)
-librt_SRC := $(filter-out $(librt_filter_SRC),$(librt_SRC))
+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))
librt_OBJ += $(patsubst $(librt_DIR)/%.S,$(librt_OUT)/%.o,$(librt_SSRC))
@@ -60,15 +58,19 @@ 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
+librt-dep-y := $(libc.depend)
+librt-dep-$(UCLIBC_HAS_THREADS_NATIVE) += $(libpthread.depend) $(libdl.depend)
-ifeq ($(DOPIC)$(UCLIBC_HAS_THREADS_NATIVE),yn)
-$(top_builddir)lib/librt.so: $(top_builddir)lib/librt.a $(libc.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 $(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))
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;