浏览代码

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 年前
父节点
当前提交
19904804da
共有 1 个文件被更改,包括 9 次插入2 次删除
  1. 9
    2
      src/util/symcheck.pl

+ 9
- 2
src/util/symcheck.pl 查看文件

@@ -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;

正在加载...
取消
保存