patches/uClibc/0.9.32/120-ctor-dtor-nptl-Fix-init-and-fini-function-compilation.patch
1 commit f9e311d11c374e68736c741ede1845bdc8091627
2 Author: Khem Raj <raj.khem@gmail.com>
3 Date: Mon Jun 13 16:30:55 2011 -0700
5 ctor/dtor nptl: Fix init and fini function compilation
7 We need to define the rules for .S files so it
8 gets the include paths some architectures like mips
11 Some architectures e.g. SH have their own version
12 of pt-initfini.c so look for that first before resorting
13 to generic version of pt-initfini.c
15 Signed-off-by: Khem Raj <raj.khem@gmail.com>
16 Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
18 diff --git a/libc/sysdeps/linux/mips/crtn.S b/libc/sysdeps/linux/mips/crtn.S
19 index cedd593..f3756a2 100644
20 --- a/libc/sysdeps/linux/mips/crtn.S
21 +++ b/libc/sysdeps/linux/mips/crtn.S
27 .type _init, @function
42 .type _fini, @function
52 .ident "GCC: (GNU) 3.3.2"
61 .type _init, @function
78 .type _fini, @function
88 .ident "GCC: (GNU) 3.4.3"
94 .type _init, @function
109 .type _fini, @function
119 .ident "GCC: (GNU) 3.3.2"
120 diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in
121 index 92d72a6..849bd59 100644
122 --- a/libpthread/nptl/Makefile.in
123 +++ b/libpthread/nptl/Makefile.in
124 @@ -64,8 +64,8 @@ endif
125 librt-so-y += $(librt_OBJS:.o=.oS) $(librt-pt-shared-only-routines-y:.o=.oS)
127 ifeq ($(UCLIBC_CTOR_DTOR),y)
128 -START_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/crti.o
129 -END_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/crtn.o
130 +START_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/pt-crti.o
131 +END_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/pt-crtn.o
132 LDFLAGS-libpthread.so += -nostartfiles
133 $(top_builddir)lib/libpthread.so: | $(START_FILE-libpthread.so) $(END_FILE-libpthread.so)
135 diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in
136 index d93b3a5..398eaea 100644
137 --- a/libpthread/nptl/sysdeps/pthread/Makefile.in
138 +++ b/libpthread/nptl/sysdeps/pthread/Makefile.in
139 @@ -73,23 +73,37 @@ CFLAGS-pt-initfini.c = -S -g0 $(PICFLAG) -fno-inline-functions \
140 -finhibit-size-directive \
141 -fno-asynchronous-unwind-tables -fno-unwind-tables \
142 $(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,))
143 -ASFLAGS-crti.S = -g0
144 -ASFLAGS-crtn.S = -g0
146 -$(libpthread_pthread_OUT)/pt-initfini.s: $(libpthread_pthread_DIR)/pt-initfini.c
147 +#ASFLAGS += $(PICFLAG) -I$(top_srcdir)include -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)
148 +ifneq ($(wildcard $(libpthread_DIR)/sysdeps/linux/$(TARGET_ARCH)/pt-initfini.c),)
149 +PTHREAD_INITFINI := $(libpthread_DIR)/sysdeps/linux/$(TARGET_ARCH)/pt-initfini.c
151 +PTHREAD_INITFINI := $(libpthread_pthread_DIR)/pt-initfini.c
154 +ASFLAGS-pt-crti.S = $(PICFLAG)
155 +ASFLAGS-pt-crtn.S = $(PICFLAG)
157 +$(libpthread_pthread_OUT)/pt-crti.o: $(libpthread_pthread_OUT)/pt-crti.S
160 +$(libpthread_pthread_OUT)/pt-crtn.o: $(libpthread_pthread_OUT)/pt-crtn.S
163 +$(libpthread_pthread_OUT)/pt-initfini.s: $(PTHREAD_INITFINI)
165 -$(libpthread_pthread_OUT)/defs.h: $(libpthread_pthread_DIR)/pt-initfini.c
166 +$(libpthread_pthread_OUT)/defs.h: $(PTHREAD_INITFINI)
167 $(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
168 $(AWK) -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
171 -$(libpthread_pthread_OUT)/crti.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
172 +$(libpthread_pthread_OUT)/pt-crti.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
173 $(do_sed) -n -e '/[ ]*\.file/d' \
174 -e '1,/@HEADER_ENDS/p' \
175 -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
176 -e '/@TRAILER_BEGINS/,$$p' $< > $@.tmp
178 -$(libpthread_pthread_OUT)/crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
179 +$(libpthread_pthread_OUT)/pt-crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
180 $(do_sed) -n -e '/[ ]*\.file/d' \
181 -e '1,/@HEADER_ENDS/p' \
182 -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \