From 19904804da505ab8896fc0179aec3452dc9a88b5 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 17 Jul 2007 01:39:06 +0100 Subject: [PATCH] Restore the "shared symbol found only in a single object should be treated as being provided by that object" code. --- src/util/symcheck.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/util/symcheck.pl b/src/util/symcheck.pl index e0099c41..8925ca62 100755 --- a/src/util/symcheck.pl +++ b/src/util/symcheck.pl @@ -97,7 +97,7 @@ while ( ( my $object, my $symbols ) = each %$symtab ) { } else { $category = "provides"; } - $globals->{$symbol}->{$category}->{$object} = $info->{section}; + $globals->{$symbol}->{$category}->{$object} = 1; } } } @@ -110,6 +110,13 @@ while ( ( my $symbol, my $info ) = each %$globals ) { my @requires = keys %{$info->{requires}}; my @shares = keys %{$info->{shares}}; + if ( ( @provides == 0 ) && ( @shares == 1 ) ) { + # A symbol "shared" by just a single file is actually being + # provided by that file; it just doesn't have an initialiser. + @provides = @shares; + @shares = (); + } + if ( ( @requires > 0 ) && ( @provides == 0 ) && ( @shares == 0 ) ) { # No object provides this symbol, but some objects require it. $problems->{$_}->{nonexistent}->{$symbol} = 1 foreach @requires; @@ -120,7 +127,7 @@ while ( ( my $symbol, my $info ) = each %$globals ) { foreach my $provide ( @provides ) { if ( $provide eq "LINKER" ) { # Linker-provided symbols are exempt from this check. - } elsif ( $info->{provides}->{$provide} =~ /^\.tbl\./ ) { + } elsif ( $symtab->{$provide}->{$symbol}->{section} =~ /^\.tbl\./ ) { # Linker tables are exempt from this check. } else { $problems->{$provide}->{unused}->{$symbol} = 1;