glibc/conform/list-header-symbols.pl
Joseph Myers 84dbedb608 Fix linknamespace h_errno handling.
Some linknamespace tests were failing because of references to
h_errno.  References to this symbol should be allowed for XPG4, UNIX98
and XOPEN2K; this patch adds it to the list of allowed data symbols
for those standards.  (h_errno was removed in the 2008 edition of
POSIX, so POSIX2008 and XOPEN2K8 references to it are genuine bugs;
fortunately it's not a public data symbol - __h_errno_location is
public, TLS h_errno is GLIBC_PRIVATE - so the symbol can simply be
renamed to __h_errno to fix those bugs without the ABI complications
normally associated with namespace issues for data symbols.)

Tested for x86_64.

	* conform/list-header-symbols.pl (%extra_syms): Add h_errno for
	XPG4, UNIX98 and XOPEN2K.
	* conform/Makefile (test-xfail-XOPEN2K/grp.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K/pwd.h/linknamespace): Likewise.
2014-12-04 17:12:46 +00:00

83 lines
3.4 KiB
Raku

#! /usr/bin/perl
# Print a list of symbols exported by some headers that would
# otherwise be in the user's namespace.
# Copyright (C) 2014 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
use GlibcConform;
use Getopt::Long;
GetOptions ('headers=s' => \$headers, 'standard=s' => \$standard,
'flags=s' => \$flags, 'cc=s' => \$CC, 'tmpdir=s' => \$tmpdir);
@headers = split (/\s+/, $headers);
# Extra symbols possibly not found through -aux-info but still
# reserved by the standard: either data symbols, or symbols where the
# standard leaves unspecified whether the identifier is a macro or
# defined with external linkage.
$extra_syms{"ISO"} = ["errno", "setjmp", "va_end"];
$extra_syms{"ISO99"} = ["errno", "math_errhandling", "setjmp", "va_end"];
# stdatomic.h not yet covered by conformance tests; as per DR#419, all
# the generic functions there or may not be defined with external
# linkage (but are reserved in any case).
$extra_syms{"ISO11"} = ["errno", "math_errhandling", "setjmp", "va_end"];
# The following lists may not be exhaustive.
$extra_syms{"POSIX"} = ["errno", "setjmp", "va_end", "environ", "sigsetjmp",
"optarg", "optind", "opterr", "optopt", "tzname"];
$extra_syms{"XPG3"} = ["errno", "setjmp", "va_end", "environ", "signgam",
"loc1", "loc2", "locs", "sigsetjmp", "optarg",
"optind", "opterr", "optopt", "daylight", "timezone",
"tzname"];
$extra_syms{"XPG4"} = ["errno", "setjmp", "va_end", "environ", "signgam",
"loc1", "loc2", "locs", "sigsetjmp", "optarg",
"optind", "opterr", "optopt", "daylight", "timezone",
"tzname", "getdate_err", "h_errno"];
$extra_syms{"UNIX98"} = ["errno", "setjmp", "va_end", "environ", "signgam",
"loc1", "loc2", "locs", "sigsetjmp", "optarg",
"optind", "opterr", "optopt", "daylight", "timezone",
"tzname", "getdate_err", "h_errno"];
$extra_syms{"XOPEN2K"} = ["errno", "setjmp", "va_end", "environ", "signgam",
"sigsetjmp", "optarg", "optind", "opterr", "optopt",
"daylight", "timezone", "tzname", "getdate_err",
"h_errno"];
$extra_syms{"XOPEN2K8"} = ["errno", "setjmp", "va_end", "environ", "signgam",
"sigsetjmp", "optarg", "optind", "opterr", "optopt",
"daylight", "timezone", "tzname", "getdate_err"];
$extra_syms{"POSIX2008"} = ["errno", "setjmp", "va_end", "environ",
"sigsetjmp", "optarg", "optind", "opterr", "optopt",
"tzname"];
%user_syms = ();
foreach my $header (@headers) {
@syms = list_exported_functions ("$CC $flags", $standard, $header, $tmpdir);
foreach my $sym (@syms) {
if ($sym !~ /^_/) {
$user_syms{$sym} = 1;
}
}
}
foreach my $sym (@{$extra_syms{$standard}}) {
$user_syms{$sym} = 1;
}
foreach my $sym (sort keys %user_syms) {
print "$sym\n";
}