patches/glibc/2.3.6/140-cygwin.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jan 17 23:06:02 2010 +0100 (2010-01-17)
changeset 1740 c57458bb354d
parent 402 197e1b49586e
permissions -rw-r--r--
configure: do not require hg when configuring in an hg clone

When configuring in an hg clone, we need hg to compute the version string.
It can happen that users do not have Mercurial (eg. if they got a snapshot
rather that they did a full clone). In this case, we can still run, of
course, so simply fill the version string with a sufficiently explicit
value, that does not require hg. The date is a good candidate.
yann@402
     1
Fixes
yann@402
     2
elf/librtld.os: In function `process_envvars': : undefined reference to `__access'
yann@402
     3
...
yann@402
     4
when building glibc-2.3.x on cygwin
yann@402
     5
yann@402
     6
Idea from
yann@402
     7
http://sources.redhat.com/ml/bug-glibc/2002-01/msg00071/glibc-2.2-cygin-shared.patch
yann@402
     8
Basically, make glibc use .oST as suffix for 'object static'
yann@402
     9
instead of .oS, since cygwin has trouble distinguishing .os from .oS
yann@402
    10
(Original patch had .on, but .oST is more mnemonic for 'object static')
yann@402
    11
yann@402
    12
glibc-linuxthreads-2.3.5 also requires a patch, see 
yann@402
    13
../glibc-linuxthreads-2.3.5/glibc-linuxthreads-2.3.5-cygwin.patch
yann@402
    14
yann@402
    15
[ forward ported to glibc-2.3.5 by Petr Cvachoucek:
yann@402
    16
yann@402
    17
Message-ID: <4282FCBA.3040000@unicontrols.cz>
yann@402
    18
Date: Thu, 12 May 2005 08:50:34 +0200
yann@402
    19
From: Petr Cvachoucek <cvachoucek@unicontrols.cz>
yann@402
    20
To: Dan Kegel <dank@kegel.com>
yann@402
    21
CC:  crossgcc@sources.redhat.com
yann@402
    22
Subject: Patches to build gcc 3.4.3 / glibc 2.3.5 on cygwin
yann@402
    23
yann@402
    24
Hi Dan,
yann@402
    25
following patches are needed to build gcc-3.4.3/glibc-2.3.5 toolchain
yann@402
    26
on cygwin. Tested to build toolchains for powerpc 604 and 750 targets.
yann@402
    27
yann@402
    28
-- 
yann@402
    29
                     Petr Cvachoucek
yann@402
    30
                     Unicontrols a.s.
yann@402
    31
                     http://www.unicontrols.cz
yann@402
    32
]
yann@402
    33
yann@402
    34
diff -aur glibc-2.3.5/Makeconfig glibc-2.3.5-cygwin/Makeconfig
yann@402
    35
--- glibc-2.3.5/Makeconfig	2005-02-16 11:50:19.000000000 +0100
yann@402
    36
+++ glibc-2.3.5-cygwin/Makeconfig	2005-05-11 08:24:51.046875000 +0200
yann@402
    37
@@ -449,7 +449,7 @@
yann@402
    38
 # run the linked programs.
yann@402
    39
 link-libc = -Wl,-rpath-link=$(rpath-link) \
yann@402
    40
 	    $(common-objpfx)libc.so$(libc.so-version) \
yann@402
    41
-	    $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib)
yann@402
    42
+	    $(common-objpfx)$(patsubst %,$(libtype.oST),c) $(gnulib)
yann@402
    43
 # This is how to find at build-time things that will be installed there.
yann@402
    44
 rpath-dirs = math elf dlfcn nss nis rt resolv crypt
yann@402
    45
 endif
yann@402
    46
@@ -656,7 +656,7 @@
yann@402
    47
 # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
yann@402
    48
 # to pass different flags for each flavor.
yann@402
    49
 libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o))
yann@402
    50
-all-object-suffixes := .o .os .op .og .ob .oS
yann@402
    51
+all-object-suffixes := .o .os .op .og .ob .oST
yann@402
    52
 object-suffixes :=
yann@402
    53
 CPPFLAGS-.o = $(pic-default)
yann@402
    54
 CFLAGS-.o = $(filter %frame-pointer,$(+cflags))
yann@402
    55
@@ -712,14 +712,14 @@
yann@402
    56
 
yann@402
    57
 ifeq (yes,$(build-shared))
yann@402
    58
 # Build special library that contains the static-only routines for libc.
yann@402
    59
-object-suffixes-for-libc += .oS
yann@402
    60
+object-suffixes-for-libc += .oST
yann@402
    61
 
yann@402
    62
 # Must build the routines as PIC, though, because they can end up in (users')
yann@402
    63
 # shared objects.  We don't want to use CFLAGS-os because users may, for
yann@402
    64
 # example, make that processor-specific.
yann@402
    65
-CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag)
yann@402
    66
-CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
yann@402
    67
-libtype.oS = lib%_nonshared.a
yann@402
    68
+CFLAGS-.oST = $(CFLAGS-.o) $(PIC-ccflag)
yann@402
    69
+CPPFLAGS-.oST = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
yann@402
    70
+libtype.oST = lib%_nonshared.a
yann@402
    71
 endif
yann@402
    72
 
yann@402
    73
 # The assembler can generate debug information too.
yann@402
    74
diff -aur glibc-2.3.5/Makerules glibc-2.3.5-cygwin/Makerules
yann@402
    75
--- glibc-2.3.5/Makerules	2004-12-15 19:52:39.000000000 +0100
yann@402
    76
+++ glibc-2.3.5-cygwin/Makerules	2005-05-11 08:25:33.578125000 +0200
yann@402
    77
@@ -416,7 +416,7 @@
yann@402
    78
 # Bounded pointer thunks are only built for *.ob
yann@402
    79
 elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks))
yann@402
    80
 
yann@402
    81
-elide-routines.oS += $(filter-out $(static-only-routines),\
yann@402
    82
+elide-routines.oST += $(filter-out $(static-only-routines),\
yann@402
    83
 				  $(routines) $(aux) $(sysdep_routines)) \
yann@402
    84
 		     $(elide-bp-thunks)
yann@402
    85
 elide-routines.os += $(static-only-routines) $(elide-bp-thunks)
yann@402
    86
@@ -961,7 +961,7 @@
yann@402
    87
 install: $(inst_libdir)/libc.so
yann@402
    88
 $(inst_libdir)/libc.so: $(common-objpfx)format.lds \
yann@402
    89
 			$(common-objpfx)libc.so$(libc.so-version) \
yann@402
    90
-			$(inst_libdir)/$(patsubst %,$(libtype.oS),\
yann@402
    91
+			$(inst_libdir)/$(patsubst %,$(libtype.oST),\
yann@402
    92
 						  $(libprefix)$(libc-name)) \
yann@402
    93
 			$(+force)
yann@402
    94
 	(echo '/* GNU ld script';\
yann@402
    95
@@ -969,7 +969,7 @@
yann@402
    96
 	 echo '   the static library, so try that secondarily.  */';\
yann@402
    97
 	 cat $<; \
yann@402
    98
 	 echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \
yann@402
    99
-	      '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
yann@402
   100
+	      '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)$(libc-name))'\
yann@402
   101
 	      ')' \
yann@402
   102
 	) > $@.new
yann@402
   103
 	mv -f $@.new $@
yann@402
   104
diff -aur glibc-2.3.5/extra-lib.mk glibc-2.3.5-cygwin/extra-lib.mk
yann@402
   105
--- glibc-2.3.5/extra-lib.mk	2004-12-02 23:54:47.000000000 +0100
yann@402
   106
+++ glibc-2.3.5-cygwin/extra-lib.mk	2005-05-11 08:27:28.156250000 +0200
yann@402
   107
@@ -13,7 +13,7 @@
yann@402
   108
 
yann@402
   109
 ifneq (,$($(lib)-static-only-routines))
yann@402
   110
 ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version)))
yann@402
   111
-object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS)
yann@402
   112
+object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oST)
yann@402
   113
 endif
yann@402
   114
 endif
yann@402
   115
 
yann@402
   116
@@ -29,7 +29,7 @@
yann@402
   117
 
yann@402
   118
 # Add each flavor of library to the lists of things to build and install.
yann@402
   119
 install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o)))
yann@402
   120
-extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\
yann@402
   121
