patches/glibc/2.7/300-binutils-_begin.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
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.
     1 --- glibc-2.7.OLD/elf/Makefile	2009-04-22 17:08:55.000000000 +0300
     2 +++ glibc-2.7/elf/Makefile	2009-04-22 18:09:18.000000000 +0300
     3 @@ -1,4 +1,4 @@
     4 -# Copyright (C) 1995-2004, 2005, 2006, 2007 Free Software Foundation, Inc.
     5 +# Copyright (C) 1995-2007, 2008, 2009 Free Software Foundation, Inc.
     6  # This file is part of the GNU C Library.
     7  
     8  # The GNU C Library is free software; you can redistribute it and/or
     9 @@ -23,7 +23,7 @@
    10  headers		= elf.h bits/elfclass.h link.h bits/link.h
    11  routines	= $(dl-routines) dl-support dl-iteratephdr \
    12  		  dl-addr enbl-secure dl-profstub \
    13 -		  dl-origin dl-libc dl-sym dl-tsd
    14 +		  dl-origin dl-libc dl-sym dl-tsd dl-sysdep
    15  
    16  # The core dynamic linking functions are in libc for the static and
    17  # profiled libraries.
    18 @@ -33,7 +33,8 @@
    19  				  execstack caller open close trampoline)
    20  all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
    21  # But they are absent from the shared libc, because that code is in ld.so.
    22 -elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin
    23 +elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \
    24 +		    dl-sysdep
    25  shared-only-routines += dl-caller
    26  
    27  # ld.so uses those routines, plus some special stuff for being the program
    28 @@ -120,13 +121,6 @@
    29  install-bin-script = ldd
    30  endif
    31  
    32 -ifeq (yes,$(build-static-nss))
    33 -nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
    34 -resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
    35 -otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
    36 -	     $(resolvobjdir)/libresolv.a
    37 -endif
    38 -
    39  others		= sprof sln
    40  install-bin	= sprof
    41  others-static   = sln
    42 @@ -165,14 +159,14 @@
    43  endif
    44  ifeq (yes,$(build-shared))
    45  tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
    46 -	 constload1 order $(tests-vis-$(have-protected)) noload filter unload \
    47 +	 constload1 order vismain noload filter unload \
    48  	 reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
    49  	 nodlopen nodlopen2 neededtest neededtest2 \
    50  	 neededtest3 neededtest4 unload2 lateglobal initfirst global \
    51  	 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
    52  	 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
    53  	 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
    54 -	 tst-tls-dlinfo \
    55 +	 tst-tls16 tst-tls17 tst-tls18 tst-tls-dlinfo \
    56  	 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
    57  	 tst-dlmodcount tst-dlopenrpath tst-deep1 \
    58  	 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
    59 @@ -181,16 +175,17 @@
    60  	 tst-stackguard1 tst-addr1 tst-thrlock
    61  #	 reldep9
    62  test-srcs = tst-pathopt
    63 -tests-vis-yes = vismain
    64  tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
    65  endif
    66  ifeq (yesyes,$(have-fpie)$(build-shared))
    67  tests: $(objpfx)tst-pie1.out
    68  endif
    69  tests: $(objpfx)tst-leaks1-mem
    70 +tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
    71 +tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
    72  modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
    73  		testobj1_1 failobj constload2 constload3 unloadmod \
    74 -		dep1 dep2 dep3 dep4 $(modules-vis-$(have-protected)) \
    75 +		dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
    76  		nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
    77  		nodel2mod1 nodel2mod2 nodel2mod3 \
    78  		nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
    79 @@ -206,7 +201,10 @@
    80  		tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
    81  		tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
    82  		tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
    83 -		tst-tlsmod15a tst-tlsmod15b \
    84 +		tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
    85 +		$(patsubst %,tst-tlsmod17a%,$(tlsmod17a-suffixes)) \
    86 +		tst-tlsmod17b \
    87 +		$(patsubst %,tst-tlsmod18a%,$(tlsmod18a-suffixes)) \
    88  		circlemod1 circlemod1a circlemod2 circlemod2a \
    89  		circlemod3 circlemod3a \
    90  		reldep8mod1 reldep8mod2 reldep8mod3 \
    91 @@ -226,7 +224,6 @@
    92  ifeq (yesyes,$(have-fpie)$(build-shared))
    93  modules-names += tst-piemod1
    94  endif
    95 -modules-vis-yes = vismod1 vismod2 vismod3
    96  modules-execstack-yes = tst-execstack-mod
    97  extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
    98  # We need this variable to be sure the test modules get the right CPPFLAGS.
    99 @@ -307,7 +304,7 @@
   100  		  $(LDFLAGS-rtld) -Wl,-z,defs -Wl,--verbose 2>&1 |	\
   101  		  LC_ALL=C \
   102  		  sed -e '/^=========/,/^=========/!d;/^=========/d'	\
   103 -		      -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
   104 +		      -e 's/\. = .* + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
   105  		  > $@.lds
   106  	$(LINK.o) -nostdlib -nostartfiles -shared -o $@			\
   107  		  $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now))	\
   108 @@ -315,7 +312,7 @@
   109  		  -Wl,-soname=$(rtld-installed-name) -T $@.lds
   110  	rm -f $@.lds
   111  	readelf -s $@ \
   112 -	  | awk '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
   113 +	  | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
   114  
   115  # interp.c exists just to get this string into the libraries.
   116  CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
   117 @@ -499,6 +496,7 @@
   118  tst-tlsmod14a.so-no-z-defs = yes
   119  tst-tlsmod14b.so-no-z-defs = yes
   120  tst-tlsmod15a.so-no-z-defs = yes
   121 +tst-tlsmod16b.so-no-z-defs = yes
   122  circlemod2.so-no-z-defs = yes
   123  circlemod3.so-no-z-defs = yes
   124  circlemod3a.so-no-z-defs = yes
   125 @@ -718,6 +716,22 @@
   126  
   127  
   128  
   129 +$(objpfx)tst-tls16: $(libdl)
   130 +$(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
   131 +
   132 +$(objpfx)tst-tls17: $(libdl)
   133 +$(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
   134 +$(patsubst %,$(objpfx)tst-tlsmod17a%.os,$(tlsmod17a-suffixes)): $(objpfx)tst-tlsmod17a%.os : tst-tlsmod17a.c
   135 +	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ -DN=$* -DNOT_IN_libc=1 $<
   136 +$(patsubst %,$(objpfx)tst-tlsmod17a%.so,$(tlsmod17a-suffixes)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
   137 +$(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)tst-tlsmod17a%.so,$(tlsmod17a-suffixes))
   138 +
   139 +$(objpfx)tst-tls18: $(libdl)
   140 +$(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)tst-tlsmod18a%.so,$(tlsmod18a-suffixes))
   141 +$(patsubst %,$(objpfx)tst-tlsmod18a%.os,$(tlsmod18a-suffixes)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
   142 +	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ -DN=$* -DNOT_IN_libc=1 $<
   143 +$(patsubst %,$(objpfx)tst-tlsmod18a%.so,$(tlsmod18a-suffixes)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
   144 +
   145  CFLAGS-tst-align.c = $(stack-align-test-flags)
   146  CFLAGS-tst-align2.c = $(stack-align-test-flags)
   147  CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
   148 @@ -804,7 +818,7 @@
   149  	cmp $@ tst-array5-static.exp > /dev/null
   150  
   151  ifeq (yesyes,$(have-fpie)$(build-shared))
   152 -CFLAGS-tst-pie1.c += -fpie
   153 +CFLAGS-tst-pie1.c += $(pie-ccflag)
   154  
   155  $(objpfx)tst-pie1.out: $(objpfx)tst-pie1
   156  	$(elf-objpfx)$(rtld-installed-name) \
   157 @@ -845,10 +859,14 @@
   158  $(objpfx)tst-dlmodcount.out: $(test-modules)
   159  
   160  check-data := $(firstword $(wildcard \
   161 -	        $(patsubst %,../scripts/data/localplt-%.data,\
   162 -			   $(addsuffix -$(config-os),\
   163 -			   	       $(config-machine) $(base-machine))\
   164 -			   generic)))
   165 +	        $(foreach D,$(add-ons) scripts,\
   166 +	        	  $(patsubst %,$(..)$D/data/localplt-%.data,\
   167 +			   	     $(abi-name) \
   168 +			   	     $(addsuffix -$(config-os),\
   169 +				     		 $(config-machine) \
   170 +						 $(base-machine)) \
   171 +			   generic))))
   172 +
   173  tests: $(objpfx)check-localplt.out
   174  
   175  ifeq ($(have-thread-library),yes)
   176 @@ -857,9 +875,11 @@
   177  
   178  $(objpfx)check-localplt.out: $(objpfx)check-localplt \
   179  			     $(common-objpfx)libc.so \
   180 - 		    	     $(common-objpfx)math/libm.so $(thread-dso) \
   181 - 		    	     $(common-objpfx)rt/librt.so \
   182 - 		    	     $(common-objpfx)dlfcn/libdl.so \
   183 +		    	     $(common-objpfx)math/libm.so $(thread-dso) \
   184 +		    	     $(common-objpfx)rt/librt.so \
   185 +		    	     $(common-objpfx)dlfcn/libdl.so \
   186 +			     $(common-objpfx)resolv/libresolv.so \
   187 +			     $(common-objpfx)crypt/libcrypt.so \
   188  			     $(check-data)
   189  	$(dir $<)$(notdir $<) $(filter-out $< $(check-data),$^) | \
   190  	  LC_ALL=C sort | \