| ... | ... | @@ -1909,6 +1909,17 @@ pub fn addOrUpdateImport( |
| 1909 | 1909 | global_gop.value_ptr.* = loc; |
| 1910 | 1910 | try wasm.resolved_symbols.put(wasm.base.allocator, loc, {}); |
| 1911 | 1911 | try wasm.undefs.putNoClobber(wasm.base.allocator, decl_name_index, loc); |
| 1912 | } else if (global_gop.value_ptr.*.index != symbol_index) { |
| 1913 | // We are not updating a symbol, but found an existing global |
| 1914 | // symbol with the same name. This means we always favor the |
| 1915 | // existing symbol, regardless whether it's defined or not. |
| 1916 | // We can also skip storing the import as we will not output |
| 1917 | // this symbol. |
| 1918 | return wasm.discarded.put( |
| 1919 | wasm.base.allocator, |
| 1920 | .{ .file = null, .index = symbol_index }, |
| 1921 | global_gop.value_ptr.*, |
| 1922 | ); |
| 1912 | 1923 | } |
| 1913 | 1924 | |
| 1914 | 1925 | if (type_index) |ty_index| { |
| ... | ... | @@ -1924,8 +1935,8 @@ pub fn addOrUpdateImport( |
| 1924 | 1935 | }; |
| 1925 | 1936 | } |
| 1926 | 1937 | } else { |
| 1938 | // non-functions will not be imported from the runtime, but only resolved during link-time |
| 1927 | 1939 | symbol.tag = .data; |
| 1928 | | return; // non-functions will not be imported from the runtime, but only resolved during link-time |
| 1929 | 1940 | } |
| 1930 | 1941 | } |
| 1931 | 1942 | |