From 93ae1ebaa6df1a0c188614bd0a601ab6e26711c5 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 26 Sep 2014 17:33:04 +0000 Subject: Clean up gnu/lib-names.h generation (bug 14171). This patch eliminates the mixture of SONAME information in shlib-versions files and SONAME information used to generate gnu/lib-names.h in makefiles, with the information in the makefiles being removed so all this information comes from the shlib-versions files. So that gnu/lib-names.h supports multiple ABIs, it is changed to be generated on the same basis as gnu/stubs.h: when there are multiple ABIs, gnu/lib-names.h is a wrapper header (the same header installed whatever ABI is being built) and separate headers such as gnu/lib-names-64.h contain the substantive contents (only one such header being installed by any glibc build). The rules for building gnu/lib-names.h were moved from Makeconfig to Makerules because they need to come after sysdeps makefiles are included (now that "ifndef abi-variants" is a toplevel conditional on the rules rather than $(abi-variants) being evaluated later inside the commands for a rule). Tested for x86_64 and x86 that the installed shared libraries are unchanged by this patch, and examined the installed gnu/lib-names*.h headers by hand. Also tested the case of a single ABI (where there is just a single header installed, again like stubs.h) by hacking abi-variants to empty for x86_64. [BZ #14171] * Makeconfig [$(build-shared) = yes] ($(common-objpfx)soversions.mk): Don't handle SONAMEs specified in makefiles. [$(build-shared) = yes && $(soversions.mk-done) = t] ($(common-objpfx)gnu/lib-names.h): Remove rule. [$(build-shared) = yes && $(soversions.mk-done) = t] ($(common-objpfx)gnu/lib-names.stmp): Likewise. Split and moved to Makerules. [$(build-shared) = yes && $(soversions.mk-done) = t] (before-compile): Don't append $(common-objpfx)gnu/lib-names.h here. [$(build-shared) = yes && $(soversions.mk-done) = t] (common-generated): Don't append gnu/lib-names.h and gnu/lib-names.stmp here. * Makerules [$(build-shared) = yes && $(soversions.mk-done) = t] (lib-names-h-abi): New variable. [$(build-shared) = yes && $(soversions.mk-done) = t] (lib-names-stmp-abi): Likewise. [$(build-shared) = yes && $(soversions.mk-done) = t && abi-variants] (before-compile): Append $(common-objpfx)$(lib-names-h-abi). [$(build-shared) = yes && $(soversions.mk-done) = t && abi-variants] (common-generated): Append gnu/lib-names.h. [$(build-shared) = yes && $(soversions.mk-done) = t && abi-variants] (install-others-nosubdir): Depend on $(inst_includedir)/$(lib-names-h-abi). [$(build-shared) = yes && $(soversions.mk-done) = t && abi-variants] ($(common-objpfx)gnu/lib-names.h): New rule. [$(build-shared) = yes && $(soversions.mk-done) = t] ($(common-objpfx)$(lib-names-h-abi)): New rule. [$(build-shared) = yes && $(soversions.mk-done) = t] ($(common-objpfx)$(lib-names-stmp-abi)): Likewise. [$(build-shared) = yes && $(soversions.mk-done) = t] (common-generated): Append $(lib-names-h-abi) and $(lib-names-stmp-abi). * scripts/lib-names.awk: Do not handle multi being set. * sysdeps/unix/sysv/linux/aarch64/Makefile (abi-lp64-ld-soname): Remove variable. (abi-lp64_be-ld-soname): Likewise. * sysdeps/unix/sysv/linux/arm/Makefile (abi-soft-ld-soname): Likewise. (abi-hard-ld-soname): Likewise. * sysdeps/unix/sysv/linux/i386/shlib-versions: New file. * sysdeps/unix/sysv/linux/mips/Makefile (abi-o32_soft-ld-soname): Remove variable. (abi-o32_hard-ld-soname): Likewise. (abi-o32_soft_2008-ld-soname): Likewise. (abi-o32_hard_2008-ld-soname): Likewise. (abi-n32_soft-ld-soname): Likewise. (abi-n32_hard-ld-soname): Likewise. (abi-n32_soft_2008-ld-soname): Likewise. (abi-n32_hard_2008-ld-soname): Likewise. (abi-n64_soft-ld-soname): Likewise. (abi-n64_hard-ld-soname): Likewise. (abi-n64_soft_2008-ld-soname): Likewise. (abi-n64_hard_2008-ld-soname): Likewise. * sysdeps/unix/sysv/linux/powerpc/Makefile (abi-64-v1-ld-soname): Likewise. (abi-64-v2-ld-soname): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/shlib-versions: Add ld.so entries. * sysdeps/unix/sysv/linux/s390/Makefile (abi-64-ld-soname): Remove variable. * sysdeps/unix/sysv/linux/s390/s390-64/shlib-versions: Add ld.so entry. * sysdeps/unix/sysv/linux/x86/Makefile (abi-32-ld-soname): Remove variable. (abi-64-ld-soname): Likewise. (abi-x32-ld-soname): Likewise. * sysdeps/unix/sysv/linux/x86_64/64/shlib-versions: Add ld.so entry. * sysdeps/unix/sysv/linux/x86_64/x32/shlib-versions: Likewise. --- Makeconfig | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) (limited to 'Makeconfig') diff --git a/Makeconfig b/Makeconfig index fad29715b6..24a3b82c78 100644 --- a/Makeconfig +++ b/Makeconfig @@ -969,7 +969,7 @@ $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig case $$number in \ [0-9]*) echo "$$lib.so-version=.$$number"; \ echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\ - *) echo "$$lib.so-version=\$$(if \$$(abi-$(default-abi)-$$lib-soname),\$$(abi-$(default-abi)-$$lib-soname),$$number)"; \ + *) echo "$$lib.so-version=$$number"; \ echo "all-sonames+=$$lib=\$$($$lib.so-version)";;\ esac; \ done; \ @@ -981,45 +981,6 @@ endif postclean-generated += soversions.mk soversions.i \ shlib-versions.v shlib-versions.v.i -# Generate the header containing the names of all shared libraries. -# We use a stamp file to avoid unnecessary recompilations. -before-compile += $(common-objpfx)gnu/lib-names.h -ifeq ($(soversions.mk-done),t) -$(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) - { \ - 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 - -common-generated += gnu/lib-names.h gnu/lib-names.stmp - # The name under which the run-time dynamic linker is installed. # We are currently going for the convention that `/lib/ld.so.1' # names the SVR4/ELF ABI-compliant dynamic linker. -- cgit 1.4.1