| ... | @@ -2167,19 +2167,16 @@ fn resolveSymbolsInObject( | ... | @@ -2167,19 +2167,16 @@ fn resolveSymbolsInObject( |
| 2167 | .global => { | 2167 | .global => { |
| 2168 | const global = &self.globals.items[resolv.where_index]; | 2168 | const global = &self.globals.items[resolv.where_index]; |
| 2169 | | 2169 | |
| 2170 | if (!(symbolIsWeakDef(sym) or symbolIsPext(sym)) and | 2170 | if (symbolIsTentative(global.*)) { |
| | 2171 | _ = tentatives.fetchSwapRemove(resolv.where_index); |
| | 2172 | } else if (!(symbolIsWeakDef(sym) or symbolIsPext(sym)) and |
| 2171 | !(symbolIsWeakDef(global.*) or symbolIsPext(global.*))) | 2173 | !(symbolIsWeakDef(global.*) or symbolIsPext(global.*))) |
| 2172 | { | 2174 | { |
| 2173 | log.err("symbol '{s}' defined multiple times", .{sym_name}); | 2175 | log.err("symbol '{s}' defined multiple times", .{sym_name}); |
| 2174 | log.err(" first definition in '{s}'", .{self.objects.items[resolv.file].name}); | 2176 | log.err(" first definition in '{s}'", .{self.objects.items[resolv.file].name}); |
| 2175 | log.err(" next definition in '{s}'", .{object.name}); | 2177 | log.err(" next definition in '{s}'", .{object.name}); |
| 2176 | return error.MultipleSymbolDefinitions; | 2178 | return error.MultipleSymbolDefinitions; |
| 2177 | } | 2179 | } else if (symbolIsWeakDef(sym) or symbolIsPext(sym)) continue; // Current symbol is weak, so skip it. |
| 2178 | if (symbolIsWeakDef(sym) or symbolIsPext(sym)) continue; // Current symbol is weak, so skip it. | | |
| 2179 | | | |
| 2180 | if (symbolIsTentative(global.*)) { | | |
| 2181 | _ = tentatives.fetchSwapRemove(resolv.where_index); | | |
| 2182 | } | | |
| 2183 | | 2180 | |
| 2184 | // Otherwise, update the resolver and the global symbol. | 2181 | // Otherwise, update the resolver and the global symbol. |
| 2185 | global.n_type = sym.n_type; | 2182 | global.n_type = sym.n_type; |