From 0ab0291b84b45f2389a019af2c88bf5169d14f64 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 26 May 2012 10:46:59 -0700 Subject: Convert WORDSIZE[32|64]/ld entries to abi-variants --- Makeconfig | 56 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 11 deletions(-) (limited to 'Makeconfig') diff --git a/Makeconfig b/Makeconfig index b4b2963..df7545f 100644 --- a/Makeconfig +++ b/Makeconfig @@ -791,6 +791,24 @@ ifeq (yes, $(build-shared)) sed '/^[ ]*#/d;/^[ ]*$$/d' $< > $@T mv -f $@T $@ +# To generate a header to support more than one ABI for different +# architecture variants, the CPU/Makefile defines abi-variants to be a +# list of names for those variants (e.g. 32 64), and, for each variant, +# defines abi-$(variant)-condition to be the condition for those options +# to use in a C #if condition. abi-includes may be defined to a list of +# headers to include in the generated header, if the default does not +# suffice. + +ifdef abi-variants +ifndef default-abi +default-abi = $(firstword $(abi-variants)) +endif +endif + +ifndef abi-includes +abi-includes := bits/wordsize.h +endif + # Process the shlib-versions file, which tells us what shared library # version numbers to use when we install shared objects on this system. # We need to wait until $(subdirs) is complete. @@ -816,24 +834,17 @@ $(common-objpfx)soversions.i: $(..)scripts/soversions.awk \ -f $^ > $@T mv -f $@T $@ $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig - (seen_DEFAULT=0; seen_WORDSIZE32=0; seen_WORDSIZE64=0; \ - while read which lib number setname; do \ + (while read which lib number setname; do \ eval seen_$$which=1; \ test x"$$which" != xABI || echo abi-name = "$$lib"; \ test x"$$which" = xDEFAULT || continue; \ case $$number in \ [0-9]*) echo "$$lib.so-version=.$$number"; \ echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\ - *) echo "$$lib.so-version=$$number"; \ + *) echo "$$lib.so-version=\$$(if \$$(abi-$(default-abi)-$$lib-soname),\$$(abi-$(default-abi)-$$lib-soname),$$number)"; \ echo "all-sonames+=$$lib=\$$($$lib.so-version)";;\ esac; \ done; \ - case "$$seen_DEFAULT$$seen_WORDSIZE32$$seen_WORDSIZE64" in \ - 100) echo biarch = no;; \ - 101) echo biarch = 32;; \ - ?1?) echo biarch = 64;; \ - *) echo >&2 BUG; exit 2;; \ - esac; \ echo soversions.mk-done = t;) < $< > $@T; exit 0 mv -f $@T $@ endif @@ -850,8 +861,31 @@ $(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @: $(common-objpfx)gnu/lib-names.stmp: $(..)scripts/lib-names.awk \ $(common-objpfx)soversions.i $(make-target-directory) - @rm -f ${@:stmp=T} $@ - LC_ALL=C $(AWK) -f $^ > ${@:stmp=T} + { \ + echo '/* This file is automatically generated.';\ + echo ' It defines macros to allow user program to find the shared'; \ + echo ' library files which come as part of GNU libc. */'; \ + echo '#ifndef __GNU_LIB_NAMES_H'; \ + echo '#define __GNU_LIB_NAMES_H 1'; \ + echo ''; \ + $(if $(abi-includes), \ + $(foreach h,$(abi-includes), echo '#include <$(h)>';) \ + echo '';) \ + $(if $(abi-variants), \ + $(foreach v,$(abi-variants),\ + $(if $(abi-$(v)-condition),\ + echo '#if $(abi-$(v)-condition)'; \ + ($(foreach s,$(all-sonames), \ + $(if $(abi-$(v)-$(firstword $(subst =, ,$(s)))-soname),\ + echo $(firstword $(subst =, ,$(s)))=$(abi-$(v)-$(firstword $(subst =, ,$(s)))-soname);, \ + echo $(s);))) \ + | LC_ALL=C $(AWK) -v multi=1 -f $(firstword $^) | LC_ALL=C sort;) \ + $(if $(abi-$(v)-condition),echo '#endif';)), \ + ($(foreach s,$(all-sonames), echo $(s);)) \ + | LC_ALL=C $(AWK) -f $(firstword $^) | LC_ALL=C sort;) \ + echo ''; \ + echo '#endif /* gnu/lib-names.h */'; \ + } > ${@:stmp=T} $(move-if-change) ${@:stmp=T} ${@:stmp=h} touch $@ endif -- cgit v1.1