diff mbox

Make linknamespace tests check only relevant libraries

Message ID alpine.DEB.2.10.1411290147140.30652@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Nov. 29, 2014, 1:47 a.m. UTC
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
<https://sourceware.org/ml/libc-alpha/2014-11/msg00882.html>, 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  <joseph@codesourcery.com>

	* 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.

Comments

Carlos O'Donell Nov. 29, 2014, 4:16 a.m. UTC | #1
On 11/28/2014 08:47 PM, Joseph Myers wrote:
> 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
> <https://sourceware.org/ml/libc-alpha/2014-11/msg00882.html>, 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.

I see ~70 less failures, but I still see ~150 failures.

The complete list follows with some excerpts of the failures.

I've sent you the tarball of the failures in a private email.

Some of them are the `profil_counter` failure you noted, but
others remain the __pointer_chk_guard_local inclusion and
subsequent libpthread analysis, which I think is not correct,
but haven't reviewed in detail.

FAIL: conform/POSIX/assert.h/linknamespace
~~~
[initial] __assert_fail -> [libc.a(assert.o)] __fxprintf -> [libc.a(fxprintf.o)] __vfwprintf -> [libc.a(vfwprintf.o)] _IO_fwide -> [libc.a(iofwide.o)] __pointer_chk_guard_local -> [libc.a(libc-start.o)] __pthread_initialize_minimal -> [libpthread.a(nptl-init.o)] __nptl_setxid_error -> [libpthread.a(pthread_create.o)] __resp -> [libc.a(res_libc.o)] __res_iclose -> [libc.a(res_init.o)] fgets_unlocked
...
~~~
FAIL: conform/POSIX/dirent.h/linknamespace
FAIL: conform/POSIX/fcntl.h/linknamespace
FAIL: conform/POSIX/grp.h/linknamespace
FAIL: conform/POSIX/locale.h/linknamespace
FAIL: conform/POSIX/math.h/linknamespace
FAIL: conform/POSIX/pwd.h/linknamespace
FAIL: conform/POSIX/semaphore.h/conform
FAIL: conform/POSIX/setjmp.h/linknamespace
FAIL: conform/POSIX/signal.h/linknamespace
FAIL: conform/POSIX/stdio.h/linknamespace
FAIL: conform/POSIX/stdlib.h/linknamespace
FAIL: conform/POSIX/string.h/linknamespace
FAIL: conform/POSIX/sys/wait.h/linknamespace
FAIL: conform/POSIX/termios.h/linknamespace
FAIL: conform/POSIX2008/arpa/inet.h/linknamespace
~~~
[initial] accept -> [libpthread.a(ptw-accept.o)] __pthread_disable_asynccancel -> [libpthread.a(cancellation.o)] __pthread_unwind -> [libpthread.a(unwind.o)] __pointer_chk_guard_local -> [libc.a(libc-start.o)] __pthread_initialize_minimal -> [libpthread.a(nptl-init.o)] __nptl_setxid_error -> [libpthread.a(pthread_create.o)] __resp -> [libc.a(res_libc.o)] __res_iclose -> [libc.a(res_init.o)] fgets_unlocked
...
~~~
FAIL: conform/POSIX2008/assert.h/linknamespace
FAIL: conform/POSIX2008/complex.h/linknamespace
FAIL: conform/POSIX2008/cpio.h/conform
FAIL: conform/POSIX2008/cpio.h/linknamespace
FAIL: conform/POSIX2008/fnmatch.h/linknamespace
FAIL: conform/POSIX2008/glob.h/linknamespace
FAIL: conform/POSIX2008/iconv.h/linknamespace
FAIL: conform/POSIX2008/langinfo.h/linknamespace
FAIL: conform/POSIX2008/locale.h/linknamespace
FAIL: conform/POSIX2008/math.h/linknamespace
FAIL: conform/POSIX2008/monetary.h/linknamespace
FAIL: conform/POSIX2008/netinet/in.h/linknamespace
FAIL: conform/POSIX2008/nl_types.h/linknamespace
FAIL: conform/POSIX2008/pwd.h/linknamespace
FAIL: conform/POSIX2008/sched.h/linknamespace
FAIL: conform/POSIX2008/semaphore.h/conform
FAIL: conform/POSIX2008/setjmp.h/linknamespace
FAIL: conform/POSIX2008/signal.h/linknamespace
FAIL: conform/POSIX2008/stdio.h/linknamespace
FAIL: conform/POSIX2008/stdlib.h/linknamespace
FAIL: conform/POSIX2008/string.h/linknamespace
FAIL: conform/POSIX2008/stropts.h/linknamespace
FAIL: conform/POSIX2008/sys/socket.h/linknamespace
FAIL: conform/POSIX2008/sys/wait.h/linknamespace
FAIL: conform/POSIX2008/termios.h/linknamespace
FAIL: conform/POSIX2008/tgmath.h/linknamespace
FAIL: conform/POSIX2008/wchar.h/linknamespace
FAIL: conform/POSIX2008/wordexp.h/linknamespace
FAIL: conform/UNIX98/arpa/inet.h/linknamespace
~~~
[initial] accept -> [libpthread.a(ptw-accept.o)] __pthread_disable_asynccancel -> [libpthread.a(cancellation.o)] __pthread_unwind -> [libpthread.a(unwind.o)] __pointer_chk_guard_local -> [libc.a(libc-start.o)] __pthread_initialize_minimal -> [libpthread.a(nptl-init.o)] __nptl_setxid_error -> [libpthread.a(pthread_create.o)] __resp -> [libc.a(res_libc.o)] __res_iclose -> [libc.a(res_init.o)] fgets_unlocked
...
~~~
FAIL: conform/UNIX98/assert.h/linknamespace
FAIL: conform/UNIX98/cpio.h/conform
FAIL: conform/UNIX98/cpio.h/linknamespace
FAIL: conform/UNIX98/dirent.h/linknamespace
FAIL: conform/UNIX98/fcntl.h/linknamespace
FAIL: conform/UNIX98/fmtmsg.h/conform
FAIL: conform/UNIX98/ftw.h/linknamespace
FAIL: conform/UNIX98/iconv.h/linknamespace
FAIL: conform/UNIX98/langinfo.h/linknamespace
FAIL: conform/UNIX98/locale.h/linknamespace
FAIL: conform/UNIX98/math.h/linknamespace
FAIL: conform/UNIX98/monetary.h/linknamespace
FAIL: conform/UNIX98/netinet/in.h/linknamespace
FAIL: conform/UNIX98/nl_types.h/linknamespace
FAIL: conform/UNIX98/semaphore.h/conform
FAIL: conform/UNIX98/setjmp.h/linknamespace
FAIL: conform/UNIX98/signal.h/linknamespace
FAIL: conform/UNIX98/string.h/linknamespace
FAIL: conform/UNIX98/stropts.h/linknamespace
FAIL: conform/UNIX98/sys/msg.h/linknamespace
FAIL: conform/UNIX98/sys/shm.h/linknamespace
FAIL: conform/UNIX98/sys/socket.h/linknamespace
FAIL: conform/UNIX98/sys/wait.h/linknamespace
FAIL: conform/UNIX98/termios.h/linknamespace
FAIL: conform/UNIX98/ucontext.h/linknamespace
FAIL: conform/UNIX98/ulimit.h/linknamespace
FAIL: conform/UNIX98/utmpx.h/linknamespace
FAIL: conform/XOPEN2K/arpa/inet.h/linknamespace
FAIL: conform/XOPEN2K/assert.h/linknamespace
FAIL: conform/XOPEN2K/complex.h/linknamespace
FAIL: conform/XOPEN2K/cpio.h/conform
FAIL: conform/XOPEN2K/cpio.h/linknamespace
FAIL: conform/XOPEN2K/dirent.h/linknamespace
~~~
[initial] closedir -> [libc.a(closedir.o)] __close_nocancel -> [libpthread.a(ptw-close.o)] __pthread_disable_asynccancel -> [libpthread.a(cancellation.o)] __pthread_unwind -> [libpthread.a(unwind.o)] __pointer_chk_guard_local -> [libc.a(libc-start.o)] __pthread_initialize_minimal -> [libpthread.a(nptl-init.o)] __nptl_setxid_error -> [libpthread.a(pthread_create.o)] __resp -> [libc.a(res_libc.o)] __res_iclose -> [libc.a(res_init.o)] fgets_unlocked
...
~~~
FAIL: conform/XOPEN2K/fmtmsg.h/conform
FAIL: conform/XOPEN2K/ftw.h/linknamespace
FAIL: conform/XOPEN2K/iconv.h/linknamespace
FAIL: conform/XOPEN2K/langinfo.h/linknamespace
FAIL: conform/XOPEN2K/locale.h/linknamespace
FAIL: conform/XOPEN2K/math.h/linknamespace
FAIL: conform/XOPEN2K/monetary.h/linknamespace
FAIL: conform/XOPEN2K/netinet/in.h/linknamespace
FAIL: conform/XOPEN2K/nl_types.h/linknamespace
FAIL: conform/XOPEN2K/sched.h/linknamespace
FAIL: conform/XOPEN2K/setjmp.h/linknamespace
FAIL: conform/XOPEN2K/stdio.h/linknamespace
FAIL: conform/XOPEN2K/string.h/linknamespace
FAIL: conform/XOPEN2K/stropts.h/linknamespace
FAIL: conform/XOPEN2K/sys/msg.h/linknamespace
FAIL: conform/XOPEN2K/sys/shm.h/linknamespace
FAIL: conform/XOPEN2K/sys/socket.h/linknamespace
FAIL: conform/XOPEN2K/termios.h/linknamespace
FAIL: conform/XOPEN2K/tgmath.h/linknamespace
FAIL: conform/XOPEN2K/ulimit.h/linknamespace
FAIL: conform/XOPEN2K/utmpx.h/linknamespace
FAIL: conform/XOPEN2K/wchar.h/linknamespace
FAIL: conform/XOPEN2K8/arpa/inet.h/linknamespace
FAIL: conform/XOPEN2K8/assert.h/linknamespace
FAIL: conform/XOPEN2K8/complex.h/linknamespace
FAIL: conform/XOPEN2K8/cpio.h/conform
FAIL: conform/XOPEN2K8/cpio.h/linknamespace
FAIL: conform/XOPEN2K8/fmtmsg.h/conform
FAIL: conform/XOPEN2K8/fnmatch.h/linknamespace
FAIL: conform/XOPEN2K8/ftw.h/linknamespace
FAIL: conform/XOPEN2K8/glob.h/linknamespace
FAIL: conform/XOPEN2K8/iconv.h/linknamespace
~~~
[initial] iconv -> [libc.a(iconv.o)] __gconv -> [libc.a(gconv.o)] __pointer_chk_guard_local -> [libc.a(libc-start.o)] __pthread_initialize_minimal -> [libpthread.a(nptl-init.o)] __nptl_setxid_error -> [libpthread.a(pthread_create.o)] __resp -> [libc.a(res_libc.o)] __res_iclose -> [libc.a(res_init.o)] fgets_unlocked
...
~~~
FAIL: conform/XOPEN2K8/langinfo.h/linknamespace
FAIL: conform/XOPEN2K8/locale.h/linknamespace
FAIL: conform/XOPEN2K8/math.h/linknamespace
FAIL: conform/XOPEN2K8/monetary.h/linknamespace
FAIL: conform/XOPEN2K8/netinet/in.h/linknamespace
FAIL: conform/XOPEN2K8/nl_types.h/linknamespace
FAIL: conform/XOPEN2K8/sched.h/linknamespace
FAIL: conform/XOPEN2K8/semaphore.h/conform
FAIL: conform/XOPEN2K8/setjmp.h/linknamespace
FAIL: conform/XOPEN2K8/signal.h/linknamespace
FAIL: conform/XOPEN2K8/stdio.h/linknamespace
FAIL: conform/XOPEN2K8/stdlib.h/linknamespace
FAIL: conform/XOPEN2K8/string.h/linknamespace
FAIL: conform/XOPEN2K8/stropts.h/linknamespace
FAIL: conform/XOPEN2K8/sys/msg.h/linknamespace
FAIL: conform/XOPEN2K8/sys/shm.h/linknamespace
FAIL: conform/XOPEN2K8/sys/socket.h/linknamespace
FAIL: conform/XOPEN2K8/sys/wait.h/linknamespace
FAIL: conform/XOPEN2K8/termios.h/linknamespace
FAIL: conform/XOPEN2K8/tgmath.h/linknamespace
FAIL: conform/XOPEN2K8/ulimit.h/linknamespace
FAIL: conform/XOPEN2K8/utmpx.h/linknamespace
FAIL: conform/XOPEN2K8/wchar.h/linknamespace
FAIL: conform/XOPEN2K8/wordexp.h/linknamespace
FAIL: conform/XPG3/cpio.h/conform
FAIL: conform/XPG3/cpio.h/linknamespace
FAIL: conform/XPG3/math.h/linknamespace
FAIL: conform/XPG4/cpio.h/conform
FAIL: conform/XPG4/cpio.h/linknamespace
FAIL: conform/XPG4/fmtmsg.h/conform
FAIL: conform/XPG4/math.h/linknamespace


