Lines Matching defs:existing
145 static void reportTypeError(const Symbol *existing, const InputFile *file,
147 error("symbol type mismatch: " + toString(*existing) + "\n>>> defined as " +
148 toString(existing->getWasmType()) + " in " +
149 toString(existing->getFile()) + "\n>>> defined as " + toString(type) +
156 static bool signatureMatches(FunctionSymbol *existing,
158 const WasmSignature *oldSig = existing->signature;
169 static void checkGlobalType(const Symbol *existing, const InputFile *file,
171 if (!isa<GlobalSymbol>(existing)) {
172 reportTypeError(existing, file, WASM_SYMBOL_TYPE_GLOBAL);
176 const WasmGlobalType *oldType = cast<GlobalSymbol>(existing)->getGlobalType();
178 error("Global type mismatch: " + existing->getName() + "\n>>> defined as " +
179 toString(*oldType) + " in " + toString(existing->getFile()) +
184 static void checkTagType(const Symbol *existing, const InputFile *file,
186 const auto *existingTag = dyn_cast<TagSymbol>(existing);
187 if (!isa<TagSymbol>(existing)) {
188 reportTypeError(existing, file, WASM_SYMBOL_TYPE_TAG);
194 warn("Tag signature mismatch: " + existing->getName() +
196 toString(existing->getFile()) + "\n>>> defined as " +
200 static void checkTableType(const Symbol *existing, const InputFile *file,
202 if (!isa<TableSymbol>(existing)) {
203 reportTypeError(existing, file, WASM_SYMBOL_TYPE_TABLE);
207 const WasmTableType *oldType = cast<TableSymbol>(existing)->getTableType();
209 error("Table type mismatch: " + existing->getName() + "\n>>> defined as " +
210 toString(*oldType) + " in " + toString(existing->getFile()) +
216 static void checkDataType(const Symbol *existing, const InputFile *file) {
217 if (!isa<DataSymbol>(existing))
218 reportTypeError(existing, file, WASM_SYMBOL_TYPE_DATA);
292 static bool shouldReplace(const Symbol *existing, InputFile *newFile,
294 // If existing symbol is undefined, replace it.
295 if (!existing->isDefined()) {
296 LLVM_DEBUG(dbgs() << "resolving existing undefined symbol: "
297 << existing->getName() << "\n");
303 LLVM_DEBUG(dbgs() << "existing symbol takes precedence\n");
307 // If the existing symbol is weak, we should replace it.
308 if (existing->isWeak()) {
309 LLVM_DEBUG(dbgs() << "replacing existing weak symbol\n");
314 if (existing->isShared()) {
315 LLVM_DEBUG(dbgs() << "replacing existing shared symbol\n");
323 errorOrWarn("duplicate symbol: " + toString(*existing) + "\n>>> defined in " +
324 toString(existing->getFile()) + "\n>>> defined in " +
382 LLVM_DEBUG(dbgs() << "resolving existing undefined symbol: " << s->getName()
580 // already an existing one in the symbols table. In this case we check that
586 static void setImportAttributes(T *existing,
591 if (!existing->importName)
592 existing->importName = importName;
593 if (existing->importName != importName)
594 error("import name mismatch for symbol: " + toString(*existing) +
595 "\n>>> defined as " + *existing->importName + " in " +
596 toString(existing->getFile()) + "\n>>> defined as " + *importName +
601 if (!existing->importModule)
602 existing->importModule = importModule;
603 if (existing->importModule != importModule)
604 error("import module mismatch for symbol: " + toString(*existing) +
605 "\n>>> defined as " + *existing->importModule + " in " +
606 toString(existing->getFile()) + "\n>>> defined as " +
610 // Update symbol binding, if the existing symbol is weak
612 if (existing->isWeak() && binding != WASM_SYMBOL_BINDING_WEAK) {
613 existing->flags = (existing->flags & ~WASM_SYMBOL_BINDING_MASK) | binding;
662 // Special handling for when the existing function is a shared symbol
669 // If the existing undefined functions is not called directly then let
670 // this one take precedence. Otherwise the existing function is either
827 Symbol *existing = find(functionTableName);
828 if (existing) {
829 if (!isa<TableSymbol>(existing)) {
834 if (existing->isDefined()) {
842 if (existing) {
843 existing->importModule = defaultModule;
844 existing->importName = functionTableName;
845 return cast<TableSymbol>(existing);
849 } else if ((existing && existing->isLive()) || ctx.arg.exportTable ||
852 // table or because the table symbol is already live. The existing table is
877 // The existing symbol is undefined, load a new one from the archive,
878 // unless the existing symbol is weak in which case replace the undefined
886 LLVM_DEBUG(dbgs() << "replacing existing weak undefined symbol\n");
893 LLVM_DEBUG(dbgs() << "replacing existing undefined\n");