patches/uClibc/0.9.32/120-ctor-dtor-nptl-Fix-init-and-fini-function-compilation.patch
changeset 2518 aa833630f29c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/uClibc/0.9.32/120-ctor-dtor-nptl-Fix-init-and-fini-function-compilation.patch	Mon Jun 27 00:12:29 2011 +0200
     1.3 @@ -0,0 +1,182 @@
     1.4 +commit f9e311d11c374e68736c741ede1845bdc8091627
     1.5 +Author: Khem Raj <raj.khem@gmail.com>
     1.6 +Date:   Mon Jun 13 16:30:55 2011 -0700
     1.7 +
     1.8 +    ctor/dtor nptl: Fix init and fini function compilation
     1.9 +    
    1.10 +    We need to define the rules for .S files so it
    1.11 +    gets the include paths some architectures like mips
    1.12 +    include headers
    1.13 +    
    1.14 +    Some architectures e.g. SH have their own version
    1.15 +    of pt-initfini.c so look for that first before resorting
    1.16 +    to generic version of pt-initfini.c
    1.17 +    
    1.18 +    Signed-off-by: Khem Raj <raj.khem@gmail.com>
    1.19 +    Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
    1.20 +
    1.21 +diff --git a/libc/sysdeps/linux/mips/crtn.S b/libc/sysdeps/linux/mips/crtn.S
    1.22 +index cedd593..f3756a2 100644
    1.23 +--- a/libc/sysdeps/linux/mips/crtn.S
    1.24 ++++ b/libc/sysdeps/linux/mips/crtn.S
    1.25 +@@ -10,7 +10,6 @@
    1.26 + #NO_APP
    1.27 + 	.align	2
    1.28 + 	.globl	_init
    1.29 +-	.ent	_init
    1.30 + 	.type	_init, @function
    1.31 + #NO_APP
    1.32 + 	lw	$31,28($sp)
    1.33 +@@ -22,14 +21,12 @@
    1.34 + 	.set	macro
    1.35 + 	.set	reorder
    1.36 + 
    1.37 +-	.end	_init
    1.38 + #APP
    1.39 + 	
    1.40 + 	.section .fini
    1.41 + #NO_APP
    1.42 + 	.align	2
    1.43 + 	.globl	_fini
    1.44 +-	.ent	_fini
    1.45 + 	.type	_fini, @function
    1.46 + #NO_APP
    1.47 + 	lw	$31,28($sp)
    1.48 +@@ -41,7 +38,6 @@
    1.49 + 	.set	macro
    1.50 + 	.set	reorder
    1.51 + 
    1.52 +-	.end	_fini
    1.53 + #APP
    1.54 + 	
    1.55 + 	.ident	"GCC: (GNU) 3.3.2"
    1.56 +@@ -54,10 +50,8 @@
    1.57 + 	
    1.58 + 	.section .init
    1.59 + #NO_APP
    1.60 +-	.align	2
    1.61 + 	.align	3
    1.62 + 	.globl	_init
    1.63 +-	.ent	_init
    1.64 + 	.type	_init, @function
    1.65 + #NO_APP
    1.66 + 	ld	$31,8($sp)
    1.67 +@@ -68,16 +62,12 @@
    1.68 + 	addiu	$sp,$sp,16
    1.69 + 	.set	macro
    1.70 + 	.set	reorder
    1.71 +-
    1.72 +-	.end	_init
    1.73 + #APP
    1.74 + 	
    1.75 + 	.section .fini
    1.76 + #NO_APP
    1.77 +-	.align	2
    1.78 + 	.align	3
    1.79 + 	.globl	_fini
    1.80 +-	.ent	_fini
    1.81 + 	.type	_fini, @function
    1.82 + #NO_APP
    1.83 + 	ld	$31,8($sp)
    1.84 +@@ -89,7 +79,6 @@
    1.85 + 	.set	macro
    1.86 + 	.set	reorder
    1.87 + 
    1.88 +-	.end	_fini
    1.89 + #APP
    1.90 + 	
    1.91 + 	.ident	"GCC: (GNU) 3.4.3"
    1.92 +@@ -105,7 +94,6 @@
    1.93 + #NO_APP
    1.94 + 	.align	2
    1.95 + 	.globl	_init
    1.96 +-	.ent	_init
    1.97 + 	.type	_init, @function
    1.98 + #NO_APP
    1.99 + 	ld	$31,24($sp)
   1.100 +@@ -118,14 +106,12 @@
   1.101 + 	.set	macro
   1.102 + 	.set	reorder
   1.103 + 
   1.104 +-	.end	_init
   1.105 + #APP
   1.106 + 	
   1.107 + 	.section .fini
   1.108 + #NO_APP
   1.109 + 	.align	2
   1.110 + 	.globl	_fini
   1.111 +-	.ent	_fini
   1.112 + 	.type	_fini, @function
   1.113 + #NO_APP
   1.114 + 	ld	$31,24($sp)
   1.115 +@@ -138,7 +124,6 @@
   1.116 + 	.set	macro
   1.117 + 	.set	reorder
   1.118 + 
   1.119 +-	.end	_fini
   1.120 + #APP
   1.121 + 	
   1.122 + 	.ident	"GCC: (GNU) 3.3.2"
   1.123 +diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in
   1.124 +index 92d72a6..849bd59 100644
   1.125 +--- a/libpthread/nptl/Makefile.in
   1.126 ++++ b/libpthread/nptl/Makefile.in
   1.127 +@@ -64,8 +64,8 @@ endif
   1.128 + librt-so-y += $(librt_OBJS:.o=.oS) $(librt-pt-shared-only-routines-y:.o=.oS)
   1.129 + 
   1.130 + ifeq ($(UCLIBC_CTOR_DTOR),y)
   1.131 +-START_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/crti.o
   1.132 +-END_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/crtn.o
   1.133 ++START_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/pt-crti.o
   1.134 ++END_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/pt-crtn.o
   1.135 + LDFLAGS-libpthread.so += -nostartfiles
   1.136 + $(top_builddir)lib/libpthread.so: | $(START_FILE-libpthread.so) $(END_FILE-libpthread.so)
   1.137 + endif
   1.138 +diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in
   1.139 +index d93b3a5..398eaea 100644
   1.140 +--- a/libpthread/nptl/sysdeps/pthread/Makefile.in
   1.141 ++++ b/libpthread/nptl/sysdeps/pthread/Makefile.in
   1.142 +@@ -73,23 +73,37 @@ CFLAGS-pt-initfini.c = -S -g0 $(PICFLAG) -fno-inline-functions	\
   1.143 + 			-finhibit-size-directive			\
   1.144 + 			-fno-asynchronous-unwind-tables -fno-unwind-tables \
   1.145 + 			$(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,))
   1.146 +-ASFLAGS-crti.S = -g0
   1.147 +-ASFLAGS-crtn.S = -g0
   1.148 + 
   1.149 +-$(libpthread_pthread_OUT)/pt-initfini.s: $(libpthread_pthread_DIR)/pt-initfini.c
   1.150 ++#ASFLAGS += $(PICFLAG) -I$(top_srcdir)include -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)
   1.151 ++ifneq ($(wildcard $(libpthread_DIR)/sysdeps/linux/$(TARGET_ARCH)/pt-initfini.c),)
   1.152 ++PTHREAD_INITFINI := $(libpthread_DIR)/sysdeps/linux/$(TARGET_ARCH)/pt-initfini.c
   1.153 ++else
   1.154 ++PTHREAD_INITFINI := $(libpthread_pthread_DIR)/pt-initfini.c
   1.155 ++endif
   1.156 ++
   1.157 ++ASFLAGS-pt-crti.S =  $(PICFLAG)
   1.158 ++ASFLAGS-pt-crtn.S =  $(PICFLAG)
   1.159 ++
   1.160 ++$(libpthread_pthread_OUT)/pt-crti.o: $(libpthread_pthread_OUT)/pt-crti.S
   1.161 ++	$(compile.S)
   1.162 ++
   1.163 ++$(libpthread_pthread_OUT)/pt-crtn.o: $(libpthread_pthread_OUT)/pt-crtn.S
   1.164 ++	$(compile.S)
   1.165 ++
   1.166 ++$(libpthread_pthread_OUT)/pt-initfini.s: $(PTHREAD_INITFINI)
   1.167 + 	$(compile.c)
   1.168 +-$(libpthread_pthread_OUT)/defs.h: $(libpthread_pthread_DIR)/pt-initfini.c
   1.169 ++$(libpthread_pthread_OUT)/defs.h: $(PTHREAD_INITFINI)
   1.170 + 	$(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
   1.171 + 		$(AWK) -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
   1.172 + 	$(Q)mv $@.tmp $@
   1.173 + 
   1.174 +-$(libpthread_pthread_OUT)/crti.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
   1.175 ++$(libpthread_pthread_OUT)/pt-crti.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
   1.176 + 	$(do_sed) -n -e '/[ 	]*\.file/d' \
   1.177 + 		-e '1,/@HEADER_ENDS/p' \
   1.178 + 		-e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
   1.179 + 		-e '/@TRAILER_BEGINS/,$$p' $< > $@.tmp
   1.180 + 	$(Q)mv $@.tmp $@
   1.181 +-$(libpthread_pthread_OUT)/crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
   1.182 ++$(libpthread_pthread_OUT)/pt-crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
   1.183 + 	$(do_sed) -n -e '/[ 	]*\.file/d' \
   1.184 + 		-e '1,/@HEADER_ENDS/p' \
   1.185 + 		-e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \