From patchwork Sat Nov 29 01:47:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 3998 Received: (qmail 9647 invoked by alias); 29 Nov 2014 01:47:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 9637 invoked by uid 89); 29 Nov 2014 01:47:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Sat, 29 Nov 2014 01:47:38 +0000 From: Joseph Myers To: Subject: Make linknamespace tests check only relevant libraries Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 This patch addresses one known caveat in the linknamespace tests: with this patch they will now only look for definitions of symbols in relevant libraries, meaning that librt and libpthread are not checked for ISO C standards, XPG3 and XPG4. In particular, this means that if __pthread_initialize_minimal is somehow brought in for one of those standards, the definition from libc-tls.o will be considered instead of that from libpthread, so avoiding bringing in lots of other libpthread symbols. This should address some of the failures reported by Carlos in , where __pointer_chk_guard_local brought in __pthread_initialize_minimal. Tested for x86_64. The removal of one XFAIL for XPG4 actually shows up a header bug (shm_open should not be declared for XPG4 - the namespace issue was for symbols brought in by shm_open, which is no longer found at all now librt isn't searched; I've filed bug 17663 for the header bug, though it would show up eventually anyway in the course of review of conform/ data against XPG4). Committed. 2014-11-29 Joseph Myers * conform/Makefile (linknamespace-symlist-stdlibs-base): New variable. (linknamespace-symlist-stdlibs-tests): Likewise. (tests-special): Append $(linknamespace-symlist-stdlibs-tests) instead of $(objpfx)symlist-stdlibs. (linknamespace-libs-isoc): New variable. (linknamespace-libs): Use $(linknamespace-libs-isoc). (linknamespace-libs-ISO): New variable. (linknamespace-libs-ISO99): Likewise. (linknamespace-libs-ISO11): Likewise. (linknamespace-libs-XPG3): Likewise. (linknamespace-libs-XPG4): Likewise. (linknamespace-libs-POSIX): Likewise. (linknamespace-libs-UNIX98): Likewise. (linknamespace-libs-XOPEN2K): Likewise. (linknamespace-libs-POSIX2008): Likewise. (linknamespace-libs-XOPEN2K8): Likewise. ($(objpfx)symlist-stdlibs): Replace by $(linknamespace-symlist-stdlibs-tests). Use $(linknamespace-libs-$*) as set of libraries. ($(linknamespace-header-tests)): Update dependencies. Use $(objpfx)symlist-stdlibs-$$std for --libsyms argument. (test-xfail-XPG4/sys/mman.h/linknamespace): Remove. * conform/linknamespace.pl: Remove comment about considering definitions of symbols from irrelevant libraries. diff --git a/conform/Makefile b/conform/Makefile index 4a498e4..641f546 100644 --- a/conform/Makefile +++ b/conform/Makefile @@ -124,7 +124,13 @@ linknamespace-symlists-tests := $(addprefix $(objpfx),\ $(linknamespace-symlists-base)) tests-special += $(linknamespace-symlists-tests) -tests-special += $(objpfx)symlist-stdlibs +linknamespace-symlist-stdlibs-base := $(foreach std,$(conformtest-standards),\ + symlist-stdlibs-$(std)) +linknamespace-symlist-stdlibs-tests := \ + $(addprefix $(objpfx),\ + $(linknamespace-symlist-stdlibs-base)) + +tests-special += $(linknamespace-symlist-stdlibs-tests) linknamespace-header-base := $(foreach std,\ $(conformtest-standards),\ @@ -294,21 +300,35 @@ $(linknamespace-symlists-tests): $(objpfx)symlist-%: list-header-symbols.pl > $@ 2> $@.err; \ $(evaluate-test) -linknamespace-libs = $(common-objpfx)libc.a $(common-objpfx)math/libm.a \ +linknamespace-libs-isoc = $(common-objpfx)libc.a $(common-objpfx)math/libm.a +linknamespace-libs = $(linknamespace-libs-isoc) \ $(common-objpfx)rt/librt.a $(static-thread-library) +linknamespace-libs-ISO = $(linknamespace-libs-isoc) +linknamespace-libs-ISO99 = $(linknamespace-libs-isoc) +linknamespace-libs-ISO11 = $(linknamespace-libs-isoc) +linknamespace-libs-XPG3 = $(linknamespace-libs-isoc) +linknamespace-libs-XPG4 = $(linknamespace-libs-isoc) +linknamespace-libs-POSIX = $(linknamespace-libs) +linknamespace-libs-UNIX98 = $(linknamespace-libs) +linknamespace-libs-XOPEN2K = $(linknamespace-libs) +linknamespace-libs-POSIX2008 = $(linknamespace-libs) +linknamespace-libs-XOPEN2K8 = $(linknamespace-libs) -$(objpfx)symlist-stdlibs: $(linknamespace-libs) - LC_ALL=C $(READELF) -W -s $^ > $@; \ +$(linknamespace-symlist-stdlibs-tests): $(objpfx)symlist-stdlibs-%: \ + $(linknamespace-libs) + LC_ALL=C $(READELF) -W -s $(linknamespace-libs-$*) > $@; \ $(evaluate-test) $(linknamespace-header-tests): $(objpfx)%/linknamespace.out: \ - linknamespace.pl $(objpfx)symlist-stdlibs + linknamespace.pl \ + $(linknamespace-symlist-stdlibs-tests) (set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \ mkdir -p $(@D)/scratch; \ $(PERL) -w $< --tmpdir=$(@D)/scratch --cc='$(CC)' \ --flags='$(conformtest-cc-flags)' --standard=$$std \ --stdsyms=$(objpfx)symlist-$$std --header=$$hdr \ - --libsyms='$(objpfx)symlist-stdlibs' --readelf='$(READELF)' \ + --libsyms=$(objpfx)symlist-stdlibs-$$std \ + --readelf='$(READELF)' \ > $@ 2>&1); \ $(evaluate-test) @@ -349,7 +369,6 @@ test-xfail-XPG4/regex.h/linknamespace = yes test-xfail-XPG4/search.h/linknamespace = yes test-xfail-XPG4/stdio.h/linknamespace = yes test-xfail-XPG4/stdlib.h/linknamespace = yes -test-xfail-XPG4/sys/mman.h/linknamespace = yes test-xfail-XPG4/sys/statvfs.h/linknamespace = yes test-xfail-XPG4/syslog.h/linknamespace = yes test-xfail-XPG4/time.h/linknamespace = yes diff --git a/conform/linknamespace.pl b/conform/linknamespace.pl index fd8c3dc..7323d4d 100644 --- a/conform/linknamespace.pl +++ b/conform/linknamespace.pl @@ -135,11 +135,6 @@ foreach my $sym (@sym_data) { # conditionally and not if the program is limited to standard # functionality. (matherr is an example of such a false positive.) # -# * For strong undefined symbols, all possible definitions are -# considered, rather than being restricted to libraries that are -# relevant to the given standard (e.g. not considering any libpthread -# definitions of ISO C symbols). -# # * If a symbol reference is only brought in by the user using a data # symbol rather than a function from the standard library, this will # not be detected.