+extra-objs += $(foreach o,$(filter-out .os .oST,$(object-suffixes-$(lib))),\
yann@402
   122
 			$(patsubst %,%$o,$(filter-out \
yann@402
   123
 					   $($(lib)-shared-only-routines),\
yann@402
   124
 					   $(all-$(lib)-routines))))
yann@402
   125
@@ -57,7 +57,7 @@
yann@402
   126
 
yann@402
   127
 
yann@402
   128
 # Use o-iterator.mk to generate a rule for each flavor of library.
yann@402
   129
-ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib))))
yann@402
   130
+ifneq (,$(filter-out .os .oST,$(object-suffixes-$(lib))))
yann@402
   131
 define o-iterator-doit
yann@402
   132
 $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \
yann@402
   133
   $(patsubst %,$(objpfx)%$o,\
yann@402
   134
@@ -65,7 +65,7 @@
yann@402
   135
 			  $(all-$(lib)-routines))); \
yann@402
   136
 	$$(build-extra-lib)
yann@402
   137
 endef
yann@402
   138
-object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib)))
yann@402
   139
+object-suffixes-left = $(filter-out .os .oST,$(object-suffixes-$(lib)))
yann@402
   140
 include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left))
yann@402
   141
 endif
yann@402
   142
 
yann@402
   143
@@ -77,9 +77,9 @@
yann@402
   144
 	$(build-extra-lib)
yann@402
   145
 endif
yann@402
   146
 
yann@402
   147
-ifneq (,$(filter .oS,$(object-suffixes-$(lib))))
yann@402
   148
-$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \
yann@402
   149
-  $(patsubst %,$(objpfx)%.oS,\
yann@402
   150
+ifneq (,$(filter .oST,$(object-suffixes-$(lib))))
yann@402
   151
+$(objpfx)$(patsubst %,$(libtype.oST),$(lib:lib%=%)): \
yann@402
   152
+  $(patsubst %,$(objpfx)%.oST,\
yann@402
   153
 	     $(filter $($(lib)-static-only-routines),\
yann@402
   154
 		      $(all-$(lib)-routines)))
yann@402
   155
 	$(build-extra-lib)
yann@402
   156
diff -aur glibc-2.3.5/nptl/Makefile glibc-2.3.5-cygwin/nptl/Makefile
yann@402
   157
--- glibc-2.3.5/nptl/Makefile	2005-02-16 09:45:56.000000000 +0100
yann@402
   158
+++ glibc-2.3.5-cygwin/nptl/Makefile	2005-05-11 08:26:01.812500000 +0200
yann@402
   159
@@ -360,7 +360,7 @@
yann@402
   160
 
yann@402
   161
 $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \
yann@402
   162
 			      $(objpfx)libpthread.so$(libpthread.so-version) \
yann@402
   163
-			      $(inst_libdir)/$(patsubst %,$(libtype.oS),\
yann@402
   164
+			      $(inst_libdir)/$(patsubst %,$(libtype.oST),\
yann@402
   165
 							$(libprefix)pthread) \
yann@402
   166
 			      $(+force)
yann@402
   167
 	(echo '/* GNU ld script';\
yann@402
   168
@@ -368,7 +368,7 @@
yann@402
   169
 	 echo '   the static library, so try that secondarily.  */';\
yann@402
   170
 	 cat $<; \
yann@402
   171
 	 echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \
yann@402
   172
-	      '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\
yann@402
   173
+	      '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\
yann@402
   174
 	      ')' \
yann@402
   175
 	) > $@.new
yann@402
   176
 	mv -f $@.new $@
yann@402
   177
diff -aur glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile
yann@402
   178
--- glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile	2004-08-16 08:46:14.000000000 +0200
yann@402
   179
+++ glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile	2005-05-11 08:26:25.937500000 +0200
yann@402
   180
@@ -10,4 +10,4 @@
yann@402
   181
 ASFLAGS-.op += -Wa,-Av9a
yann@402
   182
 ASFLAGS-.og += -Wa,-Av9a
yann@402
   183
 ASFLAGS-.ob += -Wa,-Av9a
yann@402
   184
-ASFLAGS-.oS += -Wa,-Av9a
yann@402
   185
+ASFLAGS-.oST += -Wa,-Av9a
yann@402
   186
yann@402
   187
Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>