Cheers,
Carlos.
Joseph Myers Nov. 29, 2014, 9:29 a.m. UTC | #2
On Fri, 28 Nov 2014, Carlos O'Donell wrote:

> Some of them are the `profil_counter` failure you noted, but
> others remain the __pointer_chk_guard_local inclusion and
> subsequent libpthread analysis, which I think is not correct,
> but haven't reviewed in detail.
> 
> FAIL: conform/POSIX/assert.h/linknamespace
> ~~~
> [initial] __assert_fail -> [libc.a(assert.o)] __fxprintf -> [libc.a(fxprintf.o)] __vfwprintf -> [libc.a(vfwprintf.o)] _IO_fwide -> [libc.a(iofwide.o)] __pointer_chk_guard_local -> [libc.a(libc-start.o)] __pthread_initialize_minimal -> [libpthread.a(nptl-init.o)] __nptl_setxid_error -> [libpthread.a(pthread_create.o)] __resp -> [libc.a(res_libc.o)] __res_iclose -> [libc.a(res_init.o)] fgets_unlocked

You'll note the pthread.h tests (for example) are XFAILed for all 
standards with pthreads at present.  So naturally when pthreads code is 
brought in, even without any explicit use of pthreads in the program, 
you'll get lots of failures that are logically the same as those already 
XFAILed.
diff mbox

Patch

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.