mirror of git://sourceware.org/git/glibc.git
Test for weak undefined symbols in linknamespace.pl.
This patch makes linknamespace.pl require weak undefined symbols to be within the standard namespace. (It remains the case that linknamespace.pl does not look for definitions of such symbols or require symbols used in those definitions to be within the standard namespace.) Tested for x86_64 and x86. * conform/linknamespace.pl: Require weak undefined symbols to be in the standard namespace. (%strong_syms): Rename to %seen_syms. (%strong_seen): Rename to %seen_where.
This commit is contained in:
parent
e5d19c08d1
commit
a435cc46e6
|
|
@ -1,3 +1,10 @@
|
||||||
|
2015-09-17 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
* conform/linknamespace.pl: Require weak undefined symbols to be
|
||||||
|
in the standard namespace.
|
||||||
|
(%strong_syms): Rename to %seen_syms.
|
||||||
|
(%strong_seen): Rename to %seen_where.
|
||||||
|
|
||||||
2015-09-17 H.J. Lu <hongjiu.lu@intel.com>
|
2015-09-17 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
[BZ #18970]
|
[BZ #18970]
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,8 @@ sub list_syms {
|
||||||
|
|
||||||
# Load information about GLOBAL and WEAK symbols defined or used in
|
# Load information about GLOBAL and WEAK symbols defined or used in
|
||||||
# the standard libraries.
|
# the standard libraries.
|
||||||
# Strong symbols (defined or undefined) from a given object.
|
# Symbols from a given object, except for weak defined symbols.
|
||||||
%strong_syms = ();
|
%seen_syms = ();
|
||||||
# Strong undefined symbols from a given object.
|
# Strong undefined symbols from a given object.
|
||||||
%strong_undef_syms = ();
|
%strong_undef_syms = ();
|
||||||
# Objects defining a given symbol (strongly or weakly).
|
# Objects defining a given symbol (strongly or weakly).
|
||||||
|
|
@ -112,19 +112,19 @@ foreach my $sym (@sym_data) {
|
||||||
}
|
}
|
||||||
push (@{$sym_objs{$name}}, $file);
|
push (@{$sym_objs{$name}}, $file);
|
||||||
}
|
}
|
||||||
if ($bind eq "GLOBAL") {
|
if ($bind eq "GLOBAL" || !$defined) {
|
||||||
if (!defined ($strong_syms{$file})) {
|
if (!defined ($seen_syms{$file})) {
|
||||||
$strong_syms{$file} = [];
|
$seen_syms{$file} = [];
|
||||||
}
|
}
|
||||||
push (@{$strong_syms{$file}}, $name);
|
push (@{$seen_syms{$file}}, $name);
|
||||||
if (!$defined) {
|
}
|
||||||
|
if ($bind eq "GLOBAL" && !$defined) {
|
||||||
if (!defined ($strong_undef_syms{$file})) {
|
if (!defined ($strong_undef_syms{$file})) {
|
||||||
$strong_undef_syms{$file} = [];
|
$strong_undef_syms{$file} = [];
|
||||||
}
|
}
|
||||||
push (@{$strong_undef_syms{$file}}, $name);
|
push (@{$strong_undef_syms{$file}}, $name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# Determine what ELF-level symbols are brought in by use of C-level
|
# Determine what ELF-level symbols are brought in by use of C-level
|
||||||
# symbols declared in the given header.
|
# symbols declared in the given header.
|
||||||
|
|
@ -132,12 +132,7 @@ foreach my $sym (@sym_data) {
|
||||||
# The rules followed are heuristic and so may produce false positives
|
# The rules followed are heuristic and so may produce false positives
|
||||||
# and false negatives.
|
# and false negatives.
|
||||||
#
|
#
|
||||||
# * Weak undefined symbols are ignored; however, if a code path that
|
# * All undefined symbols are considered of signficance, but it is
|
||||||
# references one (even just to check if its address is 0) is executed,
|
|
||||||
# that may conflict with a definition of that symbol in the user's
|
|
||||||
# program.
|
|
||||||
#
|
|
||||||
# * Strong undefined symbols are considered of signficance, but it is
|
|
||||||
# possible that (a) any standard library definition is weak, so can be
|
# possible that (a) any standard library definition is weak, so can be
|
||||||
# overridden by the user's definition, and (b) the symbol is only used
|
# overridden by the user's definition, and (b) the symbol is only used
|
||||||
# conditionally and not if the program is limited to standard
|
# conditionally and not if the program is limited to standard
|
||||||
|
|
@ -192,14 +187,14 @@ unlink ($cincfile) || die ("unlink $cincfile: $!\n");
|
||||||
unlink ($cincfile_o) || die ("unlink $cincfile_o: $!\n");
|
unlink ($cincfile_o) || die ("unlink $cincfile_o: $!\n");
|
||||||
unlink ($cincfile_sym) || die ("unlink $cincfile_sym: $!\n");
|
unlink ($cincfile_sym) || die ("unlink $cincfile_sym: $!\n");
|
||||||
|
|
||||||
%strong_seen = ();
|
%seen_where = ();
|
||||||
%files_seen = ();
|
%files_seen = ();
|
||||||
%all_undef = ();
|
%all_undef = ();
|
||||||
%current_undef = ();
|
%current_undef = ();
|
||||||
foreach my $sym (@elf_syms) {
|
foreach my $sym (@elf_syms) {
|
||||||
my ($file, $name, $bind, $defined) = @$sym;
|
my ($file, $name, $bind, $defined) = @$sym;
|
||||||
if ($bind eq "GLOBAL" && !$defined) {
|
if ($bind eq "GLOBAL" && !$defined) {
|
||||||
$strong_seen{$name} = "[initial] $name";
|
$seen_where{$name} = "[initial] $name";
|
||||||
$all_undef{$name} = "[initial] $name";
|
$all_undef{$name} = "[initial] $name";
|
||||||
$current_undef{$name} = "[initial] $name";
|
$current_undef{$name} = "[initial] $name";
|
||||||
}
|
}
|
||||||
|
|
@ -213,9 +208,9 @@ while (%current_undef) {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
$files_seen{$file} = 1;
|
$files_seen{$file} = 1;
|
||||||
foreach my $ssym (@{$strong_syms{$file}}) {
|
foreach my $ssym (@{$seen_syms{$file}}) {
|
||||||
if (!defined ($strong_seen{$ssym})) {
|
if (!defined ($seen_where{$ssym})) {
|
||||||
$strong_seen{$ssym} = "$current_undef{$sym} -> [$file] $ssym";
|
$seen_where{$ssym} = "$current_undef{$sym} -> [$file] $ssym";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach my $usym (@{$strong_undef_syms{$file}}) {
|
foreach my $usym (@{$strong_undef_syms{$file}}) {
|
||||||
|
|
@ -230,14 +225,14 @@ while (%current_undef) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = 0;
|
$ret = 0;
|
||||||
foreach my $sym (sort keys %strong_seen) {
|
foreach my $sym (sort keys %seen_where) {
|
||||||
if ($sym =~ /^_/) {
|
if ($sym =~ /^_/) {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if (defined ($stdsyms{$sym})) {
|
if (defined ($stdsyms{$sym})) {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
print "$strong_seen{$sym}\n";
|
print "$seen_where{$sym}\n";
|
||||||
$ret = 1;
|
$ret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue