Browse Source

Restore the "shared symbol found only in a single object should be

treated as being provided by that object" code.
tags/v0.9.3
Michael Brown 17 years ago
parent
commit
19904804da
1 changed files with 9 additions and 2 deletions
  1. 9
    2
      src/util/symcheck.pl

+ 9
- 2
src/util/symcheck.pl View File

@@ -97,7 +97,7 @@ while ( ( my $object, my $symbols ) = each %$symtab ) {
97 97
       } else {
98 98
 	$category = "provides";
99 99
       }
100
-      $globals->{$symbol}->{$category}->{$object} = $info->{section};
100
+      $globals->{$symbol}->{$category}->{$object} = 1;
101 101
     }
102 102
   }
103 103
 }
@@ -110,6 +110,13 @@ while ( ( my $symbol, my $info ) = each %$globals ) {
110 110
   my @requires = keys %{$info->{requires}};
111 111
   my @shares = keys %{$info->{shares}};
112 112
 
113
+  if ( ( @provides == 0 ) && ( @shares == 1 ) ) {
114
+    # A symbol "shared" by just a single file is actually being
115
+    # provided by that file; it just doesn't have an initialiser.
116
+    @provides = @shares;
117
+    @shares = ();
118
+  }
119
+
113 120
   if ( ( @requires > 0 ) && ( @provides == 0 ) && ( @shares == 0 ) ) {
114 121
     # No object provides this symbol, but some objects require it.
115 122
     $problems->{$_}->{nonexistent}->{$symbol} = 1 foreach @requires;
@@ -120,7 +127,7 @@ while ( ( my $symbol, my $info ) = each %$globals ) {
120 127
     foreach my $provide ( @provides ) {
121 128
       if ( $provide eq "LINKER" ) {
122 129
 	# Linker-provided symbols are exempt from this check.
123
-      } elsif ( $info->{provides}->{$provide} =~ /^\.tbl\./ ) {
130
+      } elsif ( $symtab->{$provide}->{$symbol}->{section} =~ /^\.tbl\./ ) {
124 131
 	# Linker tables are exempt from this check.
125 132
       } else {
126 133
 	$problems->{$provide}->{unused}->{$symbol} = 1;

Loading…
Cancel
Save