summaryrefslogtreecommitdiff
path: root/libpthread
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2011-05-31 09:45:44 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2011-05-31 09:45:44 +0200
commit5c49e11c01b0baf4c2c54259e5ec06274251f0fa (patch)
tree6864e9b95f933ad22ae9a419464a832346df67fa /libpthread
parent204c7849029d90e5e3486670a6a07a76f949afd6 (diff)
NPTL: Fix CTOR_DTOR
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libpthread')
-rw-r--r--libpthread/nptl/.gitignore3
-rw-r--r--libpthread/nptl/Makefile.in12
-rw-r--r--libpthread/nptl/sysdeps/pthread/Makefile.in24
-rw-r--r--libpthread/nptl/sysdeps/pthread/defs.awk24
-rw-r--r--libpthread/nptl/sysdeps/pthread/pt-initfini.c4
5 files changed, 32 insertions, 35 deletions
diff --git a/libpthread/nptl/.gitignore b/libpthread/nptl/.gitignore
index ac44e0c5d..06395e1f5 100644
--- a/libpthread/nptl/.gitignore
+++ b/libpthread/nptl/.gitignore
@@ -18,6 +18,9 @@ sysdeps/unix/sysv/linux/lowlevelrobustlock.h
sysdeps/unix/sysv/linux/structsem.h
sysdeps/unix/sysv/linux/unwindbuf.h
sysdeps/unix/sysv/linux/pthread-pi-defines.h
+sysdeps/pthread/crt[in].S
+sysdeps/pthread/defs.h
+sysdeps/pthread/pt-initfini.s
#
# symlinks
#
diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in
index 3e9676ac8..70616a1fe 100644
--- a/libpthread/nptl/Makefile.in
+++ b/libpthread/nptl/Makefile.in
@@ -63,9 +63,11 @@ librt-a-y += $(librt_OBJS)
endif
librt-so-y += $(librt_OBJS:.o=.oS) $(librt-pt-shared-only-routines-y:.o=.oS)
-ifneq ($(UCLIBC_CTOR_DTOR),y)
-START_FILE-libpthread.so := $(top_builddir)/libpthread/nptl/sysdeps/pthread/crti.o $(SHARED_START_FILES)
-END_FILE-libpthread.so := $(SHARED_END_FILES) $(top_builddir)/libpthread/nptl/sysdeps/pthread/crtn.o
+ifeq ($(UCLIBC_CTOR_DTOR),y)
+START_FILE-libpthread.so := $(top_builddir)/libpthread/nptl/sysdeps/pthread/crti.o
+END_FILE-libpthread.so := $(top_builddir)/libpthread/nptl/sysdeps/pthread/crtn.o
+LDFLAGS-libpthread.so += -nostartfiles
+$(top_builddir)lib/libpthread.so: | $(START_FILE-libpthread.so) $(END_FILE-libpthread.so)
endif
libpthread_FULL_NAME := libpthread-$(VERSION).so
@@ -137,9 +139,9 @@ CLEAN_libpthread/nptl:
$(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a)
ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
-LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs
+LDFLAGS-libpthread.so += $(LDFLAGS_NOSTRIP) -Wl,-z,defs
else
-LDFLAGS-libpthread.so := $(LDFLAGS)
+LDFLAGS-libpthread.so += $(LDFLAGS)
endif
LDFLAGS-libpthread.so += $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so $(top_builddir)lib/libdl-$(VERSION).so \
diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in
index fc0c6ac3e..d93b3a55f 100644
--- a/libpthread/nptl/sysdeps/pthread/Makefile.in
+++ b/libpthread/nptl/sysdeps/pthread/Makefile.in
@@ -67,22 +67,34 @@ librt-pt-shared-only-routines-y = rt-unwind-resume.c
ifeq ($(UCLIBC_CTOR_DTOR),y)
CFLAGS-OMIT-pt-initfini.c = $(CFLAGS-pthread)
-CFLAGS-pt-initfini.c = -S -g0 -fPIC -fno-inline-functions \
+CFLAGS-pt-initfini.c = -S -g0 $(PICFLAG) -fno-inline-functions \
$(call check_gcc,-fno-unit-at-a-time,) \
+ $(SSP_DISABLE_FLAGS) \
-finhibit-size-directive \
+ -fno-asynchronous-unwind-tables -fno-unwind-tables \
$(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,))
ASFLAGS-crti.S = -g0
ASFLAGS-crtn.S = -g0
$(libpthread_pthread_OUT)/pt-initfini.s: $(libpthread_pthread_DIR)/pt-initfini.c
$(compile.c)
- $(do_sed) '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
- $(do_awk) $(libpthread_pthread_DIR)/defs.awk > $(libpthread_pthread_OUT)/defs.h
+$(libpthread_pthread_OUT)/defs.h: $(libpthread_pthread_DIR)/pt-initfini.c
+ $(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
+ $(AWK) -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
+ $(Q)mv $@.tmp $@
-$(libpthread_pthread_OUT)/crti.S $(libpthread_pthread_OUT)/crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s
- $(do_sed) -e '1,/@HEADER_ENDS/p' \
+$(libpthread_pthread_OUT)/crti.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
+ $(do_sed) -n -e '/[ ]*\.file/d' \
+ -e '1,/@HEADER_ENDS/p' \
-e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
- -e '/@TRAILER_BEGINS/,$$p' $< > $@
+ -e '/@TRAILER_BEGINS/,$$p' $< > $@.tmp
+ $(Q)mv $@.tmp $@
+$(libpthread_pthread_OUT)/crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
+ $(do_sed) -n -e '/[ ]*\.file/d' \
+ -e '1,/@HEADER_ENDS/p' \
+ -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
+ -e '/@TRAILER_BEGINS/,$$p' $< > $@.tmp
+ $(Q)mv $@.tmp $@
endif
# It would have been easier to just add dummy files that include the real
# impl, but ok.
diff --git a/libpthread/nptl/sysdeps/pthread/defs.awk b/libpthread/nptl/sysdeps/pthread/defs.awk
deleted file mode 100644
index d41d57bd7..000000000
--- a/libpthread/nptl/sysdeps/pthread/defs.awk
+++ /dev/null
@@ -1,24 +0,0 @@
-/^[ ]*\.endp/ { need_endp = 1 }
-/^[ ]*\.end/ { need_end = 1 }
-/^[ ]*\.align/ { if($2 > max) max = $2; }
-
-END {
- if(need_endp)
- {
- print "#define END_INIT .endp _init";
- print "#define END_FINI .endp _fini";
- } else if(need_end)
- {
- print "#define END_INIT .end _init";
- print "#define END_FINI .end _fini";
- }
- else
- {
- print "#define END_INIT";
- print "#define END_FINI";
- }
- if(max)
- print "#define ALIGN .align", max;
- else
- print "#define ALIGN";
-}
diff --git a/libpthread/nptl/sysdeps/pthread/pt-initfini.c b/libpthread/nptl/sysdeps/pthread/pt-initfini.c
index 1f81144d0..ccdce3e22 100644
--- a/libpthread/nptl/sysdeps/pthread/pt-initfini.c
+++ b/libpthread/nptl/sysdeps/pthread/pt-initfini.c
@@ -44,6 +44,10 @@
/* Embed an #include to pull in the alignment and .end directives. */
__asm__ ("\n#include \"defs.h\"");
+__asm__ ("\n#if defined __i686 && defined __ASSEMBLER__");
+__asm__ ("\n#undef __i686");
+__asm__ ("\n#define __i686 __i686");
+__asm__ ("\n#endif");
/* The initial common code ends here. */
__asm__ ("\n/*@HEADER_ENDS*/");